Compare commits

...

1609 Commits

Author SHA1 Message Date
7a25b9cd85 Merge pull request #5241 from SparkiDev/wycheproof_sp_arm64_asm
SP ASM: fixes for Wycheproof tests
2022-06-14 09:08:15 -07:00
fb10c90935 Fix for Cube HAL v2 back-to-back DES/DES3. Whitespace. Enable the new FIFO 16 block logic for all hardware that supports it. 2022-06-14 11:48:51 +02:00
c52c2e5dfb Fixes for STM32H7 hash and crypto. 2022-06-14 11:48:51 +02:00
ad3f7e1de2 The STM32U5 does not support DES3 or AES 192-bit (only 128/256 bit) 2022-06-14 11:48:51 +02:00
502cbc3847 Fix for STM32U5 hash/crypto support. ZD 14305. 2022-06-14 11:48:51 +02:00
013066ca06 SP ASM: fixes for Wycheproof tests
ARM64 ASM: Fix P256 Montogomery Reduce.
Fix div to handle large dividend word.
2022-06-14 16:11:46 +10:00
af3a55a94c Merge pull request #5220 from kaleb-himes/ZD14318
Resolves inter-library API conflict reported in ZD14318
2022-06-13 14:28:13 -07:00
f401a3b53d Merge pull request #5232 from cconlon/june10
test/benchmark.c: rename Android tag, reset vars in memcb_test()
2022-06-13 14:24:17 -07:00
364bf482eb adjust wolfCrypt test/benchmark Android log TAG name, reset malloc/free counts in memcb_test() 2022-06-13 09:42:02 -06:00
0b78961111 Merge pull request #5186 from SparkiDev/pk_c_rework_1
pk.c: rework
2022-06-13 08:35:09 -07:00
5018da7f9f Merge pull request #5234 from gojimmypi/PR_Espressif_Version_README
Add note regarding ESP-IDF Version
2022-06-13 08:34:25 -07:00
9ee1833bd2 Merge pull request #5235 from SparkiDev/sess_sec_cb_fixup
Improve SessionSecret_callback code.
2022-06-13 08:21:45 -07:00
1de54ed8d7 Improve SessionSecret_callback code. 2022-06-13 10:43:09 +10:00
8899112456 Merge pull request #5230 from dgarske/tls_bench
Fix for TLS v1.1 length sanity check for large messages
2022-06-13 09:38:03 +10:00
f35eb20954 Add note regarding ESP-IDF Version 2022-06-12 12:39:04 -07:00
d5791d5c74 Fixes for TLS benchmarking app (tls_bench) for shutdown and formatting brace cleanups. 2022-06-10 13:48:46 -07:00
cafe5646b6 Fix for TLS v1.1 length sanity check for large messages. 2022-06-10 13:35:06 -07:00
afc63a3bfa Merge pull request #5199 from embhorn/zd12999
Add doc for wolfSSL_dtls_retransmit
2022-06-10 10:57:17 -07:00
d600a4b887 Spelling and Whitespace cleanups. Fix issue with trying to build pk.c directly and always getting warn even with WOLFSSL_IGNORE_FILE_WARN. 2022-06-10 09:06:55 -07:00
ba3991af5e Merge pull request #5228 from haydenroche5/strongswan
Add an --enable-strongswan option to configure.ac.
2022-06-10 08:19:32 -07:00
49008b169c Merge pull request #5087 from haydenroche5/x509_print
Add support for more extensions to wolfSSL_X509_print_ex.
2022-06-10 08:19:23 -07:00
890abfbefc pk.c: rework
Re-order RSA functions.
Add comments to RSA functions.
Rework RSA function implementations.
2022-06-10 09:54:32 +10:00
df673b987e Merge pull request #5227 from LinuxJedi/embOS-emNET
Support for SEGGER embOS and emNET
2022-06-09 08:04:29 -07:00
9954afa538 Merge pull request #5222 from tmael/rsa_sanity
Add a sanity check in RsaPad_OAEP
2022-06-09 08:04:16 -07:00
f479600066 Add support for more extensions to wolfSSL_X509_print_ex.
- Key usage
- Extended key usage
- Subject alt name

Additionally, print out the criticality of the extensions.
2022-06-09 16:50:10 +02:00
df87eb5508 Add an --enable-strongswan option to configure.ac.
Also, clean up some repetition around adding `-DHAVE_OCSP`.
2022-06-09 16:24:41 +02:00
190476dafe Support for SEGGER embOS and emNET
Adds support for embOS memory and mutex functions. Also adds support for
emNET's error codes, it uses a BSD compatible TCP/IP stack for network
functions.

There is no easy native way to detect that you are compiling with emNET
or embOS so these require the user to define WOLFSSL_EMBOS /
WOLFSSL_EMNET.
2022-06-09 11:34:55 +01:00
2748bfc737 Add a check in RsaPad_OAEP 2022-06-08 10:07:26 -07:00
9fb1143eba Merge pull request #5218 from gojimmypi/PR_zepher_legacy_link
add link to new location for old zephyr references
2022-06-07 16:40:14 -07:00
37ee5e2540 Resolves inter-library API conflict reported in ZD14318 2022-06-07 14:48:27 -06:00
85e18b2f06 Merge pull request #5219 from douzzer/20220607-strlcpy
use XSTRLCPY() and XSTRLCAT() in EncryptDerKey()
2022-06-07 09:34:40 -07:00
088d378ba4 ssl.c:EncryptDerKey(): use XSTRLCPY() and XSTRLCAT() to build up cipherInfo, and remove XSTRCPY() macro from wolfssl/wolfcrypt/types.h (clang-tidy hates on it, albeit frivolously). 2022-06-07 08:22:48 -05:00
047ed8ef61 minor change for commit author update 2022-06-06 16:47:40 -07:00
fbb6faaa2f Merge pull request #5191 from SparkiDev/sp_win_asm_xmm_nv
SP Winx64 ASM: XMM6-15 are non-volatile
2022-06-06 15:58:10 -07:00
3c634e1f59 Merge pull request #5217 from SparkiDev/pk_enc_mem_2
ECC, DH: improve encrypted memory implementations
2022-06-06 15:27:10 -07:00
711a900ff7 Merge pull request #5214 from lealem47/ghostFunc
Removing ghosts and updating defines in openssl/buffer.h
2022-06-06 17:05:33 -05:00
4ffa63c938 Merge pull request #5216 from kojo1/static-mem
wc_MakeRsKey  with Static memory pool
2022-06-06 14:42:32 -07:00
8e69b1fa0e add include.am 2022-06-06 13:10:37 -07:00
07e0a6fa8e Removing ghost functions and fixing overflow warning in ssl.c 2022-06-06 11:33:26 -07:00
86312be79e Merge pull request #5210 from kaleb-himes/new-azsphere-rev3
New azsphere example for CI testing
2022-06-06 10:00:43 -07:00
927ee21752 add link to new location for old references 2022-06-06 08:39:40 -07:00
0bcd38f7d8 ECC, DH: improve encrypted memory implementations 2022-06-06 08:40:09 +10:00
7bfe6aa127 Extend HEAP_HINT to all InitRsaKey in api.c 2022-06-05 09:12:49 +09:00
eb28d38fa8 Merge pull request #5212 from kaleb-himes/various-warnings
Fix various warnings and an uninitialized XFILE
2022-06-04 17:10:17 -07:00
1b9f922ec3 wc_MakeRsKey with static mem pool 2022-06-05 09:04:42 +09:00
dbfa207344 Merge pull request #5116 from embhorn/zd14172
Fix TSIP build with NO_AES_CBC
2022-06-04 17:51:16 +09:00
802e3127c0 Merge pull request #5145 from JacobBarthelmeh/caam
CAAM support with QNX i.MX8, add AES-CTR crypto callback
2022-06-03 15:24:10 -07:00
873b2169f9 Add readme to include.am 2022-06-03 13:33:12 -06:00
2af09a7151 Merge pull request #5205 from haydenroche5/evp_cipher_aes_gcm
Fix another AES-GCM EVP control command issue.
2022-06-03 11:47:57 -07:00
30d836dc90 Implement peer review feedback 2022-06-03 11:34:02 -06:00
96d5814bfe Implement peer review feedback 2022-06-03 11:06:46 -06:00
debb598499 Merge pull request #5008 from tmael/vx_6x
Add support for VxWorks 6.x
2022-06-03 09:40:39 -07:00
1bb2a35164 Merge pull request #5207 from anhu/longer_sigalg_list
For inter-op with OQS's OpenSSL fork, support longer sigalg list.
2022-06-03 09:24:38 -07:00
fdaf418fe0 fix spelling and remove dead else statement 2022-06-03 09:21:27 -07:00
3bcdef1972 Fix various warnings and an uninitialized XFILE 2022-06-03 09:52:53 -06:00
8fbd4d70e6 Merge pull request #5209 from TakayukiMatsuo/fix14172 2022-06-03 09:07:01 -06:00
e30ae359a4 Fix build err missing XSTRNCASECMP 2022-06-03 08:17:39 -06:00
55f3b7c277 New azsphere example for CI testing 2022-06-03 08:04:50 -06:00
42754ce98b Exclude calling some funcs when WOLFSSL_AEAD_ONLY is defined 2022-06-03 14:47:41 +09:00
64eaf74e83 Merge pull request #5206 from dgarske/user_settings
Fixes for user settings with SP ASM and ED/Curve25519 small
2022-06-03 09:25:17 +10:00
ee78e63b87 Merge pull request #5203 from dgarske/zd14289
Fix the supported version extension to always check minDowngrade
2022-06-03 08:31:36 +10:00
8307a55429 Fixes --enable-usersettings with SP ASM and ED/Curve25519 small CURVED25519_SMALL. 2022-06-02 14:17:25 -07:00
a6465c2bd0 Merge pull request #5202 from julek-wolfssl/wolfssl-multi-test/send-alert-refactor
wolfssl-multi-test fixes
2022-06-02 14:08:46 -07:00
0cda12d446 For inter-op with OQS's OpenSSL fork, support longer sigalg list. 2022-06-02 16:52:35 -04:00
fb3c611275 Fix another AES-GCM EVP control command issue.
With PR 5170, I added logic that requires a EVP_CTRL_GCM_SET_IV_FIXED command be
issued before a EVP_CTRL_GCM_IV_GEN command. This matches OpenSSL's behavior.
However, OpenSSL also clears the flag enabling EVP_CTRL_GCM_IV_GEN after
EVP_CTRL_GCM_SET_IV_FIXED if EVP_CipherInit is called with a NULL key.
Otherwise, the flag retains its value. We didn't mirror this logic, and that
caused problems in OpenSSH unit testing. This commit aligns our logic with
OpenSSL's and adds a regression test to test_evp_cipher_aes_gcm for this case.
2022-06-02 12:32:59 -07:00
2dd27c8d4a Fix the supported version extension to check the ssl->options.minDowngrade always. 2022-06-02 11:17:25 -07:00
cd008aac6a Add support for VxWorks 6.x
Use rand_r and define SEM_ID_NULL
Fix redefinition of typedef 'SOCKADDR'
2022-06-02 09:54:27 -07:00
56c48b31ad Merge pull request #5105 from tmael/rsa_oaep_nomalloc
Support RSA OAEP with nomalloc
2022-06-02 08:45:01 -07:00
2e307e1cd3 tls13.c: fix null pointer deref in FreeDcv13Args(). 2022-06-02 10:32:05 -05:00
3d71956b48 wolfssl-multi-test fixes:
- Remove RetrySendAlert and SendAlert recursion
- args possible NULL dereference
2022-06-02 16:08:25 +02:00
fb9f90b98b Merge pull request #5200 from dgarske/qat_fsanitize
Fixes for buffers when testing with Intel QAT hardware
2022-06-02 08:35:24 +10:00
9f2e3a2405 Merge pull request #5198 from dgarske/qat_ecc_marker 2022-06-01 21:35:47 +02:00
5672e2a885 Fixes for buffers when testing with Intel QAT hardware and fsanitize=address:
* PKCS7 should use allocated buffer for RSA.
* PKCS7 small stack typo for `keyAlgArray` size in `wc_PKCS7_AddRecipient_KTRI`.
* Fix for use of `free`, which should be `XFREE` in api.c.
* Cleanup old RSA benchmarking MDK5/WINCE code no longer needed with `WC_DECLARE_ARRAY_DYNAMIC_DEC` and `WC_DECLARE_ARRAY_DYNAMIC_EXE`.
2022-06-01 12:07:57 -07:00
8b9d2ad657 Merge pull request #5196 from douzzer/20220601-multi-test-fixes 2022-06-01 11:41:26 -07:00
9cfcdfc7aa Merge pull request #5149 from julek-wolfssl/store-frags-v2
Re-use async to support WANT_WRITE while sending fragments
2022-06-01 10:52:54 -07:00
2543970419 Add doc for wolfSSL_dtls_retransmit 2022-06-01 12:03:36 -05:00
cced5bd700 Merge pull request #5195 from LinuxJedi/ULL-fix
Fix 64bit postfix for constants
2022-06-01 09:40:26 -07:00
19c51dac45 Fix for QAT ECC to gate use of HW based on marker. Introduced in PR #4997. 2022-06-01 09:36:21 -07:00
494a9fe41a Merge pull request #5193 from SparkiDev/tls13_send_ticket
TLS 1.3: send ticket
2022-06-01 08:37:52 -07:00
b212853bce evp.c: in EvpCipherAesGCM(), make sure ctx->gcmAuthIn is non-null before clearing it; fix whitespace. 2022-06-01 10:29:40 -05:00
d29c656d4f SendAlert: clear output buffer to try and send the alert now 2022-06-01 16:48:57 +02:00
11a7756527 Fix 64bit postfix for constants
GCC 4.0.4 PowerPC 32bit cross-compiler complains when `UL` is used
instead of `ULL` for 64bit constants.
2022-06-01 15:04:29 +01:00
df10e1fad2 Store RetrySendAlert error in ssl->error 2022-06-01 14:59:10 +02:00
be743b2204 TLS 1.3: send ticket
Can send a new session ticket any time after handshake is complete with
TLS v1.3.
Added API for server application to do this.
Added tests.
2022-06-01 10:36:01 +10:00
3944a8737a WIN64: compiling with __clang__ _udiv128 not defined 2022-06-01 08:54:57 +10:00
dd0b9fb871 SP Winx64 ASM: XMM6-15 are non-volatile
Put the used non-volatile XMM registers on the stack at the start and
get them off again at the end.
2022-06-01 08:46:27 +10:00
81cd1e652e Merge pull request #5170 from haydenroche5/evp_cipher_aes_gcm
Fix EVP_CTRL_GCM_IV_GEN with AES-GCM.
2022-06-01 08:20:33 +10:00
c74315f1ef Save pending alerts when using async io
- Don't overwrite ssl->error
- Clear the error in ssl->error because the return of SendBuffered is now stored in ret instead
2022-05-31 18:17:11 +02:00
0554b02215 Merge pull request #5177 from JacobBarthelmeh/PKCS7 2022-05-31 09:46:14 -06:00
da91578bc7 Merge pull request #5180 from miyazakh/tsipv_up 2022-05-31 09:41:47 -06:00
2ed85926d5 Merge pull request #5187 from kareem-wolfssl/hsHashesNull
Confirm ssl->hsHashes is not NULL before attempting to dereference it.
2022-05-30 10:41:35 -07:00
8aa2da532c Combine preproc check into one statement 2022-05-30 15:27:36 +02:00
c83120d8c8 Merge pull request #5097 from tmael/c89_fixes
Fix for c89, use WOLF_C89
2022-05-28 08:29:42 -05:00
baaff96045 Merge pull request #5188 from kaleb-himes/PR5174-SUPPLEMENT
Supplement to @julek-wolfssl's fantastic find, just allow for proper expansion
2022-05-27 20:36:20 -07:00
6245395f34 Simulate WANT_WRITE only with async I/O support 2022-05-27 23:23:18 +02:00
a91a2482e7 Merge pull request #5158 from anhu/ECDHE_PSK
Add TLS 1.2 ciphersuite ECDHE_PSK_WITH_AES_128_GCM_SHA256 from RFC 8442
2022-05-27 13:25:48 -07:00
e061bc23f4 Fix asn1.h NOLINT comments. 2022-05-27 13:05:56 -07:00
f5bbad185f Supplement to @julek-wolfssl's fantastic find, just allow for proper expansion 2022-05-27 13:52:26 -06:00
8cb4819b53 Fix curve group matching on secure renegotiation 2022-05-27 21:26:55 +02:00
84bca63b2e Add WOLFSSL_NO_ASYNC_IO to low resource build 2022-05-27 21:26:55 +02:00
50c0b3d2a2 Add testing/docs for blocking write
- Fix case where message grouping can make CheckAvailableSize return a WANT_WRITE
- CheckAvailableSize in tls13.c will not return a WANT_WRITE since it only does so for DTLS <=1.2
2022-05-27 21:26:55 +02:00
decf9972bb fix whitespace. 2022-05-27 14:22:22 -05:00
8c10c3776d wolfcrypt/src/asn.c: in C89 codepath of GetFormattedTime(), add buffer size checks before calls to sprintf(). 2022-05-27 14:20:38 -05:00
aca199cb05 Fix to compile with c89
strncasecmp and snprintf are unavailable in C89
use // static analyzer suppressions
2022-05-27 14:20:37 -05:00
6e6c4500d6 Fix comments in asn1.h to use ANSI C style. 2022-05-27 11:01:29 -07:00
98ec442b37 Confirm ssl->hsHashes is not NULL before attempting to dereference it. 2022-05-27 10:57:23 -07:00
df06db114d Add TLS 1.2 ciphersuite ECDHE_PSK_WITH_AES_128_GCM_SHA256 from RFC 8442
Testing:

./autogen.sh
./configure --enable-psk
make all check

$ ./examples/server/server  -j -l ECDHE-PSK-AES128-GCM-SHA256
SSL version is TLSv1.2
SSL cipher suite is TLS_ECDHE_PSK_WITH_AES_128_GCM_SHA256
SSL curve name is SECP256R1
Client message: hello wolfssl!

$ ./examples/client/client  -s -l ECDHE-PSK-AES128-GCM-SHA256
SSL version is TLSv1.2
SSL cipher suite is TLS_ECDHE_PSK_WITH_AES_128_GCM_SHA256
SSL curve name is SECP256R1
I hear you fa shizzle!
2022-05-27 11:05:55 -04:00
81ad463026 fix a compile error by clang 2022-05-27 11:37:26 +09:00
4e8c362152 Allocate ssl->async seperately to the SSL object 2022-05-26 23:08:48 +02:00
733fe1a8d3 Use WOLFSSL_ASYNC_IO for WOLFSSL_NONBLOCK_OCSP
- Enable ssl->async to store function arguments for non-blocking OCSP
- Remove ssl->nonblockarg
2022-05-26 23:08:48 +02:00
c151dcec50 Re-use async to support WANT_WRITE while sending fragments
- Async I/O can be turned off with WOLFSSL_NO_ASYNC_IO
- WOLFSSL_ASYNC_IO functionality enabled in SendCertificateVerify() and SendServerKeyExchange() to allow safe re-entry into SendHandshakeMsg()
- Testing size of structs is refactored int WOLFSSL_ASSERT_SIZEOF_GE()
2022-05-26 23:08:48 +02:00
f93b23b524 Merge pull request #5169 from kareem-wolfssl/miscFixes
Misc. fixes
2022-05-26 12:52:39 -07:00
0b6f7c1533 Merge pull request #5176 from embhorn/zd14227
Fix to move wolfSSL_ERR_clear_error outside gate for OPENSSL_EXTRA
2022-05-26 08:33:52 -07:00
ea895e99b7 Merge pull request #5184 from SparkiDev/asn_templ_make_cert_ext
ASN template: properly handle WOLFSSL_CERT_EXT
2022-05-26 06:53:10 -07:00
2800d00bb4 Fix to move wolfSSL_ERR_clear_error outside gate for OPENSSL_EXTRA 2022-05-26 06:11:45 -05:00
cacf5aeb7e ASN template: properly handle WOLFSSL_CERT_EXT
Encoding extensions didn't properly handle WOLFSSL_CERT_EXT not being
defined.
2022-05-26 10:01:59 +10:00
a5fa98e5f0 addressed code review
update Copyright year
2022-05-26 08:50:02 +09:00
ad49aea17d fix for setting AES-CCM decrypt nonce with crypto callback 2022-05-25 13:59:56 -07:00
fa80aa6505 Merge pull request #5132 from JacobBarthelmeh/req
Add support for additional CSR attributes
2022-05-25 13:35:46 -07:00
e8d779ab78 Merge pull request #5077 from gojimmypi/ESP8266_Development
Add ESP-IDF WOLFSSL_ESP8266 setting for ESP8266 devices
2022-05-25 12:46:10 -07:00
17d7098bf6 Merge pull request #5168 from rizlik/dtls_resume
internal.c: dtls:  HelloVerifyRequest on resumption
2022-05-25 11:23:08 -07:00
2d8cc055f0 Merge pull request #5179 from SparkiDev/sp_armv6_fix_1
SP ARM32 ASM: moving large immediate value
2022-05-25 09:59:47 -07:00
da1cbfda46 Merge pull request #5178 from cconlon/nounaligned
Add define to skip SHA-512 unaligned memory test in test.c
2022-05-25 09:55:29 -07:00
3cf636163b Fix EVP_CTRL_GCM_IV_GEN with AES-GCM.
Discovered the AES-GCM flow using this command didn't work in our OpenSSH port.
This commit makes the behavior match OpenSSL and adds testing using known
OpenSSL-generated test vectors to prevent regressions. This was one of those
problems where two ends of a connection would work fine if they were both using
wolfSSL but not if one was using OpenSSL (i.e. OpenSSH interop with AES-GCM
was broken).
2022-05-25 07:00:15 -07:00
c3e4c6b6bc Merge pull request #5174 from julek-wolfssl/ocsp-typo
Typo in testing script
2022-05-25 08:16:58 -05:00
b664cea735 Typo in testing script 2022-05-25 12:10:27 +02:00
0d59d36a80 update TSIP VER to 1.15 for RX65N and RX72N
fix -140 error when enabling -O2

fix no_crypto_hash
2022-05-25 18:31:23 +09:00
6c0b65d655 internal.c: dtls: HelloVerifyRequest on resumption 2022-05-25 10:38:32 +02:00
d2cb0278f6 SP ARM32 ASM: moving large immediate value
ARMv6 and early doesn't support moving an immediate value larger than 8
bits. Compiler doesn't have enough spare registers to handle it.
2022-05-25 10:58:32 +10:00
a1fb385450 free recipent list in error cases 2022-05-24 15:12:39 -07:00
5aea58d1e8 Merge pull request #5175 from douzzer/20220524-shellcheck-warnings
20220524-shellcheck-warnings
2022-05-24 14:21:49 -07:00
a5225af1c7 Merge pull request #4973 from JacobBarthelmeh/CSharp
add example C# PSK client
2022-05-24 13:37:14 -07:00
bcb5ff5ed9 Increase MAX_ECC_STRING to include the trailing \0 for longer order strings (in eg. SECP160R1). Note that this now matches the check in wc_EccPublicKeyDecode. 2022-05-24 13:20:52 -07:00
03e086a139 Code review feedback. 2022-05-24 13:12:59 -07:00
74cbd08ff5 Merge pull request #5164 from cconlon/x509date
Remove WOLFSSL_ALT_NAMES restriction on notBefore/notAfter use in Cert struct
2022-05-24 12:41:00 -07:00
321d404d6b add define to skip unaligned memory tests in test.c 2022-05-24 11:55:21 -06:00
5c14bef6a8 global fixes for shellcheck warnings SC2027, SC2069, SC2154, SC2141, SC3014, SC3037 (all true positives). note, does not fix SC2057 in ocsp-stapling.test, which is addressed by PR #5174 . 2022-05-24 12:13:14 -05:00
b66fa1680a fix whitespace. 2022-05-24 12:13:14 -05:00
6a26dab73a X.509 cert validity for CertFromX509() and EncodeCert() shouldn't be protected by WOLFSSL_ALT_NAMES 2022-05-24 10:28:46 -06:00
5f148c3dcc Merge pull request #5172 from SparkiDev/jenkins_fixes_5
benchmark.c: fix Jenkins failure where byte, word32 not defined
2022-05-24 08:09:47 -07:00
fab9e29513 benchmark.c: fix Jenkins failure where byte, word32 not defined 2022-05-24 12:10:01 +10:00
350f1d6496 Only use __builtin_offsetof on GCC 4+. It is not supported in GCC 3 or earlier. 2022-05-23 14:44:56 -07:00
26a92977f0 Remove MCAPI project's dependency on zlib version. 2022-05-23 14:29:44 -07:00
b329a16832 Update Zephyr fs.h path. 2022-05-23 13:45:30 -07:00
465a6ceb64 Merge pull request #4920 from SparkiDev/old_timing_pad_verify
Make old less secure TimingPadVerify implementation available
2022-05-23 13:43:59 -07:00
6424af120c Merge pull request #5161 from SparkiDev/sp_armv7a
SP ARM 32: Fixes to get building for armv7-a
2022-05-23 10:01:49 -07:00
b5d65b9579 Merge pull request #5159 from kareem-wolfssl/fipsv3HmacMd5
Allow using 3DES and MD5 with FIPS 140-3, as they fall outside of the FIPS boundary.
2022-05-20 18:40:29 -07:00
9a74745246 Merge pull request #5163 from haydenroche5/evp_pkey_derive_guard
Remove unneeded FIPS guard on wolfSSL_EVP_PKEY_derive.
2022-05-20 17:12:24 -07:00
ec39ee2cb6 Merge pull request #5070 from miyazakh/crypto_only_flwup 2022-05-20 17:08:29 -06:00
d80b282fdd Merge pull request #5156 from anhu/HAVE_AES_GCM
Rename HAVE_AES_GCM guard to HAVE_AESGCM in the tests.
2022-05-20 15:03:57 -07:00
04ddd0abe4 Merge pull request #5095 from haydenroche5/decoded_cert_crit_fields
Make the critical extension flags in DecodedCert always available.
2022-05-20 15:03:39 -07:00
2fc129e236 Merge pull request #5162 from rliebscher/master
Remove unused warning in ecc.c
2022-05-20 11:42:39 -07:00
a6b948ae59 Remove unneeded FIPS guard on wolfSSL_EVP_PKEY_derive. 2022-05-20 11:29:01 -07:00
f19b426a3f fix for files included in make dist 2022-05-20 09:26:53 -06:00
a8024a32c5 Remove unused warning in ecc.c
When WOLFSSL_ECIES_OLD is defined you get an unused warning
in ecc.c / wc_ecc_encrypt_ex().
Just suppress it by "using" the parameter.
2022-05-20 16:05:10 +02:00
9427ebc5be Merge pull request #5160 from haydenroche5/tls_unique
Provide access to "Finished" messages outside the compat layer.
2022-05-19 21:30:30 -07:00
b6290f1590 Merge pull request #5157 from douzzer/20220519-multi-test-fixes
20220519-multi-test-fixes
2022-05-20 13:47:09 +10:00
bc5262a5d0 SP ARM 32: Fixes to get building for armv7-a
Change ldrd to either have even first register or change over to ldm
with even first register.
Ensure shift value in ORR instruction has a hash before it.
Don't index loads and stores by 256 or more - make them post-index.
div2 for P521 simplified.
2022-05-20 12:15:58 +10:00
6d9fbf7ab3 Provide access to "Finished" messages outside the compat layer.
Prior to this commit, if you wanted access to the Finished messages from a
handshake, you needed to turn on the compatibility layer, via one of
OPENSSL_ALL, WOLFSSL_HAPROXY, or WOLFSSL_WPAS. With this commit, defining any
of these causes WOLFSSL_HAVE_TLS_UNIQUE to be defined (a reference to the
tls-unique channel binding which these messages are used for) in settings.h.
This allows a user to define WOLFSSL_HAVE_TLS_UNIQUE to access the Finished
messages without bringing in the whole compat layer.
2022-05-19 16:34:13 -07:00
efc8d36aa5 configure.ac: add whitespace separators to "((" groupings to mollify shellcheck SC1105 "Shells disambiguate (( differently or not at all. For subshell, add spaces around ( . For ((, fix parsing errors." 2022-05-19 18:19:11 -05:00
6984cf83b2 scripts/ocsp-stapling.test: fix whitespace. 2022-05-19 16:45:50 -05:00
e35c1e5a61 setup of default build config 2022-05-19 14:54:22 -06:00
8de3765af9 clean up namespace and remove settings files 2022-05-19 14:28:23 -06:00
d8817266be trim down sln 2022-05-19 13:54:07 -06:00
6dc47580ce fixing dependency for new project 2022-05-19 13:45:09 -06:00
832a7a40a6 Allow using 3DES and MD5 with FIPS 140-3, as they fall outside of the FIPS boundary. 2022-05-19 12:06:20 -07:00
249afbbfc9 update output directory and add psk client example 2022-05-19 12:11:00 -06:00
5988f35593 src/wolfio.c: in EmbedReceiveFrom((), clear peer before recvfrom() to fix clang-analyzer-core.UndefinedBinaryOperatorResult; add DTLS_ prefix to macros SENDTO_FUNCTION and RECVFROM_FUNCTION, and gate their definitions on their being undefined to allow overrides. 2022-05-19 11:31:24 -05:00
f2e9f5349f wolfcrypt/src/asn.c: refactor DecodeBasicOcspResponse() to keep DecodedCert off the stack in WOLFSSL_SMALL_STACK builds. 2022-05-19 11:28:34 -05:00
368854b243 scripts/: refactor TLS version support tests to use -V, rather than -v (which makes frivolous connection attempts). 2022-05-19 11:18:34 -05:00
cf81ae79e4 HAVE_AESGCM 2022-05-19 11:30:58 -04:00
9c2903c176 Remove HAVE_AES_GCM guard as it is never defined. 2022-05-19 01:20:55 -04:00
4a3ff40eb3 Merge pull request #5138 from haydenroche5/issuer_names
Add ability to store issuer name components when parsing a certificate.
2022-05-18 16:56:55 -07:00
cd41c8beaf Merge pull request #5147 from rizlik/do_alert_reset
internal.c:reset input/processReply state if exiting after DoAlert()
2022-05-19 09:36:44 +10:00
b53484be10 Merge pull request #5155 from cconlon/configFix
Fix --enable-openssh FIPS detection syntax in configure.ac
2022-05-18 17:34:43 -05:00
628a34a43d fix --enable-openssh FIPS detection syntax in configure.ac 2022-05-18 12:52:07 -06:00
1026c7141e Merge pull request #5148 from JacobBarthelmeh/PKCS7 2022-05-18 11:44:20 -06:00
be172af3cd internal.c: check that we have data before processing messages
We should never encounter this bug under normal circumstances. But if we enter
processReplyEx with a wrongly `ssl->options.processReply` set to
`runProcessingOneMessage` we check that we have some data.
2022-05-18 18:49:33 +02:00
6940a5eaae internal.c:reset input/processReply state if exiting after DoAlert() 2022-05-18 18:35:29 +02:00
40063f7487 Merge pull request #5109 from rizlik/dtls_peer_matching_fix
wolfio: dtls: fix incorrect peer matching check
2022-05-18 09:12:26 -07:00
5de9c45161 resolve merge and conflict 2022-05-18 11:37:22 +09:00
ac3fc89df9 Merge pull request #5151 from SparkiDev/tls13_premaster
TLS 1.3:  pre-master secret zeroizing
2022-05-17 19:18:43 -07:00
54a96cef06 add test case 2022-05-18 11:16:10 +09:00
88abc9f3c1 addressed review comments
add to call wc_ecc_rs_to_sig and wc_ecc_verify_has
2022-05-18 11:16:07 +09:00
c1f117413f get crypto only compiled with openssl extra 2022-05-18 11:16:03 +09:00
1765e2c482 Merge pull request #5150 from haydenroche5/benchmark_main_void
Fix main signature in benchmark.c.
2022-05-18 10:10:07 +10:00
04ff6afbad Add ability to store issuer name components when parsing a certificate.
This is turned on when `WOLFSSL_HAVE_ISSUER_NAMES` is defined. This allows the
user to inspect various issuer name components (e.g. locality, organization,
etc.) by using these new fields in a `DecodedCert`.
2022-05-17 16:29:52 -07:00
2f91028f2d TLS 1.3: pre-master secret zeroizing 2022-05-18 08:52:38 +10:00
fd535242a0 Fix main signature in benchmark.c.
If `NO_CRYPT_BENCHMARK` is defined, the main function is `int main()`, but it
should be `int main(void)`.
2022-05-17 14:28:43 -07:00
8b46c95f06 macro guard for build with disable ecc 2022-05-17 11:36:09 -06:00
d6935ed3be Review comments 2022-05-17 09:21:20 -07:00
c9ae021427 Merge pull request #5143 from julek-wolfssl/x509-ret-empty-name
Return subject and issuer X509_NAME obj even when not set
2022-05-17 09:16:54 -07:00
50cc6d0422 Merge pull request #5139 from cconlon/opensshfips
Modify --enable-openssh to not enable non-FIPS algos for FIPS builds
2022-05-17 09:16:21 -07:00
6df65c0162 wolfio: dtls: fix incorrect peer matching check
Ignore packet if coming from a peer of a different size *or* from a different
peer. Avoid whole memcmp of sockaddr_in[6] struct because is not portable (there
are optional fields in struct sockaddr_in).
2022-05-17 11:01:55 +02:00
fc12c68601 Merge pull request #5146 from dgarske/kcapi_keywrap
Fix to allow enabling AES key wrap (direct) with KCAPI
2022-05-17 08:16:00 +10:00
1dc5e4cee5 add padding for variable ecc signature size 2022-05-16 15:26:29 -06:00
ec619e3f35 Merge pull request #5107 from julek-wolfssl/wpas-ex-data-leak
Call ctx->rem_sess_cb when a session is about to be invalid
2022-05-16 13:27:08 -07:00
579a37bdf0 Merge pull request #5117 from cconlon/getrandom
add support for Linux getrandom() with WOLFSSL_GETRANDOM
2022-05-16 12:36:30 -07:00
0ef4707859 Merge pull request #5137 from JacobBarthelmeh/docs 2022-05-16 12:18:14 -06:00
7f8f0dcffe Refactor cache ex_data update/retrieve into one function
- Add explicit pointer cast
2022-05-16 13:01:05 +02:00
d996086a6d Return subject and issuer X509_NAME obj even when not set
This allows the user to set the attributes of the subject and issuer name by calling X509_REQ_get_subject_name and adding attributes to it.
2022-05-16 12:49:34 +02:00
fb9b96d498 fix for index increment and change test case expected return values 2022-05-13 14:07:29 -07:00
6b1e3003fb Merge pull request #5142 from SparkiDev/ssl_move_pk
ssl.c rework
2022-05-13 12:56:14 -07:00
3a4feddf75 update code for continued support with i.MX6 2022-05-13 13:21:45 -06:00
643cd78ea2 Fix to allow enabling AES key wrap (direct) with KCAPI. 2022-05-13 11:15:32 -07:00
1a57e3065a Small cleanups. Missing (void), spelling and formatting. Also fixes for variations of 25519/448 build. 2022-05-13 09:24:59 -07:00
7305616452 Merge pull request #5080 from JacobBarthelmeh/DH
with WOLFSSL_NO_DH186 restriction allow odd DH param size generations
2022-05-13 08:57:33 -07:00
50f53f9576 Merge pull request #5129 from LinuxJedi/remove-python-wrappers
Remove the Python wrappers from wolfSSL source
2022-05-13 08:36:33 -07:00
630c5ef364 Merge pull request #5140 from SparkiDev/sp_fixes_7
SP fixes
2022-05-12 21:57:48 -07:00
852d5169d4 ssl.c rework
Move the public key APIs out of ssl.c and into pk.c.
(RSA, DSA, DH and EC)
2022-05-13 11:12:44 +10:00
eea537e5ea Merge pull request #5124 from kaleb-himes/WIN_MULTICONFIG
Address issues ID'd by new windows multi-config test
2022-05-13 09:39:15 +10:00
e8160f049e SP fixes
Fix div_word without using div.
Fix ARM32 and Cortex-M builds to work for 4096 again.
2022-05-13 09:37:24 +10:00
c3a79f50d8 modify --enable-openssh to not enable non-FIPS algos for FIPS builds 2022-05-12 16:53:57 -06:00
e6ce735ed8 add support for Linux getrandom() with WOLFSSL_GETRANDOM 2022-05-12 16:51:38 -06:00
6aaee73585 Merge pull request #5133 from rizlik/cookie_keyshare_fix
tls13: fix cookie has keyShare information check
2022-05-13 08:01:59 +10:00
d1308fcdfc Merge pull request #5122 from rizlik/tls13_pad_calc
internal.c: fix pad-size when more records are received at once
2022-05-13 07:59:36 +10:00
52fc3844a6 Merge pull request #5127 from rizlik/wolfss_msg_fix
wolfcrypt: logging: use do{}while(0) to disable WOLFSSL_MSG* macro
2022-05-13 07:55:18 +10:00
988236ca70 remove port print out 2022-05-12 13:07:04 -07:00
8124368319 Merge pull request #5136 from douzzer/20220512-stderr
print errors to stderr, not stdout
2022-05-12 13:59:41 -06:00
c4920021d8 print errors to stderr, not stdout;
fix whitespace in internal.c;

add missing error handling in examples/server/server.c around recvfrom().
2022-05-12 13:07:32 -05:00
60864f19da Merge pull request #5130 from JacobBarthelmeh/examples
print out test errors to stderr instead of stdout
2022-05-12 12:44:45 -05:00
2cf87a8049 Merge pull request #5084 from julek-wolfssl/zd14101-dtls-want-write
DTLS fixes with WANT_WRITE simulations
2022-05-12 09:36:40 -07:00
7316a275ae Add EXTRA_DIST entry for include.am 2022-05-12 17:00:02 +01:00
c3d4c3086e Add README to point to the new Python locations 2022-05-12 16:55:26 +01:00
05ce8329c9 Merge pull request #5067 from miyazakh/compat_altcertchain
"veify ok" if alternate cert chain mode is used
2022-05-12 08:54:51 -07:00
7a95be1a97 Merge pull request #5126 from JacobBarthelmeh/crl
do not error out on CRL next date if using NO_VERIFY
2022-05-12 08:44:29 -07:00
9ca1206bf3 Merge pull request #5131 from SparkiDev/sp_win_fixes_1
SP: Windows build fixes
2022-05-12 09:56:27 -05:00
44be4e1cc8 Reset ret in client and server after wolfSSL_dtls_got_timeout()
- Do UDP connect only with simulateWantWrite to accommodate macOS that doesn't like sendto being called on connected UDP sockets
- Call wolfSSL_dtls_get_current_timeout only on a DTLS connection
2022-05-12 16:48:04 +02:00
9914da3046 Fix resumption failure and use range in connect state logic 2022-05-12 15:46:08 +02:00
a31b76878f DTLS fixes with WANT_WRITE simulations
- WANT_WRITE could be returned in unexpected places. This patch takes care of that.
- Change state after SendBuffered only if in a sending state to begin with.
- Adapt client and server to simulate WANT_WRITE with DTLS
2022-05-12 15:46:08 +02:00
829e9f5277 tls13: fix cookie has keyShare information check
Fix the check to see if the cookie has key_share information or not (needed to
reconstruct the HelloRetryRequest). At the moment, it looks like we never send a
cookie without KeyShare extension. Indeed the HelloRetryRequest is sent only
because the client didn't provide a good KeyShareEntry in the first
ClientHello. When we will support DTLSv1.3, the HelloRetryRequest will be used
as a return-routability check and it may be sent without the KeyShare extension.
2022-05-12 12:10:58 +02:00
8e3d7fc6f4 wolfcrypt: logging: use do{}while(0) to disable WOLFSSL_MSG* macro
otherwise statement of the type:

if (condtion)
    WOLFSSL_MSG("");

after preprocessing will become:

if (condition)
    ;

The empty body emits a warning from the compiler.
2022-05-12 09:59:27 +02:00
36739bca62 cleanup memory on structure free 2022-05-11 21:57:13 -07:00
818ac2b8dd add more REQ attribute support 2022-05-11 22:27:48 -06:00
798d81723b Merge pull request #5128 from rizlik/dtls_bidrectional_shutdown
Support DTLS bidirectional shutdown in the examples
2022-05-11 17:00:44 -07:00
f5b0d3c0b4 SP: Windows build fixes 2022-05-12 08:25:46 +10:00
36575ff480 Merge pull request #5125 from douzzer/20220510-strncmp-misuse
s/strncmp/strcmp/g
2022-05-12 08:22:00 +10:00
5d93a48ddf veify ok if alternate cert chain mode for verifyCallback 2022-05-12 06:15:18 +09:00
5caef7eaba avoid dead store with test case 2022-05-11 11:53:17 -06:00
9bee0281cb print out test errors to stderr instead of stdout 2022-05-11 11:40:54 -06:00
fd9e1e21ed Remove the Python wrappers from wolfSSL source
The wolfCrypt and wolfSSL Python wrappers are maintained in the
wolfCrypt-py and wolfSSL-py trees respectively. The duplicates in this
tree are stale. The content has been checked and any important changes
have been ported over to their respective trees.
2022-05-11 15:02:51 +01:00
eb6f9152db Revert modifications addressed by wolfSSL/scripts PR #235 2022-05-11 07:27:16 -06:00
761ab6b17a tests: add bidirectional shutdown UDP tests 2022-05-11 13:27:37 +02:00
257c55a311 examples: allow bidirectional shutdown in UDP
This commit allows the examples to perform a bidirectional shutdown also when
using UDP. It is useful to test DTLS retransmission.

Signed-off-by: Marco Oliverio <marco@wolfssl.com>
2022-05-11 13:27:24 +02:00
27e73818c5 tests: run test_wolfSSL_dtls_export() over UDP instead of TCP 2022-05-11 12:20:15 +02:00
692a01238e tests: support udp in test_server_nofail() 2022-05-11 12:19:09 +02:00
dca71d36f6 SP: Script changed, generated result update 2022-05-11 10:51:19 +10:00
d90a89898c wolfssl/test.h:OCSPRespFreeCb(): fix non-void return of and from void function. 2022-05-10 15:14:21 -05:00
9fbb4a923f src/internal.c:GetCipherKeaStr(): allow "ECDH" (in addition to "ECDHE") as a suite clause that maps to KEA "ECDH". 2022-05-10 15:12:00 -05:00
77fa0ccb82 src/tls.c:BuildTlsFinished(): work around false positive -Wmaybe-uninitialized. 2022-05-10 15:10:23 -05:00
531120131a do not error out on CRL next date if using NO_VERIFY 2022-05-10 14:00:21 -06:00
26673a0f28 where appropriate, use strcmp/strcasecmp, not strncmp/strncasecmp;
add macro XSTRCASECMP();

update XSTRNCASECMP() for XC32 >= 1.00 to use strncasecmp.
2022-05-10 12:20:12 -05:00
cb6a138caf Implement peer review feedback 2022-05-10 08:43:18 -06:00
f06ac9965c internal.c: fix: plaintext check account for the current record only 2022-05-10 13:12:09 +02:00
db23d8a0cf internal.c: don't skip records if we don't process early-data
If we don't process early data, we want to skip only the current record and not
all the received data
2022-05-10 13:04:43 +02:00
445c1e6ceb internal.c: don't check TLS13 plaintext limit twice
Plaintext size is checked before decryption in TLS 1.3
2022-05-10 12:51:50 +02:00
0747a16893 Merge pull request #5119 from JacobBarthelmeh/fuzzing
adjust setting of input pointer with BER pkcs7 edge case
2022-05-10 09:40:51 +10:00
d5f7beefd4 Address issues ID'd by new windows multi-config test 2022-05-09 16:50:56 -06:00
063e757f6b Merge pull request #5121 from miyazakh/sce_example_update2 2022-05-09 14:15:13 -06:00
d133fa6143 server: check that the first packet of udp connection is clientHello
Used to allow for bi-directional shutdown tests with UDP and DTLS
2022-05-09 13:45:27 +02:00
0c7e9a0104 internal.c: fix pad-size when more records are received at once
don't consider the end of the record the end of received data as more records
may be read at once when DTLS will be supported.
2022-05-09 11:00:31 +02:00
59fdf05155 Merge pull request #5111 from kaleb-himes/ABI-check-test-rev2
Refactor wolfSSL_ASN1_TIME_adj to use GetFormattedTimeString (new API)
2022-05-09 09:15:57 +10:00
d95b2e69b5 Merge pull request #5112 from JacobBarthelmeh/Testing
fix for indef buffer check with pkcs7
2022-05-09 09:03:10 +10:00
b76c70d969 Merge pull request #5120 from dgarske/v5.3.0_cubepack 2022-05-08 07:50:20 -06:00
75d90aaf2f update key data and add fixes
Fix Aes gcm memory curruption

  - fix delta size calculation
  - add logging SEGGER printf for RA6M4
  - update client example

Added test cases

 - Fixed aes buffer overflow
 - Fixed usable
 - Fixed sce - no-sce use case
 - Add logging SEGGER printf for RA6M4
2022-05-07 10:43:43 +09:00
421f54e60a Merge pull request #5118 from douzzer/20220405-declaration-after-statement
20220405 declaration after statement
2022-05-06 16:16:52 -07:00
74b3df4f6c Refactor tmpF in RsaMGF1 2022-05-06 16:14:47 -07:00
bc877dab2a Changes to support v5.3.0 cube pack for ST. 2022-05-06 15:49:11 -07:00
1e1a722332 Merge pull request #5113 from JacobBarthelmeh/docs
fix markdown in readme notes
2022-05-06 14:20:16 -07:00
576f0aa045 adjust setting of input pointer with BER pkcs7 edge case 2022-05-06 14:22:53 -06:00
6be3dae6d3 Merge pull request #5104 from tmael/32_bit_ssize
Fix for stack and heap measurements of a 32-bit build
2022-05-06 14:32:06 -05:00
ad2119b2f8 Review comments 2022-05-06 12:00:32 -07:00
36877d78b4 Merge pull request #5078 from julek-wolfssl/wpas-tls13
Clean up wolfSSL_clear() and add some more logging
2022-05-06 11:45:43 -07:00
b59ac022c9 fix comment explaining ConstantCompare() in AES_GCM_decrypt_C(). 2022-05-06 13:36:54 -05:00
ccc9b1535d fix whitespace. 2022-05-06 13:34:32 -05:00
99b44f15ef fix various -Wdeclaration-after-statement, with and without --enable-smallstack. 2022-05-06 13:34:32 -05:00
3e774be88c Minor text and formatting cleanups. 2022-05-06 11:01:40 -07:00
e1aefc08ac Merge pull request #5110 from douzzer/20220405-NETWORK_UNSHARE_HELPER
$NETWORK_UNSHARE_HELPER
2022-05-06 09:46:36 -07:00
88443dea8c Merge pull request #5114 from SparkiDev/ct_fixes_2
SP: Div fixes for constant time
2022-05-06 09:44:11 -07:00
b6b007de3c Call ctx->rem_sess_cb when a session is about to be invalid
Allow the user to register a session remove callback with wolfSSL_CTX_sess_set_remove_cb() that will be called when the session is about to be free'd or evicted from cache.
2022-05-06 16:34:28 +02:00
ef89e2e637 Rename utc_str[_buf] -> time_str[_buf] (semantic change) 2022-05-06 08:18:14 -06:00
3e1ba5d4d4 Implement peer review feedback and leave some breadcrumbs in the event of future updates 2022-05-06 07:50:39 -06:00
b19f70d182 Fix TSIP build with NO_AES_CBC 2022-05-06 07:31:13 -05:00
7e9896d162 Only clear session when we didn't complete a handshake
- Allow overriding buffer size with `WOLFSSL_MSG_EX_BUF_SZ`
- Allow disabling `WOLFSSL_MSG_EX` by defining `NO_WOLFSSL_MSG_EX`
2022-05-06 12:35:49 +02:00
9ffc300641 SP: Div fixes for constant time
Implement div words for different platforms.
Use implementation not using a divide instruction unless
SP_DIV_WORD_USE_DIV or we know there is a div instruction.
Fix Thumb implementation of div word.
2022-05-06 16:02:18 +10:00
a9c7bc9d00 fix markdown in readme notes 2022-05-05 17:12:55 -06:00
853db0841f fix for indef buffer check with pkcs7 2022-05-05 16:25:28 -06:00
ecf449dfe0 Refactor wolfSSL_ASN1_TIME_adj to use GetUnformattedTimeString (new API) 2022-05-05 16:25:25 -06:00
a4eaa31b5e Merge pull request #5101 from dgarske/sniffer_async_test
Improve the sniffer asynchronous test case to support multiple concurrent streams
2022-05-06 08:14:32 +10:00
4d4145e6a0 add support for $NETWORK_UNSHARE_HELPER to the relevant scripts/. 2022-05-05 15:59:11 -05:00
19e8bb05f3 wolfcrypt/src/aes.c: fix shiftTooManyBitsSigned in AES_GCM_decrypt_C(). 2022-05-05 15:54:31 -05:00
ffe5599013 Fix testsuite 32-bit build 2022-05-05 08:08:09 -07:00
6e880495dc Merge pull request #5102 from SparkiDev/ct_valgrind_fixes_1
Constant time changes
2022-05-05 07:43:00 -07:00
189c9ab234 Constant time changes
GCM: make borrow constant time.
AES-GCM decrypt: compare at end and constant time.
Random: array_add touchs all elements every time.
RSA-OAEP: look for padding byte in constant time (look at every byte in
array).
SP
 - reduce conditional use (make them bit ops)
 - Fix point adds to not use double when adding infinity to infinity
 - Implement signed div as __divi3 is not constant time.
 - Move check sof input variables to API.
2022-05-05 12:26:57 +10:00
e81670a3c0 Merge pull request #5106 from douzzer/20220504-linuxkm-wc-port-h
linuxkm_wc_port.h: move several more definitions outside the BUILDING_WOLFSSL gate
2022-05-04 13:09:19 -07:00
9767631ebe Merge pull request #5100 from anhu/enable-wolfssh
For consistency, add --enable-wolfssh
2022-05-04 13:02:54 -07:00
af8865d13e linuxkm_wc_port.h: move several more definitions outside the BUILDING_WOLFSSL gate, as they are needed for applications to include various wolfssl headers. 2022-05-04 13:16:45 -05:00
bdd6072ede Check nomalloc with verify inline 2022-05-04 09:33:38 -07:00
f12fd6ab8b fix spelling 2022-05-04 09:11:12 -07:00
af8f18b634 Merge pull request #5103 from danielinux/rsa-encryptsize
wc_RsaEncryptSize needed in verify only and no-PSS builds
2022-05-04 07:53:06 -07:00
fff3402ed4 WOLFSSL ---> WOLFSSH 2022-05-04 09:28:08 -04:00
e606cccb10 wc_RsaEncryptSize needed in verify only and no-PSS builds 2022-05-04 14:20:44 +02:00
97f54e8e0a Support RSA OAEP with no malloc 2022-05-03 22:57:47 -07:00
ca955032a0 Fix 32-bit enable-trackmemory build 2022-05-03 20:48:38 -07:00
a9d28da7ce Fix 32-bit enable-stacksize build 2022-05-03 20:16:56 -07:00
5f539b3921 Improve the sniffer asynchronous test case to support multiple concurrent streams. 2022-05-03 16:43:15 -07:00
cb929e1247 For consistency, add a --enable-wolfssl; keep --enable-ssl for backwards compat. 2022-05-03 12:08:13 -04:00
e722c15be8 Merge pull request #5098 from JacobBarthelmeh/Release
- prep for release 5.3.0
2022-05-03 10:48:53 +10:00
628a91efda Fix for size calculation for encrypt then mac without openssl extra enabled. Fix for cast warning. 2022-05-02 17:11:48 -06:00
6f5be32d3a update rpm spec 2022-05-02 17:08:38 -06:00
94e34d7a98 use NO_SESSION_CACHE_REF with titan cache due to session rows too big error 2022-05-02 17:08:38 -06:00
29401334d3 prepare for release 5.3.0 2022-05-02 17:08:38 -06:00
48cb185ce9 Merge pull request #5096 from JacobBarthelmeh/Testing
- static analysis test fixes
2022-05-02 10:05:08 -07:00
14ff3d1f0f fix for macro guard with test case building with trusted peer certs 2022-04-29 14:46:35 -07:00
35f46018a5 Merge pull request #5094 from SparkiDev/mrg_armv8_old_c_2
Move delaration to before code statements.
2022-04-29 11:02:32 -06:00
9d7a02b28e remove uint from test case and put variable declaration at top of scope 2022-04-29 10:40:44 -06:00
38c01b9d9f fix for infer diff report 2022-04-29 10:34:38 -06:00
895522aa18 Make the critical extension flags in DecodedCert always available.
Prior to this commit, these were guarded by OPENSSL_EXTRA ||
OPENSSL_EXTRA_X509_SMALL. Adding them into the struct for non-compatibility
layer builds only increases memory usage slightly and is useful for the user.
2022-04-28 15:46:16 -07:00
ef4d484f85 Move delaration to before code statements. 2022-04-29 08:13:20 +10:00
ea8e9ee699 Merge pull request #5063 from kaleb-himes/ZD13349
Ensure supported curves and curve size(s) WIN FIPS
2022-04-28 11:50:19 -06:00
df4dd7d5b3 Merge pull request #5088 from dgarske/sniffer_async_2
Fix to properly trap errors in sniffer (broken after async additions)
2022-04-28 09:47:05 -06:00
2ec7951de6 Merge pull request #4803 from danielinux/tirtos-update-202201
Update TIRTOS support
2022-04-28 10:12:32 -05:00
9970b68e45 Add HAVE_TLS_EXTENSIONS 2022-04-28 09:10:13 -06:00
881b9e5b07 Merge pull request #5093 from SparkiDev/rsa_fermat_fix
Fix use of WC_RSA_NO_FERMAT_CHECK
2022-04-28 06:40:08 -07:00
f91936944d Fix use of WC_RSA_NO_FERMAT_CHECK 2022-04-28 16:29:48 +10:00
67838e099d Merge pull request #5092 from ejohnstown/cert-ext-gen-test
Certificate Extension Generation Test
2022-04-28 10:25:28 +10:00
8b39f863e6 fix for buffer size and key cover 2022-04-27 13:14:22 -07:00
3294a3f8f8 Certificate Extension Generation Test
The test for certificate extensions requires both the test certs option
and the certificate generation option to run. The certs for the test are
generated by wolfCrypt. This disables the extensions test if
certificate generation is disabled.
2022-04-27 13:08:28 -07:00
22802604c0 Merge pull request #5090 from dgarske/public_dh
Fix for DH public FFDHE incorrectly getting enabled
2022-04-27 13:08:46 -05:00
277d6dc5dd Fix minor clang-tidy warnings for async. 2022-04-27 10:22:19 -07:00
93e8133453 Merge pull request #4896 from elms/compat/const_casting_fun
Casting away `const` for improved compatibility
2022-04-27 09:35:58 -07:00
7e803f346d Merge pull request #5076 from JacobBarthelmeh/fuzzing
fix for sanity check on PKCS7 indef read
2022-04-27 09:34:34 -07:00
8bf228d346 Merge pull request #5083 from SparkiDev/d2i_ecpriv_der
d2i_ECPrivateKey() takes DER encoded data
2022-04-27 09:32:04 -07:00
1d64c735ce Merge pull request #5086 from elms/cmake/ocsp_crl
cmake: Add CRL, OCSP, and OCSP stapling options
2022-04-27 09:31:51 -07:00
ad68bb9a7a Merge pull request #5091 from SparkiDev/mrg_armv8_old_c
Can't declare variables in for statements
2022-04-27 09:31:19 -07:00
83f4f9e5ef Espressif notes for user_settings.h preference 2022-04-27 08:41:33 -07:00
fbc2ccca1e Fix to properly trap errors in sniffer SetupKeys after async changes. Fix minor scan-build warnings. 2022-04-27 08:28:36 -07:00
11bdb8550e Correction 2022-04-27 08:33:56 -06:00
c0d7f3b2e6 add support for i.MX8 with QNX CAAM 2022-04-27 02:27:05 -07:00
ac48438bd0 Can't declare variables in for statements 2022-04-27 11:10:53 +10:00
7233732159 move ESP8266-specific to separate section 2022-04-26 17:58:14 -07:00
f86f4a8ca0 d2i_ECPrivateKey() takes DER encoded data
Code was incorrectly using data as a private key instead of DER
decoding.
Fixed i2d_EcPrivateKey() to output DER encoded data.
2022-04-27 09:39:50 +10:00
ec38048711 cmake: Add CRL, OCSP, and OCSP stapling options 2022-04-26 16:23:46 -07:00
25e8bd6b45 Merge pull request #5044 from SparkiDev/sp_read_radix_10_oob
SP Math
2022-04-26 16:21:11 -07:00
67029dc4e7 Fix to make sure the old public DH API's are not enabled unless FIPS v2 or older. Broken in PR #5018. 2022-04-26 15:39:54 -07:00
321e44226a Casting away const for improved compatibility
This is appears to be an existing pattern.

Fixes #4893
2022-04-26 14:31:40 -07:00
a6d019ecf9 Merge pull request #5073 from JacobBarthelmeh/PKCS7 2022-04-26 14:41:13 -06:00
cbc27f7de4 Merge pull request #5085 from douzzer/20220426-multi-test
20220426 multi-test fixups
2022-04-26 11:15:59 -07:00
7436a41bc7 Merge pull request #5046 from SparkiDev/cppcheck_fixes_8
cppcheck: fixes
2022-04-26 10:37:42 -07:00
7e8598f75b Merge pull request #5081 from dgarske/sniffer_decrypt
Restore sniffer internal decrypt function. This allows decrypting TLS…
2022-04-26 09:37:32 -07:00
67a3326e6d Merge pull request #5082 from SparkiDev/sp_c++
CPP protection for extern references to asm code
2022-04-26 08:33:15 -07:00
4e02d7e404 fix clang-tidy-Customer-CFG-7 readability-redundant-preprocessor. 2022-04-26 10:20:26 -05:00
704a18d103 Merge pull request #5079 from tmael/rsa_vfg
Fix no malloc RSA  test
2022-04-26 08:11:44 -07:00
e6d267ef16 src/ssl.c wolSSL_DH_new_by_nid(): fix cppcheck nullPointer report. 2022-04-26 09:58:07 -05:00
5e1a358dff wolfcrypt/src/evp.c wolfSSL_EVP_PKEY_free(): fix clang-diagnostic-implicit-fallthrough. 2022-04-26 09:57:54 -05:00
2c5db7b64c fix whitespace. 2022-04-26 09:57:25 -05:00
0be79a8629 CPP protection for extern references to asm code 2022-04-26 10:17:25 +10:00
8737d46bb1 Merge pull request #5018 from haydenroche5/libspdm
Make changes to compatibility layer to support libspdm.
2022-04-26 09:55:22 +10:00
d362b6dd08 Merge pull request #5033 from haydenroche5/ec_key_print_fp
Add wolfSSL_EC_KEY_print_fp to compat layer.
2022-04-26 09:51:37 +10:00
273ed1df76 Restore sniffer internal decrypt function. This allows decrypting TLS v1.2 traffic ignoring AEAD errors. 2022-04-25 16:28:09 -07:00
20e5e654a3 cppcheck: fixes
CBIORecv/Send are only assigned once.
IOCB_ReadCtx/WriteCtx only assigned once.
BuildMessage checks output and input wiht sizeOnly every call - state
machine doesn't cache these.
Renamed alias_tbl variables to something unique.
Other cppcheck fixes.
Also reworked pem_read_bio_key().
2022-04-26 09:26:41 +10:00
1181081c38 Merge pull request #5075 from dgarske/cryptocb
Fix for PKCS7 with Crypto Callbacks
2022-04-25 17:23:28 -06:00
3ab5ccd04f Add support for EVP_PKEY_sign/verify functionality (#5056)
* Fix wolfSSL_RSA_public_decrypt() return value to match Openssl
* Add support for EVP_PKEY_verify_init() and EVP_PKEY_verify()
* wpa_supplicant SAE public key functionality requires this function.
* Add DSA support for EVP_PKEY_sign/verify()
* Add ECDSA support for EVP_PKEY_sign/verify()
* Add tests for EVP_PKEY_sign_verify()
* Fix "siglen = keySz" at error cases
* Fix wolfSSL_DSA_do_sign() usage
1. Check wolfSSL_BN_num_bytes() return value
2. Check siglen size
3. Double the siglen
* Check return code of wolfSSL_i2d_ECDSA_SIG() in wolfSSL_EVP_DigestSignFinal()
* Add size calculations to `wolfSSL_EVP_PKEY_sign`
* Add size checks to wolfSSL_EVP_PKEY_sign before writing out signature
* Use wc_ecc_sig_size() to calculate ECC signature size
Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
Co-authored-by: Juliusz Sosinowicz <juliusz@wolfssl.com>
2022-04-25 14:19:56 -07:00
9bf4a94796 with WOLFSSL_NO_DH186 restriction allow odd DH param size generations 2022-04-25 15:13:24 -06:00
bfd24cfa23 Merge pull request #5071 from dgarske/scan-build
Fixes for various nightly scan-build errors and warnings
2022-04-25 13:30:43 -07:00
85ef91ce6d Move up local variable at the beginning 2022-04-25 12:40:31 -07:00
34d541109d Additional scan-build warning fixes. 2022-04-25 09:55:36 -07:00
18a6a7c4a7 Fix RSA nomalloc test 2022-04-25 09:50:50 -07:00
4013f83e4f Add some missing logs and implement WOLFSSL_MSG_EX()
WOLFSSL_MSG_EX() uses XVSNPRINTF to allow for formatted strings to be printed. It uses a 100 byte internal stack buffer to format the log message.
2022-04-25 15:59:07 +02:00
15a48e411d Add WOLFSSL_ESP8266 for ESP-IDF 2022-04-23 12:30:34 -07:00
70ad19467c Merge pull request #5068 from cconlon/jniPKCallbacks
Don't enable PK Callbacks with JNI FIPS builds
2022-04-22 16:08:29 -07:00
4ecf3545d7 Improve scan-build fix for ProcessPeerCertParse checking of empty dCert. With WOLFSSL_SMALL_CERT_VERIFY it is NULL. 2022-04-22 16:07:24 -07:00
e9b80e53fa Fix issue with InitX509Name. 2022-04-22 16:02:54 -07:00
74cd2fd910 Fix for integer.c possible uses of mp_int input with DP NULL. 2022-04-22 16:02:54 -07:00
ea2841fa7a Make sure ASN1 isDynamic is always set to 0. SK Cipher doesn't have free (data is contained in the SK). 2022-04-22 16:02:54 -07:00
84a33183a6 Various scan-build fixes. 2022-04-22 16:02:54 -07:00
3755b88a02 Fix InitX509Name to set dynamicName on init. 2022-04-22 16:02:53 -07:00
c41b1b1b9b Fix to ensure args->dCert is set for ProcessPeerCertParse. 2022-04-22 16:02:53 -07:00
a6a89d3316 Fix for integer.c s_mp_add output to make sure it grows if not set. 2022-04-22 16:02:53 -07:00
5a75e0f6c6 Fix for MCAPI CRYPT_AES_CTX size with ./configure --enable-pkcallbacks --enable-mcapi --enable-ecc --enable-sha512 --with-libz --enable-opensslextra. 2022-04-22 16:02:53 -07:00
293d7e1241 Fix for report of Use of memory after it is freed. Force the dataIsAlloc set to 0. 2022-04-22 16:02:53 -07:00
8fb1bb8781 Merge pull request #5074 from embhorn/zd14105
Fix for mingw builds
2022-04-22 15:27:58 -07:00
9cbf92df01 Fix for PKCS7 sign to allow providing a public key only if using crypto callback w/devId. ZD13949. 2022-04-22 14:29:43 -07:00
d96bd30398 fix for sanity check on PKCS7 indef read 2022-04-22 15:28:03 -06:00
b543aa0148 Fix for mingw builds 2022-04-22 14:35:46 -05:00
bf16696d8c Merge pull request #5036 from dgarske/sniffer
Fixes for minor sniffer and async issues
2022-04-22 12:24:33 -07:00
ed58cfdc0f Add DEBUG_CRYPTOCB and wc_CryptoCb_InfoString to help with debugging crypto callbacks. 2022-04-22 12:20:55 -07:00
d5927a58dd add store of PKCS7 cert used for verify 2022-04-22 11:26:34 -06:00
cb1dbb75f8 Fixes for sniffer-gen.sh. 2022-04-22 08:25:00 -07:00
8c4887c166 Free session in wolfSSL_clear
- Define `NO_SESSION_CACHE_REF` in wpa build
2022-04-22 15:54:04 +02:00
6606984101 Fix for building sniffer without ECC while Curve25519 is enabled. 2022-04-21 16:54:11 -07:00
2fa1e19fe7 Fix for ./configure --enable-sniffer --enable-session-ticket --disable-ecc && make. 2022-04-21 13:28:38 -07:00
cfa338314d do not enable PK Callbacks with JNI in FIPS mode 2022-04-21 11:06:54 -06:00
4a4b019e30 tests/api.c: in test_wc_ecc_verify_hash_ex(), check that passing zero r and/or s to wc_ecc_verify_hash_ex() returns MP_ZERO_E. 2022-04-21 07:21:42 +02:00
cfab451328 Merge pull request #5024 from dgarske/zd13538 2022-04-20 13:08:13 -07:00
7964fa4195 Merge pull request #5055 from elms/cmake/out_of_src 2022-04-20 11:16:50 -07:00
f9acaab6fe Fix memory leak with pcap bpf_program not calling pcap_freecode. 2022-04-19 16:45:49 -07:00
ec76f79e9d Fixes for sniffer decrypt broken in PR #4875. The TLS v1.2 sniffer decrypt did not have ssl->curRL set for proper auth tag calculation and was placing the data at offset + 8 to leave room for explicit IV. 2022-04-19 16:31:27 -07:00
49f510544a Merge pull request #5057 from haydenroche5/pem_write_ec_rsa_pub
Add wolfSSL_PEM_write_RSAPublicKey and wolfSSL_PEM_write_EC_PUBKEY.
2022-04-19 16:19:38 -07:00
696c5eed25 Ensure supported curves and curve size(s) WIN FIPS 2022-04-19 16:16:15 -06:00
29392ac6b3 spell fix: OSCP -> OCSP 2022-04-19 15:11:08 -07:00
d4e8922dfd cmake: fixup install lib structure for windows 2022-04-19 15:11:08 -07:00
a7cc438c9c cmake: out of source support
Add `WOLFSSL_BUILD_OUT_OF_TREE` option to force not changing the
source tree. Also defaults to `CMAKE_DISABLE_SOURCE_CHANGES` to avoid
failures
2022-04-19 15:11:08 -07:00
5d0654ee56 Merge pull request #5062 from dgarske/clang_str
Fix for issue with `error: format string is not a string literal`
2022-04-19 14:27:36 -05:00
d7085069d6 Add wolfSSL_PEM_write_RSAPublicKey and wolfSSL_PEM_write_EC_PUBKEY.
These were compatibility layer stubs before.
2022-04-19 09:42:10 -07:00
95a85d16d2 Fix for issue with error: format string is not a string literal. 2022-04-19 08:49:05 -07:00
70a0983bbc Fix for minor warning with chain input enabled and async disabled. 2022-04-18 16:17:37 -07:00
52b176b6a1 Merge pull request #5060 from cconlon/ecFipsReady
ECDH_compute_key: allow setting of globalRNG with FIPS 140-3 / Ready
2022-04-18 16:15:14 -07:00
710f49795f Fix for session cache locking with session stats in get_locked_session_stats. 2022-04-18 14:29:42 -07:00
659d33fdaf Fixes for minor sniffer and async issues:
* Sniffer: Remove old restrictions for max strength, encrypt-then-mac and forcing openssl-extra.
* Fix bound warning with strncpy in sniffer.c.
* Fix for async DH issue.
* Fix for SP math all not initializing raw big int.
* Fix for array bounds warning with "-O3" on SetEccPublicKey.
* Fix a sniffer async edge case with TLS v1.2 static RSA and extended master.
* Improved the sniffer test script detection of features.
* Disable ECC custom curve test with Intel QuickAssist.
2022-04-18 11:46:40 -07:00
9172abc969 Merge pull request #5059 from julek-wolfssl/missing-XFCLOSE
Add missing XFCLOSE()
2022-04-18 14:16:36 -04:00
567ae7ca55 Merge pull request #5061 from miyazakh/sce_keydata_update 2022-04-18 09:14:34 -06:00
6e70cdf3b5 Update key data for sce example 2022-04-17 14:29:44 +09:00
e89b4cce4c Merge pull request #5045 from SparkiDev/wycheproof_armasm
Wycheproof testing of Aarch64 ASM
2022-04-15 11:23:45 -07:00
8eed940e3a Merge pull request #5040 from SparkiDev/wycheproof_intelasm
Wycheproof fixes
2022-04-15 11:19:57 -07:00
3ab87ba2ed Merge pull request #5039 from SparkiDev/ecc_pub_api
ECC: make public APIS for add and double points
2022-04-15 11:09:37 -07:00
35cb3c8a79 ECDH_compute_key: allow setting of globalRNG with FIPS 140-3 / Ready 2022-04-15 09:36:14 -06:00
6c16b9c0b5 Merge pull request #5054 from miyazakh/tsipV1p15_grose
Update Renesas TSIP version to 1.15 on GR-ROSE
2022-04-15 09:34:09 -06:00
a70e188758 Merge pull request #5058 from douzzer/20220414-clang-tidy-intmath
20220414-clang-tidy-intmath
2022-04-15 10:17:27 -05:00
a6319fc2a9 Add missing XFCLOSE() 2022-04-15 16:26:31 +02:00
607a24b499 fixes for clang-tidy and sanitizer hygiene with --disable-fastmath. 2022-04-14 21:06:04 -05:00
096889927d wolfcrypt/src/port/devcrypto/devcrypto_aes.c: remove redundant "int ret" in wc_AesCtrEncrypt() (supersedes #5052). 2022-04-14 20:23:31 -05:00
2e3ebd7d8c Merge pull request #5053 from kaleb-himes/CLOUD_PORTING_A
Change void cast(s) to be non-conditional and consolidate condition l…
2022-04-14 14:21:42 -05:00
2fbe030e5e update tsip version to 1.15 2022-04-14 06:42:11 +09:00
d706e2be32 Change void cast(s) to be non-conditional and consolidate condition logic 2022-04-13 10:25:43 -06:00
947c72937f Merge pull request #5049 from miyazakh/unused_param 2022-04-13 09:02:26 -06:00
6cd87d56d4 Merge pull request #5042 from TakayukiMatsuo/certupdate 2022-04-13 09:00:10 -06:00
26b5d032b7 Merge pull request #5050 from SparkiDev/ecc_import_fail
ECC: fix import failure return
2022-04-13 08:02:27 -05:00
824b7a3f3f ECC: fix import failure return
Passing in x=0 and y=0 meant to return ECC_INF_E.
Passing in x=0, y=not 0 or x=not 0, y=0 now checks whether the point is
valid and forces a return of BAD_FUNC_ARG when IS_POINT_E is returned
from check.
2022-04-13 14:03:13 +10:00
c5056f408f fix unused parameter when using CRYPTO_CB_ONLY_RSA 2022-04-13 07:48:18 +09:00
55e13d40b3 SP Math
sp_read_radix_10: check _sp_add_d doesn't error due to overflow
_sp_add_d: Don't change value of used for result until it is known to be
valid.
2022-04-13 08:33:30 +10:00
6cc91c8f9b Wycheproof testing of Aarch64 ASM
Fix which bytes are incremented for AES-GCM - only 4 bytes are counter.
Fix Curve25519 to reduce to below modulus at end.
2022-04-12 11:45:14 +10:00
0ef7435580 Make changes to compatibility layer to support libspdm.
- Add support for ASN1_TIME_compare, DH_new_by_nid, OBJ_length, OBJ_get0_data,
and ChaCha20-Poly1305 and HKDF in the EVP layer.
- Map EC_POINT_get_affine_coordinates to
wolfSSL_EC_POINT_get_affine_coordinates_GFp and EC_POINT_set_affine_coordinates
to wolfSSL_EC_POINT_set_affine_coordinates_GFp.
- Add kdf.h compatibility header.
2022-04-11 15:07:27 -07:00
0717135e49 Add wolfSSL_EC_KEY_print_fp to compat layer. 2022-04-11 13:02:38 -07:00
830db63bcf Update certificate signature data for TSIP in response to /certs update 2022-04-12 02:55:58 +09:00
e87ded85b4 Merge pull request #5041 from embhorn/zd13969
Add ability to set ECC Sign userCTX using WOLFSSL_CTX
2022-04-11 09:38:52 -07:00
ab6dc8d669 Add ability to set ECC Sign userCTX using WOLFSSL_CTX 2022-04-11 08:41:27 -05:00
2995c96f11 Wycheproof fixes
Curve25519: reduce to less than mod at end of curve25519, optimize to
not use imulq when andq can be used instead.
x86_64 Karatsuba Mul: Don't put add carry into overflow and then
continue adding zero. Overflow is lost.
2022-04-11 15:09:40 +10:00
b6db087a62 ECC: make public APIS for add and double points
Use internal API internally.
2022-04-11 09:19:23 +10:00
0298a29a6f Merge pull request #5037 from JacobBarthelmeh/hsm
fix for function rename
2022-04-11 08:48:28 +10:00
cd1344bbed Merge pull request #5032 from kaleb-himes/ZD13946
Add logic equivalent to configure.ac in settings.h for poly1305
2022-04-08 15:13:16 -06:00
83ad0b7010 fix for function rename 2022-04-08 15:05:08 -06:00
79e2b2b4ce Merge pull request #5030 from LinuxJedi/add-iar-msp430
Add IAR MSP430 example
2022-04-08 13:15:42 -07:00
5d46d10933 Address peer feedback 2022-04-08 10:12:24 -06:00
c84c465fc6 Merge pull request #5035 from douzzer/20220408-fuzz-6262033210802176
oss-fuzz 6262033210802176
2022-04-08 08:34:16 -07:00
50bc20e340 Fix include.am for MSP430 2022-04-08 16:26:48 +01:00
6a21a90f41 Merge pull request #5034 from SparkiDev/sp_wycheproof_fixes
SP fixes from Whycheproof tests
2022-04-08 08:20:56 -07:00
997feecd6e Remove unused header from MSP430 example 2022-04-08 15:42:38 +01:00
676fe19e2f Fixes to the MSP430 example
* Fix include.am missing line
* Fix macros
* Add "static" keyword where needed
* Make compatible with MSP430 GCC
* Add MSP430 GCC Makefile
* Fix watchdog issue with GCC, also fixes IAR when large data model is
  used
* Fix comment style
* Fix typo in RNG (makes it ever so slightly more random)
* Add example output to README
2022-04-08 15:08:55 +01:00
1c570fae3b wolfcrypt/src/asn.c GetLength_ex(): test for overlong length spec before using length as shift operand. 2022-04-08 08:15:02 -05:00
ed7e1f9770 SP fixes from Whycheproof tests
EC point add is a double if affine ordinates are the same.
Fix AVX2 implementation of mod inv to do conversion from 26 bits in
32-bit registers to 64 bits in 64-bit registers. Also handle negative
value.
RSA OAEP: loop down to last byte. Must have a separator.
Div for x86_64: fix to have all 1s when high word equals divisor.
2022-04-08 15:01:06 +10:00
9859492222 Merge pull request #5029 from haydenroche5/asn1_time_diff_2038 2022-04-07 16:45:11 -06:00
5ea38b059e For improved compatibility populate the extension value for NID_subject_alt_name. 2022-04-07 11:10:03 -07:00
5231dc63fa Merge pull request #5031 from douzzer/20220407-clang-tidy
20220407 clang-tidy
2022-04-07 09:03:56 -07:00
c1421b1be8 Add logic equivalent to configure.ac in settings.h for poly1305 2022-04-07 09:00:26 -06:00
be742cabda Add missing include.am 2022-04-07 15:39:32 +01:00
288fdbcc3e fix readability-named-parameter. 2022-04-07 08:02:24 -05:00
28cefb0d1a fix clang-analyzer-core.NonNullParamChecker. 2022-04-07 08:01:00 -05:00
4efd06fdc1 fix readability-inconsistent-declaration-parameter-name. 2022-04-07 07:59:59 -05:00
0083afc279 fix whitespace. 2022-04-07 07:59:07 -05:00
2663f5abaf Add IAR MSP430 example
A basic MSP430 example for IAR IDE.
2022-04-07 11:07:27 +01:00
161d74879a Change time2epoch to TimeToUnixTime. 2022-04-06 21:38:24 -07:00
284ebacc57 Merge pull request #4916 from JacobBarthelmeh/hsm
Add SECO use and expand cryptodev
2022-04-07 10:21:32 +10:00
80766566fc Fixes for X509_add_ext and new test case. 2022-04-06 16:35:53 -07:00
87dc197284 Merge pull request #5028 from douzzer/20220406-cppcheck
fixes to mollify cppcheck (sizeofDivisionMemfunc, zerodivcond, shiftTooManyBits, signConversionCond)
2022-04-07 08:45:24 +10:00
e9aae8b571 use hash grow function with cmac 2022-04-06 15:08:19 -06:00
f6f6d91ae1 Merge pull request #5027 from LinuxJedi/fix-dox
Minor documentation cleanup
2022-04-06 14:01:08 -07:00
9b2d927de7 Merge pull request #5026 from danielinux/fix_unititialized_var
Fixed unused variable in asn.c
2022-04-06 13:03:47 -05:00
1b5af2fdd9 Merge pull request #5022 from SparkiDev/wycheproof_fixes
Wycheproof fixes/changes
2022-04-06 10:29:17 -07:00
49e72633b8 Merge pull request #5025 from SparkiDev/ssl_move_x509
ssl.c break out
2022-04-06 10:10:18 -07:00
2a0b726c15 add AES init functions to ECB test case 2022-04-06 09:42:38 -07:00
4e8c180290 fixes to mollify cppcheck (sizeofDivisionMemfunc, zerodivcond, shiftTooManyBits, signConversionCond). 2022-04-06 11:36:01 -05:00
5ea9d11295 Minor documentation cleanup
Fixes two things across all the Doxygen:

1. Remove WOLFSSL_API from each definition
2. Add missing parameter names from functions
2022-04-06 16:17:36 +01:00
91d883d99f macro guard on ECB test case and use realloc for hash 2022-04-06 07:04:17 -07:00
3d9a1647d4 Fixed unused variable in asn.c 2022-04-06 15:35:28 +02:00
25aa0af260 ssl.c break out
Move the X509 API out of ssl.c into x509.c
2022-04-06 17:25:26 +10:00
e9187f5f00 Wycheproof fixes/changes
Allow Chachac20-Poly1305 to take an empty msg.
Allow AES-SIV to have an empty nonce.
Don't allow the length to be malleable. Must use the smallest number of
bytes to represent value.
ECDSA and DSA signature values are positive.
Add Sha512-224 and Sha512-256 OIDs.
ASN template - ensure the ECDSA/DSA signature uses all data.
Curve25519/Curve448 - WOLFSSL_ECDHX_SHARED_NOT_ZERO means shared secret
can't be 0.
Curve25519/Curve448 - check public value is less than order.
ECC - x or y may be zero but not both.
Ed25519/Ed448 - check S is less than order.
Ed448 - ge_p3_dbl can be simplified for ASM.
Prime check (integer.c/tfm.c/sp_int.c): Don't allow negative values and
make sure random candidate doesn't have bits higher than those in a set
when bits not a multiple of 8.
RSA: support Sha512-224 and Sha512-256.
RSA: Fix check for invalid in decryption. Affects plaintexts 256 bytes
and longer.
RSA: Don't allow base be larger than modulus.
RSA: Check small ciphertext (1 or 0) on decrypt when not using OAEP.
RSA: WOLFSSL_RSA_DECRYPT_TO_0_LEN allows decrypted value to be 0.
SP math all: fix div to handle large a and d when checking size of
remainder.
SP math all: set sign of result in sp_mod_2d()
2022-04-06 15:35:01 +10:00
a338b4c933 refactor SHA grew function, revert benchmark devid, increase SHA_CTX size, add AES ECB cryptocb test 2022-04-05 14:45:18 -07:00
4f5aa81031 Merge pull request #5000 from ejohnstown/tls13-wctest
Add TLSv1.3 KDF to wolfCrypt Test
2022-04-05 10:45:35 -07:00
6a3f98627e Merge pull request #5013 from anhu/wc_CheckCertSigPubKey
Add new public API wc_CheckCertSigPubKey()
2022-04-05 09:48:08 -07:00
99fbd6f160 Merge pull request #4963 from SparkiDev/tls13_psk_multi_id
TLS 1.3 PSK: multiple ids for a cipher suite
2022-04-05 09:47:14 -07:00
e9a238ca86 Merge pull request #5021 from JacobBarthelmeh/certs
allow up to and including CTC_MAX_SKID_SIZE (32 byte hash)
2022-04-05 09:46:34 -07:00
97b85552e8 Merge pull request #5023 from douzzer/20220405-strict-aliasing
enforce strict aliasing rules
2022-04-05 09:46:12 -07:00
eefc0f2f57 Add TLSv1.3 KDF to wolfCrypt Test
Added a test for the TLSv1.3 KDF to the wolfcrypt test. It uses 6
different test cases from the CAVP tests. A set of 8 session keys are
generated using multiple exporters.
2022-04-05 08:56:15 -07:00
328de3ed63 remove -Wno-strict-aliasing from AX_HARDEN_CC_COMPILER_FLAGS and AX_HARDEN_CXX_COMPILER_FLAGS in m4/ax_harden_compiler_flags.m4, and fix strict aliasing infractions in api.c. 2022-04-05 08:10:16 -05:00
e3409a40a5 configure.ac: when $ENABLED_LINUXKM_DEFAULTS, set -DWOLFSSL_OLD_PRIME_CHECK only if $ENABLED_FIPS == no. 2022-04-05 08:10:03 -05:00
b2a2a8af4a fix whitespace. 2022-04-05 08:09:48 -05:00
df9335ee0a Merge pull request #4988 from tmael/sp_loop
Fixes for Diab C89 and armclang
2022-04-05 08:20:47 +10:00
8dd07bbb73 Merge pull request #5011 from dgarske/ecc_key_decode
Fix to check if `wc_EccPublicKeyToDer` has enough output buffer space
2022-04-05 08:03:03 +10:00
77485d987e Merge pull request #5010 from haydenroche5/asn1_time_diff_2038
Fix year 2038 problem in wolfSSL_ASN1_TIME_diff.
2022-04-05 07:58:36 +10:00
c3a9520eb5 Merge pull request #5016 from dgarske/async_fixes
Fixes for async in wolfCrypt test
2022-04-05 07:56:08 +10:00
fc6e10ff42 Another test fixup. 2022-04-04 17:42:25 -04:00
68ebb051e5 allow up to and including CTC_MAX_SKID_SIZE (32 byte hash) 2022-04-04 15:19:17 -06:00
f39bd5e02b Merge pull request #5014 from dgarske/kcapi_ecc_import 2022-04-04 14:08:29 -07:00
829a8a4039 Merge pull request #5009 from embhorn/zd13980
Fix build errors for NO_WOLFSSL_SERVER and NO_WOLFSSL_CLIENT
2022-04-04 12:43:49 -07:00
6513e2ce8f Merge pull request #5019 from douzzer/20220404-linux5v18-etc
20220404 linux5v18 etc
2022-04-04 11:08:18 -07:00
bb4698a9e8 Merge pull request #5020 from douzzer/20220402-fips-linuxkm-pie-only-on-linuxkm
--enable-fips=v5 --disable-linuxkm-pie
2022-04-04 11:08:06 -07:00
9c1e2a83d1 Fix year 2038 problem in wolfSSL_ASN1_TIME_diff.
Prior to this commit, this function used XMKTIME (mktime) to convert the
passed in WOLFSSL_ASN1_TIMEs to Unix timestamps. On platforms where time_t is
32 bits long, times after the year 2038 can't be represented with this type. To
fix this, we need to not use XMKTIME. With this commit, the static function
time2epoch is added to ssl.c, which uses the date time information to compute
seconds since the Unix epoch without the use of mktime. It returns the seconds
as a long long. This is sufficient to make the function work for years > 2038 on
the platform of the user who discovered this problem in the first place (Yocto
Linux on ARMv7).
2022-04-04 11:01:21 -07:00
400c7238ef Test fixup. 2022-04-04 13:43:06 -04:00
ae9926cc42 Missing flag in unit test. 2022-04-04 12:39:10 -04:00
9b5ad6f218 Merge pull request #4968 from miyazakh/cryptonly
add WOLF_CRYPTO_CB_ONLY_RSA and WOLF_CRYPTO_CB_ONLY_ECC
2022-04-04 08:31:41 -07:00
757c93c6d5 Merge pull request #4945 from kaleb-himes/ZD13795
Fix for ZD13795 and also remove all-caps parameter
2022-04-04 08:25:10 -07:00
04385f8557 configure.ac: fips 140-3: don't insist on linuxkm-pie unless configuring an actual linuxkm build. 2022-04-04 10:14:22 -05:00
0d6c283f7a fixes for -Werror=declaration-after-statement in debug builds. 2022-04-04 09:29:26 -05:00
492704992a wolfssl/wolfcrypt/settings.h: #ifdef WOLFSSL_LINUXKM, make sure config.h is included only once, before masking out inapplicable autodetected features. 2022-04-04 09:28:06 -05:00
0fba16a394 Merge pull request #4998 from haydenroche5/get_conv_form
Add wolfSSL_EC_KEY_get_conv_form to compatibility layer.
2022-04-04 08:47:14 +10:00
880afe0d89 Add wolfSSL_EC_KEY_get_conv_form to compatibility layer. 2022-04-02 13:57:33 -07:00
54aa211fee Merge pull request #5015 from douzzer/20220401-Wvla-Wdeclaration-after-statement
fix codebase for -Wvla -Wdeclaration-after-statement
2022-04-01 18:48:00 -07:00
8e4abb0011 addressed code review comment 2022-04-02 09:18:28 +09:00
c522baa75e Unit tests. 2022-04-01 18:34:21 -04:00
ae3996fd0e fix codebase for -Wvla -Wdeclaration-after-statement; fix some whitespace. 2022-04-01 14:44:10 -05:00
211007fb44 WOLFSSL_ASN_API ---> WOLFSSL_API 2022-04-01 15:24:40 -04:00
bd0e222fec Merge pull request #5012 from julek-wolfssl/evp-enc-dec-block
Implement `EVP_EncodeBlock` and `EVP_DecodeBlock`
2022-04-01 12:24:23 -07:00
6ec0c22a28 Fixes for async in wolfCrypt test. 2022-04-01 12:04:31 -07:00
ded168f238 Add check for buffer space in wc_EccPublicKeyToDer. Refactor SetEccPublicKey to put public key directly into output buffer and eliminate small stack. Fixes ZD 13904. 2022-04-01 11:46:27 -07:00
9c572efa40 Disable the public key check in import private key for KCAPI. Fix type warning in KCAPI AES. 2022-04-01 11:27:17 -07:00
e1965094ad Add check for ULONG_MAX in SP math to detect if pre-processor correctly handles 64-bit types. 2022-04-01 09:24:46 -07:00
edea6428d9 Add new public API wc_CheckCertSigPubKey() 2022-04-01 11:40:25 -04:00
ef16ce806c Fix build errors for NO_WOLFSSL_SERVER and NO_WOLFSSL_CLIENT 2022-04-01 08:04:41 -05:00
6dffa8a13d Implement EVP_EncodeBlock and EVP_DecodeBlock 2022-04-01 13:29:40 +02:00
4db45cea4e Fixes to build with diab and armclang 2022-03-31 20:48:28 -07:00
99af84f1e2 Whitespace cleanups. 2022-04-01 09:36:53 +09:00
d3a379adac add WOLF_CRYPTO_CB_ONLY_RSA and WOLF_CRYPTO_CB_ONLY_ECC 2022-04-01 09:36:52 +09:00
b45cd921b6 Merge pull request #5005 from dgarske/renesas_spell 2022-03-31 17:44:04 -06:00
7b21cd8cf0 Merge pull request #5001 from dgarske/kcapi_ecc
KCAPI ECC/AES optimizations to further reduce page memory use
2022-04-01 08:36:23 +10:00
79444fdb56 Merge pull request #4997 from dgarske/qat_eckg
Support for Intel QuickAssist ECC KeyGen acceleration
2022-04-01 08:32:21 +10:00
1add8703e2 Merge pull request #4996 from haydenroche5/bn_rand
Improve wolfSSL_BN_rand.
2022-04-01 08:12:22 +10:00
5a8fc919ef Merge pull request #5006 from dgarske/mcapi_test 2022-03-31 18:06:13 -04:00
33d2f2687f Merge pull request #5007 from douzzer/20220331-ignore-readability-avoid-const-params-in-decls
20220331-ignore-readability-avoid-const-params-in-decls
2022-03-31 15:05:22 -07:00
01f9f7df5f Merge pull request #5002 from JacobBarthelmeh/Compatibility-Layer
sanity check before copy with new memory bio
2022-03-31 15:08:26 -05:00
0f0fdea7ff Merge pull request #5004 from julek-wolfssl/apache-enable-etm
Allow encrypt then mac with apache
2022-03-31 12:08:50 -07:00
773170464e undo changes to header files (see b7cecbacb) made to mollify clang-tidy's overly pedantic readability-avoid-const-params-in-decls -- keep declarations and definitions fully aligned, to mollify broken compilers. 2022-03-31 14:02:08 -05:00
acb04bec0c Fix mcapi_test.c to include the settings.h before crypto.h. 2022-03-31 10:54:53 -07:00
61f6b5e29c Peer review feedback. 2022-03-31 10:04:23 -07:00
064888bb2a Add KCAPI ECC support for using a private key id. 2022-03-31 09:05:03 -07:00
f8007b2d8f Further KCAPI AES/ECC memory optimizations. Adds KCAPI_USE_XMALLOC option for AES and ECC to reduce page memory use in certain KCAPI cases that allow it. 2022-03-31 08:58:22 -07:00
1993851274 Renesas spelling, code formatting and whitespace fixes. 2022-03-31 08:02:00 -07:00
90fe2ab894 Merge pull request #4999 from embhorn/zd13969
Add wolfSSL_CTX_SetCertCbCtx to set user context for CB
2022-03-31 07:43:47 -07:00
4b5649edc9 Allow encrypt then mac with apache 2022-03-31 15:55:57 +02:00
3f03f4e40a Handle case where bits is 0 properly. 2022-03-30 16:56:53 -07:00
1de5165dcc KCAPI ECC optimization to further reduce page memory use. 2022-03-30 15:01:01 -07:00
8136c55a39 sanity check before copy with new memory bio 2022-03-30 14:02:03 -07:00
a914d782c0 Merge pull request #4810 from anhu/engine_fla 2022-03-30 13:43:09 -07:00
c905c613e9 Support for Intel QuickAssist ECC KeyGen acceleration. 2022-03-30 13:07:47 -07:00
ea38e1aab5 Add wolfSSL_CTX_SetCertCbCtx to set user context for CB 2022-03-30 12:27:11 -05:00
366f159fbb Merge pull request #4991 from gojimmypi/patch-2
Overhaul Espressif ESP-IDF wolfSSL setup_win.bat
2022-03-30 06:56:49 -07:00
2029bf0a0b Merge pull request #4992 from JacobBarthelmeh/Compatibility-Layer
support creating new mem bio of length 0
2022-03-30 06:55:53 -07:00
d9df00cdfb Merge pull request #4994 from dgarske/kcapi
KCAPI ECC memory optimizations and KCAPI AES build fix
2022-03-30 11:50:39 +10:00
2077690bf0 Improve wolfSSL_BN_rand.
- Previously, this function would round up the requested bits to the next
multiple of 8. With this commit, the function returns a number of exactly the
number of bits requested, which is the same behavior as OpenSSL. This problem
was discovered by a user using the compatibility layer with OpenSSH's ssh-keygen
utility.
- This function now respects the top and bottom parameters.
- Improved unit testing.
2022-03-29 18:08:21 -07:00
409a0acb88 fine tuning on wolfcrypt\test\test_paths.h 2022-03-29 16:07:10 -07:00
d72d28ac60 copy errors are now only warnings 2022-03-29 15:39:09 -07:00
1dc3808aae Merge pull request #4986 from cconlon/sslFipsReady
Fix FIPS defines in wolfSSL_RSA_sign_generic_padding() / RSA_verify_ex()
2022-03-29 16:02:17 -05:00
d287863a35 Update setup_win.bat
more copy error checking. remove trailing whitespace.
2022-03-29 12:52:50 -07:00
d10e72bc98 Fix for KCAPI AES with WOLFSSL_NO_KCAPI_AES_CBC. 2022-03-29 12:50:28 -07:00
4ad2f68071 fix defines for FIPS around RSA-PSS in wolfSSL_RSA_sign_generic_padding() and wolfSSL_RSA_verify_ex() 2022-03-29 10:03:16 -06:00
0989a14395 Merge pull request #4995 from douzzer/20220328-multi-test-fixes
fix reproducible-build for libtool 2.4.7
2022-03-29 08:00:45 -07:00
e9b941e16e configure.ac: fix --enable-reproducible-build to cope with update from libtool-2.4.6 to -2.4.7. 2022-03-29 07:53:43 -05:00
8edf237f75 Merge pull request #4993 from SparkiDev/sakke_gen_table_tmp_size_fix
SP: fix number of temps alloced in sp_ecc_gen_table
2022-03-28 21:32:35 -05:00
194138f0b8 Merge pull request #4990 from dgarske/async_fix
Fixes for async ECC
2022-03-29 10:30:38 +10:00
9a8be82653 Merge pull request #4987 from julek-wolfssl/ffmpeg
Add support for `--enable-ffmpeg`
2022-03-28 16:33:20 -07:00
f50514b228 SP: fix number of temps alloced in sp_ecc_gen_table
Ony affects SAKKE and as a result of point add changes.
2022-03-29 09:11:45 +10:00
1abcd4b035 Reduce KCAPI ECC page memory allocation sizes. 2022-03-28 15:40:07 -07:00
05f377011b Fix for building with KCAPI AES enabled. 2022-03-28 15:05:58 -07:00
f7f94cede0 support creating new mem bio of length 0 2022-03-28 15:52:42 -06:00
0627437048 Suggestions from haydenroche5 2022-03-28 17:44:00 -04:00
12349f39e6 Merge pull request #4974 from kareem-wolfssl/iotsafe
IOTSafe workarounds
2022-03-28 13:49:44 -07:00
b203726623 Overhaul Espressif ESP-IDF wolfSSL setup_win.bat
# Description

This is a replacement to https://github.com/wolfSSL/wolfssl/pull/4989, per the [comment](https://github.com/wolfSSL/wolfssl/pull/4989#issuecomment-1080998040)

Overhauled `win_setup.bat` for more robust and flexible install of wolfSSL to ESP-IDF `component` directory. 

Functionally, there are no significant changes.  However this version:

- more verbose output 
- show directories used
- more error checking
- check for existing wolfSSL component; prompt to purge or update
- save and optionally re-use `config.h` and `user_settings.h`
- optionally target an alternate ESP-IDF path (useful for VisualGDB)
- offer tips and reminders upon completion

# Testing

Tested on Windows 10 with both ESP-IDF command prompt and stand-alone DOS prompt (e.g. for VisualGDB)

# Checklist

 - [ ] added tests
 - [ ] updated/added doxygen
 - [ ] updated appropriate READMEs
 - [ ] Updated manual and documentation

cc: @dgarske
2022-03-28 11:54:50 -07:00
5b0735cdb4 Fixes for async ECC broke in PR #4982. 2022-03-28 11:29:33 -07:00
52902f1d37 IoTSafe: Add SP_RSA to user_settings.h template. 2022-03-28 10:25:05 -07:00
6dc86e7df1 Add support for --enable-ffmpeg 2022-03-28 12:47:19 +02:00
be938ed197 IoTSafe Workarounds: Address code review feedback. 2022-03-25 16:17:53 -07:00
25d5a624d2 Merge pull request #4975 from cconlon/smallStack
smallstack cleanup for OpenSSL Compatibility Functions
2022-03-25 17:06:59 -06:00
0ee01f08bc Merge pull request #4984 from douzzer/20220325-multi-test-cleanup
20220325 multi-test fixes
2022-03-25 15:06:34 -07:00
3af3274dcd Merge pull request #4982 from SparkiDev/sp_x64_improvements
SP ASM improvements
2022-03-25 13:04:01 -07:00
07f9ca60ac Fix for async without threading. ./configure --enable-asynccrypt --enable-all CFLAGS="-DWC_NO_ASYNC_THREADING". 2022-03-25 12:43:04 -07:00
0930086fa1 Fix for increased mcapi (used by Microchip) ctx sizes if PK callbacks is enabled due to key id/label. 2022-03-25 12:36:07 -07:00
008c8509c6 multi-test fixes: whitespace in wolfcrypt/src/random.c and wolfcrypt/test/test.c, bugprone-macro-parentheses and -Wenum-compare in WS_RETURN_CODE() (wolfssl/ssl.h), and clang-analyzer-deadcode.DeadStores in api.c. 2022-03-25 13:26:41 -05:00
04e2b6c62a Merge pull request #4983 from douzzer/20220324-gcc-12-fixes
fixups for warnings from gcc-12
2022-03-24 19:16:27 -07:00
7eb95674ee Merge pull request #4966 from dgarske/kcapi
Fixes for KCAPI AES GCM and ECC
2022-03-25 10:18:16 +10:00
fd66f6bcec SP ASM improvements
Change Karatsuba implementations for x86_64.
Fix ECC code to better handle corner cases.
Add 'lower' versions of functions wehn an input is known to be less than m.
Add mont_add/dbl/tpl/sub for P384.
Change ECC point add to be cache-attack resistant.
Change mod_exp to be cache-attack resistant.
2022-03-25 10:04:25 +10:00
14522f25ff Merge pull request #4904 from kaleb-himes/OE22_NS9210_FIX
Fix up random.h conflicts with cert 3389 releases and some NETOS issues
2022-03-24 16:07:23 -07:00
feb58a8455 Merge pull request #4956 from julek-wolfssl/bind-9.18.0
bind 9.18.0 fixes
2022-03-25 08:27:34 +10:00
12776b3772 fixups for warnings from gcc-12:
src/internal.c: use XMEMCMP(), not ==, to compare array elements (fixes conflict of 74408e3ee3 vs 617eda9d44);

fix spelling of NAMEDGROUP_LEN (was NAMEDGREOUP_LEN);

src/ssl.c: in CheckcipherList() and wolfSSL_parse_cipher_list(), use XMEMCPY(), not XSTRNCPY(), to avoid (benign) -Wstringop-truncation;

scripts/sniffer-tls13-gen.sh: fix for shellcheck SC2242 (exit 1, not -1).
2022-03-24 16:33:36 -05:00
b509e174bb Whitespace fix. 2022-03-24 10:19:28 -07:00
ceae169a34 Merge pull request #4969 from dgarske/pk_pubkey 2022-03-24 12:40:03 -04:00
624f1499f0 Merge pull request #4978 from julek-wolfssl/issue/4970
Prefer status_request_v2 over status_request when both are present
2022-03-24 08:30:12 -07:00
5a0d794e88 Merge pull request #4980 from anhu/iv_docs
Correction about AES using IV in docs
2022-03-24 08:29:55 -07:00
29c0c9bf48 Rebase fixes 2022-03-24 13:41:50 +01:00
850b8c5c3b OpenSSL compatible API
`WOLFSSL_ERROR_CODE_OPENSSL` breaks ABI compatiblity due to changing the expected return code. Let's only do this when building with the full compatibility layer.
2022-03-24 12:16:59 +01:00
88d5059c36 Jenkins fixes
`WS_RETURN_CODE` was not functioning properly in master
2022-03-24 12:16:59 +01:00
98bc8402db Refactor memory BIO
- use the `WOLFSSL_BUF_MEM` struct to resize the internal memory buffer
- add a `WOLFSSL_BIO_RESIZE_THRESHOLD` define that will be used to determine how often to shrink the internal buffer. This should cut down on the number of free/malloc calls made significantly. This should help with our inefficient 1 byte reads in `loadX509orX509REQFromPemBio`.
- implement `wolfSSL_BUF_MEM_resize` which allows bi-directional buffer size manipulation
2022-03-24 12:16:59 +01:00
ae9b01c5b8 bind 9.18.0 fixes
- return `1` from `wolfSSL_BIO_set_mem_eof_return` instead of `0` for success
- bind requires ALPN
- `OPENSSL_COMPATIBLE_DEFAULT` defined for bind
- `WOLFSSL_ERROR_CODE_OPENSSL` defined when using compatibility layer
- return `bio->eof` on no pending data to read in memory BIO (defaults to `WOLFSSL_BIO_ERROR`)
- `flags` is no longer an input parameter in `wolfSSL_ERR_get_error_line_data`
- allow lazy parameter loading in `wolfSSL_DH_set0_key`
- implement reference counter in `WOLFSSL_EC_KEY`
- load serial number from `x509->serialNumber` if `x509->serial` is empty
2022-03-24 12:16:59 +01:00
f71a85d5f9 Merge pull request #4979 from dgarske/sniffer_tidy 2022-03-23 15:13:20 -04:00
1bc71da1df Correction about AES using IV in docs 2022-03-23 13:35:13 -04:00
6e550c8d75 Fix for KCAPI ECC KeyGen. Disable ECC consistency checks with KCAPI. Allow public AddSignature (used to be public). Fix KCAPI ECC SharedSecret output size. 2022-03-23 09:37:50 -07:00
8bafa7f601 Fix for KCAPI ECC sign (was not returning the signature, since ret always 0). 2022-03-23 09:37:50 -07:00
c9e3094cb0 Fixes for KCAPI ECC verify. Cleanup of the pubkey_raw. Fix KCAPI AES possible used uninitialized. 2022-03-23 09:37:50 -07:00
8d695f97c9 Fix for KCAPI KcapiEcc_LoadKey parameter to kcapi_kpp_keygen. Added option to release handle on load. Fixes for KCAPI sign output length. Added additional argument checking. 2022-03-23 09:37:50 -07:00
318350f63b Fix for ecc_check_privkey_gen with KCAPI. Fix KCAPI ECDSA to ensure we don't leak handle for multiple sign/verify calls. 2022-03-23 09:37:50 -07:00
9f2dc408a0 Fixes for KCAPI AES GCM. Add guards for algorithm macros on KCAPI. 2022-03-23 09:37:50 -07:00
1b0e5f4806 Allow disabling DRBG with KCAPI. Add KCAPI /dev/hwrng support. 2022-03-23 09:37:50 -07:00
5fe6f1c875 For KCAPI do not force enable ECC curves, set K or seed callback, disable AES GCM tests with non standard IV. 2022-03-23 09:37:50 -07:00
b04954dc98 Merge pull request #4977 from SparkiDev/ssl_move_x509_store
ssl.c: move out X509 store APIs to new file
2022-03-23 09:36:33 -07:00
f129c32273 Fixes for whitespace, script bug and bit-field type. 2022-03-23 09:31:04 -07:00
b6e590836d initialize ENABLE_FIPS 2022-03-23 10:29:59 -04:00
4412496adb Prefer status_request_v2 over status_request when both are present
Reported in https://github.com/wolfSSL/wolfssl/issues/4970
2022-03-23 11:20:22 +01:00
90f53aed34 ssl.c: move out X509 store APIs to new file 2022-03-23 13:59:54 +10:00
3dd2219548 Don't over-write ENABLED_FIPS with no if user didn't specify anything. 2022-03-22 20:33:27 -04:00
d864fc9a3f Merge pull request #4972 from julek-wolfssl/asn-time-tz-diff
`mktime` may return a negative due to timezones around the unix epoch
2022-03-22 14:03:59 -05:00
cf0e4a0e3d Merge pull request #4976 from anhu/kill_tabs
Get rid of tabs I added previously.
2022-03-22 11:35:00 -07:00
906ea4ad03 smallstack reduction for wolfSSL_EC_POINT_invert 2022-03-22 10:00:17 -06:00
64a309e245 smallstack reduction for wolfSSL_ASN1_INTEGER_to_BN 2022-03-22 10:00:17 -06:00
ddc1899d48 smallstack reduction for wolfSSL_EC_POINT_get_affine_coordinates_GFp 2022-03-22 10:00:17 -06:00
94e1b87ae0 smallstack reduction for wolfSSL_X509_set_ext, wolfSSL_EC_POINT_mul, wolfSSL_ECDSA_do_sign, wolfSSL_i2d_X509_NAME, wolfSSL_X509_REQ_sign 2022-03-22 10:00:13 -06:00
c41bef6486 Get rid of tabs I added previously. 2022-03-22 11:56:15 -04:00
aa38d99538 Fix for TLS PK callback issue with Ed25519/Ed448 and public key not being set. 2022-03-22 08:33:54 -07:00
c377a709e1 Merge pull request #4953 from cconlon/apiVersionDiff
More checks on OPENSSL_VERSION_NUMBER for API prototype differences
2022-03-21 16:59:06 -06:00
2babac6cb5 Merge pull request #4875 from dgarske/sniffer_async 2022-03-21 16:47:23 -04:00
210eb6283c smallstack reduction for wc_ecc_import_x963_ex, mp_jacobi 2022-03-21 14:43:43 -06:00
851ff9e661 smallstack reduction for PrintPubKeyRSA, PrintPubKeyDSA, PrintPubKeyDH 2022-03-21 14:43:43 -06:00
339e44bd87 smallstack reduction for wc_ecc_import_point_der_ex() 2022-03-21 14:43:43 -06:00
59665a44b5 Fixes for allowing server to have a public key set when using external key with PK callbacks. 2022-03-21 13:14:24 -07:00
29c120356e Sniffer asynchronous support.
* Adds stateful handling of DH shared secret computation in `SetupKeys`.
* Improved the decrypt handling to use internal functions and avoid generating alerts on failures.
* Fix for sniffer resume due to missing `sessionIDSz` broken in #4807.
* Fix sniffer test cases to split resume (session_ticket) tests.
* Add `snifftest` list of build features so test script can gate running resume test.
2022-03-21 12:05:08 -07:00
af70edb99d Strip trailing zeroes from cert buffer when using IOTSAFE_NO_GETDATA. 2022-03-21 10:53:36 -07:00
4951646c91 touch up class name and function comments 2022-03-21 10:56:09 -06:00
fb3d38c3e8 add example C# PSK client 2022-03-21 10:19:45 -06:00
c213c725d7 Merge pull request #4971 from SparkiDev/fp_div2_mod_ct_oob
TFM fp_div_2_ct: rework to avoid overflow
2022-03-21 09:11:41 -07:00
8bf14ba1d3 Merge pull request #4957 from JacobBarthelmeh/Compatibility-Layer
alter return value and add error string
2022-03-21 09:10:04 -07:00
08d6474878 Merge pull request #4954 from SparkiDev/rsa_fermat
RSA: check for small difference between p and q
2022-03-21 09:09:38 -07:00
b90df0a6aa Merge pull request #4951 from ejohnstown/wolfrand
wolfRand for AMD
2022-03-21 09:09:19 -07:00
d7037da0b5 mktime may return a negative due to timezones around the unix epoch 2022-03-21 17:07:13 +01:00
9763030675 Merge pull request #4845 from cconlon/pkcs7compat 2022-03-21 15:26:37 +01:00
8dbd8b0ad6 RSA: check for small difference between p and q 2022-03-21 10:58:14 +10:00
aa14607a6f TFM fp_div_2_ct: rework to avoid overflow
Don't set the overflow word. Instead integrate the div by 2 into the
function so that the overflow word doesn't need to be stored.
2022-03-21 10:43:06 +10:00
2f52d3cd20 Merge pull request #4965 from dgarske/aes_win_clang
Fixes for Windows AESNI with clang
2022-03-21 08:24:21 +10:00
dcaa218ed8 Merge pull request #4927 from cconlon/upRef 2022-03-18 18:10:36 -07:00
7ea6b73c7b Merge pull request #4928 from cconlon/compatCleanups 2022-03-18 16:23:56 -07:00
2637e5e361 Merge pull request #4926 from cconlon/namePrintRFC5523 2022-03-18 15:53:07 -07:00
c491a6c829 EVP_PKEY_copy_parameters: correctly mark inner struct owned 2022-03-18 16:37:45 -06:00
a79daa5ea8 Merge pull request #4959 from haydenroche5/asn1_time_diff_bug
Fix bug in wolfSSL_ASN1_TIME_diff.
2022-03-18 14:28:23 -07:00
582f0d82e4 address review feedback for PKCS7 compat additions 2022-03-18 12:07:44 -06:00
bfee3dffc6 Merge pull request #4967 from dgarske/pubkey_size
Fix for `wc_EccPublicKeyToDer` incorrectly requiring too much buffer
2022-03-18 09:22:52 -06:00
bcce015496 Merge pull request #4964 from julek-wolfssl/wolfSSL_get_session-docs
Update `wolfSSL_get_session` docs
2022-03-18 06:51:27 -07:00
bb27fa4555 Fix for wc_EccPublicKeyToDer incorrectly requiring too much buffer. Merge error included old ASN code and incorrectly excluded ASN template. ZD13904. 2022-03-17 18:51:37 -07:00
ef66a12a24 Merge pull request #4961 from dgarske/cust_fixups
Various portability improvements (Time, DTLS epoch size, IV alloc)
2022-03-18 11:38:57 +10:00
f117308135 Merge pull request #4921 from dgarske/private_keyid
Added private key id/label support - improve PK callback public key use
2022-03-18 11:36:28 +10:00
b546b2a5ec Improve logic around private key id/label. Adds WOLF_PRIVATE_KEY_ID. 2022-03-17 14:48:30 -07:00
f954aef973 Fixes for Windows AESNI with clang. Improve 32-bit support. 2022-03-17 14:05:24 -07:00
ae25a48509 Improve the build message to not always allocate the IV (16 byte) (use fixed buffer if <= 16 bytes). 2022-03-17 14:01:57 -07:00
3fba5d17c3 Various portability improvements:
* Change DTLS epoch size word16.
* Allow override of the `RECORD_SIZE` and `STATIC_BUFFER_LEN`.
* Remove endianness force from game build.
* Add `gmtime_s` option.
* Fix for macro conflict with `MAX_KEY_SIZE`.
* Expose functions `wolfSSL_X509_notBefore`, `wolfSSL_X509_notAfter`, `wolfSSL_X509_version` without `OPENSSL_EXTRA`.
2022-03-17 14:00:55 -07:00
54477d1bea improvements around keystore key update 2022-03-17 12:04:52 -06:00
40c79b1134 add macro guards to handle build with QNX CAAM 2022-03-17 12:04:52 -06:00
9bf2962852 default to strict NVM operations with key generation 2022-03-17 12:04:52 -06:00
090932b65c FIPS benchmark of cmac and ecb 2022-03-17 12:04:52 -06:00
55b42dd85a Add SECO use and expand cryptodev 2022-03-17 12:04:52 -06:00
1fd090d094 Update wolfSSL_get_session docs
Recommend using `wolfSSL_get1_session` and `NO_SESSION_CACHE_REF` for session resumption purposes. `wolfSSL_get_session` should not be used unless to inspect the current session object.
2022-03-17 12:56:28 +01:00
f76105a93b TLS 1.3 PSK: multiple ids for a cipher suite
When WOLFSSL_PSK_MULTI_ID_PER_CS is defined, multiple identities can be
returned for a cipher suite.
The first byte of the identity is the count of identites that have been
seen so far for the cipher suite.
2022-03-17 09:31:25 +10:00
aa8e5a29d4 Merge pull request #4947 from cconlon/compatSmallStack
Stack/smallstack cleanup for OpenSSL compatibility functions
2022-03-15 16:47:23 -07:00
a52539c489 Merge pull request #4958 from TakayukiMatsuo/example 2022-03-15 17:39:07 -06:00
5b268c0852 Merge pull request #4960 from anhu/stm32_pq_bench
Add Post-quantum KEM benchmark for STM32
2022-03-15 16:36:08 -07:00
f80faebfe5 wolfRand for AMD
1. Add configure option to enable AMD's RDSEED.
2. Add seed parameters when building specifically for AMD using RDSEED.
3. Update the wolfCrypt test to play nice with the larger seed size.
2022-03-15 15:20:08 -07:00
fbfb1fee91 Add Post-quantum KEM benchmark for STM32 2022-03-15 14:49:40 -04:00
6e6aa5b0c1 Fix bug in wolfSSL_ASN1_TIME_diff.
This function should not error out if one of the passed in times is the Unix
epoch. This amounts to erroring out when the XMKTIME returns < 0, rather than
<= 0.
2022-03-15 10:52:05 -07:00
d0e83be596 alter return value and add error string 2022-03-15 10:26:59 -07:00
365a4de154 Fix settings and removed warnings 2022-03-16 02:12:45 +09:00
d531e21f34 Merge pull request #4946 from dgarske/async_earlydata
Fixes for TLS v1.3 early data with async
2022-03-15 12:12:09 -05:00
9c29102c43 Merge pull request #4948 from SparkiDev/tls12_pa_failsafe
TLS: add peer authentication failsafe for TLS 1.2 and below
2022-03-15 09:42:56 -07:00
6762cd90da add tests for PKCS7_sign(), PKCS7_final(), SMIME_write_PKCS7() 2022-03-15 10:21:22 -06:00
ce514e6fc5 add PKCS7_sign, PKCS7_final, SMIME_write_PKCS7. add signer cert verify support to PKCS7_verify, support for PKCS7_TEXT, PKCS7_DETACHED, PKCS7_STREAM 2022-03-15 10:21:22 -06:00
ba4f3379ba remove unimplemented wc_MIME_* prototypes in asn.h 2022-03-15 10:21:22 -06:00
a7d5e6400d add support for PKCS7_TEXT flag to PKCS7_verify() 2022-03-15 10:21:22 -06:00
2febed01a5 Merge pull request #4949 from SparkiDev/ssl_move_conf
ssl.c: move TXT and CONF APIs out into conf.c
2022-03-15 09:02:42 -07:00
f7c5c9f713 extra checks for OPENSSL_VERSION_NUMBER for API prototype differences 2022-03-15 09:41:51 -06:00
7c63dd6245 smallstack reduction for wolfSSL_set_accept_state() 2022-03-15 09:40:51 -06:00
062003916c stack/smallstack reduction for wolfssl_x509_make_der(), d2iGenericKey(), PrintPubKeyEC(), wolfSSL_EC_POINT_add() 2022-03-15 09:40:48 -06:00
343e8bccdd ssl.c: move TXT and CONF APIs out into conf.c 2022-03-15 12:09:24 +10:00
4ec49d2189 Merge pull request #4943 from SparkiDev/sp_arm64_perf_1
SP ASM performance improvements
2022-03-14 18:40:51 -07:00
e3276ca683 Merge pull request #4939 from SparkiDev/aes_gcm_align
AES-GCM: stack alignment issues
2022-03-14 18:37:11 -07:00
9ed061cc96 TLS: add peer authentication failsafe for TLS 1.2 and below
Tightened the TLS 1.3 failsafe checks too.
2022-03-15 08:51:44 +10:00
eeb7f72a07 AES-GCM: stack alignment issues
Don't expect stack to be aligned.
vmovdqu is no longer slower than vmovdqa.
2022-03-15 08:49:43 +10:00
b3319bd952 Undo the logic around enable sha as its enabled by default already. 2022-03-14 16:29:13 -04:00
34e491f39f Merge pull request #4950 from SparkiDev/regression_fixes_3
TLS 1.3 script test: wait for server to write file
2022-03-14 13:24:06 -07:00
821e293ed4 Fix to add test where needed. 2022-03-14 15:54:39 -04:00
b3e28fab67 Make the code simpler. 2022-03-14 13:51:05 -04:00
ea500bd1c8 --enable-engine=fips-v2,fips-readyetc., etc. 2022-03-14 13:51:05 -04:00
07ee2bcecf Created new --enable-engine and --enable-engine-witout-fips flags 2022-03-14 13:51:05 -04:00
2c1ecacbfc TLS 1.3 script test: wait for server to write file
Also fixes for:
./configure --enable-psk --disable-rsa --disable-ecc --disable-dh
C_EXTRA_FLAGS=-DWOLFSSL_STATIC_PSK
./configure --disable-shared --enable-curve448 --enable-ed448
--disable-rsa --disable-dh --enable-tls13 --disable-ecc --enable-certgen
--enable-keygen
2022-03-14 14:42:47 +10:00
4966eb7897 Merge pull request #4944 from douzzer/20220310-asn-template-EncodeExtensions-overrun
wolfcrypt/src/asn.c: fix buffer underrun in EncodeExtensions() and leak in ParseCRL_Extensions()
2022-03-13 21:21:07 -05:00
cdb45b12c5 Merge pull request #4884 from haydenroche5/i2d_x509_name_fix
Improve wolfSSL_i2d_X509_name.
2022-03-14 11:57:07 +10:00
20562b3f78 DecodeNameConstraints (ASN Template): free ASNGetData 2022-03-14 09:14:19 +10:00
a816f329cc Merge pull request #4856 from anhu/stm32u5
Enable support for STM32U585 and PQC for STM32
2022-03-11 14:49:46 -08:00
fb0c9b2a66 ssl.c: use InitHandshakeHashes(), not FreeHandshakeHashes(), to reset ssl->hsHashes. 2022-03-11 16:26:24 -06:00
dd8fb41f66 Fixes for TLS v1.3 early data with async. 2022-03-11 14:03:46 -08:00
830431ccdf scripts/tls13.test: fix whitespace. 2022-03-11 13:54:50 -06:00
82ab7bf32c ssl.c: fix hash state memory leaks in wolfSSL_clear() and wolfSSL_TicketKeyCb(). 2022-03-11 13:40:01 -06:00
8cba961bac Comment fixups, bad braces, and stray &. 2022-03-11 12:14:02 -05:00
9fff321e3e address PR review feedback on EVP_PKEY changes 2022-03-11 10:11:02 -07:00
82c6f58eb0 define BIO_CTRL_SET, BIO_CTRL_GET 2022-03-11 09:53:56 -07:00
6e6108bb98 remove duplicate BIO_CLOSE/BIO_NOCLOSE definition, already in openssl/bio.h 2022-03-11 09:53:56 -07:00
238072c84d map BIO_s_accept to BIO_s_socket for basic use 2022-03-11 09:53:56 -07:00
2639c5e268 X509V3_set_ctx arg check fix, debug log cleanup 2022-03-11 09:53:51 -07:00
385ece92d8 ECCSI and SAKKE: fix smallstackcache memory leaks in library, and blue-moon undefined behavior bugs in test.c eccsi_test(() and sakke_test(). 2022-03-11 10:06:18 -06:00
fc92584bd2 Address the one that was missed 2022-03-11 08:36:36 -07:00
64953299cf scripts/tls13.test: retries (up to 10) for early data scenarios, to mitigate race noted in #4918 . 2022-03-11 08:18:14 -06:00
7602eef98f src/ssl.c: use strlcpy(), not strncpy(), to make string_fortified happy (else "error: ‘__builtin_strncpy’ specified bound 46 equals destination size"). 2022-03-11 08:15:44 -06:00
b2ae7f4230 wolfssl/openssl/asn1.h: in ASN1_SIMPLE(), use OFFSETOF() macro. 2022-03-11 07:59:08 -06:00
c3eab0dcdd Fixes from sanitizer build
Fix OID index in SetNameRdnItems for multi attributes.
Stop warning about strncpy to small.
Fix casting in ASN1_SIMPLE to use consistent type.
2022-03-11 14:27:50 +10:00
cf030de48a Merge pull request #4930 from SparkiDev/tfm_alloc_fails
TFM: handle more alloc failure cases gracefully
2022-03-10 15:42:21 -08:00
3ea5e56c26 SP ASM performance improvements
Mostly improving Aarch64 assembly.
Change Karatsuba implementations.
Specialised code for exponentiating to 0x10001 for RSA.
2022-03-11 08:42:46 +10:00
570daa6a7f Enable support for STM32U585 and PQ on M4 2022-03-10 14:19:01 -05:00
0eef90f951 Fix for ZD13795 and also remove all-caps parameter 2022-03-10 11:40:32 -07:00
c78bfa4db8 scripts/tls13.test: when $early_data = yes, print the matching line counts. 2022-03-10 11:56:20 -06:00
227804f034 wolfcrypt/src/asn.c: in ParseCRL_Extensions(), add missing FREE_ASNGETDATA(). 2022-03-10 11:45:37 -06:00
170b125b39 wolfcrypt/src/asn.c: fix buffer underrun in EncodeExtensions(), due to faulty iteration limit calculation, when smallstack build. 2022-03-10 09:38:19 -06:00
6b7f0d4ee7 Merge pull request #4905 from anhu/custom_ext_parse
Injection and parsing of custom extensions in X.509 certificates.
2022-03-10 10:39:05 +10:00
b30ada1608 Merge pull request #4940 from ejohnstown/wolfrand
Fix wolfRand Build
2022-03-09 15:42:19 -08:00
47895fe78d Merge pull request #4942 from dgarske/sp_math_opensslextra
Fixes to support building opensslextra with SP math
2022-03-10 08:53:21 +10:00
b4df909df0 Merge pull request #4934 from haydenroche5/x509_v_err_sync
Sync up X509_V_ERR codes with OpenSSL.
2022-03-10 08:37:10 +10:00
98f733767b Use MAX_OID_SZ 2022-03-09 17:20:50 -05:00
e1da313b91 EVP_PKEY_copy_parameters: add support for EVP_PKEY_DH 2022-03-09 14:34:09 -07:00
141cf822f2 Merge pull request #4941 from douzzer/20220309-script-cleanup
20220309 script cleanup
2022-03-09 13:30:50 -08:00
bcfe8bf2e2 Merge pull request #4933 from haydenroche5/x509_set_ext_ext_key_usage 2022-03-09 13:22:49 -07:00
3a62857dbd Fixes to support building opensslextra with SP math. Disables some of the compatibility layer BN and ECC point handling. 2022-03-09 11:53:56 -08:00
b043225dbd Fixes inspired by review by SparkiDev. 2022-03-09 13:39:53 -05:00
d6fb454063 Fix wolfRand Build
1. Remove the v3 FIPS build from configure and automake. This was for
   the old FIPS Ready build, which is now fixed to the certificate 3389
   configuration.
2. Remove AES-GCM, PKCS12, and SHA-3 from wolfRand build. They were
   getting reenabled later in the configure.
2022-03-09 10:35:39 -08:00
abfc788389 script cleanup: use #!/bin/bash on all scripts that use "echo -e" (/bin/sh is sometimes a non-Bourne/non-POSIX shell, e.g. dash/ash, with no support for "echo -e"); fix whitespace. 2022-03-09 12:28:22 -06:00
67cc8ed482 tests/api.c: fix test_wolfSSL_BIO_Qt_usecase() "function declaration isn’t a prototype". 2022-03-09 12:27:19 -06:00
4ff82e22e6 Merge pull request #4938 from douzzer/20220308-shellcheck-errors
fixes for shell script errors detected by shellcheck --severity=error.
2022-03-08 12:51:11 -08:00
70857f7b3c Merge pull request #4923 from miyazakh/set_bio
Set bio read/write flag obviously
2022-03-08 13:08:33 -07:00
c256d8ca92 Merge pull request #4936 from julek-wolfssl/no-force-ecc-ca
Don't force a ECC CA when a custom CA is passed with `-A`
2022-03-08 10:58:35 -08:00
c9a7393923 fixes for shell script errors detected by shellcheck --severity=error. 2022-03-08 12:51:48 -06:00
a4229c6cf8 Merge pull request #4932 from SparkiDev/tls_hmac_fix
TLS HMAC: fix number of blocks to not process
2022-03-08 10:06:11 -08:00
4a912f29d1 Merge pull request #4843 from tmael/sp_diab
Support (no)inline with Wind River Diab compiler
2022-03-08 10:00:16 -08:00
3c64731c4f Don't force a ECC CA when a custom CA is passed with -A
The following config would fail `../configure --enable-opensslall CFLAGS="-DOPENSSL_COMPATIBLE_DEFAULTS" && make -j check`. This is because `test-fails.conf` `ECC no signer error` test expects a failure while the ECC CA was being added as a trusted cert due to  `OPENSSL_COMPATIBLE_DEFAULTS`.
2022-03-08 15:02:43 +01:00
031c97f835 Merge pull request #4931 from douzzer/20220307-early-data-and-c99-fixes
enable-earlydata vs enable-fips/enable-asynccrypt
2022-03-08 07:34:58 -06:00
f71be0546c addressed review comments 2022-03-08 18:20:30 +09:00
31736307fd Sync up X509_V_ERR codes with OpenSSL.
We defined these codes to values that didn't match those in OpenSSL. This is a
problem if a user is porting code from OpenSSL to wolfSSL that uses hardcoded
versions of these values. While the user's code should be fixed to not use
hardcoded values, we can make the port smoother by syncing the values up.
2022-03-07 15:58:46 -08:00
2cbe28fcf9 Sequences are constructed 2022-03-07 18:50:38 -05:00
872ed28882 Merge pull request #4925 from kareem-wolfssl/nullSslMethod
Add SSL_R_NULL_SSL_METHOD_PASSED.
2022-03-07 15:36:56 -08:00
f49983b3b3 EVP_PKEY_keygen: add DH keygen support, fixes to EVP_PKEY_set1/get1_DH 2022-03-07 16:32:23 -07:00
939ce713df EVP_PKEY_derive: set internal DH key if needed 2022-03-07 16:32:22 -07:00
f3f0d49fce EVP_PKEY_CTX_new: set curve NID from pkey if available 2022-03-07 16:32:22 -07:00
85f85cc76a add DH_up_ref() and unit test 2022-03-07 16:32:22 -07:00
8e0f5f9289 EVP_PKEY_get1/set1_EC_KEY: modify for EC_KEY_up_ref support 2022-03-07 16:31:09 -07:00
76014260f6 add EC_KEY_up_ref() and unit test 2022-03-07 16:31:09 -07:00
9b808bde20 Fixes for building with HAVE_EX_DATA no compat layer. 2022-03-07 17:20:58 -06:00
39d975a3c3 Add extended key usage support to wolfSSL_X509_set_ext. 2022-03-07 15:20:01 -08:00
0231304607 fixes for make check with --enable-all (now including --enable-earlydata) with fips or asynccrypt:
in scripts/tls13.test, use fips-compatible server-side cipher suite for "TLS v1.3 cipher suite mismatch" test, and modernize some syntax;

in configure.ac, omit earlydata from enable-all when asynccrypt, pending fix;

also in configure.ac, fix AC_CHECK_DECLS()-overriding-AC_CHECK_FUNCS() kludge, to fix CPPFLAGS=-std=c99 builds.
2022-03-07 17:19:31 -06:00
0a91d42f2c TLS HMAC: fix number of blocks to not process
Change made to line for static analysis.
Change was made incorrectly due to bracketting.
This fixes it.
2022-03-08 08:10:52 +10:00
a9cc1ca877 Merge pull request #4924 from dgarske/coexist_fixes 2022-03-07 13:00:22 -08:00
d77d9b93dc This fixes a make check error.
The flags activated code that didn't account for the new oid encoding. This
code fixes that.
2022-03-07 15:47:47 -05:00
0e0ac14bbf Merge pull request #4901 from SparkiDev/kcapi_ecdh_fixes
Fixes for KCAPI ECDH/DH and page alignment
2022-03-07 11:01:16 -08:00
e7041d2315 Merge pull request #4929 from SparkiDev/siphash_clang
SipHash: Replace gcc specific ASM instruction with generic
2022-03-07 10:34:13 -08:00
3b4ba669d4 Merge pull request #4922 from dgarske/async_disable_fixes
Fixes for async disables around the DevCopy calls
2022-03-07 13:51:09 +10:00
1ca35f6cca TFM: handle more alloc failure cases gracefully 2022-03-07 13:20:39 +10:00
d5989dc15e SipHash: Replace gcc specific ASM instruction with generic
clang would not compile movxzb.
Replaced with movzbq.
2022-03-07 08:49:28 +10:00
a68261cd82 Merge pull request #4757 from kareem-wolfssl/xstatstruct
Add separate "struct stat" definition XSTAT_TYPE to make overriding XSTAT easier.
2022-03-07 08:32:05 +10:00
7006efe97f Merge pull request #4861 from JacobBarthelmeh/ECC
Deterministic ECDSA: fix for larger curve sizes
2022-03-07 08:26:35 +10:00
84beb5ed7b Merge pull request #4918 from miyazakh/enableall_earlydata
enable early data when specifying `--enable-all` option
2022-03-07 08:05:36 +10:00
6bc3b7fc9d addressed jenkins failure 2022-03-06 07:41:37 +09:00
a572c19268 set bio flag obviously
fix nightly Qt test
2022-03-06 07:41:36 +09:00
9be0633ce3 Merge pull request #4824 from dgarske/fips_ready_user
User settings template for FIPS v5 ready
2022-03-05 07:52:03 -06:00
2fc47fedee Merge pull request #4900 from miyazakh/esp_waituntil
Fix wait-until-done in rsa hw primitive acceleration of ESP-IDF port
2022-03-04 17:32:06 -07:00
930a3d85e1 add support to X509_NAME_print_ex() for RFC5523 basic escape 2022-03-04 17:19:33 -07:00
0c3b9c733f Fixes for KCAPI ECDH/DH and page alignment. ZD 13763 2022-03-04 15:06:16 -08:00
f162d7f530 Add SSL_R_NULL_SSL_METHOD_PASSED. 2022-03-04 15:11:09 -07:00
719ed213d5 Add separate "struct stat" definition XSTAT_TYPE to make overriding XSTAT easier. 2022-03-04 14:54:56 -07:00
0a1c052c40 doxygen for wc_SetCustomExtension() 2022-03-04 16:24:27 -05:00
e6189a638c IOTSafe workarounds: Allow reading files with no GetSize command available, allow sign command response with no padding. 2022-03-04 14:03:47 -07:00
806cd4fbba doxygen for myUnknownExtCallback() 2022-03-04 15:32:11 -05:00
3839b0e675 Fixes for building wolfSSL along side openssl. 2022-03-04 12:06:24 -08:00
ce8ef8f7c6 Merge pull request #4913 from kareem-wolfssl/makeClean
Allow disabling forced 'make clean' at the end of ./configure.
2022-03-04 12:02:08 -08:00
e1829e614d Merge pull request #4820 from haydenroche5/evp_pkey_paramgen
Add wolfSSL_EVP_PKEY_paramgen to the compatibility layer.
2022-03-04 11:49:21 -07:00
a4a4bdc20f fix typo, add macro guard, remove dead code path 2022-03-04 10:49:11 -07:00
90355df4b0 disable early data for --enable-distro
addressed jenkins failure
2022-03-04 17:00:29 +09:00
e91f0f173b Fixes for async disables around the DevCopy calls. ZD13824 2022-03-03 16:33:18 -08:00
09e7b7150f Allow overriding make command used for make clean with make. 2022-03-03 15:51:26 -07:00
9ec30f02a6 Merge pull request #4898 from kaleb-himes/140-2-ready 2022-03-03 14:43:02 -08:00
3ad94c63f5 Pass the tests! 2022-03-03 17:02:26 -05:00
7ec61dfe05 Make jenkins happy 2022-03-03 15:44:00 -05:00
0e8066dda0 Fix typo 2022-03-03 11:45:42 -07:00
d1212f9247 add P521 test case and fix for k generation 2022-03-03 10:44:24 -07:00
2567cd5e5a Merge pull request #4912 from julek-wolfssl/ZD13742
Check `input` size in `DecodeNsCertType`
2022-03-03 08:22:49 -08:00
3a5f78b55a Merge pull request #4919 from julek-wolfssl/ZD13737
Reported in ZD13737
2022-03-03 08:22:11 -08:00
949f8b5be1 Revert back to word16 API. 2022-03-03 10:41:05 -05:00
63e4ba5854 Merge pull request #4906 from julek-wolfssl/ZD13606-master
Fix issues reported in ZD13606
2022-03-03 21:27:22 +10:00
85fc2bb7fa Make old less secure TimingPadVerify implementation available
For customers that don't need full side channel security.
2022-03-03 21:17:25 +10:00
bdb7399398 Reported in ZD13737
Implement `wolfSSL_BIO_eof` support for most available BIO's
2022-03-03 10:25:09 +01:00
c7c3ee00bb Address code review
- Use functions instead of accessing `BIO` members
- Add `wolfSSL_BIO_method_type`
2022-03-03 10:09:41 +01:00
b45bbdc078 enable early data when enabled all 2022-03-03 16:36:03 +09:00
dad2332a95 Merge pull request #4917 from kaleb-himes/TIRTOS_KDF_ADD
Add the new kdf.c file to the TIRTOS build
2022-03-02 17:02:47 -08:00
56de8cd622 add check on hash size passed in 2022-03-02 16:52:04 -07:00
a54045113a fixes from review by dgarske 2022-03-02 17:39:15 -05:00
5d0614c630 Merge pull request #4911 from SparkiDev/enc_pem_cbc_padding
ASN PemToDer: remove padding when AES_CBC encrypted
2022-03-02 14:32:45 -08:00
59970d94f5 Merge pull request #4908 from dgarske/tick_pad
Fix for padding in session tickets
2022-03-03 08:20:35 +10:00
25556dea8d Add the new kdf.c file to the TIRTOS build 2022-03-02 14:56:46 -07:00
d86122a5e7 Merge pull request #4909 from JacobBarthelmeh/PKCS12
refactor PKCS12 parse key creation
2022-03-02 12:37:06 -08:00
deea6261e9 Allow disabling forced 'make clean' at the end of ./configure. 2022-03-02 13:20:22 -07:00
0053bd3af1 Now we can inject as wellgit checkout custom_ext_parse 2022-03-02 15:16:39 -05:00
aa18209c99 free buffer since pkey struct makes its own copy 2022-03-02 09:59:21 -07:00
f846aceee2 Check input size in DecodeNsCertType 2022-03-02 17:17:17 +01:00
8b24be04e8 ASN PemToDer: remove padding when AES_CBC encrypted 2022-03-02 11:33:44 +10:00
119f2d2651 Fix for padding in session tickets. Adds padding based on WOLFSSL_GENERAL_ALIGNMENT. Increases enc_len to 32-bit. Related to PR #4887 2022-03-01 15:40:57 -08:00
d1ba82d5e5 Merge pull request #4903 from julek-wolfssl/psk-resuming-certs
OpenSSL considers PSK resuming
2022-03-02 08:57:40 +10:00
b03233a35e handle free'ing up items in fail case 2022-03-01 15:24:53 -07:00
c3e7ff0e61 addressed code review 2022-03-02 07:09:33 +09:00
45ff8af026 refactor PKCS12 parse key creation 2022-03-01 14:49:59 -07:00
b21036947c Merge pull request #4894 from SparkiDev/sp_p521_hashlen_fix
SP P521: hash len needs special attention when 521 bits
2022-03-01 12:04:51 -08:00
71056f6591 Merge pull request #4902 from SparkiDev/tlsx_usc_leak
TLSX: supported groups in temporary not always freed
2022-03-01 12:04:35 -08:00
a104cf887e Ticket failure should result in a regular handshake 2022-03-01 10:34:43 +01:00
645f385031 Fix BioReceive for closed connection
The pending check was forcing a `WOLFSSL_CBIO_ERR_WANT_WRITE` return even though the underlying socket was closed and `WOLFSSL_BIO_FLAG_READ|WOLFSSL_BIO_FLAG_RETRY` was not set. The `wolfSSL_BIO_ctrl_pending(ssl->biord) == 0` is old and I can't find a reason to keep checking it. I left it just in the case where there is output data pending.
2022-03-01 10:34:20 +01:00
5aef687414 OpenSSL considers PSK resuming
- `SSL_VERIFY_FAIL_IF_NO_PEER_CERT` check passes on a TLS 1.3 PSK connection that isn't a ticket
2022-03-01 10:09:24 +01:00
605d701113 SP P521: hash len needs special attention when 521 bits
Need to right shift number down when hash is more than 521 bits.
Previously handled at a byte level and now at bit level.
Always return err from sp_*_ecc_mulmod_add_only_*().
When ECC add and double points are public and only have SP
implementation, check that the point ordinates are the right size.
2022-03-01 09:56:22 +10:00
1aff4399d1 Merge pull request #4899 from dgarske/kcapi
Improvements to KCAPI support
2022-03-01 08:52:55 +10:00
cb95aed41b Parsing of custom extensions in X.509 certificates. 2022-02-28 16:35:19 -05:00
9644a04db2 Peer review fix. 2022-02-28 11:32:12 -08:00
ac7bd0aae8 Fix up random.h conflicts with cert 3389 releases and some NETOS issues 2022-02-28 12:09:50 -07:00
c22282a8aa Merge pull request #4864 from TakayukiMatsuo/rsk65n 2022-02-28 09:12:24 -07:00
92bd5a4076 Merge pull request #4891 from dgarske/multi_test 2022-02-28 15:28:39 +01:00
1cb7342f61 Merge pull request #4895 from SparkiDev/benchmark_threaded
Benchmark: support multi-threaded testing
2022-02-27 21:41:07 -08:00
350881b1bb TLSX: supported groups in temporary not always freed
Fix handling of errors so that temporary is always freed.
2022-02-28 11:40:58 +10:00
f3df4400d5 Merge pull request #4886 from dgarske/zd13745
Adds CSR userId support in subject name
2022-02-28 10:15:41 +10:00
4f4a509e8c fix wait until in rsa primitive 2022-02-26 09:52:14 +09:00
9bdef1577b Fixes for hmac. 2022-02-25 15:19:52 -08:00
cc2eb0ab71 KCAPI Testing fixes. 2022-02-25 15:16:55 -08:00
870ff5b352 Merge pull request #4890 from miyazakh/objinfo
fix to use EXT_KEY_USAGE_OID in object_info
2022-02-25 16:02:48 -07:00
ce6b6951d2 Fix issue with missing OID's for ASN template. 2022-02-25 14:23:01 -08:00
ae1072afad Cleanup mess of ASN_NAME_MAX. 2022-02-25 14:23:01 -08:00
a2381ba954 Adds CSR userId support in subject name. Minor build fixes for ASN template. 2022-02-25 14:22:59 -08:00
08d1e5cb60 Merge pull request #4897 from anhu/bad_macro
Correct bad macros
2022-02-25 14:18:57 -08:00
3fdb6f0a4a Only use pthreads if supported in config. 2022-02-25 13:05:04 -08:00
27c445235c Add a cert 3389 ready option 2022-02-25 13:50:06 -07:00
821fd3c898 Peer review fixes. Check idSz and add comment about session variable use. 2022-02-25 11:38:05 -08:00
1a9faa1f7e fix suggested by dgarske 2022-02-25 14:00:07 -05:00
e3e1426b91 Improve benchmark threading macros and text output. Thread protections on variables. Fixes for testing with async. 2022-02-25 10:51:19 -08:00
997a3aabc6 Correct bad macros 2022-02-25 13:19:35 -05:00
a39a1c1d87 More fixups from cppcheck and clang-tidy. 2022-02-25 10:03:17 -08:00
56adf831a3 Benchmark: support multi-threaded testing 2022-02-25 14:12:03 +10:00
5859b90ad8 Merge pull request #4841 from haydenroche5/vs_resource_file_update
Update Visual Studio resource files.
2022-02-24 15:29:46 -08:00
c33ae4c245 Improve wolfSSL_i2d_X509_NAME and wolfSSL_i2d_X509_NAME_canon.
Like other i2d functions, these functions should be able to take a NULL output
parameter and return the necessary output buffer size. This commit adds this
ability. This commit also removes some redundant code in wolfSSL_i2d_X509_NAME.
2022-02-24 14:48:52 -08:00
269ab86002 Fixes for DoClientTicket changes. 2022-02-24 14:28:50 -08:00
c2987a9ef9 Fix for IPv6 sockaddr_len set but not read. 2022-02-24 14:09:08 -08:00
6dd7a289e7 Fix for "set but not used". 2022-02-24 13:43:56 -08:00
6e24e21d5a Fix for heap pointer in wolfSSL_DupSession. 2022-02-24 12:56:39 -08:00
2b794f03c1 Fixes for multi-test pass. Breaks from PR #4807. 2022-02-24 11:48:40 -08:00
07fdca1d62 Merge pull request #4885 from SparkiDev/asn_templ_bad_name 2022-02-24 12:44:27 -05:00
86e08525cb Merge pull request #4852 from elms/fix/more_oot
automake: fix fips touch and cleanup
2022-02-24 09:04:05 -08:00
5fdc339e34 Merge pull request #4889 from SparkiDev/sp_int_iar
SP math all: IAR doesn't accept comment lines in assembly
2022-02-24 08:37:51 -08:00
de81447b2d fix to use EXT_KEY_USAGE_OID in object_info 2022-02-24 15:18:32 +09:00
3d5b933f3c SP math all: IAR doesn't accept comment lines in assembly
Replace assembly comment lines with C comment lines.
2022-02-24 16:06:31 +10:00
bb50777f1a ASN template: handle short OIDs
cert_asn1_test was constructing a BER encoding of a certificate that
didn't have all the components. It was trying to test putting in a bad
OID in the certificate name.
The original ASN.1 parsing code stopped at the bad name. ASN.1 template
code does the whole structure and then digs into the name.
A complete certificate should have always been used.
2022-02-24 15:36:56 +10:00
b13826a3a5 Merge pull request #4840 from haydenroche5/visual_studio_cleanup
Clean up Visual Studio output and intermediate directories.
2022-02-24 15:07:13 +10:00
25407e955b Update Visual Studio resource files.
- Add a resource file for the wolfSSL FIPS VS solution.
- Update copyright year in existing wolfssl.rc.
2022-02-23 16:53:26 -08:00
d1895e5679 automake: fix fips touch and cleanup
This fixes an issue with yocto that only occurs when using `devtool`
which builds out of tree.
2022-02-23 14:11:31 -08:00
51d66877f7 Add wolfSSL_EVP_PKEY_paramgen to the compatibility layer.
Currently, it only supports ECC, which is all we need it for for the OpenSplice
port we're working on. In the ECC case, all it needs to do is set the group
appropriately. The logic is very similar to `wolfSSL_EVP_PKEY_keygen`, minus
the final step of actually generating the key.
2022-02-23 13:59:15 -08:00
666cf508a2 Merge pull request #4874 from dgarske/ocsp_ipv6 2022-02-23 13:37:16 -08:00
fbc7d5a6b2 Minor textual fixes. Thanks Hayden. 2022-02-23 09:43:10 -08:00
0824a64c92 Merge pull request #4807 from julek-wolfssl/stunnel-5.61
stunnel 5.61 support
2022-02-23 09:41:51 -08:00
b84086a482 Merge pull request #4883 from SparkiDev/ssl_bio_move
BIO: move APIs out of ssl.c
2022-02-23 09:38:54 -08:00
0afc5e2cf1 Merge pull request #4881 from SparkiDev/sp_asm_shift_fix
SP asm: fix for modexp corner case
2022-02-23 09:37:25 -08:00
8623b0c089 Merge pull request #4849 from SparkiDev/sp_p521
SP: Add support for P521
2022-02-23 09:33:49 -08:00
3a34a4cd1d Merge pull request #4882 from SparkiDev/even_mod_check
RSA/DH: check for even modulus
2022-02-23 09:33:12 -08:00
2c978a96b2 Prevent possibility of an infinite retry loop and resource exhaution
Reported in ZD13606
2022-02-23 10:07:21 +01:00
fb943a2f23 Rebase and make wolfSSL_CTX_up_ref always available
`wolfSSL_CTX_up_ref` is a small and potentially useful API for users so it doesn't need to be restricted only to the compatibility layer. The reference counting mechanisms are always available anyway. This just exposes the functionality to the user.
2022-02-23 09:55:52 +01:00
d1f53055e9 Peeking can't return a WOLFSSL_ERROR_WANT_READ in compatibility mode 2022-02-23 09:47:34 +01:00
617eda9d44 Fix misc memory issues
- Make `InternalTicket` memory alignment independent
2022-02-23 09:47:34 +01:00
b402102e58 Add backwards compatibility for wolfSSL_get_session
Before this pull request, `wolfSSL_get_session` always returned a pointer to the internal session cache. The user can't tell if the underlying session hasn't changed before it calls `wolfSSL_set_session` on it. This PR adds a define `NO_SESSION_CACHE_REF` (for now only defined with `OPENSSL_COMPATIBLE_DEFAULTS`) that makes wolfSSL only return a pointer to `ssl->session`. The issue is that this makes the pointer returned non-persistent ie: it gets free'd with the `WOLFSSL` object. This commit leverages the lightweight `ClientCache` to "increase" the size of the session cache. The hash of the session ID is checked to make sure that the underlying session hasn't changed.
2022-02-23 09:47:34 +01:00
ceff401269 Fixes for Jenkins tests
- Move test to `HAVE_IO_TESTS_DEPENDENCIES`
- Implement `wolfSSL_trust_peer_cert`
- have{cipher} options weren't being set with only RSA enabled
2022-02-23 09:47:34 +01:00
91b08fb691 Allocate ssl->session separately on the heap
- Refactor session cache access into `AddSessionToCache` and `wolfSSL_GetSessionFromCache`
2022-02-23 09:47:34 +01:00
1d712d47ba Access to session cache is now atomic
- Adding and getting sessions to and from the local cache is now atomic.
  - The new internal `wolfSSL_GetSessionFromCache` requires a destination object to be supplied when retrieving from the cache so that items can be retrieved independently from the cache. For most existing calls, the destination is `ssl->session`.
  -`PREALLOC_SESSION_TICKET_LEN` defines how much memory is temporarily allocated for the ticket if it doesn't fit in the static session buffer.
2022-02-23 09:47:34 +01:00
afca455cda stunnel 5.61 support
- New/Implemented API
  - `SSL_has_pending`
  - `wolfSSL_CertManagerLoadCRLFile`
  - `wolfSSL_LoadCRLFile`
  - `wolfSSL_CTX_LoadCRLFile`
  - `wolfSSL_CTX_add_session`
- Calling chain certificate API (for example `wolfSSL_CTX_use_certificate_chain_file`) no longer requires an actual chain certificate PEM file to be passed in as input. `ProcessUserChain` error in `ProcessBuffer` is ignored if it returns that it didn't find a chain.
- Add `WOLFSSL_TICKET_HAVE_ID` macro. When defined tickets will include the original session ID that can be used to lookup the session in internal cache. This is useful for fetching information about the peer that doesn't get sent in a resumption (such as the peer's certificate chain).
  - Add `ssl->ticketSessionID` field because `ssl->session.sessionID` is used to return the "bogus" session ID sent by the client in TLS 1.3
- `OPENSSL_COMPATIBLE_DEFAULTS` changes
  - Define `WOLFSSL_TRUST_PEER_CERT` and certificates added as CA's will also be loaded as trusted peer certificates
  - Define `WOLFSSL_TLS13_MIDDLEBOX_COMPAT`
- Seperate `internalCacheOff` and `internalCacheLookupOff` options to govern session addition and lookup
- `VerifyServerSuite` now determines if RSA is available by checking for it directly and not assuming it as the default if static ECC is not available
- `WOLFSSL_SESSION` changes
  - `ssl->extSession` added to return a dynamic session when internalCacheOff is set
  - `ssl->session.refPtr` made dynamic and gets free'd in `SSL_ResourceFree`
- If `SSL_MODE_AUTO_RETRY` is set then retry should only occur during a handshake
- `WOLFSSL_TRUST_PEER_CERT` code now always uses `cert->subjectHash` for the `cm->tpTable` table row selection
- Change some error message names to line up with OpenSSL equivalents
- Run `MatchSuite` again if certificate setup callback installed and successful
- Refactor clearing `ASN_NO_PEM_HEADER` off the error queue into a macro
- `wolfSSL_get_peer_certificate` now returns a duplicated object meaning that the caller needs to free the returned object
- Allign `wolfSSL_CRYPTO_set_mem_functions` callbacks with OpenSSL API
- `wolfSSL_d2i_PKCS12_bio` now consumes the input BIO. It now supports all supported BIO's instead of only memory BIO.
- stunnel specific
  - Always return a session object even if we don't have a session in cache. This allows stunnel to save information in the session external data that will be transfered to new connections if the session is reused
  - When allocating a dynamic session, always do `wolfSSL_SESSION_set_ex_data(session, 0, (void *)(-1)`. This is to mimic the new index callback set in `SSL_SESSION_get_ex_new_index`.
- Fix comment in `wolfSSL_AES_cbc_encrypt`
- Trusted peer certificate suite tests need to have CRL disabled since we don't have the issuer certificate in the CA store if the certificates are only added as trusted peer certificates.
tested
2022-02-23 09:47:34 +01:00
2eb044dc60 SP: Add support for P521 2022-02-23 14:51:47 +10:00
d33b787993 BIO: move APIs out of ssl.c
Get configuration working: --enable-all CFLAGS=-DNO_BIO
2022-02-23 14:11:30 +10:00
b5ed5c9b99 RSA/DH: check for even modulus 2022-02-23 09:51:15 +10:00
194466c35a Peer review fixes. 2022-02-22 15:22:27 -08:00
5b6130889e SP asm: fix for modexp corner case
When exponent bit length is a multiple of the window size and the top
word has only window bits in it, then n is shifted down by an undefined
value (size of a word). The n value is not used after this.
Check for this condition and don't attempt to shift n.
2022-02-23 09:17:08 +10:00
2beb27972b OCSP IPv6 support with --enable-ipv6 or WOLFSSL_IPV6. Improve the logic around C99 and getaddrinfo. 2022-02-22 15:07:05 -08:00
fef8a57eb2 Merge pull request #4880 from julek-wolfssl/plain-alert
Detect if we are processing a plaintext alert
2022-02-22 10:11:08 -08:00
e8c9a413ca Merge pull request #4878 from SparkiDev/sp_x64_oob_write_fix_1
ECC with SP math: OOB write
2022-02-22 09:53:32 -08:00
b40226099d Merge pull request #4877 from SparkiDev/sp_x64_asm_fix_1
SP asm: fix map function to use p not point
2022-02-22 09:50:53 -08:00
d10900e124 ECC with SP math: OOB write
Don't let input points ordinates be greater than modulus in length.
2022-02-22 17:00:23 +10:00
78f116b27f SP asm: fix map function to use p not point 2022-02-22 16:33:24 +10:00
2a750acf03 Merge pull request #4873 from dgarske/async_v5.2.0
Asynchronous Release v5.2.0: TLS 1.3 HelloRetryRequest
2022-02-22 10:35:17 +10:00
250a06f759 Merge pull request #4865 from SparkiDev/sp_int_mont_red
SP int: Montgomery Reduction
2022-02-21 16:20:17 -08:00
31abc99f6f Fix for async handling of TLS v1.3 hello retry broken in #4863. 2022-02-21 14:14:20 -08:00
6a81cc976e Merge pull request #4872 from SparkiDev/tls13_empty_cert_cli
TLS 1.3: fail immediately if server sends empty certificate message
2022-02-21 14:10:40 -08:00
38d4da56ab Merge pull request #4857 from julek-wolfssl/ZD13631
Reported in ZD13631
2022-02-21 14:01:51 -08:00
d834c50c85 Merge pull request #4858 from julek-wolfssl/ZD13611
Reported in ZD13611
2022-02-21 14:01:42 -08:00
e6c07a296d Merge pull request #4866 from ejohnstown/release
Prepare for release 5.2.0
2022-02-21 09:09:58 -08:00
9263e6ead3 TLS 1.3: fail immediately if server sends empty certificate message 2022-02-21 21:34:13 +10:00
eb9220a0b5 Modify example app to work with FreeRTOS+IoT 2022-02-21 12:46:43 +09:00
ad8bf40b5e Update readme for release. 2022-02-20 13:05:04 -08:00
bb8af1cac5 Prepare for release 5.2.0
1. Update versions as appropriate.
2. Modify FreeAtomicUser() to only free the Aes data in the callback
   contexts if the contexts exist.
2022-02-18 13:55:22 -08:00
ffb4ae07df Merge pull request #4871 from wolfSSL/small-leak
Fix Small Memory Leaks
2022-02-18 13:53:56 -08:00
041d300b2b Fix Small Memory Leaks
Found with the configuration running the unit test through valgrind.

    % ./configure CFLAGS=-DNO_WOLFSSL_CIPHER_SUITE_TEST \
      --enable-all --disable-fastmath --enable-debug --disable-shared

1. ssl.c: In wolfSSL_DSA_generate_key(), we initialize (and allocate)
   all the parameters in the key (p, q, g, x, y), and then we generate a
   key, initializes (and allocates) x and y, again. mp_clear them
   first.
2. evp.c: When printing public keys, the temporary mp_int wasn't getting
   correctly freed.
3. evp.c: When printing public keys, modified the utility functions to
   return once with a do-while-0 loop.
2022-02-18 10:01:49 -08:00
4b0c8c07f4 Merge pull request #4870 from elms/fix/tls13_renegotiation_info_ext
tls13: fix not including RENEGOTIATION_INFO ext
2022-02-17 13:09:02 -08:00
208c457348 tls13: fix to not send RENEGOTIATION_INFO ext
Introduced in PR #4742 to enable sending of extension in TLS1.2
without fully supporting secure renegotiation in accordance with
RFC 5746 4.3 https://datatracker.ietf.org/doc/html/rfc5746#section-4.3
2022-02-17 11:22:17 -08:00
95ae242550 Merge pull request #4869 from wolfSSL/silabs-aes
SILABS port: fix sizeof
2022-02-17 10:45:47 -08:00
b343c2691b Merge pull request #4867 from maximevince/master
Fix WOLFSSL_NO_TLS12 for Async dev
2022-02-17 10:18:18 -08:00
4361d1bdd2 SILABS port: fix sizeof
A sizeof wasn't dereferencing a pointer using the sizeof the pointer and
not the actual struct. This is limited to setting the key for an AES
operation only when using SILABS SE2 acceleration.
2022-02-17 08:52:46 -08:00
111ae9da84 Fix WOLFSSL_NO_TLS12 for Async dev 2022-02-17 08:10:19 +01:00
c5875cfc5a Detect if we are processing a plaintext alert 2022-02-16 10:50:44 +01:00
df0b516c68 Merge pull request #4863 from SparkiDev/tls13_auth
TLS 1.3: improved checks on received message type
2022-02-15 11:33:34 -08:00
a5ce2a33eb add macro guard around test case 2022-02-15 11:58:59 -07:00
15d0dd258a Add cert test for UID name component 2022-02-15 14:05:46 +01:00
ea5785f6fd SP int: Montgomery Reduction
Improve performance for ECC curves when all bits in words are used (mask
is 0).
On 64-bit platforms, improves performance for 256 and 384 bit curves.
On 32-bit platforms, improves performance for 224, 256, 384 bit curves.
2022-02-15 17:19:57 +10:00
94c03a77f5 TLS 1.3: improved checks on received message type
pskNegotiated field added to indicate Session Ticket or PSK negotiated.

peerAuthGood field added to indicate that any require peer
authentication (certificate, if required, or PSK) have been performed.
2022-02-15 13:25:16 +10:00
9906c9c55e Merge pull request #4862 from dgarske/no_server
Fix typo for no server
2022-02-15 10:31:12 +10:00
07045083a9 Merge pull request #4859 from SparkiDev/sp_int_thumb_small
SP int: fixup ARM Thumb asm for small builds
2022-02-14 16:07:50 -08:00
6571151d17 SP int: fixup ARM Thumb asm for small builds
Small builds or arm Thumb can't use r7.
2022-02-15 08:34:21 +10:00
c992ddbfc0 Merge pull request #4853 from SparkiDev/curve448_128bit_perf
Curve448: inline Karatsuba in sqr and mul for 128-bit impl
2022-02-14 12:04:57 -08:00
16566f329e Fix typo for no server. Should be NO_WOLFSSL_SERVER. 2022-02-14 10:37:34 -08:00
ff4ee20f05 Merge pull request #4860 from SparkiDev/disable_hmac
Configure HMAC: define NO_HMAC when HMAC disabled
2022-02-14 10:08:32 -08:00
f0a0cd1078 fix for larger curve sizes with deterministic ECC sign 2022-02-14 09:55:38 -07:00
445ed2f234 Reported in ZD13631
`ssl->peerVerifyRet` wasn't being cleared when retrying with an alternative cert chain
2022-02-14 11:01:59 +01:00
f02296a4e6 Configure HMAC: define NO_HMAC when HMAC disabled 2022-02-14 17:22:10 +10:00
38653510eb Curve448: inline Karatsuba in sqr and mul for 128-bit impl 2022-02-14 09:09:57 +10:00
4e5380668c Reported in ZD13611
The `UID` name component could not be parsed if it appears in a subject or issuer name
2022-02-12 00:36:07 +01:00
40b171124f Fixes to resolve a few make check issues. 2022-02-11 15:20:25 -08:00
2fa542eb28 Merge pull request #4846 from haydenroche5/fips_mode_compat
Implement FIPS_mode and FIPS_mode_set in the compat layer.
2022-02-11 12:50:30 -08:00
88f202aa22 Merge pull request #4855 from julek-wolfssl/issue-4854
wolfSSL_get_error may return SSL_ERROR_NONE on ret <= 0
2022-02-11 09:01:16 -08:00
4f8ffc4586 wolfSSL_get_error may return SSL_ERROR_NONE on ret <= 0
Fix docs mismatch reported in https://github.com/wolfSSL/wolfssl/issues/4854
2022-02-11 12:37:12 +01:00
34b6102816 Merge pull request #4847 from douzzer/20220209_clang-Os
fixes for clang -Os on clang >= 12.0.0
2022-02-10 21:31:01 -06:00
7da3b8458a Merge pull request #4851 from miyazakh/update_RA6M3_rmunsrc 2022-02-10 18:14:09 -07:00
fbf38fff07 wolfcrypt/src/sp_int.c: fix comment around clang-12+ -Os. 2022-02-10 16:43:17 -06:00
5c9510d92e fips_check.sh: for linuxv2 add COPY_DIRECT with wolfcrypt/src/{aes_asm.S,aes_asm.asm}; for linuxv5 add wolfcrypt/src/aes_gcm_asm.S to COPY_DIRECT; fix whitespace. 2022-02-10 16:01:08 -06:00
cbc253d713 wolfcrypt/test/test.c: gate ecc_encrypt_e2e_test() on !HAVE_FIPS || FIPS_VERSION_GE(5,3). 2022-02-10 16:00:52 -06:00
c581e13380 bwrap tweaks:
in scripts/ocsp.test, don't call ping.test when $AM_BWRAPPED = yes (ping is setuid, so fails under bwrap);

in scripts/unit.test.in, don't bwrap if $AM_BWRAPPED = yes (double-bwrapping always fails);

in testsuite/testsuite.c testsuite_test(), build tempName using tempDir, and try to assign tempDir from XGETENV("TMPDIR"), fallback to hardcoded "/tmp".
2022-02-10 15:54:39 -06:00
91578df19d fixes for clang -Os on clang >= 12.0.0; fixes for bugs in blake2s. 2022-02-10 15:54:10 -06:00
562fcd3916 Implement FIPS_mode and FIPS_mode_set in the compat layer. 2022-02-10 13:14:05 -08:00
34c87b83e2 Merge pull request #4848 from SparkiDev/sp_int_div_word_2
SP int, cortex, thumb div_word: fix to work
2022-02-10 07:42:00 -08:00
a1198549dd Merge pull request #4844 from dgarske/bench_cleanups 2022-02-10 10:24:55 -05:00
d1267b5203 Merge pull request #4805 from SparkiDev/ecies_aes_ctr
ECIES: add support for more encryption algorithms
2022-02-10 07:04:24 -08:00
e351f1a7e7 rm unused src links 2022-02-10 22:21:24 +09:00
e8fb17f7b5 SP int, cortex, thumb div_word: fix to work
Cortex builds needed # before number. Arm32 works with or without.
Thumb div_word needed to shift up if divisor too small (like other ARM
implementations).
2022-02-10 12:07:11 +10:00
e50f661639 ECIES: add support for more encryption algorithms
Add support to ECIES for AES-256-CBC, AES-128-CTR, AES-256-CTR.
Added new API wc_ecc_ctx_set_algo() that sets the encryption, KDF and
MAC algorithms.
Cleanup formatting of ECIES code.
2022-02-10 09:54:22 +10:00
4f1aa9a475 Fix benchmark input/output arguments. Cleanup line length and whitespace. 2022-02-09 13:13:42 -08:00
cba262440a Merge pull request #4842 from SparkiDev/sha3_arm_fixup
ARMASM, SHA-3: fixup when not using crypto instructions
2022-02-09 10:20:46 -08:00
bee025842e Merge pull request #4828 from TakayukiMatsuo/rtos 2022-02-09 09:37:47 -07:00
0d5edfadcb Merge pull request #4837 from SparkiDev/sp_c_config
SP C: when sp_c32.c ad sp_c64.c are included in build changed
2022-02-09 07:51:20 -08:00
c472b3582e Merge pull request #4839 from douzzer/20220207-clang-tidy-15
20220208 clang-tidy-15 fixes etc.
2022-02-09 08:36:18 -06:00
343cb0da23 SP C: when sp_c32.c ad sp_c64.c are included in build changed
When compiling with the CFLAG -m32, sp_c32.c is used and not sp_c64.c.
The build system cannot detect that this is a 32-bit platform and to use
sp_c32.c.

The SP code detects which implementaiton to use and sets defines that
enable the code in sp_c32.c or sp_c64.c.

ENABLED_64BIT, 64-bit platform, was on by default, which is not always
true.
By making ENABLED_64BIT not default then the decision of which SP C
files to include in the build had to change to not being the other.
That is, sp_c64.c is not included when the configuration line explicitly
enables 32bit and sp_c32.c is not include when the configuration line
explicitly enables 64bit.
2022-02-09 15:56:57 +10:00
f49b7107a0 Add __inline__ for Diab compiler 2022-02-08 19:54:26 -08:00
32c80781bf Prevent diab compiler from inlining functions 2022-02-08 19:25:13 -08:00
b436262cdf ARMASM, SHA-3: fixup when not using crypto instructions 2022-02-09 09:36:00 +10:00
49defbd2cc Merge pull request #4836 from embhorn/zd13634
Remove deprecated VS solution
2022-02-08 15:18:21 -08:00
67b2a1be40 Merge pull request #4831 from dgarske/zd13571_2
Improve the client certificate checking logic
2022-02-09 08:27:03 +10:00
1bd4cb4eee Modify example app to work with FreeRTOS+IoT 2022-02-09 07:18:39 +09:00
34946c2440 Merge pull request #4832 from TakayukiMatsuo/rose 2022-02-08 14:54:47 -07:00
74408e3ee3 fixes for whitespace, C++ warnings, and LLVM 15 clang-tidy defects/carps:
* whitespace in src/ssl.c, tests/api.c, wolfssl/openssl/fips_rand.h.

* clang-analyzer-core.StackAddressEscape from llvm-15 clang-tidy, in tests/suites.c:execute_test_case().

* bugprone-suspicious-memory-comparison from llvm-15 clang-tidy, in src/internal.c:DoSessionTicket() and src/ssl.c:wolfSSL_sk_push().
2022-02-08 15:20:22 -06:00
ed1fc9fc51 Merge pull request #4833 from SparkiDev/sha3_arm_crypto
SHA-3, ARM64: add assembly support for crypto instructions
2022-02-08 11:05:35 -08:00
7ec1e69dba Fixes for supporting the openssl compatibility layer. Adds ChaCha/Poly, DH extra and verify callbacks. 2022-02-08 10:18:41 -08:00
6930cc0b21 Clean up Visual Studio output and intermediate directories.
Currently, wolfssl.vcxproj and IDE/WIN10/wolfssl-fips.vcxproj do not use the
same scheme for their output and intermediate directories. Further, across
configuration/platform combinations, wolfssl.vcxproj isn't consistent, either.
For example:

```
Release|x64
OutDir: $(SolutionDir)$(Platform)\$(Configuration)\
IntDir: $(Platform)\$(Configuration)\obj\

Release|Win32
OutDir: $(SolutionDir)$(Configuration)\
IntDir: $(Configuration)\obj\
```

This commit makes every configuration/platform combo for all Visual Studio
projects follow the same pattern:

```
OutDir: $(SolutionDir)$(Platform)\$(Configuration)\
IntDir: $(Configuration)\$(Platform)\$(ProjectName)_obj\
```

The `$(ProjectName)_obj` piece gets rid of a Visual Studio warning about not
mingling the intermediate objects of disparate builds.
2022-02-08 09:23:27 -08:00
3ee6e93590 Merge pull request #4838 from SparkiDev/g++_fix_4
Rework functions to avoid warning with g++
2022-02-08 10:20:58 -06:00
1f69c52ce8 Merge pull request #4830 from dgarske/no_hmac
Fixes for building without HMAC
2022-02-07 22:26:38 -06:00
d2307186d9 Rework functions to avoid warning with g++ 2022-02-08 12:36:36 +10:00
0042a2594c SHA-3, ARM64: add assembly support for crypto instructions
Add ability to compile ARM assembly from inline C code.
2022-02-08 12:21:38 +10:00
b60d2dccce Include the havePeerCert argument in the check. 2022-02-07 16:31:50 -08:00
5169a3cf89 Improve header comments and logic. Remove NO_PWDBASED and added CRL. 2022-02-07 15:58:10 -08:00
5e5a389afb Remove deprecated VS solution 2022-02-07 17:14:41 -06:00
d0246a280d Merge pull request #4834 from anhu/guard_wc_PKCS7_SetPassword
Fix tests to properly gate on ! NO_PWDBASED && ! NO_SHA
2022-02-07 15:12:22 -08:00
56c562a516 Fixes for building with ./configure --enable-opensslextra --enable-cryptonly CFLAGS="-DNO_HMAC" && make. Found this testing a customers configuration with latest. Also fixes some trailing whitespace. 2022-02-07 15:10:21 -08:00
d085984103 Merge pull request #4829 from kosmas-valianos/kTLS
Expose Sequence Numbers so that Linux TLS (kTLS) can be configured
2022-02-07 14:55:07 -08:00
5361c0bda0 Update signature as the certificate is renewed 2022-02-08 07:31:50 +09:00
e47dd675af Fix tests to properly gate on ! NO_PWDBASED && ! NO_SHA 2022-02-07 14:44:26 -05:00
dd2e0064b2 Merge pull request #4827 from SparkiDev/sp_int_dw_asm
SP math, Aarch64, ARM32: div word asm fixup
2022-02-07 11:32:14 -08:00
54e7db0a9a Merge pull request #4739 from rizlik/psa
support Platform Security Architecture (PSA) API
2022-02-07 10:40:21 -08:00
4c8f0709fc Merge pull request #4720 from dgarske/fips_compat 2022-02-07 09:56:24 -07:00
3cdb1c639d Improve the client certificate checking logic. Make sure calling wolfSSL_CTX_mutual_auth is also checked. 2022-02-07 08:09:38 -08:00
3d85a9690f Merge pull request #4819 from lealem47/hashMismatch
Fix for OpenSSL x509_NAME_hash mismatch
2022-02-07 08:08:49 -08:00
30b35acd39 Expose Sequence Numbers so that Linux TLS (kTLS) can be configured 2022-02-07 09:30:59 +01:00
f6d79ff598 Merge pull request #4813 from dgarske/zd13571
Fix for mutual authentication to prevent mismatch of certificate and sigalgo
2022-02-07 11:00:04 +10:00
f9ff551992 Fix for OpenSSL x509_NAME_hash mismatch 2022-02-04 16:59:51 -08:00
1f8ff7d9fe Merge pull request #4822 from embhorn/zd13613
Fix warnings in VS
2022-02-04 15:37:31 -08:00
2077184953 psa: add compile-time error if builded with crypto cb 2022-02-04 21:45:38 +01:00
b8635efda7 psa: add README.md and doxygen header 2022-02-04 21:45:38 +01:00
0cb2cc1705 psa: support pk callbacks for ECDSA, ECDH, HKDF 2022-02-04 21:45:38 +01:00
630b244cee psa: introduce global lock 2022-02-04 21:45:38 +01:00
a7165907da psa: support AES 2022-02-04 21:45:38 +01:00
9ccfc81f26 psa: support PSA SHA1/SHA256/SHA224 2022-02-04 21:45:38 +01:00
06915b6fa3 psa: support PSA random generator 2022-02-04 21:45:38 +01:00
08047b2d95 Add checking to make sure key is present in all cases. Explicitly set validSigAlgo to zero with comment to clarify the default assumption. 2022-02-04 11:47:06 -08:00
2d184348fb Merge pull request #4825 from embhorn/gh4815
Fix wolfSSL_PEM_X509_INFO_read with NO_FILESYSTEM
2022-02-04 10:42:40 -08:00
327e35fc25 Merge pull request #4826 from haydenroche5/evp_aes_gcm_iv_bug
Fix IV length bug in EVP AES-GCM code.
2022-02-04 10:38:02 -08:00
d1ca8fc673 Merge pull request #4821 from elms/cmake/help_cleanup 2022-02-04 09:37:39 -08:00
08fbcf5eae autoconf: add PSA options 2022-02-04 12:12:04 +01:00
bd1b58dd7f SP math, Aarch64, ARM32: div word asm fixup
ASM code is dividing by top half of divisor. If this value is very small
then bad results are calculated.
Moved the divisor up by a quarter of the width if top quarter of divisor
is 0.
2022-02-04 11:59:31 +10:00
b850cc89b0 Fix IV length bug in EVP AES-GCM code.
In `wolfSSL_EVP_CipherInit`, `ctx`'s `ivSz` field isn't being accounted for.
A common OpenSSL EVP AES-GCM flow looks like this:

- `EVP_CIPHER_CTX_new`
- `EVP_EncryptInit_ex`
- `EVP_CIPHER_CTX_ctrl` with command `EVP_CTRL_GCM_SET_IVLEN` to set the IV
length to 16 (AES block size) instead of the default 12
- `EVP_EncryptInit_ex` again to set the key and IV
- `EVP_EncryptUpdate` however many times
- `EVP_EncryptFinal`

In fact, we test this flow in our unit test `test_wolfssl_EVP_aes_gcm`. However,
in our implementation, the second call to `EVP_EncryptInit_ex` unconditionally
resets the IV length back to 12. This doesn't cause a test failure because
decryption has the same problem, so both sides of the equation have the same
wrong view of the IV.

The solution is to preserve the IV length in wolfSSL_EVP_CipherInit if ctx->ivSz
is non-zero. Otherwise, use the default of 12 (`GCM_NONCE_MID_SZ`).

This was discovered by a user migrating to the compatibility layer. As I
mentioned, it isn't exposed by our testing. It is exposed if you try to use the
same key and IV with OpenSSL and compare the resulting ciphertext with wolfSSL.
They won't be the same and thus won't interoperate.
2022-02-03 17:40:26 -08:00
50700c3c28 Make sure Rabbit and HC128 are disabled when building FIPS against older wolfSSL. 2022-02-03 14:53:11 -08:00
a0444bf72f Fix wolfSSL_PEM_X509_INFO_read with NO_FILESYSTEM 2022-02-03 16:52:08 -06:00
7b2e457d04 Fix VS unreachable code warning 2022-02-03 15:53:35 -06:00
db6d924d4b User settings template for FIPS v5. 2022-02-03 13:35:13 -08:00
53e64b55e1 Merge pull request #4823 from haydenroche5/alpn_bug
Fix bug in TLSX_ALPN_ParseAndSet when using ALPN select callback.
2022-02-03 13:16:13 -08:00
fab2e99bff Fix bug in TLSX_ALPN_ParseAndSet when using ALPN select callback.
At the start of this function, it attempts to find an ALPN extension in the
ssl object's extensions with `TLSX_Find`. If an ALPN select callback has been
set (i.e. via `wolfSSL_CTX_set_alpn_select_cb`), that gets called next. If that
callback finds a match, it removes all existing ALPN extensions found in the
ssl object. It then uses the new protocol name like this:

```
if (TLSX_UseALPN(&ssl->extensions, (char*)out, outLen, 0, ssl->heap)
                                                           == WOLFSSL_SUCCESS) {
    if (extension == NULL) {
        extension = TLSX_Find(ssl->extensions,
                              TLSX_APPLICATION_LAYER_PROTOCOL);
    }
}
```

The bug is exposed if `extension` is not NULL, i.e. it was found on that initial
`TLSX_Find` call. `extension` is not NULL but it now points to garbage because
all the old ALPN extensions were just removed. It won't have it's value assigned
to the new extension that just got pushed via `TLSX_UseALPN` because of this
NULL check. This results in a segfault later in the function.

The solution is to remove the NULL check and always update `extension` after the
`TLSX_UseALPN` call.

This bug was discovered by a customer when using nginx + wolfSSL. I was able to
reproduce locally with curl acting as the client
2022-02-03 09:36:18 -08:00
f0b953ce0c Fix warnings in VS 2022-02-03 07:19:43 -06:00
fab8eca2fd cmake: Check for valid voerride values
Also remove trailing whitespace
2022-02-02 16:32:00 -08:00
9b4289c751 cmake: Add KEYGEN option. Cleanup help messages.
Add `WOLFSSL_KEYGEN` option and override enable when `WOLFTPM` is
enabled

Also major reduction of variables for help messages. Override only
updates `VALUE`
2022-02-02 16:15:47 -08:00
d3e3f57b77 Merge pull request #4818 from julek-wolfssl/guido-13454
`object` and `value` need to be `free`'ed
2022-02-02 16:04:39 -08:00
17eee2ba0c Merge pull request #4817 from julek-wolfssl/ZD13495
ZD13495
2022-02-02 15:54:08 -08:00
97dd974a94 object and value need to be free'ed 2022-02-02 23:13:59 +01:00
e13861bcde Fix for mutual authentication to prevent mismatch of certificate and sig algo. Work from Sean P. ZD 13571 2022-02-02 12:20:02 -08:00
28d3292a16 Merge pull request #4811 from haydenroche5/dh_get_2048_256
Add DH_get_2048_256 to compatibility layer.
2022-02-02 12:12:34 -08:00
0618b69b6d Merge pull request #4816 from julek-wolfssl/ok-error
For `0` OpenSSL prints "ok"
2022-02-02 12:10:35 -08:00
9efb791abc Merge pull request #4814 from SparkiDev/bio_dump_iter
wolfSSL_BIO_dump: fix output format and make iterative
2022-02-02 12:02:07 -08:00
d5b294edc4 ZD13495
- `wolfSSLeay_version` now returns the version of wolfSSL
- `wolfssl/openssl/crypto.h` was not enveloped in a `extern "C"` wrapper
2022-02-02 17:38:36 +01:00
c629c3fcaa Add DH_get_2048_256 to compatibility layer. 2022-02-02 07:59:17 -08:00
1552e89810 For 0 OpenSSL prints "ok" 2022-02-02 15:54:21 +01:00
cebb127ac3 test: don't free AesXts struct in-between tests that reuse the key 2022-02-02 10:46:40 +01:00
641576390d wolfSSL_BIO_dump() and wolfSSL_OBJ_obj2txt() rework
wolfSSL_BIO_dump(): fix output format and make iterative
wolfSSL_OBJ_obj2txt(): make iterative, test and rework.
2022-02-02 12:43:06 +10:00
59ea65bad3 Merge pull request #4809 from haydenroche5/asn1_int 2022-02-01 13:44:32 -07:00
99799a3e3e Merge pull request #4806 from anhu/kill_idea
Purge IDEA cipher
2022-02-01 12:27:55 -08:00
24a2ed7e9e Merge pull request #4780 from dgarske/ipsec_racoon 2022-01-31 15:10:58 -08:00
df85ea7e87 Merge pull request #4800 from SparkiDev/sp_c_smul
SP C: multiplication of two signed types with overflow is undefined in C
2022-01-31 14:29:18 -08:00
13c759cc10 Merge pull request #4812 from douzzer/20220131-camellia-clang-tidy
wolfcrypt/src/camellia.c: clang-tidy fixes (bugprone-macro-parentheses).
2022-01-31 14:13:23 -08:00
a742c33c0c Mention IDEA removal in README.md. 2022-01-31 16:18:39 -05:00
9ea40f3a9c Purge IDEA cipher 2022-01-31 15:29:25 -05:00
a7de880745 wolfcrypt/src/camellia.c: clang-tidy fixes (bugprone-macro-parentheses). 2022-01-31 14:21:54 -06:00
ecb3f215b5 Merge pull request #4808 from lealem47/certreq
Fix for certreq and certgen options with openssl compatability
2022-01-31 10:16:22 -08:00
5bdaf44354 Merge pull request #4774 from anhu/kill_rabbit
Purge Rabbit cipher
2022-01-31 09:17:23 -08:00
6b71289ae1 Add new ASN1_INTEGER compatibility functions.
This commit adds:

- wolfSSL_i2d_ASN1_INTEGER
- wolfSSL_d2i_ASN1_INTEGER
- wolfSSL_ASN1_INTEGER_cmp
2022-01-29 17:01:16 -08:00
e58ff9e765 Merge pull request #4795 from wolfSSL/cmake/wolftpm
cmake: Add options to support wolfTPM
2022-01-28 14:52:53 -08:00
f509dafd6c README.md addition 2022-01-28 17:20:25 -05:00
f608b1a731 macro logic fix 2022-01-28 13:54:13 -08:00
e135ea7338 Fix for certreq and certgen options with openssl compatability 2022-01-28 12:39:00 -08:00
40fff86807 Merge pull request #4801 from tmael/cert_rr
cert subset improvements
2022-01-28 11:00:55 -08:00
b957a6e872 Purge Rabbit cipher 2022-01-28 13:13:53 -05:00
6e76f21f9e cmake: Add options to support wolfTPM
* certgen
 * certgencache
 * certreq
 * certext
 * cryptocb
 * pkcs7
 * X9.63 KDF
 * AES-CFB
2022-01-28 09:44:09 -08:00
c69010adef Peer review feedback. 2022-01-28 09:21:03 -08:00
6615f019f5 Improved HMAC_Init error logging and code comment for FIPS failure on wc_HmacSetKey call. 2022-01-28 09:21:03 -08:00
80ae237852 Fixes for building with ipsec-tools/racoon and openvpn:
* Fix for `EVP_CIPHER_CTX_flags`, which mapped to a missing function (broke openvpn)
* Added stack of name entries for ipsec/racoon support.
* Added `X509_STORE_CTX_set_flags` stub.
* Added PKCS7 NID types.
* Improved FIPS "SHA" logic in `test_wolfSSL_SHA`
* Added some uncommon NID type definitions.
* Expose the DH `DH_set_length` and `DH_set0_pqg` with OPENSSL_ALL
2022-01-28 09:21:03 -08:00
46f25ea3e0 Merge pull request #4804 from douzzer/20220127-clang-tidy-fips_test_h
clang-tidy hygiene for fips_test.h
2022-01-28 09:00:03 -08:00
cd72b4652b Merge pull request #4798 from lealem47/cmake 2022-01-28 08:42:29 -08:00
30b2073228 test.c: fix gating on wc_ecc_encrypt_ex() for FIPS <5.3 --enable-all. 2022-01-27 19:54:07 -06:00
19042023f4 MD5 vs. FIPS 140-3: fix gating so that unit.test succeeds when --enable-fips=v5 --enable-md5 (HMAC-MD5 is non-FIPS in 140-3, but even in a FIPS 140-3 build, the non-FIPS API can be accessed directly by #undef'ing wc_Hmac*()). 2022-01-27 18:37:29 -06:00
d9073f39e1 fips_test.h: add arg names to prototypes, and delete obsolete+unused DoIntegrityTest() prototype. 2022-01-27 18:37:29 -06:00
1465f99b12 Merge pull request #4734 from haydenroche5/fips_v5_des3
Allow DES3 with FIPS v5-dev.
2022-01-27 15:07:22 -08:00
667009007b Merge pull request #4799 from SparkiDev/file_gen_fixes
Generated files: fixes
2022-01-27 14:21:34 -08:00
77a64d0087 Merge pull request #4802 from SparkiDev/ecies_compressed
ECIES: allow compressed public keys
2022-01-27 14:21:12 -08:00
1c12490c98 Adding some CMake options 2022-01-27 11:52:37 -08:00
f323964e8a Update TIRTOS module
Use SP_MATH by default. Added missing object files.
2022-01-27 16:23:23 +01:00
b890a2f15d ECIES: allow compressed public keys
ECIES messages have a public key/point at start of the data.
It can be either uncompressed or compressed.
Adding support for decrypting and encrypting of compressed point.
2022-01-27 12:10:59 +10:00
a37e17084d Use mp_iszero 2022-01-26 17:33:42 -08:00
1c1bd413e0 cert subset SHA2-256, ecc-256, cert gen, cryptocb 2022-01-26 17:11:00 -08:00
91b1e541c5 SP C: multiplication of two signed types with overflow is undefined in C
Montgomery Reduction: cast variables to be unsigned where signed
multiplication with overflow is performed.
2022-01-27 10:25:02 +10:00
a242424abe Generated files: fixes
Fixups from updating scripts that generate the files.
Include settings.h for ARM32 assembly.
ARM32 SHA-512 ASM has only one function, Transform_Sha512_Len(). The
implementation is dependent on defines.
2022-01-27 10:05:45 +10:00
9bbc5e07e6 Merge pull request #4733 from JacobBarthelmeh/ECC
include hmac for deterministic ecc sign build
2022-01-26 10:01:46 -08:00
25c6417f03 Merge pull request #4797 from douzzer/20220124-clang-tidy
clang-tidying headers
2022-01-26 10:01:00 -08:00
b7cecbacb2 update headers to resolve clang-tidy carping (mostly bugprone-macro-parentheses and readability-named-parameter). also disables MSC C4028 because incompatible with readability-avoid-const-params-in-decls. 2022-01-26 02:06:37 -06:00
9250edc2ea wolfcrypt/src/fe_x25519_128.i: harmonize argument names in fe_cswap() and fe_cmov() with those used in fe_operations.c. 2022-01-26 02:05:26 -06:00
85da17bcf8 src/ssl.c: fix argument name in openssl compat layer wrappers of hash final funcs in ssl.c (use "output", not "input"). 2022-01-26 00:27:45 -06:00
1e3516d924 src/ssl.c: implement wolfSSL_SHA512_224_Transform() and wolfSSL_SHA512_256_Transform(). 2022-01-26 00:27:07 -06:00
7c9f4911c3 src/wolfio.c: protect __GLIBC__ comparison with defined(__GLIBC__). 2022-01-26 00:22:13 -06:00
cfc7337bda Merge pull request #4794 from rizlik/openssl_srtp_script_fix
dtls-srtp: don't run openssl_srtp.test on make check
2022-01-25 16:31:29 -08:00
d0dbdd374d Merge pull request #4775 from elms/cmake/asm_user_settings
cmake: enable ASM and fix thread with usersettings
2022-01-25 16:25:16 -08:00
38558d7fd1 dtls-srtp: don't run openssl_srtp.test on make check 2022-01-25 21:51:56 +01:00
588f4a11c9 Merge pull request #4785 from douzzer/20220120-aes-internal-error-handling
20220120-aes-internal-error-handling
2022-01-24 20:45:53 -08:00
58789991f9 Allow DES3 with FIPS v5-dev. 2022-01-24 15:18:44 -08:00
50e3565df6 Merge pull request #4779 from SparkiDev/dyn_cert
Cert: allow allocation of fields even with WOLFSSL_NO_MALLOC
2022-01-24 14:17:41 -08:00
746c05ca44 AES: peer review: remove gating around sanity checks on aes->rounds in software wc_AesEncrypt() and wc_AesDecrypt();
use local variable crypto_cb_ret around WOLF_CRYPTO_CB calls for clarity;

fix line length.
2022-01-24 15:47:23 -06:00
f0041852b5 aes.c: add error catching and percolation for wc_AesGetKeySize() on FREESCALE_LTC in wc_AesEncrypt(), wc_AesDecrypt(), and wc_AesCtrEncrypt(). 2022-01-24 13:34:22 -06:00
5ff1d98306 AES: fix linebreaks in newly overlong lines in aes.c and aes.h; add missing return code in armv8-aes.c wc_AesDecryptDirect(); add missing RESTORE_VECTOR_REGISTERS() in software wc_AesXtsEncrypt() (all pursuant to peer review in #4785 from Sean). 2022-01-24 12:32:25 -06:00
565a7b0aab aes.c: in linuxkm clause of WOLFSSL_AES_DIRECT section, gate on WOLFSSL_LINUXKM && WOLFSSL_AESNI (with no-asm falling through to the generic definition), and use wolfssl-idiomatic WARN_UNUSED_RESULT, not linux-kernel-idiomatic __must_check. (thanks to John S peer review) 2022-01-24 11:44:16 -06:00
a718637c6f AES: harmonize wc_Aes{Encrypt,Decrypt} and wc_Aes{Encrypt,Decrypt}Direct implementations to return int; add return values to all static void functions in aes.c that can fail; add WARN_UNUSED_RESULT to all static functions in aes.c with return values; implement missing error percolation around AES block cipher implementations; bump FIPS version for v5-ready and v5-dev to 5.3 (v5-RC12 is 5.2). 2022-01-24 11:44:16 -06:00
dee66cfe9e Merge pull request #4789 from SparkiDev/sp_invmod_oob
SP int: sp_modinv fixes for sizes
2022-01-24 09:08:08 -08:00
93404361ff Merge pull request #4783 from SparkiDev/mac_sha512_def
SHA-512 ASM: For Mac computers default to using SHA512 instructions
2022-01-24 09:03:08 -08:00
44c0a5f9f8 Merge pull request #4790 from SparkiDev/decodesubtree_oobr
ParseCert: check index in DecodeSubtree before accessing tag
2022-01-24 08:36:52 -08:00
3d63e41653 SP int: sp_modinv fixes for sizes
sp_invmod with even modulus requires a multiplication by modulus. Don't
let modulus overflow result variable 'r'.
Fix allocation of temporary sp_ints to be correct size.
Add test for maximum modulus size in test.c.

Remove leading spaces on functions so git correctly determines which
function has changed.
Put in Thumb code for more sizes of _sp_mul_*().
2022-01-24 15:18:20 +10:00
1dd213db76 ParseCert: check index in DecodeSubtree before accessing tag 2022-01-24 12:30:48 +10:00
198843aa34 Merge pull request #4787 from douzzer/20220121-fixits-20220118-clang-tidy
cleanup re #4772
2022-01-21 12:46:07 -08:00
2955d7339e remove a debugging printf, fix whitespace/indentation, and add a comment re gethostbyname_r buffer size. 2022-01-21 13:00:22 -06:00
7a36d57e8f Merge pull request #4784 from SparkiDev/sp_int_modinv_perf
SP int: minor improvements to sp_invmod
2022-01-21 10:30:09 -08:00
869246609a Merge pull request #4772 from douzzer/20220118-clang-tidy
clang-tidy fixes/cleanups
2022-01-21 10:29:26 -08:00
4f9d0b7ea7 fix whitespace. 2022-01-21 01:26:44 -06:00
bfada558bd remove extraneous build gates and fix whitespace justification in a comment (peer review re PR #4772). 2022-01-21 01:26:44 -06:00
386aac9694 AES-SIV:
in configure.ac, enable SIV only if !ENABLED_FIPS or if building FIPS v5-dev;

in cmac.{c,h}, remove !HAVE_FIPS gating on ShiftAndXorRb().
2022-01-21 01:26:33 -06:00
84f7d812d3 linuxkm/module_exports.c.template: include siphash.h. 2022-01-21 01:25:48 -06:00
10b8f56fec wolfio.c: in wolfIO_TcpConnect(), test for usability of gethostbyname_r by (__GLIBC__ >= 2) && defined(__USE_MISC), not defined(__GNUC__). 2022-01-21 01:25:48 -06:00
5e33da8147 fix whitespace. 2022-01-21 01:25:48 -06:00
bb07d0a490 wolfio.c: refactor wolfIO_TcpConnect(() to use gethostbyname_r() if GNUC && !SINGLE_THREADED, for thread safety. 2022-01-21 01:25:48 -06:00
6a56d3e131 jumbo patch of fixes for clang-tidy gripes (with some bug fixes).
defect/gripe statistics:

    configured --enable-all --enable-sp-math-all --enable-intelasm

    with LLVM 13 clang-tidy -checks=readability-*,bugprone-*,misc-no-recursion,misc-misplaced-const,misc-redundant-expression,misc-unused-parameters,misc-unused-using-decls,-clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling,-clang-analyzer-optin.performance.Padding,-readability-braces-around-statements,-readability-function-size,-readability-function-cognitive-complexity,-bugprone-suspicious-include,-bugprone-easily-swappable-parameters,-readability-isolate-declaration,-readability-magic-numbers,-readability-else-after-return,-bugprone-reserved-identifier,-readability-suspicious-call-argument,-bugprone-suspicious-string-compare,-bugprone-branch-clone,-misc-redundant-expression,-readability-non-const-parameter,-readability-redundant-control-flow,-readability-misleading-indentation,-bugprone-narrowing-conversions,-bugprone-implicit-widening-of-multiplication-result

    [note these figures don't reflect additional defects fixed in this commit for --enable-smallstack, --enable-fips, --enable-async, --enable-asn=template, and --enable-fastmath, and --disable-fastmath]

    pre-patch warning count per file, with suppressions:

    clang-analyzer-security.insecureAPI.strcpy    6  wolfssl/tests/suites.c
    clang-analyzer-security.insecureAPI.strcpy    2  wolfssl/testsuite/testsuite.c
    bugprone-suspicious-missing-comma             3  wolfssl/examples/server/server.c
    bugprone-suspicious-missing-comma             3  wolfssl/examples/client/client.c
    readability-redundant-preprocessor            2  wolfssl/wolfcrypt/src/asn.c
    readability-redundant-preprocessor            1  wolfssl/wolfcrypt/src/rsa.c
    readability-redundant-preprocessor            9  wolfssl/src/ssl.c
    readability-redundant-preprocessor            2  wolfssl/src/tls13.c
    readability-redundant-preprocessor           18  wolfssl/tests/api.c
    readability-redundant-preprocessor            3  wolfssl/src/internal.c
    readability-redundant-preprocessor           10  wolfssl/wolfcrypt/test/test.c
    readability-named-parameter                   1  wolfssl/wolfcrypt/benchmark/benchmark.c
    readability-named-parameter                   7  wolfssl/src/internal.c
    readability-named-parameter                   1  wolfssl/wolfcrypt/src/ecc.c
    readability-named-parameter                   1  wolfssl/testsuite/testsuite.c
    readability-named-parameter                  11  wolfssl/wolfcrypt/src/ge_operations.c
    misc-no-recursion                             3  wolfssl/src/ssl.c
    readability-uppercase-literal-suffix          4  wolfssl/wolfcrypt/src/asn.c
    readability-uppercase-literal-suffix          1  wolfssl/src/ssl.c
    readability-uppercase-literal-suffix         13  wolfssl/wolfcrypt/benchmark/benchmark.c
    bugprone-too-small-loop-variable              1  wolfssl/wolfcrypt/src/rsa.c
    bugprone-too-small-loop-variable              2  wolfssl/wolfcrypt/src/sha3.c
    bugprone-too-small-loop-variable              4  wolfssl/wolfcrypt/src/idea.c
    bugprone-signed-char-misuse                   2  wolfssl/src/ssl.c
    bugprone-signed-char-misuse                   3  wolfssl/wolfcrypt/src/sp_int.c
    bugprone-signed-char-misuse                   3  wolfssl/examples/client/client.c
    bugprone-macro-parentheses                   19  wolfssl/wolfcrypt/src/aes.c
    bugprone-macro-parentheses                  109  wolfssl/wolfcrypt/src/camellia.c
    bugprone-macro-parentheses                    1  wolfssl/src/tls.c
    bugprone-macro-parentheses                    3  wolfssl/wolfcrypt/src/md4.c
    bugprone-macro-parentheses                    2  wolfssl/wolfcrypt/src/asn.c
    bugprone-macro-parentheses                   26  wolfssl/wolfcrypt/src/blake2b.c
    bugprone-macro-parentheses                  257  wolfssl/wolfcrypt/src/sha3.c
    bugprone-macro-parentheses                   15  wolfssl/src/ssl.c
    bugprone-macro-parentheses                    1  wolfssl/wolfcrypt/src/sha.c
    bugprone-macro-parentheses                    8  wolfssl/tests/api.c
    bugprone-macro-parentheses                    4  wolfssl/wolfcrypt/src/sp_int.c
    bugprone-macro-parentheses                    6  wolfssl/wolfcrypt/benchmark/benchmark.c
    bugprone-macro-parentheses                   38  wolfssl/wolfcrypt/src/hc128.c
    bugprone-macro-parentheses                   12  wolfssl/wolfcrypt/src/md5.c
    bugprone-macro-parentheses                   10  wolfssl/wolfcrypt/src/sha256.c
    bugprone-macro-parentheses                    4  wolfssl/wolfcrypt/test/test.c
    bugprone-macro-parentheses                    3  wolfssl/wolfcrypt/src/ecc.c
    bugprone-macro-parentheses                    2  wolfssl/tests/suites.c
    bugprone-macro-parentheses                    4  wolfssl/wolfcrypt/src/cpuid.c
    bugprone-macro-parentheses                   26  wolfssl/wolfcrypt/src/blake2s.c
    bugprone-macro-parentheses                   24  wolfssl/wolfcrypt/src/sha512.c
    bugprone-macro-parentheses                    3  wolfssl/wolfcrypt/src/poly1305.c
    bugprone-macro-parentheses                   24  wolfssl/wolfcrypt/src/ripemd.c
    readability-inconsistent-declaration-parameter-name    1  wolfssl/src/internal.c
    readability-inconsistent-declaration-parameter-name    1  wolfssl/testsuite/testsuite.c

    pre-patch warning count summaries, with suppressions:

    clang-analyzer-security.insecureAPI.strcpy                  8
    bugprone-suspicious-missing-comma                           6
    readability-redundant-preprocessor                         45
    readability-named-parameter                                21
    misc-no-recursion                                           3
    readability-uppercase-literal-suffix                       18
    bugprone-too-small-loop-variable                            7
    bugprone-signed-char-misuse                                 8
    bugprone-macro-parentheses                                601
    readability-inconsistent-declaration-parameter-name         2

    pre-patch warning count summaries, without suppressions:

    clang-analyzer-security.insecureAPI.strcpy                  8
    bugprone-branch-clone                                     152
    readability-non-const-parameter                           118
    bugprone-suspicious-missing-comma                           6
    bugprone-suspicious-include                                52
    readability-magic-numbers                               22423
    readability-redundant-preprocessor                         45
    readability-named-parameter                                21
    readability-function-cognitive-complexity                 845
    readability-else-after-return                             398
    bugprone-implicit-widening-of-multiplication-result       595
    readability-function-size                                  21
    readability-isolate-declaration                          1090
    misc-redundant-expression                                   2
    bugprone-narrowing-conversions                            994
    misc-no-recursion                                           3
    readability-uppercase-literal-suffix                       18
    bugprone-reserved-identifier                               56
    readability-suspicious-call-argument                       74
    bugprone-too-small-loop-variable                            7
    bugprone-easily-swappable-parameters                      437
    bugprone-signed-char-misuse                                 8
    readability-misleading-indentation                         94
    bugprone-macro-parentheses                                601
    readability-inconsistent-declaration-parameter-name         2
    bugprone-suspicious-string-compare                        495
    readability-redundant-control-flow                         20
    readability-braces-around-statements                    11483
    clang-analyzer-valist.Uninitialized                         1
    clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling   3502
2022-01-21 01:25:48 -06:00
b75fe633ad SP int: minor improvements to sp_invmod 2022-01-21 16:47:59 +10:00
8a2cab8702 SHA-512 ASM: For Mac computers default to using SHA512 instructions 2022-01-21 16:40:35 +10:00
30e9d2813e Merge pull request #4782 from haydenroche5/aes_siv_gpp
Fix AES-SIV test with g++.
2022-01-21 15:37:12 +10:00
888bd2b304 Fix AES-SIV test with g++.
The string initializers for the AES-SIV test vector fields needed an extra byte
for the null terminator expected by g++.
2022-01-20 19:22:25 -08:00
848f5eeb0c Merge pull request #4755 from dgarske/dtls_srtp
DTLS SRTP (RFC5764) support (adds `--enable-srtp`)
2022-01-21 10:43:47 +10:00
d1a23a3285 Merge pull request #4758 from kareem-wolfssl/asioOldTls
Fix building ASIO with Old TLS disabled.
2022-01-20 10:44:41 -08:00
427b67d51b Merge pull request #4756 from kareem-wolfssl/noBio
Fix building with OPENSSL_EXTRA and NO_BIO defined.
2022-01-20 10:41:22 -08:00
5ea23d389c Merge pull request #4778 from haydenroche5/chrony
Add --enable-chrony configure option.
2022-01-20 08:46:00 -08:00
40f573df72 dtls-srtp: NIT: fix EKM size in comments 2022-01-20 16:55:44 +01:00
46c0809f5a dtls-srtp: add script to test interop with OpenSSL 2022-01-20 16:55:44 +01:00
d5aa76b161 dtsl-srtp: use PRF according to the DTLS version used
RFC 5764 sec 4.1.2
2022-01-20 16:55:30 +01:00
cdb2936244 dtls-srtp: PRF: fix correct order of client/server random in seed
see RFC 5705 Section 4
2022-01-20 16:12:04 +01:00
231a0bbb84 dtls-srtp: no ekm cross check on single threaded/no pthread conf 2022-01-20 16:12:04 +01:00
1af3ea56c8 Cert: allow allocation of fields even with WOLFSSL_NO_MALLOC
subjectCN and publicKey in a DecodedCert are needed by the certificate
store in some cases. For embedded, allow them to be allocated even with
WOLFSSL_NO_MALLOC defined.
2022-01-20 16:16:09 +10:00
d728a7f0e6 Merge pull request #4777 from SparkiDev/sp_modinv_even_fix
SP int: fix rework of sp_invmod
2022-01-19 20:32:48 -08:00
a05b1b012f Add --enable-chrony configure option.
This turns on the necessary features for using the chrony NTP package with
wolfSSL.
2022-01-19 19:13:34 -08:00
95efdccd7f Merge pull request #4751 from SparkiDev/sp_int_thumb_asm
SP int: ARM Thumb asm snippets
2022-01-19 18:52:02 -08:00
609d6442b1 Merge pull request #4753 from SparkiDev/siphash
Add SipHash algorithm
2022-01-19 18:51:44 -08:00
fcce4f7a92 Merge pull request #4765 from haydenroche5/aes_siv
Add AES-SIV (RFC 5297).
2022-01-19 18:51:12 -08:00
29513e1ec8 include hmac for deterministic ecc sign build 2022-01-20 09:25:32 +07:00
b767857abb SP int: fix rework of sp_invmod
Simplify code and check for m mod a == 0 which means there is no
inverse.
2022-01-20 10:37:31 +10:00
a6485a228d Add SipHash algorithm 2022-01-20 09:41:18 +10:00
a1185adf2c SP int: ARM Thumb asm snippets 2022-01-20 09:16:45 +10:00
62b07d8806 Add AES-SIV (RFC 5297).
This commit adds functions to encrypt and decrypt data using AES in SIV mode, as
described in RFC 5297. This was added in the process of porting chrony to
wolfSSL. chrony is an NTP implementation that can use NTS (network time
security), which requires AES-SIV.
2022-01-19 14:32:33 -08:00
d668037541 Merge pull request #4746 from elms/gh/templates
github: Initial templates
2022-01-19 14:04:21 -08:00
c6fdb34daa cmake: enable ASM and fix thread with usersettings
* Assembly files were not being compiled.
* With When `-DWOLFSSL_USER_SETTINGS` `HAVE_PTHREAD` was not
  propagating to `config.h`
2022-01-19 13:34:25 -08:00
7adbf59f22 Merge pull request #4767 from anhu/kill_hc128
Get rid of HC-128
2022-01-19 12:20:18 -08:00
c5d3581ac2 Merge pull request #4771 from SparkiDev/sp_c_mont_red
SP C: fix corner case of P256 and P384 mont red
2022-01-19 11:32:49 -08:00
0175013604 Merge pull request #4770 from anhu/cve
CVE-2022-23408
2022-01-19 11:31:24 -08:00
0f50ffb2ef github: Initial templates 2022-01-19 10:36:01 -08:00
8e0ece920b Test cleanups. Fix possible leak in TLSX_UseSRTP. 2022-01-19 09:22:02 -08:00
af71aec77e Mention removal of HC-128 in README.md 2022-01-19 09:49:25 -05:00
86ba0ef643 tests: support test for SRTP
the test will check that the same Exported Keying Material is generated between
client and server
2022-01-19 13:35:29 +01:00
9b69f693e4 dtls-srtp: check that length of strings matched before memcomparing
otherwise if profile_str_len is > strlen(gSrtpProfiles[i].name) we end up
comparing memory past gSrtpProfiles[i].name. -fsanitize=address catches this:

```
==100159==ERROR: AddressSanitizer: global-buffer-overflow on address 0x7f40d8d533b2 at pc 0x7f40d8eb014f bp 0x7f40d50fe240 sp 0x7f40d50fd9e8
READ of size 21 at 0x7f40d8d533b2 thread T107
    #0 0x7f40d8eb014e in MemcmpInterceptorCommon(void*, int (*)(void const*, void const*, unsigned long), void const*, void const*, unsigned long) /build/gcc/src/gcc/libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc:860
    #1 0x7f40d8eb06e6 in __interceptor_memcmp /build/gcc/src/gcc/libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc:892
    #2 0x7f40d8eb06e6 in __interceptor_memcmp /build/gcc/src/gcc/libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc:887
    #3 0x7f40d8c2e830 in DtlsSrtpFindProfile src/ssl.c:1310
    #4 0x7f40d8c2e9ed in DtlsSrtpSelProfiles src/ssl.c:1347
    #5 0x7f40d8c2eada in wolfSSL_CTX_set_tlsext_use_srtp src/ssl.c:1359
    #6 0x563bf381b4c5 in server_test examples/server/server.c:2278
    #7 0x7f40d88f0258 in start_thread (/usr/lib/libpthread.so.0+0x9258)
    #8 0x7f40d88195e2 in __GI___clone (/usr/lib/libc.so.6+0xfe5e2)
```
2022-01-19 13:14:58 +01:00
c06ba390cd SP C: fix corner case of P256 and P384 mont red 2022-01-19 14:22:04 +10:00
4c05d35452 Merge pull request #4743 from miyazakh/tls_bench_onlymode 2022-01-18 15:41:48 -07:00
2984cb5abf Merge pull request #4768 from SparkiDev/sp_invmod_nr
SP math: sp_invmod changed to not call itself
2022-01-18 16:20:37 -06:00
65d1d32972 Merge pull request #4769 from SparkiDev/sp_mont_red_neg
SP math neg: Mont Reduce fix
2022-01-18 14:12:09 -08:00
884b8634af CVE-2022-23408 2022-01-18 16:06:08 -05:00
e6466f92b7 Counting properly 2022-01-18 15:41:16 -05:00
ff128c07a1 Remove extra references to Guid no longer required. Note that other count gaps exist so this should be fine. 2022-01-18 15:23:08 -05:00
ba589955f7 Improve the DTLS SRTP client side parsing. 2022-01-18 11:23:13 -08:00
e745de657f Merge pull request #4761 from haydenroche5/time_cb
Add time callback functionality.
2022-01-18 16:49:19 +10:00
53a4903e2f SP math neg: Mont Reduce fix
Compare the absolute value for negatives.
2022-01-18 16:22:38 +10:00
e11d484746 Merge pull request #4752 from LinuxJedi/fix-ber-der
Fix buffer overflows in BERtoDER
2022-01-17 21:05:39 -07:00
84b06ac1b6 Merge pull request #4730 from embhorn/zd13475
Document wc_AesCfbEncrypt and wc_AesCfbDecrypt
2022-01-17 19:45:45 -07:00
1b0926a3b8 Add time callback functionality.
This commit adds `wolfSSL_SetTimeCb` and `wolfSSL_time`. The former allows the
user to override the function wolfSSL uses to get the current time,
`wolfSSL_time`. If set, `wolfSSL_time` uses that function. If not set,
`wolfSSL_time` uses the `XTIME` macro by default. This functionality is needed
for the port of chrony to wolfSSL. chrony is an NTP implementation that uses
GnuTLS by default. For TLS, chrony uses the time it computes in place of the
default system time function.
2022-01-17 17:49:51 -08:00
fc861f3d6d SP math: sp_invmod changed to not call itself
When the modulus is even, calculate m^-1 mod a instead and fixup after.
Don't call self to do inverse.
2022-01-18 10:45:57 +10:00
f3f5b0f53b Peer review fixes. Improve profile not found handling or errors. Improve inline function. 2022-01-17 15:52:40 -08:00
c2860cb311 Get rid of HC-128 2022-01-17 18:11:54 -05:00
ec44747029 Merge pull request #4764 from SparkiDev/evp_cbn_casecmp
wolfSSL_EVP_get_cipherbyname: case compare
2022-01-17 14:11:07 -08:00
d38c5003d0 Merge pull request #4762 from ejohnstown/old-gcc
Old Compiler Warning Cleanup (GCC 4.0.2)
2022-01-17 09:44:44 -08:00
989a4f096e Merge pull request #4728 from miyazakh/sce_aes128_cryonly 2022-01-17 10:28:57 -07:00
e953707258 Merge pull request #4754 from miyazakh/update_espidfport 2022-01-17 10:27:28 -07:00
6197853f37 Document wc_AesCfbEncrypt and wc_AesCfbDecrypt 2022-01-17 11:27:19 -06:00
d06cf97d73 Old Compiler Warning Cleanup (GCC 4.0.2)
test.c:
1. Removed pragma disabling the warning for unused functions.
2. Fixed the guards around the function that wasn't getting removed from
   the build. And matched the guards to the call of the function. The
   issue is a test that fails only in a cert 3389 build using Arm
   assembly single-precision public keys.
3. Fixed the guards around a couple other functions.
2022-01-16 22:08:35 -08:00
1b5d0c75b8 wolfSSL_EVP_get_cipherbyname: case compare
Accept any case alternatives to name or alias.
Remove case only different aliases.
Tidy up formatting in function.
2022-01-17 09:39:16 +10:00
b68b14b499 Merge pull request #4724 from embhorn/zd13462
Improve param checks of enc
2022-01-16 15:35:54 -08:00
815527be6b Merge pull request #4745 from SparkiDev/m1_sha512
Aarch64 SHA512: fixup to work on Apple M1
2022-01-16 15:29:01 -08:00
15f501358d Merge pull request #4716 from julek-wolfssl/issue-4592
Verification: Domain check should only be performed on leaf certs
2022-01-17 08:40:14 +10:00
001469589b Old Compiler Warning Cleanup (GCC 4.0.2)
Fixed a lot of shadowed global values. Some were prototype and function
declaration parameter name conflicts. Some conflicted with typenames.
Some conflicted with globals in libc.
2022-01-14 17:43:21 -08:00
5ddf4392df Old Compiler Warning Cleanup (GCC 4.0.2)
pwdbased.c: Simplified some arithmetic to fix a variable promotion
warning.
2022-01-14 17:36:12 -08:00
2cf21a3f69 Old Compiler Warning Cleanup (GCC 4.0.2)
ecc.c,api.c: Initialize some variables to fix warning for possible
uninitialized variable use.
2022-01-14 17:33:49 -08:00
e724622506 Old Compiler Warning Cleanup (GCC 4.0.2)
ge_operations.c: Added the keyword `inline` to several function
prototypes for functions declared `inline`.
2022-01-14 17:19:01 -08:00
2085624a29 Old Compiler Warning Cleanup (GCC 4.0.2)
1. Removed pragma disabling the warning for non-literal format strings
on `printf()`.
2. Switched the `printf()` into two printf calls.
2022-01-14 17:11:55 -08:00
153b9abc31 Old Compiler Warning Cleanup (GCC 4.0.2)
ssl.c: Fix a couple of checks on hashType enum that were using a `< 0`
for the lower bound on an unsigned.
2022-01-14 16:32:18 -08:00
021f9171c5 Fix building ASIO with Old TLS disabled. 2022-01-14 15:00:02 -07:00
eade8ecdf1 DTLS SRTP improvements. Added support for client to send list of profiles. Added support for more SRTP profiles. 2022-01-14 13:43:29 -08:00
1ed152daeb Fix building with OPENSSL_EXTRA and NO_BIO defined. 2022-01-14 11:19:01 -07:00
31e84d82b8 Domain check should only be performed on leaf certs
- Refactor `*_set_verify` functions into common logic
- NULL protect `wolfSSL_X509_VERIFY_PARAM_set1_host` and add debug info
2022-01-14 18:16:42 +01:00
6ccbd8776f DTLS SRTP (RFC5764) support (adds --enable-srtp). Used with WebRTC to agree on profile for new real-time session keys. 2022-01-14 07:35:45 -08:00
a33d901409 update ESP-IDF port to fix failure 2022-01-14 15:35:28 +09:00
f81e15f342 Merge pull request #4750 from SparkiDev/etm-disable
TLS EncryptThenMac; fix when extension response sent
2022-01-13 13:33:57 -08:00
8d7059497e Merge pull request #4742 from elms/fix/secure_renegotiate_compat
TLS: Default secure renegotiation compatibility
2022-01-13 10:23:27 -08:00
1a4bc322f7 Fix buffer overflow in PKCS7_VerifySignedData
wc_PKCS7_AddDataToStream() was called the first time prior to BERtoDER
conversion, subsequent times afterwards which meant the stream idx
pointer was incorrect. This patch restarts the stream after conversion.

Fixes ZD13476
2022-01-13 14:49:31 +00:00
92d01611ff Fix buffer overflow in GetOID
When converting BER to DER we switched the pointer for pkiMsg to the DER
but not the size which could cause buffer overflow.

Fixes ZD13471
2022-01-13 13:26:32 +00:00
70b169e3f2 TLS EncryptThenMac; fix when extension response sent
Only respond with the extension when negotiated a block cipher.
2022-01-13 12:46:21 +10:00
ba579753ba Merge pull request #4749 from ejohnstown/vpath-fix 2022-01-12 17:06:37 -08:00
15c5ac880e PKCS7 Test Output
When running the test with PKCS7 enabled, there's an additional option
that will save to disk the generated PKCS7 blobs for by-hand review.
(PKCS7_OUTPUT_TEST_BUNDLES) Fixed a couple compile errors that were
missed with that option enabled.
2022-01-12 14:51:11 -08:00
33f0e2eda5 In the wolfCrypt test, fix a few filenames to use the VPATH versions. 2022-01-12 14:50:43 -08:00
0acf8d0e75 Merge pull request #4732 from embhorn/zd13375
SP int, TFM: Init vars for static analysis
2022-01-13 07:06:19 +10:00
3ddfb0f189 Aarch64 SHA512: fixup to work on Apple M1
Directive needed on Apple to indicate SHA3 extensions available.
Fixup C file as well - remove unused constants not avaiable and
prototype function that is extern elsewhere.
2022-01-12 12:56:39 +10:00
336e595ebb Remove some lingering oldname return values 2022-01-11 17:09:52 -08:00
723cfb2d0b make server/client only work 2022-01-12 09:23:23 +09:00
efe2cea8d1 TLS: Default secure renegotiation compatability
By default this change will have servers send the renegotiation info
extension, but not allow renegotiation. This is accordance with RFC 5746

From to RFC 5746:
> In order to enable clients to probe, even servers that do not support
> renegotiation MUST implement the minimal version of the extension
> described in this document for initial handshakes, thus signaling
> that they have been upgraded.

With openSSL 3.0 the default it not allow connections to servers
without secure renegotiation extension. See
https://github.com/openssl/openssl/pull/15127
2022-01-11 15:56:35 -08:00
abc9b7197d Merge pull request #4676 from ThalesGroup/iotsafe-hkdf-extract
Iotsafe hkdf extract
2022-01-11 07:37:30 -08:00
f0f65f41b7 addressed review comments 2022-01-11 19:53:54 +09:00
c7b0b7003e Merge pull request #4700 from dgarske/pkcs11_id
Improved the PKCS11 init to support slotId or tokenName
2022-01-11 14:25:37 +10:00
30777bb5ee nit minor changes 2022-01-11 10:08:52 +08:00
9a4981a5a8 Improved the PKCS11 init to support slotId or tokenName. Adds new wc_Pkcs11Token_InitName and alters existing wc_Pkcs11Token_Init to allow NULL tokenName. ZD13348 2022-01-10 16:53:01 -08:00
5910ada93d Merge pull request #4736 from douzzer/20220107-cppcheck-hygiene
cppcheck sweep
2022-01-10 12:52:22 -08:00
6a02826bbf Merge pull request #4740 from dgarske/sess_names_docs
Session doc and naming cleanups
2022-01-10 14:38:47 -06:00
5392190807 Merge pull request #4741 from danielinux/psoc6-sha512-fix
PsoC6 hw crypto: added missing wc_InitSha512_ex()
2022-01-10 12:32:13 -08:00
814e7c91e0 PsoC6 hw crypto: added missing wc_InitSha512_ex() 2022-01-10 18:30:53 +01:00
f72d198778 Merge pull request #4723 from dgarske/se050 2022-01-10 10:11:49 -07:00
43bbc5d2e5 Merge pull request #4738 from SparkiDev/sp_int_div_arm_2
SP int: ARM64/32 sp_div_word changes
2022-01-10 07:58:28 -08:00
6ce248e2f9 Improve documentation for wolfSSL_get1_session. Add wolfSSL specific naming on the internal session functions to avoid possible user conflicts. ZD13363 and ZD13487. 2022-01-10 07:47:19 -08:00
5cce1926bb Init vars for static analysis 2022-01-10 08:24:29 -06:00
6398087d5b SP int: ARM64/32 sp_div_word changes
Fixup up formatting.
Fix comments.
Aarch64: don't use variable r when hi can be used.
ARM 32-bit: Add a version that uses udiv - not available on all chips
and can be slower anyway.
2022-01-10 16:27:39 +10:00
1a291870a3 minor fixes 2022-01-10 10:28:14 +08:00
4bbf90d604 Merge pull request #4702 from SparkiDev/sp_int_div_arm
SP int: transplant the div_word from SP into SP int for ARM64 and ARM32
2022-01-09 17:54:39 -08:00
355b5821b2 WOLFSSL_SESSION_EXPORT: fixes for scan-build complaints (deadcode.DeadStores) building --enable-all --enable-sessionexport. 2022-01-08 11:43:56 -06:00
c50964cc35 src/internal.c: fix flubbed edit in wolfSSL_session_import_internal(). 2022-01-08 11:08:57 -06:00
49fc54ef1f linuxkm/linuxkm_wc_port.h: move XMALLOC/XREALLOC/XFREE definitions outside BUILDING_WOLFSSL gate as-was, for back-compat. 2022-01-08 02:41:02 -06:00
56c28ff307 src/ssl.c: in wolfSSL_SESSION_has_ticket(), add (void)sess if !defined(HAVE_SESSION_TICKET), to fix -Wunused-parameter. 2022-01-08 02:39:50 -06:00
ff0eb5a41e wolfcrypt/test/test.c: in wolfcrypt_test(), tweak formatting of CheckRunTimeSettings() to resolve invalidPrintfArgType_uint from cppcheck --force. 2022-01-08 01:35:46 -06:00
a4444e6c3e wolfcrypt/test/test.c: in rsa_oaep_padding_test(), remove accidentally repeated MEMORY_E check. 2022-01-08 01:10:02 -06:00
7341b54a20 wolfssl/wolfcrypt/tfm.h: fixes for cppcheck complaints: preprocessorErrorDirective[division/modulo by zero] 2022-01-08 00:34:33 -06:00
cb86da71fa wolfssl/wolfcrypt/ecc.h: fixes for cppcheck complaints: preprocessorErrorDirective[division/modulo by zero] 2022-01-08 00:34:22 -06:00
fdb6a2d87d wolfssl/test.h: fixes for cppcheck complaints: nullPointerRedundantCheck invalidScanfArgType_int 2022-01-08 00:34:09 -06:00
29fcbb0b19 wolfcrypt/test/test.c: fixes for cppcheck complaints: memleakOnRealloc nullPointerRedundantCheck uninitvar invalidPrintfArgType_uint 2022-01-08 00:33:54 -06:00
70ab36f81c wolfcrypt/src/wc_port.c: fixes for cppcheck complaints: uninitvar nullPointer 2022-01-08 00:33:33 -06:00
8aa1100508 wolfcrypt/src/wc_pkcs11.c: fixes for cppcheck complaints: uninitvar 2022-01-08 00:32:48 -06:00
71b0b89e95 wolfcrypt/src/srp.c: fixes for cppcheck complaints: identicalInnerCondition 2022-01-08 00:32:37 -06:00
82b508b917 wolfcrypt/src/sha512.c: fixes for cppcheck complaints: nullPointerRedundantCheck 2022-01-08 00:32:26 -06:00
6e763825ed wolfcrypt/src/sha.c: fixes for cppcheck complaints: bufferAccessOutOfBounds 2022-01-08 00:32:14 -06:00
094d89bfb9 wolfcrypt/src/rsa.c: fixes for cppcheck complaints: identicalInnerCondition 2022-01-08 00:32:03 -06:00
24bb007d3c wolfcrypt/src/random.c: fixes for cppcheck complaints: uninitvar 2022-01-08 00:31:51 -06:00
1488e28ea3 wolfcrypt/src/port/ti/ti-aes.c: fixes for cppcheck complaints: missingReturn[false positive] 2022-01-08 00:31:36 -06:00
9e76ec8855 wolfcrypt/src/pkcs7.c: fixes for cppcheck complaints: nullPointerArithmeticRedundantCheck 2022-01-08 00:31:07 -06:00
dc98f4dd30 wolfcrypt/src/pkcs12.c: fixes for cppcheck complaints: uselessAssignmentPtrArg 2022-01-08 00:30:52 -06:00
67de528d91 wolfcrypt/src/logging.c: fixes for cppcheck complaints: invalidPrintfArgType_sint 2022-01-08 00:30:32 -06:00
f126e6add5 wolfcrypt/src/integer.c: fixes for cppcheck complaints: nullPointerRedundantCheck[false positive; added suppression] 2022-01-08 00:30:20 -06:00
1eb5537e34 wolfcrypt/src/fe_low_mem.c: fixes for cppcheck complaints: funcArgOrderDifferent 2022-01-08 00:30:00 -06:00
d4aa6bd1fc wolfcrypt/src/evp.c: fixes for cppcheck complaints: bufferAccessOutOfBounds nullPointerRedundantCheck 2022-01-08 00:29:47 -06:00
c557a74953 wolfcrypt/src/ecc.c: fixes for cppcheck complaints: invalidPrintfArgType_sint identicalInnerCondition 2022-01-08 00:29:35 -06:00
d36a1be74b wolfcrypt/src/dh.c: fixes for cppcheck complaints: identicalInnerCondition 2022-01-08 00:29:18 -06:00
11f72877a2 wolfcrypt/src/asn.c: fixes for cppcheck complaints: invalidPrintfArgType_uint nullPointerRedundantCheck 2022-01-08 00:29:09 -06:00
8ba6027073 src/wolfio.c: fixes for cppcheck complaints: nullPointer uninitvar 2022-01-08 00:28:35 -06:00
bb727d2ef2 src/ssl.c: fixes for cppcheck complaints: uselessAssignmentPtrArg autoVariables[not a defect; added suppression] invalidPrintfArgType_sint nullPointerRedundantCheck pointerSize 2022-01-08 00:28:09 -06:00
4d3dfc451d src/sniffer.c: fixes for cppcheck complaints: negativeIndex 2022-01-08 00:27:59 -06:00
b69dc00bd7 src/internal.c: fixes for cppcheck complaints: nullPointerRedundantCheck uninitvar 2022-01-08 00:27:47 -06:00
ff4c6e5d7b linuxkm: relocate WOLFSSL_LINUXKM code in wolfssl/wolfcrypt/wc_port.h and wolfcrypt/src/memory.c to linuxkm/{linuxkm_wc_port.h,linuxkm_memory.c}, and gate SIMD in IRQ handlers on -DLINUXKM_SIMD_IRQ in prep for Linux 5.16;
linuxkm: when -DWOLFCRYPT_ONLY, don't include ssl.h in module_exports.c.template and module_hooks.c, and fix gating to work right with that;

wolfssl/wolfcrypt/types.h: add support for a WOLFSSL_XFREE_NO_NULLNESS_CHECK gate (used in cppcheck analysis).
2022-01-07 22:39:38 -06:00
a14982b079 configure.ac: add ENABLED_WPAS to the config summary. 2022-01-07 21:36:24 -06:00
b4da751076 Fixes for SE050 Ed25519/Curve25519. 2022-01-07 12:54:54 -08:00
bbc9bc5e2c wolfcrypt/src/port/kcapi/kcapi_hmac.c: fix memory leak in wc_HmacSetKey() (fixes #4731). 2022-01-07 12:40:31 -06:00
b97894c617 Merge pull request #4729 from anhu/STM32U575xx
Add support for STM32U575xx boards.
2022-01-06 16:34:28 -08:00
f3e1e8c155 Add support for STM32U575xx boards. 2022-01-06 15:40:45 -05:00
d21105b3ca Merge pull request #4725 from elms/cmake/min_ver_3.16
cmake: Increase minimum version to 3.16 and fix HomeBrew build
2022-01-06 08:09:44 -08:00
f74831a7da Improve param checks of enc 2022-01-06 09:12:18 -06:00
0e6ba492e5 update signed ca
fix aes128-gcm crypt only usecase
2022-01-06 15:18:16 +09:00
252e2b6a99 Merge pull request #4726 from ejohnstown/typos
Fix a couple typos in asn.c
2022-01-05 14:51:50 -08:00
1e903a20a5 Merge pull request #4722 from dgarske/minor 2022-01-05 15:03:44 -05:00
32223b9c3a Merge pull request #4697 from LinuxJedi/isotp
Add ISO-TP support to wolfio
2022-01-05 10:34:43 -08:00
66ade8006b Fix a couple typos in asn.c 2022-01-05 10:24:25 -08:00
cc2b69573c cmake: Increase minimum version to 3.16 and fix HomeBrew build
Increasing cmake version required to allow use of more recent
additions in the future.

Reported issue is that Homebrew use different compiler than AppleClang
(from XCode). Correctly test for AppleClang to set xcode specific `ar`
and `ranlib` flags. It may also be appropraite to use for ANDROID as
well see
7d057b2738 (diff-6f7a068f87ca22bd0105fef2143b0960e4993854863fd20c9416c677ee33a737R61-R67)
2022-01-05 09:29:27 -08:00
e847bf7301 ISO-TP buffer fixes
* Flow control failed on wrap around when there is going to be no more
  flow control packets.
* If ISOTP_Send is provided more than 4095 bytes, limit it to 4095 bytes
  as wolfSSL will retry with the rest.
* Set the default receive size to the max ISO-TP data size.
* A few other cleanups.
2022-01-05 11:37:15 +00:00
84df7a50dc Minor build warning fixes. Possible benchmark unused bench_pq_asym_algs. Fix if RSA enabled and WOLFSSL_SP_MATH set and WOLFSSL_HAVE_SP_RSA is not. 2022-01-04 15:38:35 -08:00
96e1f77c32 Adds compatibility FIPS DRBG API's and test cases. 2022-01-04 15:13:06 -08:00
35847c1371 Merge pull request #4717 from embhorn/zd13452
Fix heap-buffer-overflow in GetBerHeader
2022-01-04 16:11:03 -07:00
be69412e27 Merge pull request #4682 from JacobBarthelmeh/qnx
add check on mutex lock return value with qnx CAAM
2022-01-04 14:36:40 -08:00
db1bb9ea6a Merge pull request #4694 from anhu/with-curl
Add a --enable-curl build option
2022-01-04 13:39:07 -08:00
cf29badd52 Merge pull request #4721 from anhu/lighty
lighttpd requires WOLFSSL_KEY_GEN…
2022-01-04 12:37:41 -08:00
038a9d8fa9 lighttpd requires WOLFSSL_KEY_GEN. Without it, a call to wolfSSL_CTX_use_PrivateKey fails. 2022-01-04 13:09:13 -05:00
58d8f52107 Merge pull request #4719 from JacobBarthelmeh/release
bump version for dev and update year in readme
2022-01-04 08:40:06 -08:00
247cbdeef7 Cleanups for ISO-TP in wolfio
* Add Doxygen comments
* Make ISOTP_Send, ISOTP_Receive and wolfSSL_SetIO_ISOTP safer
* Reorder isotp_wolfssl_ctx
* Other minor cleanups
2022-01-04 12:57:11 +00:00
12d3f94c98 update build and update NULL salt usecase 2022-01-04 13:18:39 +08:00
7dd50a1beb bump version for dev and update year in readme 2022-01-03 16:02:10 -07:00
3134bd2e71 Fix heap-buffer-overflow in GetBerHeader 2022-01-03 14:51:47 -06:00
a0b9e2bead Merge pull request #4715 from JacobBarthelmeh/release
update README for release v5.1.1
2022-01-03 10:51:51 -08:00
5f16a826dd update README for release v5.1.1 2022-01-03 09:39:16 -07:00
70ca57790c Merge pull request #4713 from ejohnstown/fips-RC12
FIPS RC12
2021-12-30 17:16:03 -08:00
68e58bb321 Update configure and fips-check.sh for FIPS RC12. 2021-12-30 15:21:44 -08:00
7ad7821193 Merge pull request #4712 from rizlik/aes_free_fix
Fix potential resources leaks
2021-12-30 13:57:04 -08:00
ea5374c62d wolfcrypt: aes: gcm: streaming api: add missing wc_AesFree() 2021-12-30 20:33:23 +01:00
4907696ed4 wolfssl: keys: add missing wc_AesFree() when setting new keys 2021-12-30 20:30:36 +01:00
2679c386ae wolfcrypt: wc_encrypt: add missing wc_AesFree() 2021-12-30 20:30:36 +01:00
933065d696 wolfcrypt: cmac: add missing wc_AesFree() 2021-12-30 20:30:36 +01:00
7edc916057 wolfcrypt/wolfssl: tests: adding missing wc_Aes*Free()
In some Aes implementation this may leak resources
2021-12-30 20:30:33 +01:00
67b27f64d0 Merge pull request #4708 from dgarske/async_v5.1.0
Fixes for wolfSSL Async v5.1.0
2021-12-29 13:30:41 -07:00
ff68ab8eea Merge pull request #4707 from JacobBarthelmeh/release
bump version by .1 for developing on
2021-12-29 12:09:43 -08:00
c4f51931c9 Merge pull request #4710 from JacobBarthelmeh/sessionExport
fix for location of xmemset
2021-12-29 11:52:08 -08:00
69733e87c5 SNI and ALT_CERT_CHAINS 2021-12-29 12:50:50 -05:00
73b4cc9476 fix for location of xmemset 2021-12-29 10:48:06 -07:00
bc6690c584 Merge pull request #4709 from miyazakh/Update_fspv3p5_RA6M3 2021-12-29 09:10:18 -07:00
d11e88298a Add Make file and fix identation 2021-12-29 11:45:32 +08:00
4fc2891d5a Merge branch 'wolfSSL:master' into iotsafe-hkdf-extract 2021-12-29 11:15:13 +08:00
f5df363cdd remove configure.xml from include.am 2021-12-29 11:16:14 +09:00
1d107d0403 update RA6M3 projects to the latest e2studio and FSP v3.5.0 2021-12-29 11:06:48 +09:00
930cad649e Fix to resolve possible memory leak with DSA wc_DsaPublicKeyDecode in API unit test when used with HAVE_WOLF_BIGINT. 2021-12-28 16:34:54 -08:00
0f9550d80a increase version for rpm build 2021-12-28 15:35:14 -08:00
616026880e bump version by .1 for dev 2021-12-28 16:25:05 -07:00
2b670c026d Merge pull request #4705 from JacobBarthelmeh/DTLS
account for DTLS extra header size when reading msg from pool
2021-12-27 19:16:26 -08:00
a07673ad07 Merge pull request #4706 from douzzer/20211227-fix-null-pointer-wolfSSL_EVP_CIPHER_CTX_ctrl
wolfcrypt/src/evp.c: fix wolfSSL_EVP_CIPHER_CTX_ctrl() null pointer…
2021-12-27 20:08:43 -07:00
aa05eb2879 wolfcrypt/src/evp.c: fix wolfSSL_EVP_CIPHER_CTX_ctrl() null pointer passed to XMEMCPY(), found by sanitizers under gcc-11.2.1. 2021-12-27 17:59:28 -06:00
05a19c852b account for DTLS extra header size when reading msg from pool 2021-12-27 16:52:09 -07:00
930cc053d5 Merge pull request #4704 from JacobBarthelmeh/release
prepare for release 5.1.0
2021-12-27 12:35:49 -08:00
d1b03eb8b9 add missing header files for rpm build 2021-12-27 09:49:47 -08:00
816718ecd3 prepare for release 5.1.0 2021-12-27 10:34:09 -07:00
cbab5bb6cb add kdf.c to MYSQL cmake build 2021-12-27 10:10:35 -07:00
5a4e59c09d fix warning about NULL compare 2021-12-27 10:02:16 -07:00
4e1c39b4c6 Merge pull request #4701 from SparkiDev/asn_templ_fix_1
ASN template: get compiling
2021-12-24 07:42:56 -08:00
fd31c017e1 Merge pull request #4703 from douzzer/20211224-fixits
20211224 ssl.c fixes
2021-12-24 07:42:00 -08:00
7c2a2229c5 Use XMEMCPY and defined constannts for ISOTP 2021-12-24 11:56:16 +00:00
54e9076c45 src/ssl.c: fix whitespace and heap reference in FreeSession() (re 569c066fab). 2021-12-24 01:16:32 -06:00
9d49884274 Merge pull request #4690 from dgarske/resume
Fixes for session resumption edge cases
2021-12-24 15:28:06 +10:00
02186dbd23 Fix for TLS v1.3 client session ticket resumption where the server opts to do a new handshake. Fix to make sure preMasterSz is valid. 2021-12-23 18:45:52 -08:00
a92fb0eb42 Fix for session resumption to ensure use of the right cipher suite. ZD13297 2021-12-23 18:42:41 -08:00
80a4793201 SP int: transplant the div_word from SP into SP int for ARM64 and ARM32 2021-12-24 12:26:19 +10:00
f1f15f411f Merge pull request #4688 from embhorn/gh4684
Fix missing include ws2tcpip.h for VS build
2021-12-24 11:58:12 +10:00
929174be6b Merge pull request #4667 from dgarske/zd13363
Improve TLS client side session cache references
2021-12-24 11:23:06 +10:00
4c6af465c4 ASN template: get compiling 2021-12-24 11:21:18 +10:00
a75e152b93 Merge pull request #4698 from JacobBarthelmeh/Jenkins
fix for user_settings_all.h build on 'VS' and build with libz + pkcs7 test
2021-12-23 16:54:40 -08:00
37925e0b6a Merge pull request #4699 from douzzer/ssl-wolfCrypt_SetPrivateKeyReadEnable_fips 2021-12-23 16:42:06 -08:00
1e4b13dfac Only include ws2tcpip.h if not user IO. 2021-12-23 15:25:25 -08:00
8eea17d92a More stuff, probably not complete yet 2021-12-23 17:28:24 -05:00
569c066fab Improve TLS client side session cache references to provide option for not returning an internal session cache pointer. Now use wolfSSL_get1_sesson for reference logic, that requires calling wolfSSL_SESSION_free. To disable this feature use NO_SESSION_CACHE_REF. 2021-12-23 14:25:45 -08:00
7b5b1f5a4d src/ssl.c: refine integration of wolfCrypt_SetPrivateKeyReadEnable_fips(), started by 52754123d9: depend on fips 5.1+, and call as matched pair in wolfSSL_Init() and wolfSSL_Cleanup(). 2021-12-23 16:05:25 -06:00
f950f24b1a Merge pull request #4691 from JacobBarthelmeh/sessionExport
retain same size for exported session
2021-12-23 14:03:11 -08:00
21c8b19fc2 Merge pull request #4696 from JacobBarthelmeh/build_tests
fix for a couple reports from build_tests
2021-12-23 13:42:06 -08:00
801c0c7efd Merge pull request #4549 from elms/cmake/ac_catchup
cmake/configure consistency
2021-12-23 13:49:44 -07:00
57d2555ac8 Merge pull request #4695 from douzzer/20211222-fips-config-update-and-fix-test_RsaDecryptBoundsCheck
fips config update and test-driven cleanup
2021-12-23 10:38:36 -08:00
bb8d38c2a1 Add ISO-TP support to wolfio
ISO-TP is a commonly used simple transport layer for CAN bus which
allows larger than the 1-8 bytes payload than the CAN bus protocol
allows.

This implements our own ISO-TP transport layer for wolfSSL when compiled
with `WOLFSSL_ISOTP`.
2021-12-23 18:27:34 +00:00
f9c9f4c840 refactor IP macro defines 2021-12-23 09:59:05 -08:00
c4e50ef086 fix for libz test with pkcs7 2021-12-23 09:37:09 -08:00
a8605309c6 Merge pull request #4692 from haydenroche5/wolfssl_init_fipsv5
Call wc_SetSeed_Cb and wolfCrypt_SetPrivateKeyReadEnable_fips in wolfSSL_Init.
2021-12-23 09:28:36 -08:00
9892f1f2d5 Merge pull request #4679 from dgarske/fips_ecc_pct 2021-12-23 10:27:51 -07:00
dc073f9c1d cmake: add back de-duplication and fix formatting 2021-12-23 09:22:47 -08:00
37eec1ed19 cmake: reduce port includes
TESTING:

```
./autogen.sh && ./configure --enable-reproducible-build --prefix=$PWD/ac_repro && make install
cmake -B b2 -DWOLFSSL_REPRODUCIBLE_BUILD=yes -DCMAKE_INSTALL_PREFIX:PATH=$PWD/cmake_repro && cmake --build b2 && cmake --install b2
diff -rq ac_repro cmake_repro
```
2021-12-23 09:22:47 -08:00
6ff1e0b037 cmake: correct libtool version, default to shared library, generate pkgconfig 2021-12-23 09:22:47 -08:00
c89b7d5f79 configure and cmake: Closing gap on options and output
cmake:
 * 32-bit and 16-bit mode flags
 * Add 4bit to AESGCM
 * Add align data
 * Encrypted Keys option
 * PKC12 option
 * Header installation cleanup

configure:
 * Add comment for `v5-RC9`
 * update CFLAGS to always be appended instead of mix of prepend and append
 * removed duplicate `ARC4` logic
2021-12-23 09:22:47 -08:00
63df8f0836 add fe_low_mem.c to wolfssl vs project and fix a couple warnings 2021-12-23 16:55:51 +00:00
40d5bd052f Merge pull request #4693 from embhorn/zd13433
Fix to init ctx in wc_Des3_SetKey
2021-12-23 07:41:13 -08:00
86e51b97e9 Merge pull request #4689 from haydenroche5/wolfengine_compression_fix
Fix usage of SSL_OP_NO_COMPRESSION that was breaking wolfEngine.
2021-12-23 10:47:30 +10:00
a5b3daf216 fix whitespace. 2021-12-22 17:34:06 -06:00
951eb72ecb fips-check.sh: update+streamline flavors -- add linuxv5-dev (checks out fips master same as old linuxv5-ready) , drop linuxv5-RC8, linuxv5-RC9, linuxv5-RC10, and the desupported/unbuildable fips-v3-ready; update linuxv5 and linuxv5-ready to use WCv5.0-RC11; use the term "flavor" consistently for the fips key (versus "version" or "platform"); cleanup to satisfy shellcheck. 2021-12-22 17:32:36 -06:00
a6ed5dc92d configure.ac: update fips with RC11. 2021-12-22 17:32:36 -06:00
b0a5b16068 api.c: fix logic in test_RsaDecryptBoundsCheck(). 2021-12-22 17:32:36 -06:00
29c18a110b Fix to init ctx in wc_Des3_SetKey 2021-12-22 17:05:58 -06:00
11e8d729c2 Merge pull request #4685 from SparkiDev/sp_gen_fix_1
SP gen: Regenerate
2021-12-22 15:02:03 -08:00
991ddaadfc Add a --enable-curl build option 2021-12-22 17:34:58 -05:00
52754123d9 Call wc_SetSeed_Cb and wolfCrypt_SetPrivateKeyReadEnable_fips in wolfSSL_Init.
Additionally, remove wc_SetSeed_Cb calls applications (e.g. example client and
server), since they are now redundant.
2021-12-22 14:21:06 -08:00
8670e33baf Merge pull request #4651 from TakayukiMatsuo/tsip_sce 2021-12-22 15:00:32 -07:00
fd39197e4b retain same size for exported session 2021-12-22 14:28:42 -07:00
646ceb259a Fix usage of SSL_OP_NO_COMPRESSION that was breaking wolfEngine.
Replace instances of SSL_OP_NO_COMPRESSION with WOLFSSL_OP_NO_COMPRESSION in
ssl.c. Only define SSL_OP_NO_COMPRESSION when using the compatibility layer.
Before these changes, wolfEngine builds were failing due to
SSL_OP_NO_COMPRESSION being defined in both wolfSSL and OpenSSL headers.
2021-12-22 10:23:51 -08:00
38214bd083 Disable the FIPS consistency checks in ECC and DH for key generation by default. 2021-12-22 10:06:19 -08:00
8d4c22abda Merge pull request #4687 from julek-wolfssl/asn-template-var-init
`items` needs to be initialized as the compiler complains
2021-12-22 08:58:54 -08:00
9d137668c7 Merge pull request #4675 from julek-wolfssl/openssh-8.8
Fix macro name conflicts with openssh
2021-12-22 08:31:36 -08:00
713c4afcb4 Fix missing include ws2tcpip.h for VS build 2021-12-22 09:26:22 -06:00
8435eb4644 Add WC_ namespace to variable handling defines 2021-12-22 12:16:02 +01:00
618599656f items needs to be initialized as the compiler complains 2021-12-22 10:42:48 +01:00
81cf1ae38a fix alignment 2021-12-22 15:16:08 +08:00
c7fc0fac05 revert changes + spelling/comments 2021-12-22 15:11:50 +08:00
9091cbde5f Merge branch 'wolfSSL:master' into iotsafe-hkdf-extract 2021-12-22 14:46:28 +08:00
ea432f45cd Merge pull request #4686 from SparkiDev/fe448_cast
Curve448: add casts for Windows
2021-12-21 22:21:25 -08:00
cd96330f2a Integrate Renesas TSIP specific code into Renesas common logics 2021-12-22 13:18:32 +09:00
140cf8955d Merge branch 'wolfSSL:master' into iotsafe-hkdf-extract 2021-12-22 12:01:11 +08:00
80e291fcd1 Curve448: add casts for Windows 2021-12-22 12:57:15 +10:00
dd9b1afb72 Remove magic numbers from WOLFSSL_ASN_TEMPLATE code (#4582)
* pkcs8KeyASN and other misc asn fixes

- Test fixes for testing with `USE_CERT_BUFFERS_1024`

* intASN

* bitStringASN

* objectIdASN

* algoIdASN

* rsaKeyASN

* pbes2ParamsASN

* pbes1ParamsASN

* pkcs8DecASN

* p8EncPbes1ASN

* rsaPublicKeyASN

* dhParamASN

* dhKeyPkcs8ASN

* dsaKeyASN

* dsaPubKeyASN

- Add `wc_SetDsaPublicKey` without header testing

* dsaKeyOctASN

* rsaCertKeyASN

* eccCertKeyASN

* rdnASN

* certNameASN

* digestInfoASN

* otherNameASN

* altNameASN

* basicConsASN

* crlDistASN

* accessDescASN

* authKeyIdASN

* keyUsageASN

* keyPurposeIdASN

* subTreeASN

* nameConstraintsASN

* policyInfoASN

* certExtHdrASN

* certExtASN

* x509CertASN

* reqAttrASN

* strAttrASN

* certReqASN

* eccPublicKeyASN

* edPubKeyASN

* ekuASN

* nameASN

* certExtsASN

* sigASN

* certReqBodyASN_IDX_EXT_BODY

* dsaSigASN

* eccSpecifiedASN

* eccKeyASN

* edKeyASN

* singleResponseASN

* respExtHdrASN

* ocspRespDataASN

* ocspBasicRespASN

* ocspResponseASN

* ocspNonceExtASN

* ocspRequestASN

* revokedASN

* crlASN

* pivASN

* pivCertASN

* dateASN

* `wc_SetDsaPublicKey` was not including `y` in the sequence length

* All index names changed to uppercase

* Shorten names in comments

* Make sure extensions have sequence header when in cert gen

* Fix/refactor size calc in `SetNameEx`

* Pad blocks for encryption

* Add casting for increased enum portability

* Use stack for small ASN types
2021-12-22 11:28:01 +10:00
af0bcef0ef Merge pull request #4648 from embhorn/zd13365
Fix - wolfSSL_init should cleanup on failure of a component
2021-12-21 17:17:16 -08:00
bf612c075b Merge pull request #4668 from ejohnstown/kcapi-ecdsa
KCAPI ECDSA Memory
2021-12-21 15:32:33 -08:00
bf37845e2d Merge pull request #4680 from JacobBarthelmeh/certs
update certificate expiration dates and fix autorenew
2021-12-22 08:48:35 +10:00
395c5815bd SP gen: Regenerate
Put back in fix for SAKKE.
2021-12-22 08:24:33 +10:00
a6a071771b Merge pull request #4681 from SparkiDev/sp_arm64_p384_mr
SP ARM64: P-384 prime specific Montogmery Reduction
2021-12-21 13:50:33 -08:00
bbfcd0cac8 fix build warning with af_alg 2021-12-21 10:20:34 -08:00
d29cdd3537 fix for --enable-ip-alt-name build 2021-12-21 09:53:58 -08:00
d28cb70735 fix for ed25519 client cert generation 2021-12-21 09:03:54 -08:00
78a419fdf5 spelling 2021-12-21 15:57:19 +08:00
ebff24353a fix Spelling 2021-12-21 15:53:57 +08:00
f1bbfa5a24 revert change on Derive Master secret 2021-12-21 15:51:32 +08:00
31cf4f305c fixing comments and spelling; fallback hkdf imp + signature header 2021-12-21 15:41:43 +08:00
343cfb32f2 add check on mutex lock return value with qnx CAAM 2021-12-20 17:41:06 -07:00
9f2419246e SP ARM64: P-384 prime specific Montogmery Reduction
Improves performance
2021-12-21 10:18:12 +10:00
c0f8fd5f5d update certificate dates and fix autorenew 2021-12-20 16:04:05 -08:00
6b47954d58 Merge pull request #4670 from julek-wolfssl/krb5-missing-api
Missing config for krb5 1.16.1
2021-12-20 15:54:41 -08:00
3644d97dd8 Merge pull request #4613 from SparkiDev/sp_div_max
SP math all: div handling of length of dividend
2021-12-20 15:10:35 -08:00
360a513696 Merge pull request #4553 from SparkiDev/sp_mont_inv_order_fix
SP: fix when mont_mul_order is defined
2021-12-20 15:09:08 -08:00
463d050d3d Merge pull request #4678 from dgarske/nightly
Nightly fixes: PK with no AES and OCSP test with DTLS
2021-12-21 09:00:22 +10:00
0ce9703768 Merge pull request #4666 from SparkiDev/ecc_enc_mem
ECC: better protection when using encrypted memory
2021-12-20 14:48:13 -08:00
bb306d14b7 Merge pull request #4643 from kareem-wolfssl/zd13328
Fix building with OPENSSL_EXTRA defined and NO_WOLFSSL_STUB not defined.
2021-12-21 08:02:17 +10:00
d588437504 Merge pull request #4677 from anhu/oqs_to_pqc
--with-liboqs now defines HAVE_LIBOQS and HAVE_PQC
2021-12-20 13:00:30 -08:00
d8b58b8b05 Put both DigiCert Global Root CA and GlobalSign Root CA into the Google CA list. Fixes --enable-dtls --enable-ocsp ./scripts/ocsp.test`. 2021-12-20 11:47:34 -08:00
ebc64db7d0 Fix for --enable-pkcallbacks --disable-aes --disable-aesgcm. 2021-12-20 10:17:50 -08:00
b290e8089c Merge pull request #4672 from SparkiDev/sp_c_mont_red
SP C: specific Montgomery reduction code for P256 and P384
2021-12-20 09:50:54 -08:00
79f6301521 Add error for case of user defining HAVE_PQC without HAVE_LIBOQS. 2021-12-20 12:42:09 -05:00
7d4c13b9a4 --with-liboqs now defines HAVE_LIBOQS and HAVE_PQC
AKA: The Great Rename of December 2021
2021-12-20 11:48:03 -05:00
93712fcfbd fallback in software imp if callback not supporting operation ie: NULL salt 2021-12-20 17:34:27 +08:00
d1f850273f add hkdf-extract to iotsafe implementation + sample application 2021-12-20 17:33:24 +08:00
6d2da74c21 Merge pull request #4625 from dgarske/zd13208
Fix for PKCS7 verify to handle content type OID with indef BER encoding
2021-12-20 14:49:59 +10:00
ce4f436d0f Merge pull request #4587 from SparkiDev/dis_algs_fix_1
Disable algorithms: fixes
2021-12-19 20:12:30 -08:00
2477574a69 Fix for PKCS7 verify to handle pkcs7-data content type OID with indef BER encoding. ZD13208 2021-12-17 14:24:35 -08:00
ab9eda636a Merge pull request #4671 from lealem47/remove-n
Removing extra \n from WOLFSSL_LEAVE and WOLFSSL_ENTER
2021-12-17 14:04:42 -08:00
b45f1ed761 KCAPI ECDSA Memory
Use page aligned memory when using ECDSA signing and verify.
2021-12-17 11:11:16 -08:00
97830b81d6 Merge pull request #4674 from anhu/uninitialized
Fix unitialized usage
2021-12-17 10:51:43 -08:00
771647615a Merge pull request #4669 from douzzer/rehab-configure-fips
FIPS configure cleanup
2021-12-17 08:58:44 -08:00
9cc1624023 Fix unitialized usage 2021-12-17 11:55:08 -05:00
2f0b451545 Merge pull request #4673 from julek-wolfssl/should-retry-fix
Fix `test_wolfSSL_BIO_should_retry` test
2021-12-17 08:16:16 -07:00
21a5a571e8 Fix test_wolfSSL_BIO_should_retry test
When `OPENSSL_COMPATIBLE_DEFAULTS` is defined then `SSL_MODE_AUTO_RETRY` is set on context creation. For this test we need to clear this mode so that the `WOLFSSL_CBIO_ERR_WANT_READ` can propagate up to the user.
2021-12-17 12:32:25 +01:00
bd515cd3a6 Merge pull request #4637 from SparkiDev/sp_c32_rsa
SP C RSA: normalize tmpa after conditionally adding p
2021-12-16 18:54:28 -08:00
6cac0ea5a9 SP C: specific Montgomery reduction code for P256 and P384
Improves performance of 32-bit and 64-bit SP C code.
2021-12-17 12:00:16 +10:00
5c6bd8c2c9 configure.ac: in fips v5 setup, consider HAVE_AES{CCM,CTR,GCM,OFB}_PORT when auto-setting -DWOLFSSL_AES_DIRECT -DHAVE_AES_ECB; refactor KCAPI options for readability and correctness. 2021-12-16 17:03:01 -06:00
0b2b218de7 ECC: better protection when using encrypted memory
Added new ECC scalar multiplication implementation.
2021-12-17 08:30:45 +10:00
a79440b95a Removing extra \n from WOLFSSL_LEAVE and WOLFSSL_ENTER 2021-12-16 13:30:43 -07:00
f889916fae ssl.c: fix C++ invalid conversion in wolfSSL_sk_X509_INFO_value(). 2021-12-16 13:29:17 -06:00
e35c3c0d71 wolfcrypt/src/wc_port.c: fix whitespace. 2021-12-16 13:01:01 -06:00
cf16480c85 configure.ac: fix hard tabs, and fix fips "v5-ready" that should have been "v5-dev". 2021-12-16 13:00:10 -06:00
b7307e0ca5 ecc.c: small stack refactor for mp_int on the stack in wc_ecc_gen_deterministic_k(). 2021-12-16 13:00:10 -06:00
fed5eb1d94 ecc.c: fix a deadcode.DeadStores warning in wc_ecc_gen_deterministic_k(). 2021-12-16 13:00:10 -06:00
b6b12fe946 configure.ac: fips cleanup: drop flavor keys "v5-REL" (confusing); drop "v3" aka "v3-ready" (no longer buildable); add flavor "v5-dev" aka "dev"; refactor the "v5*" case of the FIPS setup switch to impose feature locks for v5 and v5-ready, but allow feature overrides with the new v5-dev; fix a debugging echo in the v2 case added in 1c27654300. 2021-12-16 13:00:10 -06:00
dec78169bf Merge pull request #4658 from julek-wolfssl/apache-2.4.51
Add Apache 2.4.51 support
2021-12-16 08:52:10 -08:00
ea2245c4d1 Merge pull request #4656 from JacobBarthelmeh/SanityChecks
sanity check before reading policy constraint
2021-12-16 08:42:19 -08:00
424bd2d73d Merge pull request #4599 from julek-wolfssl/issue-4593
Add WOLFSSL_FORCE_AUTO_RETRY option: force retrying of network reads
2021-12-16 08:42:07 -08:00
3bd737b9ef Merge pull request #4665 from miyazakh/sce_fsp_update_v3p5 2021-12-16 09:39:13 -07:00
7699d92935 Merge pull request #4664 from anhu/Fix_ENCRYPT_LEN
Do not let anything override HAVE_LIBOQS when setting ENCRYPT_LEN
2021-12-16 07:51:32 -08:00
44cc9e4824 Fix - wolfSSL_init should cleanup on failure of a component 2021-12-16 09:50:50 -06:00
afa6237f56 Add WOLFSSL_FORCE_AUTO_RETRY option: force retrying of network reads 2021-12-16 15:33:30 +01:00
d5783d1eaa Missing config for krb5 1.16.1 2021-12-16 14:35:39 +01:00
017d6cf464 Simplify error queue macros 2021-12-16 12:39:58 +01:00
e78f7f734e Add Apache 2.4.51 support
- Define `OPENSSL_COMPATIBLE_DEFAULTS` and `WOLFSSL_NO_OCSP_ISSUER_CHECK` for Apache config
- Fix `SSL_set_timeout` to match OpenSSL signature
- Implement `pkey` in `X509_INFO`
- Detect attempt to connect with plain HTTP
- Implement `wolfSSL_OCSP_request_add1_nonce`
- Set `ssl->cipher.bits` when calling `wolfSSL_get_current_cipher`
- Use custom flush method in `wolfSSL_BIO_flush` when set in BIO method
- Set the TLS version options in the `ssl->options` at the end of ClientHello parsing
- Don't modify the `ssl->version` when in a handshake (`ssl->msgsReceived.got_client_hello` is set)
- `wolfSSL_get_shutdown` returns a full bidirectional return when the SSL object is cleared. `wolfSSL_get_shutdown` calls `wolfSSL_clear` on a successful shutdown so if we detect a cleared SSL object, assume full shutdown was performed.
2021-12-16 12:39:38 +01:00
fa913f797a Merge pull request #4657 from SparkiDev/sakke_cond_add
SAKKE: fixup cond add to use all words
2021-12-16 07:40:13 +01:00
63ade421c1 fix redundat #ifdef 2021-12-16 09:30:21 +09:00
bd7e19b8fe Merge pull request #4639 from JacobBarthelmeh/ECC
deterministic ECC sign edge case fix and add variant
2021-12-16 08:48:37 +10:00
abe8696852 Merge pull request #4642 from cconlon/pubKeyDerFromX509
Add wc_GetPubKeyDerFromCert()
2021-12-15 14:30:58 -08:00
7975ead1af Do not let anything override HAVE_LIBOQS when setting ENCRYPT_LEN because oqs wants biggest value. 2021-12-15 14:48:50 -05:00
e1cee463b6 Merge pull request #4662 from douzzer/20211214-fixits
20211214 fixits
2021-12-15 10:47:50 -08:00
463118005f Merge pull request #4663 from ejohnstown/revert-pr
Revert configure.ac PR
2021-12-15 12:33:19 -06:00
8688bd43f1 Revert "Swap v5-ready (exception) and v5, add the wildcard back in for all non-ready cases"
This reverts commit 23fbf2e786.
2021-12-15 10:24:05 -08:00
1b6e0c45d0 Merge pull request #4660 from kaleb-himes/FIPS_READY_KCAPI_FOLLOWUP
Swap v5-ready (exception) and v5, add the wildcard back in for all non-ready cases
2021-12-15 10:16:33 -08:00
5172130287 add wc_GetPubKeyDerFromCert(), get pub key DER from DecodedCert 2021-12-15 11:04:52 -07:00
9af9d96cc7 Update README for FSP v3.5.0
fix tyo
2021-12-15 15:46:16 +09:00
a773cdfd5d pkcs12.c wc_d2i_PKCS12_fp(): mollify Visual Studio (false positives C4701 and C4703). 2021-12-14 18:33:24 -06:00
242eb2dcf1 wolfcrypt/src/pkcs12.c: fix scan-build deadcode.DeadStores gripe. 2021-12-14 18:08:54 -06:00
eb032e0266 configure.ac: refactor changes of 7cccaa98b7 around FIPS v5*. 2021-12-14 18:08:12 -06:00
23fbf2e786 Swap v5-ready (exception) and v5, add the wildcard back in for all non-ready cases 2021-12-14 13:28:35 -07:00
a6c7d56c32 Merge pull request #4655 from haydenroche5/wc_pkcs12_from_file
Add wc_d2i_PKCS12_fp to parse a PKCS #12 file directly in wolfCrypt.
2021-12-14 08:58:57 -08:00
994e370db3 SAKKE: fixup cond add to use all words 2021-12-14 12:02:59 +10:00
2359045b28 Merge pull request #4649 from kaleb-himes/KCAPI_FIPS_READY
The minimal changes needed to add KCAPI support with fips-ready
2021-12-13 17:33:03 -08:00
92d207a1cd Add wc_d2i_PKCS12_fp to parse a PKCS #12 file directly in wolfCrypt. 2021-12-13 15:28:34 -08:00
a2cf234100 sanity check before reading policy constraint 2021-12-13 14:32:46 -08:00
f5cd61e4f9 Merge pull request #4654 from embhorn/zd13375
Fix _sp_exptmod_base_2 to init vars.
2021-12-14 07:38:20 +10:00
7fd1b7aa51 Merge pull request #4650 from anhu/changelog
Mention falcon in the changelog
2021-12-13 10:37:07 -08:00
638d00f593 Merge pull request #4634 from danielinux/iotsafe-16bit-id
IoT-SAFE module: improvements and bug fixes
2021-12-13 11:33:19 -07:00
caf9024984 Merge pull request #4652 from douzzer/no-rsa-no-dh-no-dsa
WOLFSSL_ECC_NO_SMALL_STACK etc
2021-12-13 10:12:14 -08:00
9a85638ac3 Merge pull request #4647 from anhu/evp_pkey_dummy_falcon
In d2iGenericKey(), if a falcon key is encountered, make a dummy pkey.
2021-12-13 10:12:07 -08:00
53eb5d2e5a Fix _sp_exptmod_base_2 to init vars. 2021-12-13 10:16:55 -06:00
355b779a3e feature gating tweaks to better support --disable-rsa --disable-dh --disable-dsa. also a whitespace fix in ssl.c. 2021-12-11 14:08:04 -06:00
2193df1d62 add WOLFSSL_ECC_NO_SMALL_STACK. 2021-12-10 23:57:14 -06:00
41d4aafa3f Merge pull request #4645 from haydenroche5/parse_cert_public
Make wolfCrypt ASN cert parsing functionality public.
2021-12-10 18:27:18 -08:00
eec9649049 Mention falcon in the changelog 2021-12-10 16:54:13 -05:00
7cccaa98b7 The minimal changes needed to add KCAPI support with fips-ready 2021-12-10 14:44:20 -07:00
4c12f0be95 Only one call to wc_falcon_init() and comment on 300. 2021-12-10 16:40:41 -05:00
1d8ff70900 In d2iGenericKey(), if a falcon key is encountered, make a dummy pkey.
This allows apache-httpd to work without PQ-specific patch along with a previous
pull request.
2021-12-10 14:18:42 -05:00
6764e7c15f Make wolfCrypt ASN cert parsing functionality public.
Currently, the `ParseCert` function is only available if `WOLFSSL_ASN_API` is
defined to `WOLFSSL_API`. The only way to achieve this without enabling the
compatibility layer is to define `WOLFSSL_TEST_CERT`. There are users defining
this so that they can parse certs with wolfCrypt, even though this doesn't seem
to be the original intent of the define. This commit adds the function
`wc_ParseCert` to the public wolfCrypt API. It's simply a wrapper around
`ParseCert`. Similarly, this commit adds `wc_InitDecodedCert` and
`wc_FreeDecodedCert` to the public API, which are wrappers around
`InitDecodedCert` and `FreeDecodedCert`, respectively.
2021-12-10 10:43:28 -08:00
dde8cd9039 Merge pull request #4646 from julek-wolfssl/SSL_OP_NO_COMPRESSION-redef-error
Fix redefinition error of `WOLFSSL_OP_NO_COMPRESSION`
2021-12-10 08:46:43 -08:00
65a0b71994 Merge pull request #4641 from anhu/priv_key_check
Actually do a private/public key check for FALCON.
2021-12-10 06:53:35 -08:00
e40ba00ece Fix redefinition error of WOLFSSL_OP_NO_COMPRESSION 2021-12-10 15:11:11 +01:00
6b5fa9d0ae remove consistency check; let it fail elsewhere. 2021-12-09 17:12:42 -05:00
b921161309 Merge pull request #4633 from SparkiDev/tls13_expired
TLS13: Skip if expired rather than turning off resuming
2021-12-09 14:10:42 -08:00
dd0e3d6ebf Merge pull request #4644 from kareem-wolfssl/iotsafe_class
Fix compiling Iotsafe with C++ by avoiding reserved keyword 'class'.
2021-12-09 09:10:24 -08:00
494abde3eb Better casting. 2021-12-09 09:45:28 -05:00
f02763b088 Fixes after review comments 2021-12-09 11:23:44 +01:00
4764c4d6fa Merge pull request #4636 from JacobBarthelmeh/client
print out PEM of peer cert with example client
2021-12-08 20:04:57 -08:00
32014c69fd TLS 13 session ticket timeout: fixup checks
Check difference between now and ticket seen from encrypted ticket
against timeout.
2021-12-09 12:43:30 +10:00
6da0cc1ced Merge pull request #4600 from dgarske/cust_oid
Support for Custom OID in subject and CSR request extension
2021-12-09 11:24:30 +10:00
4200cf1b4d Fix compiling Iotsafe with C++ by avoiding reserved keyword 'class'. 2021-12-08 17:17:58 -07:00
376be0f66a Fix building with OPENSSL_EXTRA defined and NO_WOLFSSL_STUB not defined. 2021-12-08 16:51:51 -07:00
7022eb6f89 Actually do a private/public key check for FALCON. 2021-12-08 18:04:11 -05:00
dac0c21989 Merge pull request #4640 from anhu/prevent_stack_corruption
Pass in pointer to a local size_t var, not word32 var to prevent stack corruption
2021-12-08 14:44:07 -08:00
cf0d3263ac Merge pull request #4628 from julek-wolfssl/issue-4623
Handle an `EPIPE` error from the socket
2021-12-09 08:08:56 +10:00
74442605fa Pass in pointer to a local size_t var, not word32 var to prevent stack corruption. 2021-12-08 16:01:52 -05:00
ad078a7358 adjust macro guard in example client 2021-12-08 13:45:37 -07:00
0446d93285 add deterministic k variant for ECC to enable all 2021-12-08 10:49:17 -07:00
dfce101b5b deterministic ECC sign edge case fix and add variant 2021-12-08 09:54:47 -07:00
dd0e1226b7 Merge pull request #4638 from miyazakh/sce_protect_iar_compiler 2021-12-08 09:50:16 -07:00
081d28f556 better handling for global index
fix function proto type definition
2021-12-08 11:42:23 +09:00
3b65a4876f SP C RSA: normalize tmpa after conditionally adding p
Numbers in a word get too big for fast mul implementation when not
normalized.
Only affects RSA keys where p < q.
2021-12-08 11:25:20 +10:00
9a07b3af9b print out PEM of peer cert with example client 2021-12-07 14:07:47 -07:00
8609d98122 Merge pull request #4635 from julek-wolfssl/PrintPubKeyEC-wrong-free
Return early on failed `key` init
2021-12-07 13:28:53 -07:00
223f25149b Return early on failed key init 2021-12-07 18:11:19 +01:00
96daf2bede Merge pull request #4632 from julek-wolfssl/PrintPubKeyEC-leak
`a` and `key` were not being freed => leak in `PrintPubKeyEC`
2021-12-07 07:20:05 -07:00
1cb8b34fba IoT-SAFE: minor fixes + doxygen for new API calls 2021-12-07 14:11:14 +01:00
9e73c324a4 iot-safe: Fixed debug printf, updated slot number for 16-bit demo 2021-12-07 14:11:14 +01:00
23982e4fb3 Fixed wolfIoT_ecc_keygen when key is stored during generation 2021-12-07 14:11:14 +01:00
b23d51ab78 Avoid looping on uart read after applet initialization fails 2021-12-07 14:11:14 +01:00
5da89c6275 Clear meaning for the return value of iotsafe_gen_keypair 2021-12-07 14:11:14 +01:00
4d483b0a28 iotsafe: allow init to continue with empty response 2021-12-07 14:11:13 +01:00
29e20eeadc Fix to rebase branch on current master 2021-12-07 14:11:13 +01:00
e551f439f4 Reworked expect_tok to fix NULL dereferences 2021-12-07 14:11:13 +01:00
0c0f36d67d IoT-SAFE: Minor fixes
- reverted length change in put public operation
- Loading CA from IoT-SAFE file slot in 16bit demo
2021-12-07 14:11:13 +01:00
2646747f2a Fixed 8bit variable overflow/useless code 2021-12-07 14:11:13 +01:00
0621ba061b Multiple fixes for IoT-SAFE
- Tested with a different SIM:
  - 16bit IDs
  - Directly retrieving public key from keygen function
  - larger response buffers (up to 256 bytes in ReadFile)
  - Fixed hardcoded length in ID buffers
2021-12-07 14:11:13 +01:00
2f17a7e626 Support longer-than-8bit IDs for IoTSAFE key/file slots 2021-12-07 14:11:13 +01:00
574d171357 Fix leak when mp_int = 0 in integer.c 2021-12-07 12:46:24 +01:00
85ec6054c6 TLS13: Skip if expired rather than turning off resuming 2021-12-07 13:58:38 +10:00
9f6aa36866 Merge pull request #4629 from dgarske/zd13337
Additional checking for side on TLS messages
2021-12-07 10:13:44 +10:00
e1b7363647 Fixes from peer review. 2021-12-06 16:12:07 -08:00
261d305b32 Merge pull request #4627 from cconlon/fipsOsSeed 2021-12-06 16:06:46 -08:00
d5c27fca7d Merge pull request #4626 from JacobBarthelmeh/certs
add human readable string of IP
2021-12-07 08:23:31 +10:00
579056a2f3 Subject raw should be populated with WOLFSSL_CERT_EXT. 2021-12-06 14:19:32 -08:00
e45c33a771 Merge pull request #4624 from miyazakh/jenkins_qt_failure 2021-12-06 09:53:34 -07:00
5107f6b752 Merge pull request #4630 from douzzer/20211204-nits
20211204 nits
2021-12-06 08:24:17 -08:00
96b8b11fba a and key were not being freed => leak in PrintPubKeyEC 2021-12-06 12:03:02 +01:00
30b68060fb configure.ac: fix whitespace; client.c: make gcc 5.4.0 -Wmaybe-uninitialized happy. 2021-12-04 00:57:49 -06:00
54c3e0ac73 Additional checking for side on TLS messages. ZD13337 2021-12-03 11:49:08 -08:00
e4bd5d9046 Handle an EPIPE error from the socket
Issue reported in https://github.com/wolfSSL/wolfssl/issues/4623
2021-12-03 17:44:53 +01:00
9eabf16ed8 fix redefinition of OS_Seed error with FIPS Ready on some compilers 2021-12-02 17:01:11 -07:00
1ec86ee4cc add human readable string of IP 2021-12-02 16:04:58 -07:00
b4c6140b64 Merge pull request #4442 from julek-wolfssl/kerberos
Add Kerberos 5 support
2021-12-02 09:07:34 -08:00
baee7bace4 Merge pull request #4584 from ethanlooney/nxp_se050_curve25519
Added curve25519 support for NXP SE050
2021-12-02 02:47:36 -08:00
a5bd6cde8d fix nigtly jenkins Qt Job failure 2021-12-02 16:37:48 +09:00
48b15b0dfb Merge pull request #4616 from SparkiDev/sp_int_mips32
SP math all: MIPS asm fix
2021-12-01 16:16:14 -08:00
9f611e8b80 Merge pull request #4589 from JacobBarthelmeh/native-lwip
Native LwIP support update
2021-12-01 10:37:13 -08:00
5c172ca955 Merge pull request #4622 from douzzer/fix-wolfsentry-build
wolfsentry fixes re HAVE_EX_DATA and wolfsentry_sockaddr
2021-12-01 08:16:07 -08:00
d06ada2ccc Merge pull request #4610 from julek-wolfssl/nginx-1.21.4
Add support for Nginx 1.21.4
2021-12-01 22:27:12 +10:00
aac1b406df Add support for Nginx 1.21.4
- Add KEYGEN to Nginx config
- Check for name length in `wolfSSL_X509_get_subject_name`
- Refactor `wolfSSL_CONF_cmd`
- Implement `wolfSSL_CONF_cmd_value_type`
- Don't forecfully overwrite side
- `issuerName` should be `NULL` since the name is empty
2021-12-01 09:49:52 +01:00
32db20143c wolfssl/test.h: fix --enable-wolfsentry CFLAGS=-pedantic. 2021-11-30 23:40:30 -06:00
3f65916f3a HAVE_EX_DATA: fix wolfssl/ssl.h and tests/api.c to build -DHAVE_EX_DATA but -UOPENSSL_EXTRA. 2021-11-30 23:39:16 -06:00
7b5b4015f6 Merge pull request #4621 from dgarske/zd13303 2021-11-30 21:04:41 -06:00
43ac0d3684 adjust test file for pritnf and test_pass 2021-11-30 16:41:02 -07:00
b69a1c860c Merge pull request #3996 from cconlon/pkcs7_detachedhash
adjust PKCS7_VerifySignedData to correctly verify precomputed content hash with detached signature
2021-11-30 12:46:46 -08:00
a0300f7ab0 Fixes for ECDSA_Size. If group is unknown set to -1, otherwise defaults to first ECC index. Fix the signature size calculation to use our existing enum and calculation logic. ZD13303 2021-11-30 12:33:49 -08:00
1e74c6f38d Merge pull request #4620 from JacobBarthelmeh/Testing
do not load example CA if not verifying peer
2021-11-30 12:17:58 -08:00
29517fd617 Merge pull request #4609 from danielinux/tls13_hkdf_callback
TLS 1.3: Add HKDF extract callback
2021-11-30 10:59:44 -08:00
6d4c067b72 Merge pull request #4607 from anhu/wolfcrypt_pq_benchmarks
Use wolfCrypt's benchmarking app to run the PQ algorithms.
2021-11-30 10:09:48 -08:00
0340b49ff9 do not load example CA if not verifying peer 2021-11-30 10:44:05 -07:00
d32f26de64 Merge pull request #4619 from kojo1/early_data
OpneSSL compat for SSL_read/write_early_data
2021-11-30 08:36:14 -08:00
d3d73f7a4e Merge pull request #4614 from SparkiDev/sp_exp_nct
SP math all: fix exponent bit count
2021-11-30 08:26:41 -08:00
37df78b082 Merge pull request #4615 from SparkiDev/mp_mulx
TFM: fix Intel MULX multiply
2021-11-30 08:26:17 -08:00
5a55baddad Merge pull request #4617 from SparkiDev/ecc_point_on_curve
ECC wc_ecc_point_is_on_curve: validate oridinates against prime
2021-11-30 08:25:47 -08:00
7a41089b12 Merge pull request #4618 from douzzer/wc-port-h-linuxkm-XSNPRINTF-XATOI
linuxkm wc_port.h macro scoping fix
2021-11-30 08:25:06 -08:00
78f4c84ee0 Merge pull request #4586 from SparkiDev/sp_gen_ecc_order
SP: fix range of k to be 1..n-1
2021-11-30 08:23:46 -08:00
c3b1d9f9e7 Cosmetic and prototypes changes after reviewer's comments 2021-11-30 10:06:54 +01:00
6af38a9f5b OpneSSL compat for SSL_read/write_early_data 2021-11-30 17:38:01 +09:00
a33ae21801 whitespace cleanups and portability/pedantic fixes 2021-11-29 23:58:39 -06:00
5fbdd2a2c0 wc_port.h: for linuxkm, move definitions of XSNPRINTF and XATOI macros outside the defined(BUILDING_WOLFSSL) gate, to prevent inclusion of stdio.h and stdlib.h from types.h when building application code. 2021-11-29 23:23:23 -06:00
567cd155ea ECC wc_ecc_point_is_on_curve: validate oridinates against prime 2021-11-30 14:17:41 +10:00
a7d538a82f SP math all: MIPS asm fix
Names $lo and $hi in register list are not supported with old GCC
compiler. Newer compiler also supports %lo and %hi.
2021-11-30 12:56:08 +10:00
9f6fd6abf9 TFM: fix Intel MULX multiply
Carry wasn't being handled properly.
2021-11-30 12:07:44 +10:00
e5e280b175 SP math all: fix exponent bit count
Only when using non-constant time implementation and modulus even.
2021-11-30 10:28:42 +10:00
a3d46bee32 SP math all: div handling of length of dividend
Fail when dividend is maximum size as we may be shifting left and
overflow when divisor is not on a word boundary.
2021-11-30 09:46:11 +10:00
f7c34d22e6 add calls to user callback and adjust formating 2021-11-29 15:56:00 -07:00
7221e06ff7 Merge pull request #4588 from miyazakh/sce_protect_mode_e2studio 2021-11-29 15:32:48 -07:00
9e2e0c06dc Merge pull request #4608 from miyazakh/esp_idf
Fix compile error on the latest ESP-IDF
2021-11-29 14:13:13 -07:00
80c16745c4 Merge pull request #4602 from embhorn/zd13296
Initialize global in TSIP port
2021-11-29 13:01:03 -08:00
8a2945fe66 More braces. 2021-11-29 15:56:44 -05:00
5aa8bc2983 Drop a brace. 2021-11-29 15:47:53 -05:00
c104ab2206 Merge pull request #4572 from SparkiDev/ecc_pub_decode
mp_sqrt: TonelliShanks algorithm doesn't handle zero
2021-11-29 12:27:36 -08:00
c78256702d Merge pull request #4604 from tmael/fix_cc_ecc
Fix Cryptocell ecc build
2021-11-29 11:01:33 -08:00
57fb5453cb Support for HKDF Extract callback 2021-11-29 14:51:13 +01:00
f6893789b9 add dummy_test_paths.h to include.am 2021-11-27 14:34:23 +09:00
a25c338007 fix build failures
update README to follow the latest ESP-IDF
2021-11-27 13:14:36 +09:00
fea438d07f Use wolfCrypt's benchmarking app to run the PQ algorithms. 2021-11-26 15:15:23 -05:00
fb4e39f00a addressed review comments prt1 2021-11-26 16:03:42 +09:00
b2c0bacb06 Fix Cryptocell ecc 2021-11-24 19:22:40 -08:00
ae0cefc48d Merge pull request #4603 from anhu/stop_OPENSSLEXTRA
Stop needlessly enabling ENABLED_OPENSSLEXTRA when enabling liboqs.
2021-11-24 13:46:31 -07:00
ffe7a84e3d Stop needlessly enabling ENABLED_OPENSSLEXTRA when enabling liboqs. 2021-11-24 14:09:19 -05:00
6d7e50d2ae Initialize global in TSIP port 2021-11-24 09:22:14 -06:00
be870e742d Edge case build fixes (cert gen only). 2021-11-23 15:12:48 -08:00
7396a0cb3a Resolves all peer review comments. Fixes to get Curve25519 working on real hardware. Regression testing fixes for ECC. 2021-11-23 15:03:53 -08:00
7524ededd3 Support for Custom OID in subject and CSR request extension:
* Adds new build option `WOLFSSL_CUSTOM_OID` for supplying a custom OID in a CSR
* Fixes in ASN template CSR generation.
* Fix to allow calling `wc_Ed25519PublicKeyToDer` and `wc_Ed448PublicKeyToDer` with NULL output buffer to get length only.
* Refactor of the certificate subject name encoding.
* Refactor of the OID's to consolidate.
* Improvements to the Domain Component API unit test.
ZD 12943
2021-11-23 09:51:13 -08:00
dcc2a2852c Merge pull request #4590 from JacobBarthelmeh/fuzzing
sanity check on pem size
2021-11-22 16:09:13 -08:00
f5239cc57e Merge pull request #4597 from cconlon/removeSwig
Remove swig wrapper
2021-11-22 15:31:40 -08:00
23e722be27 Merge pull request #4595 from masap/fix-linuxkm
Fix failure of make distclean when linuxkm is enabled
2021-11-22 12:01:21 -08:00
84be329ffb remove swig wrapper, now that we have dedicated Java and Python wrappers 2021-11-22 11:32:37 -07:00
89ed811e23 fix compile error when disabled SCEPROTECT 2021-11-22 21:36:02 +09:00
0de4136ad6 Rebase fixes 2021-11-22 13:10:55 +01:00
5fc2dadde1 Fix issue in wolfSSL_BN_rand_range causing random errors 2021-11-22 11:48:31 +01:00
1d7b2de074 Code review changes 2021-11-22 11:48:31 +01:00
3da810cb1b Implement OpenSSL API's
- `OBJ_DUP`
- `i2d_PKCS7`
- `BN_rshift1
- `BN_rshift` testing
- Add `--enable-krb`
2021-11-22 11:47:58 +01:00
e7c5f137be Implement BN_rand_range 2021-11-22 11:45:27 +01:00
82a9f74476 Compat updates
- implement `wolfSSL_PEM_X509_INFO_read`
- `wolfSSL_EVP_CipherUpdate` no-ops on `NULL` input
- add md4 support to `wolfSSL_EVP_MD_block_size` and `wolfSSL_EVP_MD_size`
2021-11-22 11:45:27 +01:00
ccbe184434 Implement CTS
Ciphertext stealing on top of CBC is implemented with `wolfSSL_CRYPTO_cts128_encrypt` and `wolfSSL_CRYPTO_cts128_decrypt` APIs
2021-11-22 11:45:27 +01:00
fa662c2ab1 AES_cbc_encrypt enc parameter flipped. 1 = encrypt 0 = decrypt
This change makes the `enc` parameter of `AES_cbc_encrypt` consistent with OpenSSL. This commit flips the meaning of this parameter now.
2021-11-22 11:45:27 +01:00
ace5d444a4 Fix failure of make distclean when linuxkm is enabled
$ make distclean
Making distclean in linuxkm
make[1]: Entering directory '/home/honma/git/wolfssl/linuxkm'
make[1]: *** No rule to make target 'distclean'.  Stop.
make[1]: Leaving directory '/home/honma/git/wolfssl/linuxkm'
make: *** [Makefile:6431: distclean-recursive] Error 1

Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
2021-11-22 05:50:38 +09:00
30a01a0758 Fix failure of check at commiting when linuxkm is enabled
Making check in linuxkm
make[2]: Entering directory '/home/honma/git/wolfssl/linuxkm'
make[2]: warning: -j13 forced in submake: resetting jobserver mode.
make[2]: *** No rule to make target 'check'.  Stop.
make[2]: Leaving directory '/home/honma/git/wolfssl/linuxkm'
make[1]: *** [Makefile:6431: check-recursive] Error 1
make[1]: Leaving directory '/home/honma/git/wolfssl'
make: *** [Makefile:6901: check] Error 2

Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
2021-11-22 05:50:38 +09:00
82eb23b300 addressed jenkins failures 2021-11-20 10:15:57 +09:00
5182e2a8c8 Merge pull request #4580 from kareem-wolfssl/minor_fixes
Check ssl->arrays in SendClientHello to avoid null dereference.  Allow building with fallthrough defined.
2021-11-19 16:55:01 -08:00
d00c7641ae addressed jenkins failure 2021-11-20 09:14:21 +09:00
f6c48bf7dc Merge pull request #4560 from kaleb-himes/OE30-OE31-non-fips-changes
OE30 and OE31 changes external to FIPS module for NetBSD builds
2021-11-19 15:49:30 -08:00
34346bab4f Merge pull request #4579 from JacobBarthelmeh/PKCS7
BER size adjustment with PKCS7
2021-11-19 14:49:03 -08:00
8de281c1d4 Fix minimum clang version for FALL_THROUGH. Not working properly before clang 11. 2021-11-19 15:16:56 -07:00
617668b9aa Merge pull request #4585 from kareem-wolfssl/encryptMacFix
Fix building Import/ExportOptions with HAVE_ENCRYPT_THEN_MAC undefined.
2021-11-19 13:45:16 -08:00
fd6d479888 Rework ssl and ssl->arrays NULL checks, and add to SendTls13ClientHello as well. 2021-11-19 14:19:27 -07:00
72d4dcce0f Fix updated FALL_THROUGH macro. Fix a couple of case statements and remove a trailing whitespace. 2021-11-19 14:13:02 -07:00
0772635972 Rework FALL_THROUGH definition to use fallthrough if defined. 2021-11-19 14:06:54 -07:00
930e1ac473 Check ssl->arrays in SendClientHello to avoid null dereference. Allow building with fallthrough defined. 2021-11-19 14:06:54 -07:00
5d49847147 sanity check on pem size 2021-11-19 13:55:03 -07:00
c3500fa24e Merge pull request #4581 from miyazakh/max_earlydata
add get_max_eraly_data
2021-11-19 09:42:01 -07:00
5a72fee3df Disable algorithms: fixes
WOLFSSL_PUBLIC_MP and disable algorithms didn't work because of api.c.
 - mp_cond_copy not available unless ECC compiled in
 - wc_export_int not available unless ECC compiled in
Enabling only DH and using SP with SP Math didn't work as the DH
parameters were too small.
sp_cmp is needed when only DH.
mp_set_int is was not available in SP math when RSA is not defined.
mp_set is close enough for the use cases.
Configure with SP and SP math but not RSA, DH and ECC didn't configure -
now default to small maths.
2021-11-19 16:56:33 +10:00
9a331d7072 update Readme 2021-11-19 15:35:06 +09:00
7e2fab6f4a warning with keil build and native lwip want read case 2021-11-18 22:58:50 -07:00
c84194ffc8 include renesas_cmn.h to am file 2021-11-19 14:44:45 +09:00
f50fcd918e support Renesas RA SCE protect mode on RA6M4 evaluation board 2021-11-19 14:22:16 +09:00
7e81372131 Merge pull request #4583 from dgarske/zd13242
Improve `ret` handling in the `ProcessPeerCerts` verify step.
2021-11-19 10:22:08 +10:00
af097401f2 SP: fix range of k to be 1..n-1
Was checking less than order - 2 then adding one.
i.e. 0..order-3 => 1..order-2
2021-11-19 09:40:26 +10:00
757f3b8105 Fix building Import/ExportOptions with HAVE_ENCRYPT_THEN_MAC undefined. 2021-11-18 16:06:22 -07:00
3054f20c6a Improve ret handling in the ProcessPeerCerts verify step. 2021-11-18 14:51:09 -08:00
2841b5c93b Merge pull request #3010 from kaleb-himes/ZD10203
Consistency in PP checking on use of WOLFSSL_CRYPTO_EX_DATA
2021-11-18 14:47:25 -08:00
9bc159a5ec addressed review comment 2021-11-19 07:24:46 +09:00
4324cf8f0a Correct cast from uint to uchar 2021-11-18 10:18:25 -07:00
5a85d63543 Added curve25519 support for NXP SE050
Reverted commented out lines from se050_port.h
2021-11-18 09:23:59 -07:00
e33156d0dc Merge pull request #4578 from kaleb-himes/OE33_NON_FIPS_CHANGES
OE33: Fix issues found by XCODE and add user_settings.h
2021-11-18 06:59:43 -08:00
d02e819e4c Merge pull request #4575 from SparkiDev/dh_enc_fix_2
ASN: DH private key encoding
2021-11-18 06:57:40 -08:00
618b9619c5 Merge pull request #4571 from anhu/init_sig_algs
Uninitialized var.
2021-11-18 22:46:37 +10:00
db3c0f7829 Merge pull request #4574 from masap/fix-asn1-integer-get
Fix invalid return value of ASN1_INTEGER_get()
2021-11-18 17:20:15 +10:00
483be08b1f add definition for early_data_status compat 2021-11-18 14:21:47 +09:00
6ba00f66cd Merge pull request #4573 from ejohnstown/fips-check-fix
Fix FIPS Check Script
2021-11-17 21:30:45 -06:00
b42a0d9712 native lwip update 2021-11-17 17:36:44 -07:00
7da0d524ff add get_max_eraly_data
support set/get_max_eraly_data compatibility layer
2021-11-18 09:07:32 +09:00
370570d19b ASN: DH private key encoding
Proper fix for sequence length when small keys.
2021-11-18 08:28:49 +10:00
4800db1f9d Enable max/min int test even when non 64bit platform
Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
2021-11-18 06:58:21 +09:00
cb3fc0c7ce Fix invalid return value of ASN1_INTEGER_get()
When DIGIT_BIT is less than SIZEOF_LONG * CHAR_BIT, ASN1_INTEGER_get() can
return invalid value. For example, with trailing program, ASN1_INTEGER_get()
unexpectedly returns -268435449 (0xf0000007) on i386.

On the i386 platform (DIGIT_BIT=28), the input value 0x7fffffff is separated
into 0xfffffff and 0x7 and stored in the dp array of mp_int. Previously,
wolfSSL_BN_get_word_1() returned 0xfffffff shifted by 28 bits plus 0x7, so this
patch fixed it to return 0xfffffff plus 0x7 shifted by 28 bits.

int main(void)
{
    ASN1_INTEGER *a;
    long val;
    int ret;

    a = ASN1_INTEGER_new();
    val = 0x7fffffff;
    ret = ASN1_INTEGER_set(a, val);
    if (ret != 1) {
        printf("ret=%d\n", ret);
    }

    if (ASN1_INTEGER_get(a) != val) {
        printf("ASN1_INTEGER_get=%ld\n", ASN1_INTEGER_get(a));
    }

    ASN1_INTEGER_free(a);

    return 0;
}

Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
2021-11-18 06:58:21 +09:00
ab0654bb64 remove something that slipped in 2021-11-17 16:38:30 -05:00
39edf8d206 pulled up a line. 2021-11-17 16:38:30 -05:00
49c7abb875 Changes suggested by SparkiDev. 2021-11-17 16:38:30 -05:00
5c48e74c7f 0xFF 2021-11-17 16:38:30 -05:00
0ae0b31509 The following config:
./configure --with-liboqs --enable-all --disable-psk --enable-intelasm --enable-aesni --enable-sp-math-all --enable-sp-asm CFLAGS="-O3"

Yeilds the following erorr:

src/internal.c: In function ‘DoServerKeyExchange’:
src/internal.c:24487:28: error: ‘sigAlgo’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
24487 |                         if (sigAlgo == ed448_sa_algo &&
      |                            ^

This fixes it.
2021-11-17 16:38:30 -05:00
38ec0bb31f Merge branch 'master' of github.com:wolfssl/wolfssl into OE33_NON_FIPS_CHANGES 2021-11-17 14:02:56 -07:00
995ef60ff1 Merge pull request #4577 from kaleb-himes/WINDOWS_AES_OFB_ON
Turn on AES-OFB mode in windows for FIPS=v5
2021-11-17 12:20:19 -08:00
37db5a9ab3 Add include.am(s) for new file(s) 2021-11-17 12:05:05 -07:00
ddf06b8161 BER size adjustment with PKCS7 2021-11-17 12:03:32 -07:00
f638df3575 Fix issues found by XCODE and add user_settings.h
Disable internal test settings by default
2021-11-17 11:00:56 -07:00
ef62fab4ea Update
1. WIN10 FIPS build should use version 5,2 now.
2. Update the v5-ready build ot use version 5,2.
3. Remove eol-whitespace from the benchmark source.
2021-11-17 09:19:34 -08:00
c7c682ba2a Move up to avoid breaking the patch applied for windows 2021-11-17 09:37:26 -07:00
dc6ec2b849 Turn on AES-OFB mode in windows for FIPS=v5 2021-11-17 09:22:58 -07:00
158ebcaa0a Add v5-RC10 to the list of allowed versions 2021-11-16 16:36:38 -08:00
a5e581506e Merge pull request #4570 from dgarske/android_keystore
Fixes for building wolfSSL with Android WPA Supplicant and KeyStore
2021-11-17 08:30:01 +10:00
e8e0bc0d49 Merge pull request #4552 from SparkiDev/sp_mod_exp_zero
SP: mod_exp with exponent of 0 is invalid
2021-11-16 08:29:13 -08:00
2b3ab855dd Fixes for building wolfSSL with Android WPA Supplicant and KeyStore. 2021-11-16 08:27:30 -08:00
33a6b8c779 Merge pull request #4531 from dgarske/cryptocb_aesccm
Added crypto callback support for AES CCM
2021-11-16 22:45:11 +10:00
8606788198 SP: mod_exp with exponent of 0 is invalid
Don't allow exponenetiation by 0 as it is cryptographically invalid and
not supported by the implementation.
Also check for even modulus in mod_exp.
2021-11-16 11:27:26 +10:00
1559e92dca Add crypto callback AES CCM test case. 2021-11-15 16:22:10 -08:00
d3fc8c229a mp_sqrt: TonelliShanks algorithm doesn't handle zero
(0 * 0) mod p = 0.
Modular reduce n and shortcut when 0.
2021-11-16 09:23:07 +10:00
6547bcb44c Consistency in PP checking on use of WOLFSSL_CRYPTO_EX_DATA 2021-11-11 17:47:17 -07:00
6bb86cf4da OE30 and OE31 changes external to FIPS module for NetBSD builds 2021-11-10 15:16:21 -07:00
ff3179012d SP: fix when mont_mul_order is defined
Customer configuration that failed:
./configure --enable-cryptonly --enable-ecc --enable-sp=yes,asm
--disable-rsa --disable-dh --disable-sha3 --disable-sha224 --disable-md5
--disable-sha --disable-pkcs12 --disable-memory --disable-chacha
--disable-poly1305 --disable-sha512 --disable-sha384 --disable-aesgcm
--disable-aescbc --disable-aes --disable-rng CFLAGS="-DNO_SIG_WRAPPER
-DWOLFSSL_PUBLIC_MP -DECC_USER_CURVES -DNO_ECC_SIGN -DNO_ECC_DHE
-DNO_ECC_KEY_EXPORT"
2021-11-09 17:50:21 +10:00
82c106be80 Added crypto callback support for AES CCM. 2021-11-02 09:53:55 -07:00
a8b6304e19 add unit test for wc_PKCS7_VerifySignedData_ex() with detached signature and content digest only 2021-10-25 15:52:19 -06:00
322cb05852 adjust PKCS7_VerifySignedData to correctly verify precomputed content hash with detached signature 2021-10-25 14:46:10 -06:00
1010 changed files with 379182 additions and 142764 deletions

58
.github/ISSUE_TEMPLATE/bug_report.yaml vendored Normal file
View File

@ -0,0 +1,58 @@
name: Bug Report
description: File a bug report
title: "[Bug]: "
labels: ["bug", "triage"]
body:
- type: markdown
attributes:
value: >
Thanks for reporting an bug. If you would prefer a private method,
please email support@wolfssl.com
- type: input
id: contact
attributes:
label: Contact Details
description: How can we get in touch with you if we need more info?
placeholder: ex. email@example.com
validations:
required: false
- type: input
id: version
attributes:
label: Version
description: What version were you using?
validations:
required: true
- type: textarea
id: details
attributes:
label: Description
description: |
Describe the issue in detail
Please include:
* Specific `./configure` options or `user_settings.h`
* Target and build environment
placeholder: |
Blinded by the light!
Code runs too fast. It's gone plaid!
...
validations:
required: true
- type: textarea
id: reproduce
attributes:
label: Reproduction steps
description: If possible please give instructions on how to reproduce.
placeholder: |
1. `./configure --enable-42`
2. `make question`
3.
...
validations:
required: false
- type: textarea
id: logs
attributes:
label: Relevant log output
description: Please copy and paste any relevant log output. This will be automatically formatted into code, so no need for backticks.
render: shell

28
.github/ISSUE_TEMPLATE/other.yaml vendored Normal file
View File

@ -0,0 +1,28 @@
name: General Issue
description: Request support with an issue
labels: ["triage"]
body:
- type: markdown
attributes:
value: >
Thanks for reporting an issue. If you would prefer a private method,
please email support@wolfssl.com
- type: input
id: version
attributes:
label: Version
description: What version were you using?
validations:
required: true
- type: textarea
id: details
attributes:
label: Description
description: |
Describe the issue in detail.
Please include specific configuration options or user_settings.h
placeholder: |
`./configure --enable-world-domination` fails
...
validations:
required: true

16
.github/PULL_REQUEST_TEMPLATE.md vendored Normal file
View File

@ -0,0 +1,16 @@
# Description
Please describe the scope of the fix or feature addition.
Fixes zd#
# Testing
How did you test?
# Checklist
- [ ] added tests
- [ ] updated/added doxygen
- [ ] updated appropriate READMEs
- [ ] Updated manual and documentation

12
.github/SECURITY.md vendored Normal file
View File

@ -0,0 +1,12 @@
# Security Policy
## Reporting a Vulnerability
If you discover a vulnerability, please report it to support@wolfssl.com
1. Include a detailed description
2. Include method to reproduce and/or method of discovery
3. We will evaulate the report promptly and respond to you with findings.
4. We will credit you with the report if you would like.
**Please keep the vulnerability private** until a fix has been released.

27
.gitignore vendored
View File

@ -208,14 +208,6 @@ TAGS
support/cyassl.pc
support/wolfssl.pc
cyassl/ctaocrypt/stamp-h1
swig/_cyassl.so
swig/_wolfssl.so
swig/cyassl.py
swig/wolfssl.py
swig/cyassl.pyc
swig/wolfssl.pyc
swig/cyassl_wrap.c
swig/wolfssl_wrap.c
stamp-h1
clang_output_*
internal.plist
@ -235,6 +227,7 @@ IDE/MDK-ARM/LPC43xx/LPC43xx/
!linuxkm/Makefile
/Kbuild
linuxkm/*.ko
linuxkm/*.ko.signed
linuxkm/Module.symvers
linuxkm/built-in.a
linuxkm/modules.order
@ -362,6 +355,24 @@ IDE/XCODE/Index
/IDE/Renesas/e2studio/Projects/test/*.launch
/IDE/Renesas/e2studio/Projects/test/*.scfg
/IDE/Renesas/e2studio/RX65N/GR-ROSE/.metadata
/IDE/Renesas/e2studio/RX65N/GR-ROSE/smc/src
/IDE/Renesas/e2studio/RX65N/GR-ROSE/smc/trash
/IDE/Renesas/e2studio/RX65N/GR-ROSE/test/src/smc_gen
/IDE/Renesas/e2studio/RX65N/GR-ROSE/test/generate
/IDE/Renesas/e2studio/RX65N/RSK/.metadata
/IDE/Renesas/e2studio/RX65N/RSK/smc/src
/IDE/Renesas/e2studio/RX65N/RSK/smc/trash
/IDE/Renesas/e2studio/RX65N/RSK/test/src/smc_gen
/IDE/Renesas/e2studio/RX65N/RSK/test/generate
/IDE/Renesas/e2studio/RX72N/EnvisionKit/.metadata
/IDE/Renesas/e2studio/RX72N/EnvisionKit/smc/src
/IDE/Renesas/e2studio/RX72N/EnvisionKit/smc/trash
/IDE/Renesas/e2studio/RX72N/EnvisionKit/test/src/smc_gen
/IDE/Renesas/e2studio/RX72N/EnvisionKit/test/generate
# QNX CAAM
/IDE/QNX/example-server/server-tls
/IDE/QNX/example-client/client-tls

File diff suppressed because it is too large Load Diff

View File

@ -1,3 +1,375 @@
# wolfSSL Release 5.3.0 (May 3rd, 2022)
Release 5.3.0 of wolfSSL embedded TLS has bug fixes and new features including:
## New Feature Additions
### Ports
* Updated support for Stunnel to version 5.61
* Add i.MX8 NXP SECO use for secure private ECC keys and expand cryptodev-linux for use with the RSA/Curve25519 with the Linux CAAM driver
* Allow encrypt then mac with Apache port
* Update Renesas TSIP version to 1.15 on GR-ROSE and certificate signature data for TSIP / SCE example
* Add IAR MSP430 example, located in IDE/IAR-MSP430 directory
* Add support for FFMPEG with the enable option `--enable-ffmpeg`, FFMPEG is used for recording and converting video and audio (https://ffmpeg.org/)
* Update the bind port to version 9.18.0
### Post Quantum
* Add Post-quantum KEM benchmark for STM32
* Enable support for using post quantum algorithms with embedded STM32 boards and port to STM32U585
### Compatibility Layer Additions
* Add port to support libspdm (https://github.com/DMTF/libspdm/blob/main/README.md), compatibility functions added for the port were:
- ASN1_TIME_compare
- DH_new_by_nid
- OBJ_length, OBJ_get0_data,
- EVP layer ChaCha20-Poly1305, HKDF
- EC_POINT_get_affine_coordinates
- EC_POINT_set_affine_coordinates
* Additional functions added were:
- EC_KEY_print_fp
- EVP_PKEY_paramgen
- EVP_PKEY_sign/verify functionality
- PEM_write_RSAPublicKey
- PEM_write_EC_PUBKEY
- PKCS7_sign
- PKCS7_final
- SMIME_write_PKCS7
- EC_KEY/DH_up_ref
- EVP_DecodeBlock
- EVP_EncodeBlock
- EC_KEY_get_conv_form
- BIO_eof
- Add support for BIO_CTRL_SET and BIO_CTRL_GET
* Add compile time support for the type SSL_R_NULL_SSL_METHOD_PASSED
* Enhanced X509_NAME_print_ex() to support RFC5523 basic escape
* More checks on OPENSSL_VERSION_NUMBER for API prototype differences
* Add extended key usage support to wolfSSL_X509_set_ext
* SSL_VERIFY_FAIL_IF_NO_PEER_CERT now can also connect with compatibility layer enabled and a TLS 1.3 PSK connection is used
* Improve wolfSSL_BN_rand to handle non byte boundaries and top/bottom parameters
* Changed X509_V_ERR codes to better match OpenSSL values used
* Improve wolfSSL_i2d_X509_name to allow for a NULL input in order to get the expected resulting size
* Enhance the smallstack build to reduce stack size farther when built with compatibility layer enabled
### Misc.
* Sniffer asynchronous support addition, handling of DH shared secret and tested with Intel QuickAssist
* Added in support for OCSP with IPv6
* Enhance SP (single precision) optimizations for use with the ECC P521
* Add new public API wc_CheckCertSigPubKey() for use to easily check the signature of a certificate given a public key buffer
* Add CSR (Certificate Signing Request) userId support in subject name
* Injection and parsing of custom extensions in X.509 certificates
* Add WOLF_CRYPTO_CB_ONLY_RSA and WOLF_CRYPTO_CB_ONLY_ECC to reduce code size if using only crypto callback functions with RSA and ECC
* Created new --enable-engine configure flag used to build wolfSSL for use with wolfEngine
* With TLS 1.3 PSK, when WOLFSSL_PSK_MULTI_ID_PER_CS is defined multiple IDs for a cipher suite can be handled
* Added private key id/label support with improving the PK (Public Key) callbacks
* Support for Intel QuickAssist ECC KeyGen acceleration
* Add the function wolfSSL_CTX_SetCertCbCtx to set user context for certificate call back
* Add the functions wolfSSL_CTX_SetEccSignCtx(WOLFSSL_CTX* ctx, void *userCtx) and wolfSSL_CTX_GetEccSignCtx(WOLFSSL_CTX* ctx) for setting and getting a user context
* wolfRand for AMD --enable-amdrand
## Fixes
### PORT Fixes
* KCAPI memory optimizations and page alignment fixes for ECC, AES mode fixes and reduction to memory usage
* Add the new kdf.c file to the TI-RTOS build
* Fix wait-until-done in RSA hardware primitive acceleration of ESP-IDF port
* IOTSafe workarounds when reading files with ending 0s and for ECC signatures
### Math Library Fixes
* Sanity check with SP math that ECC points ordinates are not greater than modulus length
* Additional sanity checks that _sp_add_d does not error due to overflow
* Wycheproof fixes, testing integration, and fixes for AVX / AArch64 ASM edge case tests
* TFM fp_div_2_ct rework to avoid potential overflow
### Misc.
* Fix for PKCS#7 with Crypto Callbacks
* Fix for larger curve sizes with deterministic ECC sign
* Fixes for building wolfSSL alongside openssl using --enable-opensslcoexist
* Fix for compatibility layer handling of certificates with SHA256 SKID (Subject Key ID)
* Fix for wolfSSL_ASN1_TIME_diff erroring out on a return value of 0 from mktime
* Remove extra padding when AES-CBC encrypted with PemToDer
* Fixes for TLS v1.3 early data with async.
* Fixes for async disables around the DevCopy calls
* Fixes for Windows AES-NI with clang compiler
* Fix for handling the detection of processing a plaintext TLS alert packet
* Fix for potential memory leak in an error case with TLSX supported groups
* Sanity check on `input` size in `DecodeNsCertType`
* AES-GCM stack alignment fixes with assembly code written for AVX/AVX2
* Fix for PK callbacks with server side and setting a public key
## Improvements/Optimizations
### Build Options and Warnings
* Added example user settings template for FIPS v5 ready
* Automake file touch cleanup for use with Yocto devtool
* Allow disabling forced 'make clean' at the end of ./configure by using --disable-makeclean
* Enable TLS 1.3 early data when specifying `--enable-all` option
* Disable PK Callbacks with JNI FIPS builds
* Add a FIPS cert 3389 ready option, this is the fips-ready build
* Support (no)inline with Wind River Diab compiler
* ECDH_compute_key allow setting of globalRNG with FIPS 140-3
* Add logic equivalent to configure.ac in settings.h for Poly1305
* Fixes to support building opensslextra with SP math
* CPP protection for extern references to x86_64 asm code
* Updates and enhancements for Espressif ESP-IDF wolfSSL setup_win.bat
* Documentation improvements with auto generation
* Fix reproducible-build for working an updated version of libtool, version 2.4.7
* Fixes for Diab C89 and armclang
* Fix `mcapi_test.c` to include the settings.h before crypto.h
* Update and handle builds with NO_WOLFSSL_SERVER and NO_WOLFSSL_CLIENT
* Fix for some macro defines with FIPS 140-3 build so that RSA_PKCS1_PSS_PADDING can be used with RSA sign/verify functions
### Math Libraries
* Add RSA/DH check for even modulus
* Enhance TFM math to handle more alloc failure cases gracefully
* SP ASM performance improvements mostly around AArch64
* SP ASM improvements for additional cache attack resistance
* Add RSA check for small difference between p and q
* 6-8% performance increase with ECC operations using SP int by improving the Montgomery Reduction
### Testing and Validation
* All shell scripts in source tree now tested for correctness using shellcheck and bash -n
* Added build testing under gcc-12 and -std=c++17 and fixed warnings
* TLS 1.3 script test improvement to wait for server to write file
* Unit tests for ECC r/s zeroness handling
* CI server was expanded with a very “quiet” machine that can support multiple ContantTime tests ensuring ongoing mitigation against side-channel timing based attacks. Algorithms being assessed on this machine are: AES-CBC, AES-GCM, CHACHA20, ECC, POLY1305, RSA, SHA256, SHA512, CURVE25519.
* Added new multi configuration windows builds to CI testing for greater testing coverage of windows use-cases
### Misc.
* Support for ECC import to check validity of key on import even if one of the coordinates (x or y) is 0
* Modify example app to work with FreeRTOS+IoT
* Ease of access for cert used for verifying a PKCS#7 bundle
* Clean up Visual Studio output and intermediate directories
* With TLS 1.3 fail immediately if a server sends empty certificate message
* Enhance the benchmark application to support multi-threaded testing
* Improvement for `wc_EccPublicKeyToDer` to not overestimate the buffer size required
* Fix to check if `wc_EccPublicKeyToDer` has enough output buffer space
* Fix year 2038 problem in wolfSSL_ASN1_TIME_diff
* Various portability improvements (Time, DTLS epoch size, IV alloc)
* Prefer status_request_v2 over status_request when both are present
* Add separate "struct stat" definition XSTATSTRUCT to make overriding XSTAT easier for portability
* With SipHash replace gcc specific ASM instruction with generic
* Don't force a ECC CA when a custom CA is passed with `-A`
* Add peer authentication failsafe for TLS 1.2 and below
* Improve parsing of UID from subject and issuer name with the compatibility layer by
* Fallback to full TLS handshake if session ticket fails
* Internal refactoring of code to reduce ssl.c file size
# wolfSSL Release 5.2.0 (Feb 21, 2022)
## Vulnerabilities
* \[High\] A TLS v1.3 server who requires mutual authentication can be
bypassed. If a malicious client does not send the certificate_verify
message a client can connect without presenting a certificate even
if the server requires one. Thank you to Aina Toky Rasoamanana and
Olivier Levillain of Télécom SudParis.
* \[High\] A TLS v1.3 client attempting to authenticate a TLS v1.3
server can have its certificate check bypassed. If the sig_algo in
the certificate_verify message is different than the certificate
message checking may be bypassed. Thank you to Aina Toky Rasoamanana and
Olivier Levillain of Télécom SudParis.
## New Feature Additions
* Example applications for Renesas RX72N with FreeRTOS+IoT
* Renesas FSP 3.5.0 support for RA6M3
* For TLS 1.3, improved checks on order of received messages.
* Support for use of SHA-3 cryptography instructions available in
ARMv8.2-A architecture extensions. (For Apple M1)
* Support for use of SHA-512 cryptography instructions available in
ARMv8.2-A architecture extensions. (For Apple M1)
* Fixes for clang -Os on clang >= 12.0.0
* Expose Sequence Numbers so that Linux TLS (kTLS) can be configured
* Fix bug in TLSX_ALPN_ParseAndSet when using ALPN select callback.
* Allow DES3 with FIPS v5-dev.
* Include HMAC for deterministic ECC sign build
* Add --enable-chrony configure option. This sets build options needed
to build the Chrony NTP (Network Time Protocol) service.
* Add support for STM32U575xx boards.
* Fixes for NXPs SE050 Ed25519/Curve25519.
* TLS: Secure renegotiation info on by default for compatibility.
* Inline C code version of ARM32 assembly for cryptographic algorithms
available and compiling for improved performance on ARM platforms
* Configure HMAC: define NO_HMAC to disable HMAC (default: enabled)
* ISO-TP transport layer support added to wolfio for TLS over CAN Bus
* Fix initialization bug in SiLabs AES support
* Domain and IP check is only performed on leaf certificates
## ARM PSA Support (Platform Security Architecture) API
* Initial support added for ARMs Platform Security Architecture (PSA)
API in wolfCrypt which allows support of ARM PSA enabled devices by
wolfSSL, wolfSSH, and wolfBoot and wolfCrypt FIPS.
* Included algorithms: ECDSA, ECDH, HKDF, AES, SHA1, SHA256, SHA224, RNG
## ECICE Updates
* Support for more encryption algorithms: AES-256-CBC, AES-128-CTR,
AES-256-CTR
* Support for compressed public keys in messages.
## Math Improvements
* Improved performance of X448 and Ed448 through inlining Karatsuba in
square and multiplication operations for 128-bit implementation
(64-bit platforms with 128-bit type support).
* SP Math C implementation: fix for corner case in curve specific
implementations of Montgomery Reduction (P-256, P-384).
* SP math all: assembly snippets added for ARM Thumb. Performance
improvement on platform.
* SP math all: ARM64/32 sp_div_word assembly snippets added to remove
dependency on __udiv3.
* SP C implementation: multiplication of two signed types with overflow
is undefined in C. Now cast to unsigned type before multiplication is
performed.
* SP C implementation correctly builds when using CFLAG: -m32
## OpenSSL Compatibility Layer
* Added DH_get_2048_256 to compatibility layer.
* wolfSSLeay_version now returns the version of wolfSSL
* Added C++ exports for APIs in wolfssl/openssl/crypto.h. This allows
better compatibility when building with a C++ compiler.
* Fix for OpenSSL x509_NAME_hash mismatch
* Implement FIPS_mode and FIPS_mode_set in the compat layer.
* Fix for certreq and certgen options with openssl compatibility
* wolfSSL_BIO_dump() and wolfSSL_OBJ_obj2txt() rework
* Fix IV length bug in EVP AES-GCM code.
* Add new ASN1_INTEGER compatibility functions.
* Fix wolfSSL_PEM_X509_INFO_read with NO_FILESYSTEM
## CMake Updates
* Check for valid override values.
* Add `KEYGEN` option.
* Cleanup help messages.
* Add options to support wolfTPM.
## VisualStudio Updates
* Remove deprecated VS solution
* Fix VS unreachable code warning
## New Algorithms and Protocols
* AES-SIV (RFC 5297)
* DTLS SRTP (RFC 5764), used with WebRTC to agree on profile for new
real-time session keys
* SipHash MAC/PRF for hash tables. Includes inline assembly for
x86_64 and Aarch64.
## Remove Obsolete Algorithms
* IDEA
* Rabbit
* HC-128
# wolfSSL Release 5.1.1 (Jan 3rd, 2022)
Release 5.1.1 of wolfSSL embedded TLS has a high vulnerability fix:
### Vulnerabilities
* \[High\] In connections using AES-CBC or DES3 with TLS/DTLS 1.2 or 1.1 the IV being used is not random. Users using wolfSSL version 5.0.0 or 5.1.0 doing TLS/DTLS 1.2 or 1.1 connections, without AEAD only, should update the version of wolfSSL used. (CVE-2022-23408)
# wolfSSL Release 5.1.0 (Dec 27, 2021)
Release 5.1.0 of wolfSSL embedded TLS has bug fixes and new features including:
### Vulnerabilities
* \[Low\] Potential for DoS attack on a wolfSSL client due to processing hello packets of the incorrect side. This affects only connections using TLS v1.2 or less that have also been compromised by a man in the middle attack. Thanks to James Henderson, Mathy Vanhoef, Chris M. Stone, Sam L. Thomas, Nicolas Bailleut, and Tom Chothia (University of Birmingham, KU Leuven, ENS Rennes for the report.
* \[Low\] Client side session resumption issue once the session resumption cache has been filled up. The hijacking of a session resumption has been demonstrated so far with only non verified peer connections. That is where the client is not verifying the servers CA that it is connecting to. There is the potential though for other cases involving proxies that are verifying the server to be at risk, if using wolfSSL in a case involving proxies use wolfSSL_get1_session and then wolfSSL_SESSION_free when done where possible. If not adding in the session get/free function calls we recommend that users of wolfSSL that are resuming sessions update to the latest version (wolfSSL version 5.1.0 or later). Thanks to the UK's National Cyber Security Centre (NCSC) for the report.
### New Feature Additions
###### Ports
* Curve25519 support with NXP SE050 added
* Renesas RA6M4 support with SCE Protected Mode and FSP 3.5.0
* Renesas TSIP 1.14 support for RX65N/RX72N
###### Post Quantum
* Post quantum resistant algorithms used with Apache port
* NIST round 3 FALCON Signature Scheme support added to TLS 1.3 connections
* FALCON added to the benchmarking application
* Testing of cURL with wolfSSL post quantum resistant build
###### Compatibility Layer Additions
* Updated NGINX port to NGINX version 1.21.4
* Updated Apache port to Apache version 2.4.51
* Add support for SSL_OP_NO_TLSv1_2 flag with wolfSSL_CTX_set_options function
* Support added for the functions
- SSL_CTX_get_max_early_data
- SSL_CTX_set_max_early_data
- SSL_set_max_early_data
- SSL_get_max_early_data
- SSL_CTX_clear_mode
- SSL_CONF_cmd_value_type
- SSL_read_early_data
- SSL_write_early_data
###### Misc.
* Crypto callback support for AES-CCM added. A callback function can be registered and used instead of the default AES-CCM implementation in wolfSSL.
* Added AES-OFB to the FIPS boundary for future FIPS validations.
* Add support for custom OIDs used with CSR (certificate signing request) generation using the macro WOLFSSL_CUSTOM_OID
* Added HKDF extract callback function for use with TLS 1.3
* Add variant from RFC6979 of deterministic ECC signing that can be enabled using the macro WOLFSSL_ECDSA_DETERMINISTIC_K_VARIANT
* Added the function wc_GetPubKeyDerFromCert to get the public key from a DecodedCert structure
* Added the functions wc_InitDecodedCert, wc_ParseCert and wc_FreeDecodedCert for access to decoding a certificate into a DecodedCert structure
* Added the macro WOLFSSL_ECC_NO_SMALL_STACK for hybrid builds where the numerous malloc/free with ECC is undesired but small stack use is desired throughout the rest of the library
* Added the function wc_d2i_PKCS12_fp for reading a PKCS12 file and parsing it
### Fixes
###### PORT Fixes
* Building with Android wpa_supplicant and KeyStore
* Setting initial value of CA certificate with TSIP enabled
* Cryptocell ECC build fix and fix with RSA disabled
* IoT-SAFE improvement for Key/File slot ID size, fix for C++ compile, and fixes for retrieving the public key after key generation
###### Math Library Fixes
* Check return values on TFM library montgomery function in case the system runs out of memory. This resolves an edge case of invalid ECC signatures being created.
* SP math library sanity check on size of values passed to sp_gcd.
* SP math library sanity check on exponentiation by 0 with mod_exp
* Update base ECC mp_sqrtmod_prime function to handle an edge case of zero
* TFM math library with Intel MULX multiply fix for carry in assembly code
###### Misc.
* Fix for potential heap buffer overflow with compatibility layer PEM parsing
* Fix for edge memory leak case with an error encountered during TLS resumption
* Fix for length on inner sequence created with wc_DhKeyToDer when handling small DH keys
* Fix for sanity check on input argument to DSA sign and verify
* Fix for setting of the return value with ASN1 integer get on an i386 device
* Fix for BER to DER size checks with PKCS7 decryption
* Fix for memory leak with PrintPubKeyEC function in compatibility layer
* Edge case with deterministic ECC key generation when the private key has leading 0s
* Fix for build with OPENSSL_EXTRA and NO_WOLFSSL_STUB both defined
* Use page aligned memory with ECDSA signing and KCAPI
* Skip expired sessions for TLS 1.3 rather than turning off the resume behavior
* Fix for DTLS handling dropped or retransmitted messages
### Improvements/Optimizations
###### Build Options and Warnings
* Bugfix: could not build with liboqs and without DH enabled
* Build with macro NO_ECC_KEY_EXPORT fixed
* Fix for building with the macro HAVE_ENCRYPT_THEN_MAC when session export is enabled
* Building with wolfSentry and HAVE_EX_DATA macro set
###### Math Libraries
* Improvement for performance with SP C implementation of montgomery reduction for ECC (P256 and P384) and SP ARM64 implementation for ECC (P384)
* With SP math handle case of dividing by length of dividend
* SP math improvement for lo/hi register names to be used with older GCC compilers
###### Misc.
* ASN name constraints checking code refactor for better efficiency and readability
* Refactor of compatibility layer stack freeing calls to simplify and reduce code
* Scrubbed code for trailing spaces, hard tabs, and any control characters
* Explicit check that leaf certificate's public key type match cipher suite signature algorithm
* Additional NULL sanity checks on WOLFSSL struct internally and improve switch statement fallthrough
* Retain OCSP error value when CRL is enabled with certificate parsing
* Update to NATIVE LwIP support for TCP use
* Sanity check on PEM size when parsing a PEM with OpenSSL compatibility layer API.
* SWIG wrapper was removed from the codebase in favor of dedicated Java and Python wrappers.
* Updates to bundled example client for when to load the CA, handling print out of IP alt names, and printing out the peers certificate in PEM format
* Handling BER encoded inner content type with PKCS7 verify
* Checking for SOCKET_EPIPE errors from low level socket
* Improvements to cleanup in the case that wolfSSL_Init fails
* Update test and example certificates expiration dates
# wolfSSL Release 5.0.0 (Nov 01, 2021)
Release 5.0.0 of wolfSSL embedded TLS has bug fixes and new features including:

View File

@ -17,6 +17,11 @@ cc_library_shared {
"-DWOLFSSL_USER_SETTINGS",
"-Os",
"-fomit-frame-pointer",
/* If using WOLFSSL_ARMASM then add these cflags for ARM crypto extensions */
/* "-mcpu=cortex-a73+crypto", */
/* "-march=armv8-a", */
/* "-mstrict-align", */
],
include_dirs: [
"external/wolfssl/wolfssl",
@ -68,10 +73,9 @@ cc_library_shared {
"./wolfcrypt/src/ge_operations.c",
"./wolfcrypt/src/hash.c",
"./wolfcrypt/src/kdf.c",
"./wolfcrypt/src/hc128.c",
"./wolfcrypt/src/hmac.c",
"./wolfcrypt/src/idea.c",
"./wolfcrypt/src/integer.c",
"./wolfcrypt/src/kdf.c",
"./wolfcrypt/src/logging.c",
"./wolfcrypt/src/md2.c",
"./wolfcrypt/src/md4.c",
@ -81,7 +85,6 @@ cc_library_shared {
"./wolfcrypt/src/pkcs7.c",
"./wolfcrypt/src/poly1305.c",
"./wolfcrypt/src/pwdbased.c",
"./wolfcrypt/src/rabbit.c",
"./wolfcrypt/src/random.c",
"./wolfcrypt/src/rc2.c",
"./wolfcrypt/src/ripemd.c",

View File

@ -8,12 +8,32 @@
#define HAVE_FIPS
#endif
#ifdef __aarch64__
#if !defined(__clang__) || \
(defined(__clang__) && defined(__clang_major__) && __clang_major__ >= 5)
/* older clang v4 has issue with inline assembly contraints */
#define WOLFSSL_ARMASM
#endif
#endif
#if 1 /* SP Assembly Speedups (wPAA) */
#define WOLFSSL_SP
#define WOLFSSL_SP_SMALL /* use smaller version of code */
#define WOLFSSL_HAVE_SP_RSA
#define WOLFSSL_HAVE_SP_DH
#define WOLFSSL_HAVE_SP_ECC
#ifdef WOLFSSL_ARMASM
#define WOLFSSL_SP_ARM64_ASM
#endif
#endif
/* WPA Supplicant Support */
#define WOLFSSL_WPAS_SMALL
#define OPENSSL_ALL
#define HAVE_THREAD_LS
#define USE_FAST_MATH
#define FP_MAX_BITS (4096*2) /* Maximum math bits (Max RSA key bits * 2) */
#define TFM_TIMING_RESISTANT
#define ECC_TIMING_RESISTANT
#define WC_RSA_BLINDING
@ -22,8 +42,8 @@
#if 1
#define WOLFSSL_TLS13
#define WC_RSA_PSS
#endif
#define WC_RSA_PSS
#define HAVE_SESSION_TICKET
#define HAVE_TLS_EXTENSIONS
#define HAVE_SUPPORTED_CURVES
@ -58,7 +78,10 @@
#define WOLFSSL_KEY_GEN
#define WC_RSA_NO_PADDING
#define WOLFSSL_DH_CONST
#define HAVE_FFDHE_2048
#define HAVE_FFDHE_3072
#define HAVE_FFDHE_4096
#define HAVE_DH_DEFAULT_PARAMS
#ifdef HAVE_FIPS
#define WOLFSSL_VALIDATE_FFC_IMPORT
@ -68,6 +91,9 @@
#define WOLFSSL_SHA224
#define WOLFSSL_SHA512
#define WOLFSSL_SHA384
#define WOLFSSL_NOSHA512_256
#define WOLFSSL_NOSHA512_224
#define WOLFSSL_SHA3
#define HAVE_HKDF
#define HAVE_PKCS8
@ -80,6 +106,9 @@
#define HAVE_ECC_CDH
#define WOLFSSL_VALIDATE_ECC_IMPORT
#endif
#ifdef __i386
#define TFM_NO_ASM
#endif
#define HAVE_AESGCM
#define HAVE_AESCCM
@ -93,9 +122,6 @@
#define NO_DSA
#define NO_RC4
#define NO_HC128
#define NO_RABBIT
#define NO_RC4
#define NO_PSK
#define WOLFSSL_NO_SHAKE256
#define NO_MD4

View File

@ -558,12 +558,6 @@ extern "C" {
#undef NO_OLD_TLS
#define NO_OLD_TLS
#undef NO_HC128
#define NO_HC128
#undef NO_RABBIT
#define NO_RABBIT
#undef NO_PSK
#define NO_PSK

View File

@ -424,21 +424,11 @@
<type>1</type>
<locationURI>WOLFSSL_ROOT/wolfcrypt/src/hash.c</locationURI>
</link>
<link>
<name>wolfcrypt/src/hc128.c</name>
<type>1</type>
<locationURI>WOLFSSL_ROOT/wolfcrypt/src/hc128.c</locationURI>
</link>
<link>
<name>wolfcrypt/src/hmac.c</name>
<type>1</type>
<locationURI>WOLFSSL_ROOT/wolfcrypt/src/hmac.c</locationURI>
</link>
<link>
<name>wolfcrypt/src/idea.c</name>
<type>1</type>
<locationURI>WOLFSSL_ROOT/wolfcrypt/src/idea.c</locationURI>
</link>
<link>
<name>wolfcrypt/src/integer.c</name>
<type>1</type>
@ -489,11 +479,6 @@
<type>1</type>
<locationURI>WOLFSSL_ROOT/wolfcrypt/src/pwdbased.c</locationURI>
</link>
<link>
<name>wolfcrypt/src/rabbit.c</name>
<type>1</type>
<locationURI>WOLFSSL_ROOT/wolfcrypt/src/rabbit.c</locationURI>
</link>
<link>
<name>wolfcrypt/src/random.c</name>
<type>1</type>

View File

@ -93,8 +93,6 @@ HMAC-SHA test passed!
HAC-SHA256 test passed!
HMAC-SHA512 test passed!
GMC test passed!
HC-128 test passed!
Rabbit test passed!
DS test passed!
DS3 test passed!
AES test passed!

View File

@ -93,8 +93,6 @@ HMAC-SHA512 test passed!
X963-KDF test passed!
GMAC test passed!
ARC4 test passed!
HC-128 test passed!
Rabbit test passed!
DES test passed!
DES3 test passed!
AES test passed!
@ -172,4 +170,4 @@ ED 25519 verify 2 ops took 1.000 sec, avg 500.000 ms, 2.000 ops/sec
## References
For more information please contact info@wolfssl.com.
For more information please contact info@wolfssl.com.

View File

@ -1,10 +1,16 @@
# ESP-IDF port
NOTICE: These Espressif examples have been created and tested with the latest stable release branch of
[ESP-IDF V4](https://docs.espressif.com/projects/esp-idf/en/v4.4.1/esp32/get-started/index.html)
and have not yet been upgraded to the master branch V5.
See the latest [migration guides](https://docs.espressif.com/projects/esp-idf/en/latest/esp32/migration-guides/index.html).
## Overview
ESP-IDF development framework with wolfSSL by setting *WOLFSSL_ESPIDF* definition
Including the following examples:
* Simple [tls_client](./examples/wolfssl_client/)/[server](./examples/wolfssl_server/)
* Simple [TLS client](./examples/wolfssl_client/)/[server](./examples/wolfssl_server/)
* Cryptographic [test](./examples/wolfssl_test/)
* Cryptographic [benchmark](./examples/wolfssl_benchmark/)
@ -13,21 +19,16 @@ Including the following examples:
## Requirements
1. [ESP-IDF development framework](https://docs.espressif.com/projects/esp-idf/en/latest/get-started/)
Note: This expects to use Linux version.
## Setup for Linux
1. Run `setup.sh` at _/path/to_`/wolfssl/IDE/Espressif/ESP-IDF/` to deploy files into ESP-IDF tree
For Windows : Run `setup_win.bat` at `.\IDE\Espressif\ESP-IDF\`
2. Find Wolfssl files at _/path/to/esp_`/esp-idf/components/wolfssl/`
3. Find [Example programs](https://github.com/wolfSSL/wolfssl/tree/master/IDE/Espressif/ESP-IDF/examples) under _/path/to/esp_`/esp-idf/examples/protocols/wolfssl_xxx` (where xxx is the project name)
4. Uncomment out `#define WOLFSSL_ESPIDF` in _/path/to/esp_`/esp-idf/components/wolfssl/wolfssl/wolfcrypt/settings.h`
Uncomment out `#define WOLFSSL_ESPWROOM32` in _/path/to/esp_`/esp-idf/components/wolfssl/wolfssl/wolfcrypt/settings.h`
for example the default:
`~/esp/esp-idf/components/wolfssl/wolfssl/wolfcrypt/settings.h`
## Setup for Windows
1. Run ESP-IDF Command Prompt (cmd.exe) or Run ESP-IDF PowerShell Environment
2. Run `setup_win.bat` at `.\IDE\Espressif\ESP-IDF\`
3. Find Wolfssl files at _/path/to/esp_`/esp-idf/components/wolfssl/`
4. Find [Example programs](https://github.com/wolfSSL/wolfssl/tree/master/IDE/Espressif/ESP-IDF/examples) under _/path/to/esp_`/esp-idf/examples/protocols/wolfssl_xxx` (where xxx is the project name)
## Configuration
1. The `user_settings.h` can be found in _/path/to/esp_`/esp-idf/components/wolfssl/include/user_settings.h`
@ -39,7 +40,6 @@ Including the following examples:
For question please email [support@wolfssl.com]
Note: This is tested with :
- OS: Ubuntu 18.04.1 LTS and Microsoft Windows 10 Pro 10.0.19041 and well as WSL Ubuntu
- ESP-IDF: v4.1 and v4.0.1
- OS: Ubuntu 20.04.3 LTS and Microsoft Windows 10 Pro 10.0.19041 and well as WSL Ubuntu
- ESP-IDF: ESP-IDF v4.3.2
- Module : ESP32-WROOM-32

View File

@ -4,7 +4,7 @@
Including the following examples:
* simple `tls_client`/`tls_server`
* simple `TLS client`/`server`
* crypt benchmark
The `user_settings.h` file enables some of the hardened settings.
@ -15,11 +15,11 @@ Including the following examples:
2. Microchip CryptoAuthentication Library: https://github.com/MicrochipTech/cryptoauthlib
## Setup
1. wolfSSL under ESP-IDF. Please see [README.md](https://github.com/wolfSSL/wolfssl/blob/master/IDE/Espressif/ESP-IDF/README.md)
2. CryptoAuthentication Library under ESP-IDF. Please see [README.md](https://github.com/miyazakh/cryptoauthlib_esp_idf/blob/master/README.md)
3. Uncomment out `#define WOLFSSL_ESPWROOM32SE` in `/path/to/wolfssl/wolfssl/wolfcrypt/settings.h`
* **Note:** Need to enable `WOLFSSL_ESPIDF`
1. Comment out `#define WOLFSSL_ESPWROOM32` in `/path/to/wolfssl/IDE/Espressif/ESP-IDF/user_settings.h`\
Uncomment out `#define WOLFSSL_ESPWROOM32SE` in `/path/to/wolfssl/IDE/Espressif/ESP-IDF/user_settings.h`
* **Note:** crypt test will fail if enabled `WOLFSSL_ESPWROOM32SE`
3. wolfSSL under ESP-IDF. Please see [README.md](https://github.com/wolfSSL/wolfssl/blob/master/IDE/Espressif/ESP-IDF/README.md)
4. CryptoAuthentication Library under ESP-IDF. Please see [README.md](https://github.com/miyazakh/cryptoauthlib_esp_idf/blob/master/README.md)
## Configuration
1. The `user_settings.h` can be found in `/path/to/esp-idf/components/wolfssl/include/user_settings.h`

View File

@ -1,4 +1,4 @@
/* unistd.h
/* wolfcrypt/test/test_paths.h
*
* Copyright (C) 2006-2021 wolfSSL Inc.
*
@ -19,4 +19,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
*/
/* DUMMY Header */
#ifndef NO_FILESYSTEM
#define CERT_PREFIX "@abs_top_srcdir@/"
#define CERT_WRITE_TEMP_DIR "@abs_top_builddir@/"
#endif /* NO_FILESYSTEM */

View File

@ -1,8 +1,8 @@
#wolfSSL Example
# wolfSSL Benchmark Example
The Example contains of wolfSSL benchmark program.
1. "make menuconfig" to configure the program.
1. `idf.py menuconfig` to configure the program.
1-1. Example Configuration ->
BENCH_ARG : argument that you want to use. Default is "-lng 0"
@ -10,7 +10,7 @@ The Example contains of wolfSSL benchmark program.
When you want to run the benchmark program
1. "make flash" to compile and load the firmware
2. "make monitor" to see the message
1. `idf.py -p <PORT> flash` to compile and load the firmware
2. `idf.py monitor` to see the message
See the README.md file in the upper level 'examples' directory for more information about examples.

View File

@ -23,6 +23,7 @@
#include <string.h>
#include <wolfssl/wolfcrypt/settings.h>
#include <wolfssl/wolfcrypt/types.h>
#include <wolfcrypt/benchmark/benchmark.h>
#include "sdkconfig.h"

View File

@ -2,21 +2,26 @@
The Example contains of wolfSSL tls client demo.
1. "make menuconfig" to config the project
1-1. Example Configuration ->
1. `idf.py menuconfig` to config the project
1-1. Example Configuration ->
WIFI SSID: your own WIFI, which is connected to the Internet.(default is "myssid")
WIFI Password: WIFI password, and default is "mypassword"
Target host ip address : the host that you want to connect to.(default is 127.0.0.1)
1-2. Example Connection Configuration ->
WIFI SSID: your own WIFI, which is connected to the Internet.(default is "myssid")
WIFI Password: WIFI password, and default is "mypassword"
Note: the example program uses 11111 port. If you want to use different port
, you need to modify DEFAULT_PORT definition in the code.
When you want to test the wolfSSL client
1. "make flash monitor" to load the firmware and see the context
1. `idf.py -p <PORT> flash` and then `idf.py monitor` to load the firmware and see the context
2. You can use <wolfssl>/examples/server/server program for test.
e.g. Launch ./examples/server/server -v 4 -b -i
e.g. Launch ./examples/server/server -v 4 -b -i -d
See the README.md file in the upper level 'examples' directory for more information about examples.

View File

@ -1,17 +1,5 @@
menu "Example Configuration"
config WIFI_SSID
string "WiFi SSID"
default "myssid"
help
SSID (network name) for the example to connect to.
config WIFI_PASSWORD
string "WiFi Password"
default "mypassword"
help
WiFi password (WPA or WPA2) for the example to use.
config TARGET_HOST
string "Target host"
default "127.0.01.1"

View File

@ -54,7 +54,7 @@ static void set_time()
/* please update the time if seeing unknown failure when loading cert. */
/* this could cause TLS communication failure due to time expiration */
/* incleasing 31536000 seconds is close to spend 356 days. */
utctime.tv_sec = 1619650800; /* dummy time: Wed April 28 23:00:00 2021 */
utctime.tv_sec = 1645797600; /* dummy time: Fri 25 Feb 2022 02:00:00 2022 */
utctime.tv_usec = 0;
tz.tz_minuteswest = 0;
tz.tz_dsttime = 0;
@ -102,8 +102,13 @@ static esp_err_t wifi_event_handler(void *ctx, system_event_t *event)
esp_wifi_connect();
break;
case SYSTEM_EVENT_STA_GOT_IP:
#if ESP_IDF_VERSION_MAJOR >= 4
ESP_LOGI(TAG, "got ip:" IPSTR "\n",
IP2STR(&event->event_info.got_ip.ip_info.ip));
#else
ESP_LOGI(TAG, "got ip:%s",
ip4addr_ntoa(&event->event_info.got_ip.ip_info.ip));
#endif
/* http://esp32.info/docs/esp_idf/html/dd/d08/group__xEventGroupSetBits.html */
xEventGroupSetBits(wifi_event_group, CONNECTED_BIT);
break;
@ -123,7 +128,8 @@ void app_main(void)
ESP_ERROR_CHECK(nvs_flash_init());
ESP_LOGI(TAG, "Initialize wifi");
#if ESP_IDF_VERSION_MAJOR >= 4 && ESP_IDF_VERSION_MINOR >= 1
#if (ESP_IDF_VERSION_MAJOR >= 4 && ESP_IDF_VERSION_MINOR >= 1) || \
(ESP_IDF_VERSION_MAJOR > 5)
esp_netif_init();
#else
tcpip_adapter_init();

View File

@ -1,17 +1,18 @@
#wolfSSL Example
# wolfSSL Server Example
The Example contains a wolfSSL simple server.
1. "make menuconfigure" to configure the project
1. `idf.py menuconfigure` to configure the project
1-1. Example Configuration ->
1-1. Example Connection Configuration ->
WIFI SSID : your own WIFI, which is connected to the Internet.(default is "myssid")
WIFI Password : WIFI password, and default is "mypassword"
When you want to test the wolfSSL simple server demo
1. "make flash" to compile the code and load the firmware
2. "make monitor" to see the context. The assigned IP address can be found in output message.
1. `idf.py -p <PORT> flash` to compile the code and load the firmware
2. `idf.py monitor` to see the context. The assigned IP address can be found in output message.
3. Once the server connects to the wifi, it is waiting for client request.
("Waiting for a connection..." message will be displayed.)
@ -19,4 +20,3 @@ When you want to test the wolfSSL simple server demo
e.g ./example/client/client -h xx.xx.xx
See the README.md file in the upper level 'examples' directory for more information about examples.

View File

@ -1,15 +0,0 @@
menu "Example Configuration"
config WIFI_SSID
string "WiFi SSID"
default "myssid"
help
SSID (network name) for the example to connect to.
config WIFI_PASSWORD
string "WiFi Password"
default "mypassword"
help
WiFi password (WPA or WPA2) for the example to use.
endmenu

View File

@ -51,7 +51,7 @@ static void set_time()
/* please update the time if seeing unknown failure when loading cert. */
/* this could cause TLS communication failure due to time expiration */
/* incleasing 31536000 seconds is close to spend 356 days. */
utctime.tv_sec = 1619650800; /* dummy time: Wed April 28 23:00:00 2021 */
utctime.tv_sec = 1645797600; /* dummy time: Fri 25 Feb 2022 02:00:00 2022 */
utctime.tv_usec = 0;
tz.tz_minuteswest = 0;
tz.tz_dsttime = 0;
@ -126,7 +126,8 @@ void app_main(void)
ESP_LOGI(TAG, "Initialize wifi");
/* TCP/IP adapter initialization */
#if ESP_IDF_VERSION_MAJOR >= 4 && ESP_IDF_VERSION_MINOR >= 1
#if (ESP_IDF_VERSION_MAJOR >= 4 && ESP_IDF_VERSION_MINOR >= 1) || \
(ESP_IDF_VERSION_MAJOR > 5)
esp_netif_init();
#else
tcpip_adapter_init();

View File

@ -1,10 +1,10 @@
#wolfSSL Example
# wolfSSL Crypt Test Example
The Example contains of wolfSSL test program.
When you want to run the benchmark program
1. "make menuconfig" to configure the program,first
2. "make flash" to compile and load the firmware
3. "make monitor" to see the message
1. `idf.py menuconfig` to configure the program,first
2. `idf.py build` to compile and `idf.py -p <PORT> flash` to load the firmware
3. `idf.py monitor` to see the message
See the README.md file in the upper level 'examples' directory for more information about examples.

View File

@ -16,12 +16,22 @@ set(COMPONENT_SRCDIRS "./src/"
set(COMPONENT_REQUIRES lwip)
set(COMPONENT_ADD_INCLUDEDIRS
"."
"./include"
"../freertos/include/freertos"
"${WOLFSSL_ROOT}"
)
if(IS_DIRECTORY ${IDF_PATH}/components/freertos/FreeRTOS-Kernel/)
set(COMPONENT_ADD_INCLUDEDIRS
"."
"./include"
"../freertos/FreeRTOS-Kernel/include/freertos"
"${WOLFSSL_ROOT}"
)
else()
set(COMPONENT_ADD_INCLUDEDIRS
"."
"./include"
"../freertos/include/freertos"
"${WOLFSSL_ROOT}"
)
endif()
if(IS_DIRECTORY ${IDF_PATH}/components/cryptoauthlib)
list(APPEND COMPONENT_ADD_INCLUDEDIRS "../cryptoauthlib/lib")

View File

@ -58,6 +58,7 @@ ${MKDCMD} ${WOLFSSLLIB_TRG_DIR}/src
${MKDCMD} ${WOLFSSLLIB_TRG_DIR}/wolfcrypt
${MKDCMD} ${WOLFSSLLIB_TRG_DIR}/wolfcrypt/src
${MKDCMD} ${WOLFSSLLIB_TRG_DIR}/wolfssl
${MKDCMD} ${WOLFSSLLIB_TRG_DIR}/wolfssl/openssl
${MKDCMD} ${WOLFSSLLIB_TRG_DIR}/test
${MKDCMD} ${WOLFSSLLIB_TRG_DIR}/include
@ -76,9 +77,12 @@ ${CPDCMD} ./src/*.c ${WOLFSSLLIB_TRG_DIR}/src/
${CPDCMD} -r ./wolfcrypt/src/*.{c,i} ${WOLFSSLLIB_TRG_DIR}/wolfcrypt/src/
${CPDCMD} -r ./wolfcrypt/src/port ${WOLFSSLLIB_TRG_DIR}/wolfcrypt/src/port/
${CPDCMD} -r ./wolfcrypt/test ${WOLFSSLLIB_TRG_DIR}/wolfcrypt/
# Copy dummy test_paths.h to handle the case configure hasn't yet executed
${CPDCMD} -r ${WOLFSSL_ESPIDFDIR}/dummy_test_paths.h ${WOLFSSLLIB_TRG_DIR}/wolfcrypt/test/test_paths.h
${CPDCMD} -r ./wolfcrypt/benchmark ${WOLFSSLLIB_TRG_DIR}/wolfcrypt/
${CPDCMD} -r ./wolfssl/*.h ${WOLFSSLLIB_TRG_DIR}/wolfssl/
${CPDCMD} -r ./wolfssl/openssl/*.h ${WOLFSSLLIB_TRG_DIR}/wolfssl/openssl/
${CPDCMD} -r ./wolfssl/wolfcrypt ${WOLFSSLLIB_TRG_DIR}/wolfssl/
# user_settings.h

View File

@ -1,77 +1,398 @@
@echo off
REM Expect the script at /path/to/wolfssl/IDE/Espressif/ESP-IDF/
if NOT EXIST "setup.sh" (
echo "Please run this script at /path/to/wolfssl/IDE/Espressif/ESP-IDF/
goto exit
::******************************************************************************************************
::******************************************************************************************************
echo;
echo wolfSSL Windows Setup. Version 1.0a
echo;
echo This utility will copy a static snapshot of wolfSSL files to the ESP32-IDF component directory.
echo;
echo If you wish to keep your component library fresh with git pull, consider hard link with mklink.
echo;
echo "mklink [[/d] | [/h] | [/j]] <link> <target>"
echo;
::******************************************************************************************************
::******************************************************************************************************
SET COPYERROR=false
:: if there's a setup.sh, we are probably starting in the right place.
if NOT EXIST "setup.sh" (
echo Please run this script at /path/to/wolfssl/IDE/Espressif/ESP-IDF/
goto :ERR
)
if "%IDF_PATH%" == "" (
echo "Please launch the script from ESP-IDF command prompt."
goto exit
:: if there's also a default user_settings.h, we are very likely starting in the right place.
if NOT EXIST "user_settings.h" (
echo Please run this script at /path/to/wolfssl/IDE/Espressif/ESP-IDF/
goto :ERR
)
:: see if there was a parameter passed for a specific EDP-IDF directory
:: this may be different than the standard ESP-IDF environment (e.g. VisualGDB)
if not "%1" == "" (
if not exist "%1" (
echo "ERROR: optional directory was specified, but not found: %1"
goto :ERR
)
SET IDF_PATH=%1
echo Using specified IDF_PATH: %IDF_PATH%
)
:: if no IDF_PATH is found, we don't know what to do. Go exit with error.
if "%IDF_PATH%" == "" (
echo Please launch the script from ESP-IDF command prompt,
echo or set your desired IDF_PATH environment variable,
echo or pass a parameter to your directory, such as for VisualGDB with ESP-IDF 4.4:
echo;
echo .\setup_win.bat C:\SysGCC\esp32\esp-idf\v4.4
echo;
goto :ERR
)
:: Here we go!
:: setup some path variables
echo;
set SCRIPTDIR=%CD%
set BASEDIR=%SCRIPTDIR%\..\..\..\
set BASEDIR=%SCRIPTDIR%\..\..\..
set WOLFSSL_ESPIDFDIR=%BASEDIR%\IDE\Espressif\ESP-IDF
set WOLFSSLLIB_TRG_DIR=%IDF_PATH%\components\wolfssl
set WOLFSSLEXP_TRG_DIR=%IDF_PATH%\examples\protocols
echo Copy files into $IDF_PATH%
rem Remove/Create directories
rmdir /S/Q %WOLFSSLLIB_TRG_DIR%
mkdir %WOLFSSLLIB_TRG_DIR%
mkdir %WOLFSSLLIB_TRG_DIR%\src
mkdir %WOLFSSLLIB_TRG_DIR%\wolfcrypt\src
mkdir %WOLFSSLLIB_TRG_DIR%\wolfssl
mkdir %WOLFSSLLIB_TRG_DIR%\test
mkdir %WOLFSSLLIB_TRG_DIR%\include
echo Using SCRIPTDIR = %SCRIPTDIR%
echo Using BASEDIR = %BASEDIR%
echo Using WOLFSSL_ESPIDFDIR = %WOLFSSL_ESPIDFDIR%
echo Using WOLFSSLLIB_TRG_DIR = %WOLFSSLLIB_TRG_DIR%
echo Using WOLFSSLEXP_TRG_DIR = %WOLFSSLEXP_TRG_DIR%
echo;
echo Equivalalent destination path:
dir %WOLFSSL_ESPIDFDIR%\*.xyzzy 2> nul | findstr \
echo;
echo Equivalalent source directory paths:
:: show the path of the equivalent %VALUE% (search for files that don't exist, supress error, and look for string with "\")
dir %BASEDIR%\*.xyzzy 2> nul | findstr \
dir %WOLFSSLLIB_TRG_DIR%\*.xyzzy 2> nul | findstr \
dir %WOLFSSLEXP_TRG_DIR%\*.xyzzy 2> nul | findstr \
:: set the FileStamp variable to the current date: YYMMYY_HHMMSS
:: the simplest method, to use existing TIME ad DATE variables:
:: date = Thu 09/17/2015
:: time = 11:13:15.47
:: 012345678901234567890
::
:: There is no leading zero for single digit hours (e.g. 9:00am), so we need to manually include the zero
:: here |
if "%TIME:~0,1%" == " " set FileStamp=%DATE:~12,2%%DATE:~7,2%%DATE:~4,2%_0%TIME:~1,1%%TIME:~3,2%%TIME:~6,2%
:: otherwise, if a space not found before the digit, it is a 2 digit hour, so no extract zero is needed
if NOT "%TIME:~0,1%" == " " set FileStamp=%DATE:~12,2%%DATE:~7,2%%DATE:~4,2%_%TIME:~0,2%%TIME:~3,2%%TIME:~6,2%
:: Backup existing user settings
if exist %WOLFSSLLIB_TRG_DIR%\include\config.h (
echo;
echo Saving: %WOLFSSLLIB_TRG_DIR%\include\config.h
echo to: %SCRIPTDIR%\config_h_%FileStamp%.bak
copy %WOLFSSLLIB_TRG_DIR%\include\config.h %SCRIPTDIR%\config_h_%FileStamp%.bak
echo;
)
if exist %WOLFSSL_ESPIDFDIR%\user_settings.h (
echo Saving: %WOLFSSLLIB_TRG_DIR%\include\user_settings.h
echo to: %SCRIPTDIR%\user_settings_h_%FileStamp%.bak
copy %WOLFSSLLIB_TRG_DIR%\include\user_settings.h %SCRIPTDIR%\user_settings_h_%FileStamp%.bak
echo;
)
::******************************************************************************************************
:: check if there's already an existing %WOLFSSLLIB_TRG_DIR% and confirm removal
::******************************************************************************************************
if exist %WOLFSSLLIB_TRG_DIR% (
echo;
echo WARNING: Existing files found in %WOLFSSLLIB_TRG_DIR%
echo;
:: clear any prior errorlevel
call;
choice /c YN /m "Delete files and proceed with install in %WOLFSSLLIB_TRG_DIR% "
if errorlevel 2 GOTO :NODELETE
GOTO :PURGE
echo;
echo Ready to copy files into %IDF_PATH%
::******************************************************************************************************
:NODELETE
::******************************************************************************************************
:: clear any prior errorlevel
echo;
call;
choice /c YN /m "Refresh files %WOLFSSLLIB_TRG_DIR% (there will be a prompt to keep or overwrite user_settings and config) "
if errorlevel 2 GOTO :NOCOPY
GOTO :REFRESH
)
::******************************************************************************************************
:PURGE
::******************************************************************************************************
:: purge existing directory
if exist %WOLFSSLLIB_TRG_DIR% (
echo;
echo Removing %WOLFSSLLIB_TRG_DIR%
rmdir %WOLFSSLLIB_TRG_DIR% /S /Q
if exist %WOLFSSLLIB_TRG_DIR% (
SET COPYERROR=true
echo;
echo WARNING: Failed to remove %WOLFSSLLIB_TRG_DIR%
echo;
echo Check permissions, open files, read-only attributes, etc.
echo;
)
echo;
) else (
echo;
echo Prior %WOLFSSLLIB_TRG_DIR% not found, installing fresh.
echo;
)
::******************************************************************************************************
:REFRESH
::******************************************************************************************************
if not exist %WOLFSSLLIB_TRG_DIR% mkdir %WOLFSSLLIB_TRG_DIR%
if not exist %WOLFSSLLIB_TRG_DIR%\src mkdir %WOLFSSLLIB_TRG_DIR%\src
if not exist %WOLFSSLLIB_TRG_DIR%\wolfcrypt\src mkdir %WOLFSSLLIB_TRG_DIR%\wolfcrypt\src
if not exist %WOLFSSLLIB_TRG_DIR%\wolfssl mkdir %WOLFSSLLIB_TRG_DIR%\wolfssl
if not exist %WOLFSSLLIB_TRG_DIR%\wolfssl\openssl mkdir %WOLFSSLLIB_TRG_DIR%\wolfssl\openssl
if not exist %WOLFSSLLIB_TRG_DIR%\test mkdir %WOLFSSLLIB_TRG_DIR%\test
if not exist %WOLFSSLLIB_TRG_DIR%\include mkdir %WOLFSSLLIB_TRG_DIR%\include
rem copying ... files in src/ into $WOLFSSLLIB_TRG_DIR%/src
xcopy /Y/Q %BASEDIR%\src\*.c %WOLFSSLLIB_TRG_DIR%\src\
xcopy /Y/Q %BASEDIR%\wolfcrypt\src\*.c %WOLFSSLLIB_TRG_DIR%\wolfcrypt\src
xcopy /Y/Q %BASEDIR%\wolfcrypt\src\*.i %WOLFSSLLIB_TRG_DIR%\wolfcrypt\src
xcopy /E/Y/Q %BASEDIR%\wolfcrypt\src\port %WOLFSSLLIB_TRG_DIR%\wolfcrypt\src\port\
xcopy /E/Y/Q %BASEDIR%\wolfcrypt\test %WOLFSSLLIB_TRG_DIR%\wolfcrypt\test\
xcopy /E/Y/Q %BASEDIR%\wolfcrypt\benchmark %WOLFSSLLIB_TRG_DIR%\wolfcrypt\benchmark\
xcopy /Y/Q %BASEDIR%\wolfssl\*.h %WOLFSSLLIB_TRG_DIR%\wolfssl\
xcopy /E/Y/Q %BASEDIR%\wolfssl\wolfcrypt %WOLFSSLLIB_TRG_DIR%\wolfssl\wolfcrypt\
echo;
echo Copying files to %WOLFSSLLIB_TRG_DIR%\src\
xcopy %BASEDIR%\src\*.c %WOLFSSLLIB_TRG_DIR%\src\ /S /E /Q /Y
if %errorlevel% NEQ 0 SET COPYERROR=true
rem user_settings.h
xcopy /F/Q %WOLFSSL_ESPIDFDIR%\user_settings.h %WOLFSSLLIB_TRG_DIR%\include\
echo F |xcopy /F/Q %WOLFSSL_ESPIDFDIR%\dummy_config_h %WOLFSSLLIB_TRG_DIR%\include\config.h
echo;
echo Copying src\*.c files to %WOLFSSLLIB_TRG_DIR%\wolfcrypt\src
xcopy %BASEDIR%\wolfcrypt\src\*.c %WOLFSSLLIB_TRG_DIR%\wolfcrypt\src /S /E /Q /Y
if %errorlevel% NEQ 0 SET COPYERROR=true
rem unit test app
xcopy /E/Y/Q %WOLFSSL_ESPIDFDIR%\test %WOLFSSLLIB_TRG_DIR%\test\
xcopy /F/Q %WOLFSSL_ESPIDFDIR%\libs\CMakeLists.txt %WOLFSSLLIB_TRG_DIR%\
xcopy /F/Q %WOLFSSL_ESPIDFDIR%\libs\component.mk %WOLFSSLLIB_TRG_DIR%\
echo;
echo Copying src\*.i files to %WOLFSSLLIB_TRG_DIR%\wolfcrypt\src
xcopy %BASEDIR%\wolfcrypt\src\*.i %WOLFSSLLIB_TRG_DIR%\wolfcrypt\src /S /E /Q /Y
if %errorlevel% NEQ 0 SET COPYERROR=true
rem Benchmark program
rmdir /S/Q %WOLFSSLEXP_TRG_DIR%\wolfssl_benchmark\
mkdir %WOLFSSLEXP_TRG_DIR%\wolfssl_benchmark\main\
echo;
echo Copying files to %WOLFSSLLIB_TRG_DIR%\wolfcrypt\src\port\
xcopy %BASEDIR%\wolfcrypt\src\port %WOLFSSLLIB_TRG_DIR%\wolfcrypt\src\port\ /S /E /Q /Y
if %errorlevel% NEQ 0 SET COPYERROR=true
xcopy %BASEDIR%\wolfcrypt\benchmark\benchmark.h %BASEDIR%\IDE\Espressif\ESP-IDF\examples\wolfssl_benchmark\main\benchmark.h
xcopy %BASEDIR%\wolfcrypt\benchmark\benchmark.c %BASEDIR%\IDE\Espressif\ESP-IDF\examples\wolfssl_benchmark\main\benchmark.c
echo;
echo Copying files to %WOLFSSLLIB_TRG_DIR%\wolfcrypt\test\
xcopy %BASEDIR%\wolfcrypt\test %WOLFSSLLIB_TRG_DIR%\wolfcrypt\test\ /S /E /Q /Y
if %errorlevel% NEQ 0 SET COPYERROR=true
xcopy /F/Q %BASEDIR%\wolfcrypt\benchmark\benchmark.c %WOLFSSLEXP_TRG_DIR%\wolfssl_benchmark\main\
xcopy /E/F/Q %WOLFSSL_ESPIDFDIR%\examples\wolfssl_benchmark %WOLFSSLEXP_TRG_DIR%\wolfssl_benchmark\
:: Copy dummy test_paths.h to handle the case configure hasn't yet executed
echo;
echo Copying dummy_test_paths.h to %WOLFSSLLIB_TRG_DIR%\wolfcrypt\test\test_paths.h
echo new config > %WOLFSSLLIB_TRG_DIR%\wolfcrypt\test\test_paths.h
if %errorlevel% NEQ 0 SET COPYERROR=true
xcopy %WOLFSSL_ESPIDFDIR%\dummy_test_paths.h %WOLFSSLLIB_TRG_DIR%\wolfcrypt\test\test_paths.h /S /E /Y
if %errorlevel% NEQ 0 SET COPYERROR=true
rem Crypt Test program
rmdir /S/Q %WOLFSSLEXP_TRG_DIR%\wolfssl_test\
mkdir %WOLFSSLEXP_TRG_DIR%\wolfssl_test\main\
xcopy /F/Q %BASEDIR%\wolfcrypt\test\test.c %WOLFSSLEXP_TRG_DIR%\wolfssl_test\main\
xcopy /E/F/Q %WOLFSSL_ESPIDFDIR%\examples\wolfssl_test %WOLFSSLEXP_TRG_DIR%\wolfssl_test\
echo;
echo Copying files to %WOLFSSLLIB_TRG_DIR%\wolfcrypt\benchmark\
xcopy %BASEDIR%\wolfcrypt\benchmark %WOLFSSLLIB_TRG_DIR%\wolfcrypt\benchmark\ /S /E /Q /Y
if %errorlevel% NEQ 0 SET COPYERROR=true
rem TLS Client program
rmdir /S/Q %WOLFSSLEXP_TRG_DIR%\wolfssl_client\
mkdir %WOLFSSLEXP_TRG_DIR%\wolfssl_client\main\
xcopy /E/F/Q %WOLFSSL_ESPIDFDIR%\examples\wolfssl_client %WOLFSSLEXP_TRG_DIR%\wolfssl_client\
echo;
echo Copying files to %WOLFSSLLIB_TRG_DIR%\wolfssl\
xcopy %BASEDIR%\wolfssl\*.h %WOLFSSLLIB_TRG_DIR%\wolfssl\ /S /E /Q /Y
if %errorlevel% NEQ 0 SET COPYERROR=true
rem TLS Server program
rmdir /S/Q %WOLFSSLEXP_TRG_DIR%\wolfssl_server\
mkdir %WOLFSSLEXP_TRG_DIR%\wolfssl_server\main\
xcopy /E/F/Q %WOLFSSL_ESPIDFDIR%\examples\wolfssl_server %WOLFSSLEXP_TRG_DIR%\wolfssl_server\
echo;
echo Copying files to%WOLFSSLLIB_TRG_DIR%\wolfssl\openssl\
xcopy %BASEDIR%\wolfssl\openssl\*.h %WOLFSSLLIB_TRG_DIR%\wolfssl\openssl\ /S /E /Q /Y
if %errorlevel% NEQ 0 SET COPYERROR=true
:exit
echo completed
echo;
echo Copying files to %WOLFSSLLIB_TRG_DIR%\wolfssl\wolfcrypt\
xcopy %BASEDIR%\wolfssl\wolfcrypt %WOLFSSLLIB_TRG_DIR%\wolfssl\wolfcrypt\ /S /E /Q /Y
if %errorlevel% NEQ 0 SET COPYERROR=true
::******************************************************************************************************
:: user_settings and config defaults
::******************************************************************************************************
:: user_settings.h (default, may be overwritten by prior file)
echo;
echo Copying default user_settings.h to %WOLFSSLLIB_TRG_DIR%\include\
xcopy %WOLFSSL_ESPIDFDIR%\user_settings.h %WOLFSSLLIB_TRG_DIR%\include\ /F
if %errorlevel% NEQ 0 SET COPYERROR=true
:: echo Creating new config file: %WOLFSSLLIB_TRG_DIR%\include\config.h (default, may be overwritten by prior file)
echo new config > %WOLFSSLLIB_TRG_DIR%\include\config.h
xcopy %WOLFSSL_ESPIDFDIR%\dummy_config_h. %WOLFSSLLIB_TRG_DIR%\include\config.h /F /Y
if %errorlevel% NEQ 0 SET COPYERROR=true
:: Check if operator wants to keep prior config.h
if EXIST config_h_%FileStamp%.bak (
echo;
:: clear any prior errorlevel
call;
choice /c YN /m "Use your prior config.h "
if errorlevel 2 GOTO :NO_CONFIG_RESTORE
xcopy config_h_%FileStamp%.bak %WOLFSSLLIB_TRG_DIR%\include\config.h /Y
if %errorlevel% NEQ 0 SET COPYERROR=true
) else (
echo;
echo Prior config.h not found. Using default file.
)
::******************************************************************************************************
:NO_CONFIG_RESTORE
::******************************************************************************************************
:: Check if operator wants to keep prior config.h
if EXIST user_settings_h_%FileStamp%.bak (
echo;
:: clear any prior errorlevel
call;
choice /c YN /m "User your prior user_settings.h "
if errorlevel 2 GOTO :NO_USER_SETTINGS_RESTORE
xcopy user_settings_h_%FileStamp%.bak %WOLFSSLLIB_TRG_DIR%\include\user_settings.h /Y
if %errorlevel% NEQ 0 SET COPYERROR=true
) else (
echo;
echo Prior user_settings.h not found. Using default file.
)
::******************************************************************************************************
:NO_USER_SETTINGS_RESTORE
::******************************************************************************************************
:: unit test app
echo;
echo Copying unit files to %WOLFSSLLIB_TRG_DIR%\test\
xcopy %WOLFSSL_ESPIDFDIR%\test %WOLFSSLLIB_TRG_DIR%\test\ /S /E /Q /Y
if %errorlevel% NEQ 0 GOTO :COPYERR
echo;
echo Copying CMakeLists.txt to %WOLFSSLLIB_TRG_DIR%\
xcopy %WOLFSSL_ESPIDFDIR%\libs\CMakeLists.txt %WOLFSSLLIB_TRG_DIR%\ /F
if %errorlevel% NEQ 0 GOTO :COPYERR
echo;
echo Copying component.mk to %WOLFSSLLIB_TRG_DIR%\
xcopy %WOLFSSL_ESPIDFDIR%\libs\component.mk %WOLFSSLLIB_TRG_DIR%\ /F
if %errorlevel% NEQ 0 GOTO :COPYERR
:: Benchmark program
echo;
echo Removing %WOLFSSLEXP_TRG_DIR%\wolfssl_benchmark\
rmdir %WOLFSSLEXP_TRG_DIR%\wolfssl_benchmark\ /S /Q
if %errorlevel% NEQ 0 GOTO :COPYERR
echo;
echo Copying %WOLFSSLEXP_TRG_DIR%\wolfssl_benchmark\main\
mkdir %WOLFSSLEXP_TRG_DIR%\wolfssl_benchmark\main\
xcopy %BASEDIR%\wolfcrypt\benchmark\benchmark.h %BASEDIR%\IDE\Espressif\ESP-IDF\examples\wolfssl_benchmark\main\benchmark.h /F /Y
if %errorlevel% NEQ 0 GOTO :COPYERR
xcopy %BASEDIR%\wolfcrypt\benchmark\benchmark.c %BASEDIR%\IDE\Espressif\ESP-IDF\examples\wolfssl_benchmark\main\benchmark.c /F /Y
if %errorlevel% NEQ 0 GOTO :COPYERR
xcopy %BASEDIR%\wolfcrypt\benchmark\benchmark.c %WOLFSSLEXP_TRG_DIR%\wolfssl_benchmark\main\ /F /Y
if %errorlevel% NEQ 0 GOTO :COPYERR
xcopy %WOLFSSL_ESPIDFDIR%\examples\wolfssl_benchmark %WOLFSSLEXP_TRG_DIR%\wolfssl_benchmark\ /Q /Y
if %errorlevel% NEQ 0 GOTO :COPYERR
:: Crypt Test program
echo;
echo Copying %WOLFSSLEXP_TRG_DIR%\wolfssl_test\
rmdir %WOLFSSLEXP_TRG_DIR%\wolfssl_test\ /S /Q
mkdir %WOLFSSLEXP_TRG_DIR%\wolfssl_test\main\
xcopy %BASEDIR%\wolfcrypt\test\test.c %WOLFSSLEXP_TRG_DIR%\wolfssl_test\main\ /S /E /Q /Y
if %errorlevel% NEQ 0 GOTO :COPYERR
xcopy %WOLFSSL_ESPIDFDIR%\examples\wolfssl_test %WOLFSSLEXP_TRG_DIR%\wolfssl_test\ /S /E /Q /Y
if %errorlevel% NEQ 0 GOTO :COPYERR
:: TLS Client program
echo;
echo Copying %WOLFSSLEXP_TRG_DIR%\wolfssl_client\
rmdir %WOLFSSLEXP_TRG_DIR%\wolfssl_client\ /S /Q
mkdir %WOLFSSLEXP_TRG_DIR%\wolfssl_client\main\
xcopy %WOLFSSL_ESPIDFDIR%\examples\wolfssl_client %WOLFSSLEXP_TRG_DIR%\wolfssl_client\ /S /E /Q /Y
if %errorlevel% NEQ 0 GOTO :COPYERR
:: TLS Server program
echo;
echo Copying %WOLFSSLEXP_TRG_DIR%\wolfssl_server\
rmdir %WOLFSSLEXP_TRG_DIR%\wolfssl_server\ /S /Q
mkdir %WOLFSSLEXP_TRG_DIR%\wolfssl_server\main\
xcopy %WOLFSSL_ESPIDFDIR%\examples\wolfssl_server %WOLFSSLEXP_TRG_DIR%\wolfssl_server\ /S /E /Q /Y
if %errorlevel% NEQ 0 GOTO :COPYERR
goto :DONE
:: error during copy encountered
::******************************************************************************************************
:COPYERR
::******************************************************************************************************
echo;
echo Error during copy.
echo
echo Please ensure none of the target files are flagged as read-only, open, etc.
goto :ERR
:: abort at user request
::******************************************************************************************************
:NOCOPY
::******************************************************************************************************
echo;
echo Setup did not copy any files.
goto :ERR
:: ERROR
::******************************************************************************************************
:ERR
::******************************************************************************************************
exit /B 1
:: Success
::******************************************************************************************************
:DONE
::******************************************************************************************************
echo;
echo;
echo Edit config file in "%WOLFSSLLIB_TRG_DIR%\include\user_settings.h" before trying to compile.
echo;
echo See Component files for wolfSSL in %WOLFSSLLIB_TRG_DIR%
echo;
echo See additional examples at https://github.com/wolfSSL/wolfssl-examples
echo;
echo REMINDER: Ensure any wolfSSL #include definitions occur BEFORE include files in your source code.
echo;
if "%COPYERROR%" == "true" (
echo;
echo WARNING: Copy completed with errors! Check for files in use, permissions, symbolic links, etc.
echo;
)
echo setup_win.bat for ESP-IDF completed.

View File

@ -4,7 +4,7 @@ The test contains of wolfSSL unit-test app on Unity.
When you want to run the app
1. Go to /esp-idf/tools/unit-test-app/ folder
2. "idf.py menuconfig" to configure unit test app.
3. "idf.py -T wolfssl build" to build wolfssl unit test app.
2. `idf.py menuconfig` to configure unit test app.
3. `idf.py -T wolfssl build` to build wolfssl unit test app.
See [https://docs.espressif.com/projects/esp-idf/en/latest/api-guides/unit-tests.html] for more information about unit test app.

View File

@ -18,6 +18,23 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
*/
#undef WOLFSSL_ESPIDF
#define WOLFSSL_ESPIDF
/*
* choose ONE of these Espressif chips to define:
*
* WOLFSSL_ESPWROOM32
* WOLFSSL_ESPWROOM32SE
* WOLFSSL_ESP8266
*
* comment out the others:
*/
#define WOLFSSL_ESPWROOM32
/* #define WOLFSSL_ESPWROOM32SE */
/* #define WOLFSSL_ESP8266 */
#define BENCH_EMBEDDED
#define USE_CERT_BUFFERS_2048
@ -93,3 +110,6 @@
/* #define NO_WOLFSSL_ESP32WROOM32_CRYPT_HASH*/
/* #define NO_WOLFSSL_ESP32WROOM32_CRYPT_AES */
/* #define NO_WOLFSSL_ESP32WROOM32_CRYPT_RSA_PRI */
/* adjust wait-timeout count if you see timeout in rsa hw acceleration */
#define ESP_RSA_TIMEOUT_CNT 0x249F00

View File

@ -610,12 +610,6 @@ extern unsigned int my_rng_seed_gen(void);
#undef NO_OLD_TLS
#define NO_OLD_TLS
#undef NO_HC128
#define NO_HC128
#undef NO_RABBIT
#define NO_RABBIT
#undef NO_PSK
#define NO_PSK

View File

@ -182,11 +182,8 @@ SRC_C += ../../wolfcrypt/src/arc4.c
SRC_C += ../../wolfcrypt/src/blake2b.c
SRC_C += ../../wolfcrypt/src/camellia.c
SRC_C += ../../wolfcrypt/src/dsa.c
SRC_C += ../../wolfcrypt/src/hc128.c
SRC_C += ../../wolfcrypt/src/idea.c
SRC_C += ../../wolfcrypt/src/md2.c
SRC_C += ../../wolfcrypt/src/md4.c
SRC_C += ../../wolfcrypt/src/rabbit.c
SRC_C += ../../wolfcrypt/src/ripemd.c

View File

@ -82,7 +82,6 @@ libwolfssl_C_SRCS += \
../../wolfcrypt/src/chacha20_poly1305 \
../../wolfcrypt/src/pwdbased \
../../wolfcrypt/src/chacha \
../../wolfcrypt/src/rabbit \
../../wolfcrypt/src/cmac \
../../wolfcrypt/src/random \
../../wolfcrypt/src/coding \
@ -118,11 +117,9 @@ libwolfssl_C_SRCS += \
../../wolfcrypt/src/wc_encrypt \
../../wolfcrypt/src/hash \
../../wolfcrypt/src/wc_pkcs11 \
../../wolfcrypt/src/hc128 \
../../wolfcrypt/src/wc_port \
../../wolfcrypt/src/hmac \
../../wolfcrypt/src/wolfcrypt_first \
../../wolfcrypt/src/idea \
../../wolfcrypt/src/wolfcrypt_last \
../../wolfcrypt/src/wolfevent \
../../wolfcrypt/src/logging \

View File

@ -1,7 +1,7 @@
#!/bin/bash
if [ -z $1 ]; then
echo "./build <Debug | Release>"
exit -1
exit 1
fi
printf "Erasing previous hexagon_$1_dynamic_toolv83_v65 and UbuntuARM_$1_aarch64\n"

View File

@ -1978,15 +1978,9 @@
<file>
<name>$PROJ_DIR$\..\..\..\..\wolfcrypt\src\kdf.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\..\..\wolfcrypt\src\hc128.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\..\..\wolfcrypt\src\hmac.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\..\..\wolfcrypt\src\idea.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\..\..\wolfcrypt\src\integer.c</name>
</file>
@ -2017,9 +2011,6 @@
<file>
<name>$PROJ_DIR$\..\..\..\..\wolfcrypt\src\pwdbased.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\..\..\wolfcrypt\src\rabbit.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\..\..\wolfcrypt\src\random.c</name>
</file>

View File

@ -1980,9 +1980,6 @@
<file>
<name>$PROJ_DIR$\..\..\..\..\..\wolfcrypt\src\pwdbased.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\..\..\..\wolfcrypt\src\rabbit.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\..\..\..\wolfcrypt\src\random.c</name>
</file>

View File

@ -2370,9 +2370,6 @@
<file>
<name>$PROJ_DIR$\..\..\..\..\..\wolfcrypt\src\pwdbased.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\..\..\..\wolfcrypt\src\rabbit.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\..\..\..\wolfcrypt\src\random.c</name>
</file>

View File

@ -36,15 +36,15 @@ wolfssl (latest version)
# asn.c misc.c #
# chacha.c poly1305.c #
# chacha20_poly1305.c pwdbased.c #
# coding.c rabbit.c #
# des3.c random.c #
# dh.c rsa.c #
# dsa.c sha.c #
# ecc.c sha256.c #
# hash.c sha512.c #
# hmac.c tfm.c #
# md4.c wc_encrypt.c #
# md5.c wc_port.c #
# coding.c random.c #
# des3.c rsa.c #
# dh.c sha.c #
# dsa.c sha256.c #
# ecc.c sha512.c #
# hash.c tfm.c #
# hmac.c wc_encrypt.c #
# md4.c wc_port.c #
# md5.c #
# kdf.c #
#---------------------------------------------#
@ -173,8 +173,6 @@ HMAC-SHA256 test passed!
HMAC-SHA384 test passed!
HMAC-SHA512 test passed!
GMAC test passed!
HC-128 test passed!
Rabbit test passed!
Chacha test passed!
POLY1305 test passed!
ChaCha20-Poly1305 AEAD test passed!

27
IDE/IAR-MSP430/Makefile Normal file
View File

@ -0,0 +1,27 @@
PROGRAM = wolfcrypt
WOLFSSL_SRC_DIR = ../..
TI_COMPILER_PATH = /opt/ti/msp430-gcc/bin
WOLFSSL_CFLAGS += -I$(WOLFSSL_SRC_DIR) -I. -DWOLFSSL_USER_SETTINGS
SRC_FILES = $(wildcard $(WOLFSSL_SRC_DIR)/src/*.c)
SRC_FILES += $(wildcard $(WOLFSSL_SRC_DIR)/wolfcrypt/src/*.c)
SRC_FILES := $(filter-out %bio.c %misc.c %evp.c, $(SRC_FILES))
SRC = main.c \
$(SRC_FILES)
CFLAGS += $(WOLFSSL_CFLAGS) -O3 -mmcu=msp430f5659 -I/opt/ti/msp430-gcc/include -L/opt/ti/msp430-gcc/include -mlarge -mcode-region=either -fdata-sections -ffunction-sections -Wl,--gc-sections
CC = $(TI_COMPILER_PATH)/msp430-elf-gcc
STRIP = $(TI_COMPILER_PATH)/msp430-elf-strip
$(PROGRAM): $(SRC)
$(CC) $(CFLAGS) $(SRC) $(LDFLAGS) $(LDLIBS) -o $@
$(STRIP) $@
clean:
rm -f $(PROGRAM)
install:
mspdebug tilib "prog $(PROGRAM)" --allow-fw-update

88
IDE/IAR-MSP430/README.md Normal file
View File

@ -0,0 +1,88 @@
# MSP430 Example
This example was designed to be used with the MSP430F5359/MSP430F5659 but can be ported to any similar MSP platform. It will take ~50KB of ROM space and a 8KB of statically allocated RAM (nearly half for constants).
The example runs at 8MHz and executes a benchmark of ECC key generations, shared secrets and 1KB ChaCha20/Poly1305 encryption.
At 8MHz the ECC steps will take 13-15 seconds each and 1000 iterations of ChaCha20/Poly1305 will take about 45 seconds.
## Hardware Setup
A basic development board / ISP combination will work fine, such as the MSP-TS430PZ100 series with the MSP-FET430 series programmer.
The example will output text via UART 1, on the MSP430 which is port 8 bits 2&3 (pins 60/61) on the MSP430F5359. The UART will run at 57600 baud.
In addition every second port 1 bit 1 will be toggled on/off (typically an LED would be here).
## IDE setup
When setting up the IDE, copy the wolfSSL source code to your project's directory and add all the .c and .h files from `wolfcrypt/src` to your project.
Use the `main.c` provided here and copy the `user_settings.h` file to the `wolfssl/wolfcrypt` subdirectory of wolfSSL.
You will need to set at least 700 bytes of stack, no heap is required. You will also need to change the "Library Configuration" to "Full DLIB" so the `printf()` functions work correctly.
Make sure to add the definition `WOLFSSL_USER_SETTINGS` to the preprocessor settings in your project to that `user_settings.h` is loaded in. You will also need to add the wolfSSL root directory to the "Additional include directories".
From here you can set any optimizer settings you need.
## MSP430 GCC Makefile
Also included is a `Makefile` for TI's GCC, when compiling with GCC the code size will be larger and the application will be ~2x slower.
To use this Makefile you will need [TI's MSP430 GCC](https://www.ti.com/tool/MSP430-GCC-OPENSOURCE) installed as well as `mspdebug` with the `libmsp430.so` accessible to it. You will need to edit the `Makefile` to set the `TI_COMPILER_PATH` to where you have installed this.
Once everything is in place you can run `make` to build it and `make install` to flash the MSP430 with it.
**Note**: this will not work with the much older version of MSP430 GCC that comes in Linux distribution repositories.
## Example Output
This is an example output for the demo application when compiled with IAR.
```
START!
Rand generated: 2317
Rand generated: -31901
Rand generated: 13538
Rand generated: -24035
Rand generated: 18849
Rand generated: -1593
Rand generated: 29653
Rand generated: -8148
Rand generated: -27438
Rand generated: 618
Rand generated: -17119
Rand generated: 4668
Rand generated: -26289
Rand generated: 28126
Rand generated: -15749
Rand generated: 22041
Rand generated: 8710
Rand generated: -22039
Rand generated: 1781
Rand generated: -32168
Rand generated: 6187
Rand generated: -7650
Rand generated: 30268
Rand generated: -13585
Rand generated: 24388
Rand generated: 8520
RNG init
Alice init
Bob init
.............Alice keygen 13 seconds
..............Bob keygen 14 seconds
.............Bob secret 13 seconds
..............Alice secret 14 seconds
Successfully generated a common secret
Alices' Secret: 85f3c7f599620c768e6dbb77dc2f8f764254cc1821aeb0a30503632dbc9bdb54
Bobs' Secret: 85f3c7f599620c768e6dbb77dc2f8f764254cc1821aeb0a30503632dbc9bdb54
ChaCha20/Poly1305 Encryption Start, 1000 itterations, 1024 bytes
............................................
End 44 seconds
ChaCha20/Poly1305 Decryption Start, 1000 itterations
............................................
End 44 seconds
end
```

View File

@ -0,0 +1,9 @@
# vim:ft=automake
# included from Top Level Makefile.am
# All paths should be given relative to the root
EXTRA_DIST+= IDE/IAR-MSP430/Makefile
EXTRA_DIST+= IDE/IAR-MSP430/README.md
EXTRA_DIST+= IDE/IAR-MSP430/main.c
EXTRA_DIST+= IDE/IAR-MSP430/user_settings.h

357
IDE/IAR-MSP430/main.c Normal file
View File

@ -0,0 +1,357 @@
/* MSP430 example main.c
*
* Copyright (C) 2022 wolfSSL Inc.
*
* This file is part of wolfSSL.
*
* wolfSSL is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* wolfSSL is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
*/
#include <wolfssl/wolfcrypt/settings.h>
#include <wolfssl/wolfcrypt/wc_port.h>
#include <wolfssl/wolfcrypt/types.h>
#include <wolfssl/wolfcrypt/random.h>
#include <wolfssl/wolfcrypt/ecc.h>
#include <wolfssl/wolfcrypt/curve25519.h>
#include <wolfssl/wolfcrypt/chacha20_poly1305.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <msp430f5659.h>
/* Without __root on some of the functions, IAR's "Discard Unused Publics"
will optimze out some of the functions
*/
#if defined(__IAR_SYSTEMS_ICC__)
#define IAR_KEEP __root
#else
#define IAR_KEEP
#endif
#define ECC_256_BIT_FIELD 32 /* 256-bit curve field */
#define WOLF_GEN_MEM (2*1024)
#define CHACHA_TEST_LEN 1024
static byte gWolfMem[WOLF_GEN_MEM];
static byte generatedCiphertext[CHACHA_TEST_LEN];
static byte generatedPlaintext[CHACHA_TEST_LEN];
#define MCLK_FREQ_MHZ 8 /* MCLK = 8MHz */
static const byte key[] = {
0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87,
0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f,
0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97,
0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f
};
static const byte plaintext[] = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras lacus odio, pretium vel sagittis ac, facilisis quis diam. Vivamus condimentum velit sed dolor consequat interdum. Etiam eleifend ornare felis, eleifend egestas odio vulputate eu. Sed nec orci nunc. Etiam quis mi augue. Donec ullamcorper suscipit lorem, vel luctus augue cursus fermentum. Etiam a porta arcu, in convallis sem. Integer efficitur elementum diam, vel scelerisque felis posuere placerat. Donec vestibulum sit amet leo sit amet tincidunt. Etiam et vehicula turpis. Phasellus quis finibus sapien. Sed et tristique turpis. Nullam vitae sagittis tortor, et aliquet lorem. Cras a leo scelerisque, convallis lacus ut, fermentum urna. Mauris quis urna diam. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Nam aliquam vehicula orci id pulvinar. Proin mollis, libero sollicitudin tempor ultrices, massa augue tincidunt turpis, sit amet aliquam neque nibh nec dui. Fusce finibus massa quis rutrum suscipit cras amet";
static const byte iv[] = {
0x07, 0x00, 0x00, 0x00, 0x40, 0x41, 0x42, 0x43,
0x44, 0x45, 0x46, 0x47
};
static const byte aad[] = { /* additional data */
0x50, 0x51, 0x52, 0x53, 0xc0, 0xc1, 0xc2, 0xc3,
0xc4, 0xc5, 0xc6, 0xc7
};
volatile unsigned int seconds;
IAR_KEEP unsigned int msp430_time(long *x)
{
return seconds;
}
static void print_secret(char* who, byte* s, int sLen)
{
int i;
printf("%ss' Secret: ", who);
for (i = 0; i < sLen; i++) {
printf("%02x", s[i]);
}
printf("\r\n");
}
/* This is a very crude RNG, do not use in production */
IAR_KEEP unsigned int msp430_rnd(void)
{
unsigned int result = TA0R ^ TA2R;
printf("Rand generated: %d\r\n", result);
return result;
}
static void uart_init()
{
P8SEL |= BIT3 + BIT2;
UCA1CTLW0 = UCSWRST; /* Put eUSCI in reset */
UCA1CTLW0 |= UCSSEL__SMCLK; /* CLK = SMCLK */
/* Baud Rate calculation
This was calculated to produce 115200 for a 16MHz clock, so it produces
57600 at 8MHz
16000000/(16*115200) = 8.6805
Fractional portion = 0.6805
Use Table 24-5 in Family User Guide
*/
UCA1BR0 = 8;
UCA1BR1 = 0x00;
UCA1MCTL |= UCOS16 | UCBRF_11 | UCBRS_0;
UCA1CTLW0 &= ~UCSWRST; /* Initialize eUSCI */
UCA1IE |= UCRXIE; /* Enable USCI_A0 RX interrupt */
}
#if defined(__IAR_SYSTEMS_ICC__)
IAR_KEEP size_t __write(int fd, const unsigned char *_ptr, size_t len)
#else
int write(int fd, const char *_ptr, int len)
#endif
{
size_t i;
for(i=0 ; i<len ; i++) {
while(!(UCA1IFG&UCTXIFG));
UCA1TXBUF = (unsigned char) _ptr[i];
}
return len;
}
static void SetVcoreUp (unsigned int level)
{
/* Change VCORE voltage level */
PMMCTL0_H = PMMPW_H; /* Open PMM registers for write */
SVSMHCTL = SVSHE /* Set SVS/SVM high side new level */
+ SVSHRVL0 * level
+ SVMHE
+ SVSMHRRL0 * level;
SVSMLCTL = SVSLE /* Set SVM low side to new level */
+ SVMLE
+ SVSMLRRL0 * level;
while ((PMMIFG & SVSMLDLYIFG) == 0); /* Wait till SVM is settled */
PMMIFG &= ~(SVMLVLRIFG + SVMLIFG); /* Clear already set flags */
PMMCTL0_L = PMMCOREV0 * level; /* Set VCore to new level */
if ((PMMIFG & SVMLIFG)) /* Wait till new level reached */
while ((PMMIFG & SVMLVLRIFG) == 0);
SVSMLCTL = SVSLE /* Set SVS/SVM low side to new level */
+ SVSLRVL0 * level
+ SVMLE
+ SVSMLRRL0 * level;
PMMCTL0_H = 0x00; /* Lock PMM registers for write access */
}
/* Stop WDT
We need to do this before main() because when there is ~4K of data to
initialize the watchdog will fire before initialization completes, sending
it into an endless loop of nothing.
See: https://www.iar.com/knowledge/support/technical-notes/general/my-msp430-does-not-start-up/
*/
#if defined(__IAR_SYSTEMS_ICC__)
int __low_level_init()
{
WDTCTL = WDTPW | WDTHOLD;
return 1;
}
#else
static void __attribute__((naked, used, section(".crt_0042")))
disable_watchdog (void)
{
WDTCTL = WDTPW | WDTHOLD;
}
#endif
int main(void)
{
byte generatedAuthTag[16];
WOLFSSL_HEAP_HINT* HEAP_HINT = NULL;
int ret;
int start;
/* NOTE: Change core voltage one level at a time.. */
SetVcoreUp (0x01);
SetVcoreUp (0x02);
SetVcoreUp (0x03);
/* USC module configuration, Fdcoclockdiv = Fmclk = 8MHz */
UCSCTL8 &= ~SMCLKREQEN; /* disable SMCLK clock requests */
UCSCTL3 = (0*FLLREFDIV0) /* FLL ref divider 1 */
+ SELREF2; /* set REFOCLK as FLL reference clock source */
UCSCTL4 = SELA__REFOCLK /* ACLK = REFO */
+ SELM__DCOCLKDIV /* MCLK = DCOCLKDIV */
+ SELS__DCOCLKDIV; /* SMCLK = DCOCLKDIV */
__bis_SR_register(SCG0); /* disable FLL operation */
UCSCTL0 = 0x0000; /* lowest possible DCO, MOD */
UCSCTL1 = DISMOD_L /* modulation disabled */
+ DCORSEL_6; /* DCO range for 8MHz operation */
UCSCTL2 = FLLD_0 /* D=FLLD=1, so that Fdco=8MHz */
+ 243; /* DCO multiplier for 8MHz */
/* (N + 1) * FLLRef = Fdcodiv */
/* (243 + 1) * 32768 = 8MHz (multiplier N = 243) */
__bic_SR_register(SCG0); /* re-enable FLL operation */
/* worst-case settling time for the DCO when the DCO range bits have been
32 x 32 x 8 MHz / 32,768 Hz = 250000 = MCLK cycles for DCO to settle
*/
__delay_cycles(250000);
TA0CCR0 = 32768-1;
TA0CCTL0 |= CCIE;
TA0CTL = TASSEL_1 + ID_0 + MC_1;
TA2CTL = TASSEL_2 | MC_2;
P1DIR = 1;
P1OUT = 0;
uart_init();
#if defined(__IAR_SYSTEMS_ICC__)
__enable_interrupt();
#else
_enable_interrupts();
#endif
printf("START!\r\n");
#ifdef HAVE_ECC
WC_RNG rng;
ecc_key AliceKey, BobKey;
byte AliceSecret[ECC_256_BIT_FIELD] = {0};
byte BobSecret[ECC_256_BIT_FIELD] = {0};
word32 secretLen = 0;
if (wc_LoadStaticMemory(&HEAP_HINT, gWolfMem, sizeof(gWolfMem),
WOLFMEM_GENERAL, 10) != 0) {
printf("unable to load static memory");
}
ret = wc_InitRng_ex(&rng, HEAP_HINT, INVALID_DEVID);
if (ret != 0) {
printf("RNG init fail: %d\r\n", ret);
return ret;
}
printf("RNG init\r\n");
ret = wc_ecc_init(&AliceKey);
if (ret != 0) {
printf("Alice init fail\r\n");
goto only_rng;
}
printf("Alice init\r\n");
ret = wc_ecc_init(&BobKey);
if (ret != 0) {
printf("Bob init fail\r\n");
goto alice_and_rng;
}
printf("Bob init\r\n");
start = seconds;
ret = wc_ecc_make_key(&rng, ECC_256_BIT_FIELD, &AliceKey);
if (ret != 0) {
printf("Alice keygen fail\r\n");
goto all_three;
}
printf("Alice keygen %d seconds\r\n", seconds - start);
start = seconds;
ret = wc_ecc_make_key(&rng, ECC_256_BIT_FIELD, &BobKey);
if (ret != 0) {
printf("Bob keygen fail\r\n");
goto all_three;
}
printf("Bob keygen %d seconds\r\n", seconds - start);
start = seconds;
secretLen = ECC_256_BIT_FIELD; /* explicit set */
ret = wc_ecc_shared_secret(&AliceKey, &BobKey, AliceSecret, &secretLen);
if (ret != 0) {
printf("Shared secret fail\r\n");
goto all_three;
}
printf("Bob secret %d seconds\r\n", seconds - start);
start = seconds;
secretLen = ECC_256_BIT_FIELD; /* explicit reset for best practice */
ret = wc_ecc_shared_secret(&BobKey, &AliceKey, BobSecret, &secretLen);
if (ret == 0) {
if (XMEMCMP(AliceSecret, BobSecret, secretLen))
printf("Failed to generate a common secret\n");
} else {
goto all_three;
}
printf("Alice secret %d seconds\r\n", seconds - start);
printf("Successfully generated a common secret\r\n");
print_secret("Alice", AliceSecret, (int) secretLen);
print_secret("Bob", BobSecret, (int) secretLen);
all_three:
wc_ecc_free(&BobKey);
alice_and_rng:
wc_ecc_free(&AliceKey);
only_rng:
wc_FreeRng(&rng);
printf(
"ChaCha20/Poly1305 Encryption Start, 1000 itterations, %d bytes\r\n",
(int)strlen((const char*)plaintext));
start = seconds;
for (int i=0; i <= 1000; i++) {
ret = wc_ChaCha20Poly1305_Encrypt(key, iv, aad, sizeof(aad), plaintext,
strlen((const char*)plaintext), generatedCiphertext,
generatedAuthTag);
if (ret) {
printf("ChaCha error: %d\r\n", ret);
break;
}
}
printf("\r\nEnd %d seconds\r\n", seconds - start);
start = seconds;
printf("ChaCha20/Poly1305 Decryption Start, 1000 itterations\r\n");
start = seconds;
for (int i=0; i <= 1000; i++) {
ret = wc_ChaCha20Poly1305_Decrypt(key, iv, aad, sizeof(aad),
generatedCiphertext, strlen((const char*)plaintext),
generatedAuthTag, generatedPlaintext);
if (ret) {
printf("ChaCha error: %d\r\n", ret);
break;
}
}
printf("\r\nEnd %d seconds\r\n", seconds - start);
#else
printf("Configure wolfSSL with --enable-ecc and try again\n");
ret = -1;
#endif
printf("end\r\n");
while(1) {
__delay_cycles(8000000);
}
return ret;
}
/* Timer ISR */
#if defined(__TI_COMPILER_VERSION__) || defined(__IAR_SYSTEMS_ICC__)
#pragma vector=TIMER0_A0_VECTOR
__interrupt void TIMER0_A0_ISR(void)
#elif defined(__GNUC__)
void __attribute__ ((interrupt(TIMER0_A0_VECTOR))) TIMER0_A0_ISR (void)
#else
#error Compiler not supported!
#endif
{
seconds++;
P1OUT = seconds ^ 2;
fprintf(stderr, ".");
}

View File

@ -0,0 +1,134 @@
/* user_settings.h
*
* Copyright (C) 2006-2022 wolfSSL Inc.
*
* This file is part of wolfSSL.
*
* wolfSSL is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* wolfSSL is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
*/
#ifndef WOLFSSL_USER_SETTINGS_H
#define WOLFSSL_USER_SETTINGS_H
#ifdef __cplusplus
extern "C" {
#endif
#undef SINGLE_THREADED
#define SINGLE_THREADED
#undef WOLFSSL_STATIC_MEMORY
#define WOLFSSL_STATIC_MEMORY
#undef WOLFSSL_NO_MALLOC
#define WOLFSSL_NO_MALLOC
#undef NO_FILESYSTEM
#define NO_FILESYSTEM
/* WolfCrypt Only (no TLS) */
#define WOLFCRYPT_ONLY
/* 16 bit */
#define WC_16BIT_CPU
/* Endianness - defaults to little endian */
#ifdef __BIG_ENDIAN__
#define BIG_ENDIAN_ORDER
#endif
/* Expose the math mp_ API's */
#define WOLFSSL_PUBLIC_MP
/* Use single precision math only */
#define WOLFSSL_SP_MATH
#define WOLFSSL_SP_NO_MALLOC
#define WOLFSSL_SP_SMALL
#define WOLFSSL_SP_NO_DYN_STACK
#define WOLFSSL_HAVE_SP_ECC
#define SP_WORD_SIZE 32
#define FP_MAX_BITS (2*256)
#define USE_SLOW_SHA
#define USE_SLOW_SHA256
#define USE_SLOW_SHA512
/* Enable Timing Resistance */
#define TFM_TIMING_RESISTANT
#define ECC_TIMING_RESISTANT
/* Enable ECC */
#define HAVE_ECC
#define ECC_USER_CURVES /* Only 256-Bit Curves */
//#define ECC_SHAMIR
/* Optional Feature Disables */
#define NO_SIG_WRAPPER
//#define NO_ECC_KEY_EXPORT
//#define NO_ECC_DHE
//#define NO_ECC_SIGN
//#define NO_ECC_VERIFY
/* Disable Algorithms */
#define NO_AES
#define NO_AES_CBC
#define NO_DES3
#define NO_DSA
#define NO_RSA
#define NO_DH
#define NO_RC4
#define NO_MD4
#define NO_MD5
#define NO_SHA
#define NO_PWDBASED
#define NO_PKCS12
#define NO_PKCS8
#define HAVE_CHACHA
#define HAVE_POLY1305
#define SIZEOF_LONG_LONG 8
/* Disable Features */
//#define NO_ASN
//#define NO_CERTS
//#define NO_WOLFSSL_MEMORY
#define WOLFSSL_NO_PEM
//#define NO_CODING
#define NO_PSK
#ifndef DEBUG_WOLFSSL
#define DEBUG_WOLFSSL
#define NO_ERROR_STRINGS
#endif
#define CUSTOM_RAND_TYPE unsigned int
extern unsigned int msp430_rnd(void);
#undef CUSTOM_RAND_GENERATE
#define CUSTOM_RAND_GENERATE msp430_rnd
extern unsigned int msp430_time(long *x);
#undef XTIME
#define XTIME msp430_time
#undef NO_CRYPT_TEST
#define NO_CRYPT_TEST
#undef NO_CRYPT_BENCHMARK
#define NO_CRYPT_BENCHMARK
#ifdef __cplusplus
}
#endif
#endif /* WOLFSSL_USER_SETTINGS_H */

View File

@ -47,9 +47,7 @@
<ClCompile Include="..\..\wolfcrypt\src\ge_operations.c" />
<ClCompile Include="..\..\wolfcrypt\src\hash.c" />
<ClCompile Include="..\..\wolfcrypt\src\kdf.c" />
<ClCompile Include="..\..\wolfcrypt\src\hc128.c" />
<ClCompile Include="..\..\wolfcrypt\src\hmac.c" />
<ClCompile Include="..\..\wolfcrypt\src\idea.c" />
<ClCompile Include="..\..\wolfcrypt\src\integer.c" />
<ClCompile Include="..\..\wolfcrypt\src\logging.c" />
<ClCompile Include="..\..\wolfcrypt\src\md2.c" />
@ -60,7 +58,6 @@
<ClCompile Include="..\..\wolfcrypt\src\pkcs7.c" />
<ClCompile Include="..\..\wolfcrypt\src\poly1305.c" />
<ClCompile Include="..\..\wolfcrypt\src\pwdbased.c" />
<ClCompile Include="..\..\wolfcrypt\src\rabbit.c" />
<ClCompile Include="..\..\wolfcrypt\src\random.c" />
<ClCompile Include="..\..\wolfcrypt\src\ripemd.c" />
<ClCompile Include="..\..\wolfcrypt\src\rsa.c" />
@ -114,9 +111,7 @@
<ClInclude Include="..\..\wolfssl\wolfcrypt\fips_test.h" />
<ClInclude Include="..\..\wolfssl\wolfcrypt\ge_operations.h" />
<ClInclude Include="..\..\wolfssl\wolfcrypt\hash.h" />
<ClInclude Include="..\..\wolfssl\wolfcrypt\hc128.h" />
<ClInclude Include="..\..\wolfssl\wolfcrypt\hmac.h" />
<ClInclude Include="..\..\wolfssl\wolfcrypt\idea.h" />
<ClInclude Include="..\..\wolfssl\wolfcrypt\integer.h" />
<ClInclude Include="..\..\wolfssl\wolfcrypt\logging.h" />
<ClInclude Include="..\..\wolfssl\wolfcrypt\md2.h" />
@ -131,7 +126,6 @@
<ClInclude Include="..\..\wolfssl\wolfcrypt\pkcs7.h" />
<ClInclude Include="..\..\wolfssl\wolfcrypt\poly1305.h" />
<ClInclude Include="..\..\wolfssl\wolfcrypt\pwdbased.h" />
<ClInclude Include="..\..\wolfssl\wolfcrypt\rabbit.h" />
<ClInclude Include="..\..\wolfssl\wolfcrypt\random.h" />
<ClInclude Include="..\..\wolfssl\wolfcrypt\ripemd.h" />
<ClInclude Include="..\..\wolfssl\wolfcrypt\rsa.h" />

View File

@ -418,12 +418,6 @@ extern "C" {
#undef NO_RC4
#define NO_RC4
#undef NO_HC128
#define NO_HC128
#undef NO_RABBIT
#define NO_RABBIT
#undef NO_MD4
#define NO_MD4

View File

@ -170,21 +170,11 @@
<type>1</type>
<locationURI>PARENT-2-PROJECT_LOC/wolfcrypt/src/kdf.c</locationURI>
</link>
<link>
<name>src/wolfcrypt-src/hc128.c</name>
<type>1</type>
<locationURI>PARENT-2-PROJECT_LOC/wolfcrypt/src/hc128.c</locationURI>
</link>
<link>
<name>src/wolfcrypt-src/hmac.c</name>
<type>1</type>
<locationURI>PARENT-2-PROJECT_LOC/wolfcrypt/src/hmac.c</locationURI>
</link>
<link>
<name>src/wolfcrypt-src/idea.c</name>
<type>1</type>
<locationURI>PARENT-2-PROJECT_LOC/wolfcrypt/src/idea.c</locationURI>
</link>
<link>
<name>src/wolfcrypt-src/integer.c</name>
<type>1</type>
@ -235,11 +225,6 @@
<type>1</type>
<locationURI>PARENT-2-PROJECT_LOC/wolfcrypt/src/pwdbased.c</locationURI>
</link>
<link>
<name>src/wolfcrypt-src/rabbit.c</name>
<type>1</type>
<locationURI>PARENT-2-PROJECT_LOC/wolfcrypt/src/rabbit.c</locationURI>
</link>
<link>
<name>src/wolfcrypt-src/random.c</name>
<type>1</type>

View File

@ -62,7 +62,6 @@ Wolfssl_C_Files :=$(WOLFSSL_ROOT)/wolfcrypt/src/aes.c\
$(WOLFSSL_ROOT)/wolfcrypt/src/error.c\
$(WOLFSSL_ROOT)/wolfcrypt/src/hash.c\
$(WOLFSSL_ROOT)/wolfcrypt/src/kdf.c\
$(WOLFSSL_ROOT)/wolfcrypt/src/hc128.c\
$(WOLFSSL_ROOT)/wolfcrypt/src/hmac.c\
$(WOLFSSL_ROOT)/wolfcrypt/src/integer.c\
$(WOLFSSL_ROOT)/src/internal.c\
@ -79,7 +78,6 @@ Wolfssl_C_Files :=$(WOLFSSL_ROOT)/wolfcrypt/src/aes.c\
$(WOLFSSL_ROOT)/wolfcrypt/src/wc_port.c\
$(WOLFSSL_ROOT)/wolfcrypt/src/wolfmath.c\
$(WOLFSSL_ROOT)/wolfcrypt/src/pwdbased.c\
$(WOLFSSL_ROOT)/wolfcrypt/src/rabbit.c\
$(WOLFSSL_ROOT)/wolfcrypt/src/random.c\
$(WOLFSSL_ROOT)/wolfcrypt/src/ripemd.c\
$(WOLFSSL_ROOT)/wolfcrypt/src/rsa.c\

View File

@ -45,8 +45,6 @@
#define NO_WOLFSSL_MEMORY
#define NO_DEV_RANDOM
#define NO_MD4
#define NO_RABBIT
#define NO_HC128
#define NO_DSA
#define NO_PWDBASED
#define NO_PSK

View File

@ -48,8 +48,6 @@
#define NO_ASN_TIME
#define NO_PWDBASED
#define NO_HC128
#define NO_RABBIT
#define NO_RC4
#define NO_DSA
#define NO_DES3

View File

@ -138,19 +138,6 @@
#define NO_HMAC
#endif
// </e>
// <e>HC128
#define MDK_CONF_HC128 0
#if MDK_CONF_HC128 == 1
#define HAVE_HC128
#endif
// </e>
// <e>RABBIT
#define MDK_CONF_RABBIT 1
#if MDK_CONF_RABBI == 0
#define NO_RABBIT
#endif
// </e>
// <e>AEAD
#define MDK_CONF_AEAD 0
#if MDK_CONF_AEAD == 1

View File

@ -175,19 +175,6 @@
#define NO_HMAC
#endif
// </e>
// <e>HC128
#define MDK_CONF_HC128 0
#if MDK_CONF_HC128 == 1
#define HAVE_HC128
#endif
// </e>
// <e>RABBIT
#define MDK_CONF_RABBIT 1
#if MDK_CONF_RABBI == 0
#define NO_RABBIT
#endif
// </e>
// <e>AEAD
#define MDK_CONF_AEAD 0
#if MDK_CONF_AEAD == 1

View File

@ -197,19 +197,6 @@
#define NO_HMAC
#endif
// </e>
// <e>HC128
#define MDK_CONF_HC128 0
#if MDK_CONF_HC128 == 1
#define HAVE_HC128
#endif
// </e>
// <e>RABBIT
#define MDK_CONF_RABBIT 1
#if MDK_CONF_RABBI == 0
#define NO_RABBIT
#endif
// </e>
// <e>AEAD
#define MDK_CONF_AEAD 0
#if MDK_CONF_AEAD == 1

View File

@ -74,7 +74,7 @@ __task void tcp_tick (void)
__task void tcp_poll (void)
{
WOLFSSL_MSG("TCP polling started.\n") ;
WOLFSSL_MSG("TCP polling started.") ;
while (1) {
main_TcpNet ();
#if defined (HAVE_KEIL_RTX)
@ -128,7 +128,7 @@ void main_task (void)
#endif
#ifdef HAVE_KEIL_RTX
WOLFSSL_MSG("Terminating tcp_main\n") ;
WOLFSSL_MSG("Terminating tcp_main") ;
os_tsk_delete_self ();
#endif

View File

@ -145,14 +145,6 @@ extern void hmac_sha384_test(void *arg) ;
extern void arc4_test(void *arg) ;
#endif
#ifndef NO_HC128
extern void hc128_test(void *arg) ;
#endif
#ifndef NO_RABBIT
extern void rabbit_test(void *arg) ;
#endif
#ifndef NO_DES3
extern void des_test(void *arg) ;
extern void des3_test(void *arg) ;
@ -267,12 +259,6 @@ static struct {
#ifndef NO_RC4
"arc4", arc4_test,
#endif
#ifndef NO_HC128
"hc128", hc128_test,
#endif
#ifndef NO_RABBIT
"rabbit", rabbit_test,
#endif
#ifndef NO_DES3
"des", des_test,
"des3", des3_test,

View File

@ -851,19 +851,6 @@
<Focus>0</Focus>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>..\..\..\wolfcrypt\src\hc128.c</PathWithFileName>
<FilenameWithoutPath>hc128.c</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
<File>
<GroupNumber>1</GroupNumber>
<FileNumber>23</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<Focus>0</Focus>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>..\..\..\wolfcrypt\src\hmac.c</PathWithFileName>
<FilenameWithoutPath>hmac.c</FilenameWithoutPath>
<RteFlg>0</RteFlg>
@ -871,7 +858,7 @@
</File>
<File>
<GroupNumber>1</GroupNumber>
<FileNumber>24</FileNumber>
<FileNumber>23</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<Focus>0</Focus>
@ -884,7 +871,7 @@
</File>
<File>
<GroupNumber>1</GroupNumber>
<FileNumber>25</FileNumber>
<FileNumber>24</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<Focus>0</Focus>
@ -897,7 +884,7 @@
</File>
<File>
<GroupNumber>1</GroupNumber>
<FileNumber>26</FileNumber>
<FileNumber>25</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<Focus>0</Focus>
@ -910,7 +897,7 @@
</File>
<File>
<GroupNumber>1</GroupNumber>
<FileNumber>27</FileNumber>
<FileNumber>26</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<Focus>0</Focus>
@ -923,7 +910,7 @@
</File>
<File>
<GroupNumber>1</GroupNumber>
<FileNumber>28</FileNumber>
<FileNumber>27</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<Focus>0</Focus>
@ -936,7 +923,7 @@
</File>
<File>
<GroupNumber>1</GroupNumber>
<FileNumber>29</FileNumber>
<FileNumber>28</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<Focus>0</Focus>
@ -949,7 +936,7 @@
</File>
<File>
<GroupNumber>1</GroupNumber>
<FileNumber>30</FileNumber>
<FileNumber>29</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<Focus>0</Focus>
@ -962,7 +949,7 @@
</File>
<File>
<GroupNumber>1</GroupNumber>
<FileNumber>31</FileNumber>
<FileNumber>30</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<Focus>0</Focus>
@ -975,7 +962,7 @@
</File>
<File>
<GroupNumber>1</GroupNumber>
<FileNumber>32</FileNumber>
<FileNumber>31</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<Focus>0</Focus>
@ -988,20 +975,7 @@
</File>
<File>
<GroupNumber>1</GroupNumber>
<FileNumber>33</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<Focus>0</Focus>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>..\..\..\wolfcrypt\src\rabbit.c</PathWithFileName>
<FilenameWithoutPath>rabbit.c</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
<File>
<GroupNumber>1</GroupNumber>
<FileNumber>34</FileNumber>
<FileNumber>32</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<Focus>0</Focus>
@ -1014,7 +988,7 @@
</File>
<File>
<GroupNumber>1</GroupNumber>
<FileNumber>35</FileNumber>
<FileNumber>33</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<Focus>0</Focus>
@ -1027,7 +1001,7 @@
</File>
<File>
<GroupNumber>1</GroupNumber>
<FileNumber>36</FileNumber>
<FileNumber>34</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<Focus>0</Focus>
@ -1040,7 +1014,7 @@
</File>
<File>
<GroupNumber>1</GroupNumber>
<FileNumber>37</FileNumber>
<FileNumber>35</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<Focus>0</Focus>
@ -1053,7 +1027,7 @@
</File>
<File>
<GroupNumber>1</GroupNumber>
<FileNumber>38</FileNumber>
<FileNumber>36</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<Focus>0</Focus>
@ -1066,7 +1040,7 @@
</File>
<File>
<GroupNumber>1</GroupNumber>
<FileNumber>39</FileNumber>
<FileNumber>37</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<Focus>0</Focus>
@ -1079,7 +1053,7 @@
</File>
<File>
<GroupNumber>1</GroupNumber>
<FileNumber>40</FileNumber>
<FileNumber>38</FileNumber>
<FileType>1</FileType>
<tvExp>1</tvExp>
<Focus>0</Focus>
@ -1092,7 +1066,7 @@
</File>
<File>
<GroupNumber>1</GroupNumber>
<FileNumber>41</FileNumber>
<FileNumber>39</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<Focus>0</Focus>
@ -1105,7 +1079,7 @@
</File>
<File>
<GroupNumber>1</GroupNumber>
<FileNumber>42</FileNumber>
<FileNumber>40</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<Focus>0</Focus>
@ -1118,7 +1092,7 @@
</File>
<File>
<GroupNumber>1</GroupNumber>
<FileNumber>43</FileNumber>
<FileNumber>41</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<Focus>0</Focus>
@ -1131,7 +1105,7 @@
</File>
<File>
<GroupNumber>1</GroupNumber>
<FileNumber>44</FileNumber>
<FileNumber>42</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<Focus>0</Focus>
@ -1144,7 +1118,7 @@
</File>
<File>
<GroupNumber>1</GroupNumber>
<FileNumber>45</FileNumber>
<FileNumber>43</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<Focus>0</Focus>
@ -1157,7 +1131,7 @@
</File>
<File>
<GroupNumber>1</GroupNumber>
<FileNumber>46</FileNumber>
<FileNumber>44</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<Focus>0</Focus>
@ -1170,7 +1144,7 @@
</File>
<File>
<GroupNumber>1</GroupNumber>
<FileNumber>47</FileNumber>
<FileNumber>45</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<Focus>0</Focus>
@ -1183,7 +1157,7 @@
</File>
<File>
<GroupNumber>1</GroupNumber>
<FileNumber>48</FileNumber>
<FileNumber>46</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<Focus>0</Focus>
@ -1204,7 +1178,7 @@
<RteFlg>0</RteFlg>
<File>
<GroupNumber>2</GroupNumber>
<FileNumber>48</FileNumber>
<FileNumber>47</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<Focus>0</Focus>
@ -1217,7 +1191,7 @@
</File>
<File>
<GroupNumber>2</GroupNumber>
<FileNumber>49</FileNumber>
<FileNumber>48</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<Focus>0</Focus>
@ -1230,7 +1204,7 @@
</File>
<File>
<GroupNumber>2</GroupNumber>
<FileNumber>50</FileNumber>
<FileNumber>49</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<Focus>0</Focus>
@ -1243,7 +1217,7 @@
</File>
<File>
<GroupNumber>2</GroupNumber>
<FileNumber>51</FileNumber>
<FileNumber>50</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<Focus>0</Focus>
@ -1256,7 +1230,7 @@
</File>
<File>
<GroupNumber>2</GroupNumber>
<FileNumber>52</FileNumber>
<FileNumber>51</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<Focus>0</Focus>
@ -1269,7 +1243,7 @@
</File>
<File>
<GroupNumber>2</GroupNumber>
<FileNumber>53</FileNumber>
<FileNumber>52</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<Focus>0</Focus>
@ -1282,7 +1256,7 @@
</File>
<File>
<GroupNumber>2</GroupNumber>
<FileNumber>54</FileNumber>
<FileNumber>53</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<Focus>0</Focus>
@ -1295,7 +1269,7 @@
</File>
<File>
<GroupNumber>2</GroupNumber>
<FileNumber>55</FileNumber>
<FileNumber>54</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<Focus>0</Focus>
@ -1316,7 +1290,7 @@
<RteFlg>0</RteFlg>
<File>
<GroupNumber>3</GroupNumber>
<FileNumber>56</FileNumber>
<FileNumber>55</FileNumber>
<FileType>5</FileType>
<tvExp>0</tvExp>
<Focus>0</Focus>
@ -1329,7 +1303,7 @@
</File>
<File>
<GroupNumber>3</GroupNumber>
<FileNumber>57</FileNumber>
<FileNumber>56</FileNumber>
<FileType>5</FileType>
<tvExp>0</tvExp>
<Focus>0</Focus>
@ -1342,7 +1316,7 @@
</File>
<File>
<GroupNumber>3</GroupNumber>
<FileNumber>58</FileNumber>
<FileNumber>57</FileNumber>
<FileType>5</FileType>
<tvExp>0</tvExp>
<Focus>0</Focus>
@ -1355,7 +1329,7 @@
</File>
<File>
<GroupNumber>3</GroupNumber>
<FileNumber>59</FileNumber>
<FileNumber>58</FileNumber>
<FileType>5</FileType>
<tvExp>0</tvExp>
<Focus>0</Focus>

View File

@ -511,11 +511,6 @@
<FileType>1</FileType>
<FilePath>..\..\..\wolfcrypt\src\ge_operations.c</FilePath>
</File>
<File>
<FileName>hc128.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\..\wolfcrypt\src\hc128.c</FilePath>
</File>
<File>
<FileName>hmac.c</FileName>
<FileType>1</FileType>
@ -566,11 +561,6 @@
<FileType>1</FileType>
<FilePath>..\..\..\wolfcrypt\src\pwdbased.c</FilePath>
</File>
<File>
<FileName>rabbit.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\..\wolfcrypt\src\rabbit.c</FilePath>
</File>
<File>
<FileName>random.c</FileName>
<FileType>1</FileType>
@ -1225,11 +1215,6 @@
<FileType>1</FileType>
<FilePath>..\..\..\wolfcrypt\src\ge_operations.c</FilePath>
</File>
<File>
<FileName>hc128.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\..\wolfcrypt\src\hc128.c</FilePath>
</File>
<File>
<FileName>hmac.c</FileName>
<FileType>1</FileType>
@ -1280,11 +1265,6 @@
<FileType>1</FileType>
<FilePath>..\..\..\wolfcrypt\src\pwdbased.c</FilePath>
</File>
<File>
<FileName>rabbit.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\..\wolfcrypt\src\rabbit.c</FilePath>
</File>
<File>
<FileName>random.c</FileName>
<FileType>1</FileType>
@ -1939,11 +1919,6 @@
<FileType>1</FileType>
<FilePath>..\..\..\wolfcrypt\src\ge_operations.c</FilePath>
</File>
<File>
<FileName>hc128.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\..\wolfcrypt\src\hc128.c</FilePath>
</File>
<File>
<FileName>hmac.c</FileName>
<FileType>1</FileType>
@ -1994,11 +1969,6 @@
<FileType>1</FileType>
<FilePath>..\..\..\wolfcrypt\src\pwdbased.c</FilePath>
</File>
<File>
<FileName>rabbit.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\..\wolfcrypt\src\rabbit.c</FilePath>
</File>
<File>
<FileName>random.c</FileName>
<FileType>1</FileType>

View File

@ -245,20 +245,6 @@
#endif
// </e>
// <e>HC128
#define MDK_CONF_HC128 1
#if MDK_CONF_HC128 == 0
#define NO_HC128
#endif
// </e>
// <e>RABBIT
#define MDK_CONF_RABBIT 1
#if MDK_CONF_RABBIT == 0
#define NO_RABBIT
#endif
// </e>
// <e>CHACHA
#define MDK_CONF_CHACHA 1
#if MDK_CONF_CHACHA == 1

View File

@ -245,20 +245,6 @@
#endif
// </e>
// <e>HC128
#define MDK_CONF_HC128 1
#if MDK_CONF_HC128 == 0
#define NO_HC128
#endif
// </e>
// <e>RABBIT
#define MDK_CONF_RABBIT 1
#if MDK_CONF_RABBIT == 0
#define NO_RABBIT
#endif
// </e>
// <e>CHACHA
#define MDK_CONF_CHACHA 1
#if MDK_CONF_CHACHA == 1

View File

@ -245,20 +245,6 @@
#endif
// </e>
// <e>HC128
#define MDK_CONF_HC128 1
#if MDK_CONF_HC128 == 0
#define NO_HC128
#endif
// </e>
// <e>RABBIT
#define MDK_CONF_RABBIT 1
#if MDK_CONF_RABBIT == 0
#define NO_RABBIT
#endif
// </e>
// <e>CHACHA
#define MDK_CONF_CHACHA 1
#if MDK_CONF_CHACHA == 1

View File

@ -243,20 +243,6 @@
#endif
// </e>
// <e>HC128
#define MDK_CONF_HC128 1
#if MDK_CONF_HC128 == 0
#define NO_HC128
#endif
// </e>
// <e>RABBIT
#define MDK_CONF_RABBIT 1
#if MDK_CONF_RABBIT == 0
#define NO_RABBIT
#endif
// </e>
// <e>CHACHA
#define MDK_CONF_CHACHA 1
#if MDK_CONF_CHACHA == 1

View File

@ -245,20 +245,6 @@
#endif
// </e>
// <e>HC128
#define MDK_CONF_HC128 1
#if MDK_CONF_HC128 == 0
#define NO_HC128
#endif
// </e>
// <e>RABBIT
#define MDK_CONF_RABBIT 1
#if MDK_CONF_RABBIT == 0
#define NO_RABBIT
#endif
// </e>
// <e>CHACHA
#define MDK_CONF_CHACHA 1
#if MDK_CONF_CHACHA == 1

View File

@ -245,20 +245,6 @@
#endif
// </e>
// <e>HC128
#define MDK_CONF_HC128 1
#if MDK_CONF_HC128 == 0
#define NO_HC128
#endif
// </e>
// <e>RABBIT
#define MDK_CONF_RABBIT 1
#if MDK_CONF_RABBIT == 0
#define NO_RABBIT
#endif
// </e>
// <e>CHACHA
#define MDK_CONF_CHACHA 1
#if MDK_CONF_CHACHA == 1

View File

@ -245,20 +245,6 @@
#endif
// </e>
// <e>HC128
#define MDK_CONF_HC128 1
#if MDK_CONF_HC128 == 0
#define NO_HC128
#endif
// </e>
// <e>RABBIT
#define MDK_CONF_RABBIT 1
#if MDK_CONF_RABBIT == 0
#define NO_RABBIT
#endif
// </e>
// <e>CHACHA
#define MDK_CONF_CHACHA 1
#if MDK_CONF_CHACHA == 1

View File

@ -152,14 +152,6 @@ extern void hmac_sha384_test(void *arg) ;
extern void arc4_test(void *arg) ;
#endif
#ifndef NO_HC128
extern void hc128_test(void *arg) ;
#endif
#ifndef NO_RABBIT
extern void rabbit_test(void *arg) ;
#endif
#ifndef NO_DES3
extern void des_test(void *arg) ;
extern void des3_test(void *arg) ;
@ -274,12 +266,6 @@ static struct {
#ifndef NO_RC4
"arc4", arc4_test,
#endif
#ifndef NO_HC128
"hc128", hc128_test,
#endif
#ifndef NO_RABBIT
"rabbit", rabbit_test,
#endif
#ifndef NO_DES3
"des", des_test,
"des3", des3_test,

View File

@ -245,20 +245,6 @@
#endif
// </e>
// <e>HC128
#define MDK_CONF_HC128 1
#if MDK_CONF_HC128 == 0
#define NO_HC128
#endif
// </e>
// <e>RABBIT
#define MDK_CONF_RABBIT 1
#if MDK_CONF_RABBIT == 0
#define NO_RABBIT
#endif
// </e>
// <e>CHACHA
#define MDK_CONF_CHACHA 1
#if MDK_CONF_CHACHA == 1

View File

@ -98,9 +98,7 @@ $(WOLF_ROOT)/wolfcrypt/src/fe_operations.o\
$(WOLF_ROOT)/wolfcrypt/src/ge_low_mem.o\
$(WOLF_ROOT)/wolfcrypt/src/ge_operations.o\
$(WOLF_ROOT)/wolfcrypt/src/hash.o\
$(WOLF_ROOT)/wolfcrypt/src/hc128.o\
$(WOLF_ROOT)/wolfcrypt/src/hmac.o\
$(WOLF_ROOT)/wolfcrypt/src/idea.o\
$(WOLF_ROOT)/wolfcrypt/src/integer.o\
$(WOLF_ROOT)/wolfcrypt/src/logging.o\
$(WOLF_ROOT)/wolfcrypt/src/md2.o\
@ -111,7 +109,6 @@ $(WOLF_ROOT)/wolfcrypt/src/pkcs12.o\
$(WOLF_ROOT)/wolfcrypt/src/pkcs7.o\
$(WOLF_ROOT)/wolfcrypt/src/poly1305.o\
$(WOLF_ROOT)/wolfcrypt/src/pwdbased.o\
$(WOLF_ROOT)/wolfcrypt/src/rabbit.o\
$(WOLF_ROOT)/wolfcrypt/src/random.o\
$(WOLF_ROOT)/wolfcrypt/src/ripemd.o\
$(WOLF_ROOT)/wolfcrypt/src/rsa.o\

View File

@ -34,8 +34,6 @@
#define WC_RSA_PSS
#define WOLFSSL_BASE64_ENCODE
#define NO_RC4
#define NO_HC128
#define NO_RABBIT
#define WOLFSSL_SHA224
#define WOLFSSL_SHA3
#define WOLFSSL_SHAKE256

View File

@ -0,0 +1,44 @@
wolfSSL for Microsoft Azure Sphere Devices in MSVS 2019
==========================================
## Description
This directory contains the Visual Studio CMake Project that is targeted for
the visual studio 2019 Azure Sphere plugin.
## Limitations
The example includes a client and server executable but the main.c app
only runs the server by default. main.c can be manually modified to run the
client instead if desired.
By default the main.c app include the hardware definitions for MT3620-mini. It
can be manually modified to include hardware definitions for MT3620, or
avnet MT3620 instead.
The app relies on a wolfSSL static library project, app and library are built
by the CMakeLists.txt located in
IDE/MSVS-2019-AZSPHERE/wolfssl_new_azsphere/CMakeLists.txt. The library and app
use `user_settings.h` to enable and disable features.
### Set Up Steps
0. Setup your Azure Sphere device.
[Install Azure Sphere](https://docs.microsoft.com/en-us/azure-sphere/install/install)
[Set up an account](https://docs.microsoft.com/en-us/azure-sphere/install/azure-directory-account)
[Claim your device](https://docs.microsoft.com/en-us/azure-sphere/install/claim-device)
[Configure networking](https://docs.microsoft.com/en-us/azure-sphere/install/configure-wifi)
1. Open the local folder IDE/MSVS-2019-AZSPHERE/wolfssl_new_azsphere in MSVS 2019
2. From the file menu select "Build" dropdown
+ Click: `Rebuild All` option
3. Connect your Azure Sphere MT3620-mini Development Board using USB.
4. Test the server.
+ Run server(Azure Sphere) using: `Debug->'Start new instance'`
+ Run the following wolfSSL example client command inside wolfssl directory.
```
./examples/client/client -h "Server IP Address" -p 11111 -A ./certs/ca-cert.pem
```
For other information please refer to the README in IDE/VS-AZURE-SPHERE

View File

@ -0,0 +1,138 @@
/* client.c
*
* Copyright (C) 2006-2021 wolfSSL Inc.
*
* This file is part of wolfSSL.
*
* wolfSSL is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* wolfSSL is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
*/
#include "client.h"
/* the usual suspects */
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
/* socket includes */
#include <sys/socket.h>
#include <arpa/inet.h>
#include <netinet/in.h>
#include <unistd.h>
/* utility functions shared between client and server */
#include <shared/util.h>
/* wolfSSL */
#include <wolfssl/wolfcrypt/settings.h>
#include <wolfssl/ssl.h>
#include <wolfssl/certs_test.h>
/* Azure Sphere */
#include <applibs/networking.h>
#ifndef NO_MAIN_DRIVER
int main(int argc, char** argv)
#else
int azsphere_client_app(int argc, char** argv)
#endif
{
bool isNetworkingReady = false;
SOCKET_T sockfd = 0;
char buff[256];
size_t len;
int ret;
/* declare wolfSSL objects */
WOLFSSL_CTX* ctx = NULL;
WOLFSSL* ssl = NULL;
util_PrintIfAddr();
/* Check if the Azure Sphere Dev Board has network connectivity. */
if ((Networking_IsNetworkingReady(&isNetworkingReady) < 0) || !isNetworkingReady) {
fprintf(stderr, "ERROR: network is not up.\n");
return -1;
}
ret = wolfIO_TcpConnect(&sockfd, SERVER_IP, DEFAULT_PORT, 0);
if ((ret != 0) || ((int)sockfd < 0)) {
fprintf(stderr, "ERROR: failed to create socket.");
return -1;
}
/* Initialize wolfSSL */
wolfSSL_Init();
/* Create and initialize WOLFSSL_CTX */
ctx = wolfSSL_CTX_new(wolfTLSv1_2_client_method());
if (ctx == NULL) {
fprintf(stderr, "ERROR: failed to create WOLFSSL_CTX\n");
util_Cleanup(sockfd,ctx,ssl);
return -1;
}
/* Load client certificates into WOLFSSL_CTX */
ret = wolfSSL_CTX_load_verify_buffer(ctx, CERT, SIZEOF_CERT, WOLFSSL_FILETYPE_ASN1);
if (ret != SSL_SUCCESS) {
fprintf(stderr, "ERROR: failed to load client certificate, "
"please check the buffer.\n");
util_Cleanup(sockfd,ctx,ssl);
return -1;
}
/* Create a WOLFSSL object */
if ((ssl = wolfSSL_new(ctx)) == NULL) {
fprintf(stderr, "ERROR: failed to create WOLFSSL object\n");
util_Cleanup(sockfd,ctx,ssl);
return -1;
}
/* Attach wolfSSL to the socket */
wolfSSL_set_fd(ssl, sockfd);
/* Connect to wolfSSL on the server side */
if (wolfSSL_connect(ssl) != SSL_SUCCESS) {
fprintf(stderr, "ERROR: failed to connect to wolfSSL\n");
util_Cleanup(sockfd,ctx,ssl);
return -1;
}
/* Get length of message for server. */
printf("\nMessage for server: %s\n",msg);
len = strnlen(msg, sizeof(msg));
/* Send the message to the server */
if (wolfSSL_write(ssl, msg, (int)len) != len) {
fprintf(stderr, "ERROR: failed to write\n");
util_Cleanup(sockfd,ctx,ssl);
return -1;
}
/* Read the server data into our buff array */
memset(buff, 0, sizeof(buff));
if (wolfSSL_read(ssl, buff, sizeof(buff) - 1) == -1) {
fprintf(stderr, "ERROR: failed to read\n");
util_Cleanup(sockfd,ctx,ssl);
return -1;
}
/* Print to stdout any data the server sends */
printf("Server Reply: %s\n", buff);
/* Cleanup and return */
util_Cleanup(sockfd,ctx,ssl);
return 0; /* Return reporting a success */
}

View File

@ -0,0 +1,125 @@
/* client.h
*
* Copyright (C) 2006-2022 wolfSSL Inc.
*
* This file is part of wolfSSL.
*
* wolfSSL is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* wolfSSL is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
*/
#ifndef WOLFSSL_CLIENT_H
#define WOLFSSL_CLIENT_H
#include <wolfssl/wolfcrypt/settings.h>
#ifdef NO_MAIN_DRIVER
int azsphere_client_app(int argc, char** argv);
#endif
static const unsigned char wolfssl_website_root_ca[] =
{
0x30, 0x82, 0x03, 0x75, 0x30, 0x82, 0x02, 0x5D, 0xA0, 0x03,
0x02, 0x01, 0x02, 0x02, 0x0B, 0x04, 0x00, 0x00, 0x00, 0x00,
0x01, 0x15, 0x4B, 0x5A, 0xC3, 0x94, 0x30, 0x0D, 0x06, 0x09,
0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x05, 0x05,
0x00, 0x30, 0x57, 0x31, 0x0B, 0x30, 0x09, 0x06, 0x03, 0x55,
0x04, 0x06, 0x13, 0x02, 0x42, 0x45, 0x31, 0x19, 0x30, 0x17,
0x06, 0x03, 0x55, 0x04, 0x0A, 0x13, 0x10, 0x47, 0x6C, 0x6F,
0x62, 0x61, 0x6C, 0x53, 0x69, 0x67, 0x6E, 0x20, 0x6E, 0x76,
0x2D, 0x73, 0x61, 0x31, 0x10, 0x30, 0x0E, 0x06, 0x03, 0x55,
0x04, 0x0B, 0x13, 0x07, 0x52, 0x6F, 0x6F, 0x74, 0x20, 0x43,
0x41, 0x31, 0x1B, 0x30, 0x19, 0x06, 0x03, 0x55, 0x04, 0x03,
0x13, 0x12, 0x47, 0x6C, 0x6F, 0x62, 0x61, 0x6C, 0x53, 0x69,
0x67, 0x6E, 0x20, 0x52, 0x6F, 0x6F, 0x74, 0x20, 0x43, 0x41,
0x30, 0x1E, 0x17, 0x0D, 0x39, 0x38, 0x30, 0x39, 0x30, 0x31,
0x31, 0x32, 0x30, 0x30, 0x30, 0x30, 0x5A, 0x17, 0x0D, 0x32,
0x38, 0x30, 0x31, 0x32, 0x38, 0x31, 0x32, 0x30, 0x30, 0x30,
0x30, 0x5A, 0x30, 0x57, 0x31, 0x0B, 0x30, 0x09, 0x06, 0x03,
0x55, 0x04, 0x06, 0x13, 0x02, 0x42, 0x45, 0x31, 0x19, 0x30,
0x17, 0x06, 0x03, 0x55, 0x04, 0x0A, 0x13, 0x10, 0x47, 0x6C,
0x6F, 0x62, 0x61, 0x6C, 0x53, 0x69, 0x67, 0x6E, 0x20, 0x6E,
0x76, 0x2D, 0x73, 0x61, 0x31, 0x10, 0x30, 0x0E, 0x06, 0x03,
0x55, 0x04, 0x0B, 0x13, 0x07, 0x52, 0x6F, 0x6F, 0x74, 0x20,
0x43, 0x41, 0x31, 0x1B, 0x30, 0x19, 0x06, 0x03, 0x55, 0x04,
0x03, 0x13, 0x12, 0x47, 0x6C, 0x6F, 0x62, 0x61, 0x6C, 0x53,
0x69, 0x67, 0x6E, 0x20, 0x52, 0x6F, 0x6F, 0x74, 0x20, 0x43,
0x41, 0x30, 0x82, 0x01, 0x22, 0x30, 0x0D, 0x06, 0x09, 0x2A,
0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x01, 0x05, 0x00,
0x03, 0x82, 0x01, 0x0F, 0x00, 0x30, 0x82, 0x01, 0x0A, 0x02,
0x82, 0x01, 0x01, 0x00, 0xDA, 0x0E, 0xE6, 0x99, 0x8D, 0xCE,
0xA3, 0xE3, 0x4F, 0x8A, 0x7E, 0xFB, 0xF1, 0x8B, 0x83, 0x25,
0x6B, 0xEA, 0x48, 0x1F, 0xF1, 0x2A, 0xB0, 0xB9, 0x95, 0x11,
0x04, 0xBD, 0xF0, 0x63, 0xD1, 0xE2, 0x67, 0x66, 0xCF, 0x1C,
0xDD, 0xCF, 0x1B, 0x48, 0x2B, 0xEE, 0x8D, 0x89, 0x8E, 0x9A,
0xAF, 0x29, 0x80, 0x65, 0xAB, 0xE9, 0xC7, 0x2D, 0x12, 0xCB,
0xAB, 0x1C, 0x4C, 0x70, 0x07, 0xA1, 0x3D, 0x0A, 0x30, 0xCD,
0x15, 0x8D, 0x4F, 0xF8, 0xDD, 0xD4, 0x8C, 0x50, 0x15, 0x1C,
0xEF, 0x50, 0xEE, 0xC4, 0x2E, 0xF7, 0xFC, 0xE9, 0x52, 0xF2,
0x91, 0x7D, 0xE0, 0x6D, 0xD5, 0x35, 0x30, 0x8E, 0x5E, 0x43,
0x73, 0xF2, 0x41, 0xE9, 0xD5, 0x6A, 0xE3, 0xB2, 0x89, 0x3A,
0x56, 0x39, 0x38, 0x6F, 0x06, 0x3C, 0x88, 0x69, 0x5B, 0x2A,
0x4D, 0xC5, 0xA7, 0x54, 0xB8, 0x6C, 0x89, 0xCC, 0x9B, 0xF9,
0x3C, 0xCA, 0xE5, 0xFD, 0x89, 0xF5, 0x12, 0x3C, 0x92, 0x78,
0x96, 0xD6, 0xDC, 0x74, 0x6E, 0x93, 0x44, 0x61, 0xD1, 0x8D,
0xC7, 0x46, 0xB2, 0x75, 0x0E, 0x86, 0xE8, 0x19, 0x8A, 0xD5,
0x6D, 0x6C, 0xD5, 0x78, 0x16, 0x95, 0xA2, 0xE9, 0xC8, 0x0A,
0x38, 0xEB, 0xF2, 0x24, 0x13, 0x4F, 0x73, 0x54, 0x93, 0x13,
0x85, 0x3A, 0x1B, 0xBC, 0x1E, 0x34, 0xB5, 0x8B, 0x05, 0x8C,
0xB9, 0x77, 0x8B, 0xB1, 0xDB, 0x1F, 0x20, 0x91, 0xAB, 0x09,
0x53, 0x6E, 0x90, 0xCE, 0x7B, 0x37, 0x74, 0xB9, 0x70, 0x47,
0x91, 0x22, 0x51, 0x63, 0x16, 0x79, 0xAE, 0xB1, 0xAE, 0x41,
0x26, 0x08, 0xC8, 0x19, 0x2B, 0xD1, 0x46, 0xAA, 0x48, 0xD6,
0x64, 0x2A, 0xD7, 0x83, 0x34, 0xFF, 0x2C, 0x2A, 0xC1, 0x6C,
0x19, 0x43, 0x4A, 0x07, 0x85, 0xE7, 0xD3, 0x7C, 0xF6, 0x21,
0x68, 0xEF, 0xEA, 0xF2, 0x52, 0x9F, 0x7F, 0x93, 0x90, 0xCF,
0x02, 0x03, 0x01, 0x00, 0x01, 0xA3, 0x42, 0x30, 0x40, 0x30,
0x0E, 0x06, 0x03, 0x55, 0x1D, 0x0F, 0x01, 0x01, 0xFF, 0x04,
0x04, 0x03, 0x02, 0x01, 0x06, 0x30, 0x0F, 0x06, 0x03, 0x55,
0x1D, 0x13, 0x01, 0x01, 0xFF, 0x04, 0x05, 0x30, 0x03, 0x01,
0x01, 0xFF, 0x30, 0x1D, 0x06, 0x03, 0x55, 0x1D, 0x0E, 0x04,
0x16, 0x04, 0x14, 0x60, 0x7B, 0x66, 0x1A, 0x45, 0x0D, 0x97,
0xCA, 0x89, 0x50, 0x2F, 0x7D, 0x04, 0xCD, 0x34, 0xA8, 0xFF,
0xFC, 0xFD, 0x4B, 0x30, 0x0D, 0x06, 0x09, 0x2A, 0x86, 0x48,
0x86, 0xF7, 0x0D, 0x01, 0x01, 0x05, 0x05, 0x00, 0x03, 0x82,
0x01, 0x01, 0x00, 0xD6, 0x73, 0xE7, 0x7C, 0x4F, 0x76, 0xD0,
0x8D, 0xBF, 0xEC, 0xBA, 0xA2, 0xBE, 0x34, 0xC5, 0x28, 0x32,
0xB5, 0x7C, 0xFC, 0x6C, 0x9C, 0x2C, 0x2B, 0xBD, 0x09, 0x9E,
0x53, 0xBF, 0x6B, 0x5E, 0xAA, 0x11, 0x48, 0xB6, 0xE5, 0x08,
0xA3, 0xB3, 0xCA, 0x3D, 0x61, 0x4D, 0xD3, 0x46, 0x09, 0xB3,
0x3E, 0xC3, 0xA0, 0xE3, 0x63, 0x55, 0x1B, 0xF2, 0xBA, 0xEF,
0xAD, 0x39, 0xE1, 0x43, 0xB9, 0x38, 0xA3, 0xE6, 0x2F, 0x8A,
0x26, 0x3B, 0xEF, 0xA0, 0x50, 0x56, 0xF9, 0xC6, 0x0A, 0xFD,
0x38, 0xCD, 0xC4, 0x0B, 0x70, 0x51, 0x94, 0x97, 0x98, 0x04,
0xDF, 0xC3, 0x5F, 0x94, 0xD5, 0x15, 0xC9, 0x14, 0x41, 0x9C,
0xC4, 0x5D, 0x75, 0x64, 0x15, 0x0D, 0xFF, 0x55, 0x30, 0xEC,
0x86, 0x8F, 0xFF, 0x0D, 0xEF, 0x2C, 0xB9, 0x63, 0x46, 0xF6,
0xAA, 0xFC, 0xDF, 0xBC, 0x69, 0xFD, 0x2E, 0x12, 0x48, 0x64,
0x9A, 0xE0, 0x95, 0xF0, 0xA6, 0xEF, 0x29, 0x8F, 0x01, 0xB1,
0x15, 0xB5, 0x0C, 0x1D, 0xA5, 0xFE, 0x69, 0x2C, 0x69, 0x24,
0x78, 0x1E, 0xB3, 0xA7, 0x1C, 0x71, 0x62, 0xEE, 0xCA, 0xC8,
0x97, 0xAC, 0x17, 0x5D, 0x8A, 0xC2, 0xF8, 0x47, 0x86, 0x6E,
0x2A, 0xC4, 0x56, 0x31, 0x95, 0xD0, 0x67, 0x89, 0x85, 0x2B,
0xF9, 0x6C, 0xA6, 0x5D, 0x46, 0x9D, 0x0C, 0xAA, 0x82, 0xE4,
0x99, 0x51, 0xDD, 0x70, 0xB7, 0xDB, 0x56, 0x3D, 0x61, 0xE4,
0x6A, 0xE1, 0x5C, 0xD6, 0xF6, 0xFE, 0x3D, 0xDE, 0x41, 0xCC,
0x07, 0xAE, 0x63, 0x52, 0xBF, 0x53, 0x53, 0xF4, 0x2B, 0xE9,
0xC7, 0xFD, 0xB6, 0xF7, 0x82, 0x5F, 0x85, 0xD2, 0x41, 0x18,
0xDB, 0x81, 0xB3, 0x04, 0x1C, 0xC5, 0x1F, 0xA4, 0x80, 0x6F,
0x15, 0x20, 0xC9, 0xDE, 0x0C, 0x88, 0x0A, 0x1D, 0xD6, 0x66,
0x55, 0xE2, 0xFC, 0x48, 0xC9, 0x29, 0x26, 0x69, 0xE0
};
static const int sizeof_wolfssl_website_root_ca = sizeof(wolfssl_website_root_ca);
#endif /* WOLFSSL_CLIENT_H */

View File

@ -0,0 +1,25 @@
# vim:ft=automake
# included from Top Level Makefile.am
# All paths should be given relative to the root
EXTRA_DIST+= IDE/MSVS-2019-AZSPHERE/client/client.c
EXTRA_DIST+= IDE/MSVS-2019-AZSPHERE/client/client.h
EXTRA_DIST+= IDE/MSVS-2019-AZSPHERE/server/server.c
EXTRA_DIST+= IDE/MSVS-2019-AZSPHERE/server/server.h
EXTRA_DIST+= IDE/MSVS-2019-AZSPHERE/shared/util.h
EXTRA_DIST+= IDE/MSVS-2019-AZSPHERE/user_settings.h
EXTRA_DIST+= IDE/MSVS-2019-AZSPHERE/wolfssl_new_azsphere/.gitignore
EXTRA_DIST+= IDE/MSVS-2019-AZSPHERE/wolfssl_new_azsphere/CMakeLists.txt
EXTRA_DIST+= IDE/MSVS-2019-AZSPHERE/wolfssl_new_azsphere/CMakeSettings.json
EXTRA_DIST+= IDE/MSVS-2019-AZSPHERE/wolfssl_new_azsphere/HardwareDefinitions/avnet_mt3620_sk/inc/hw/template_appliance.h
EXTRA_DIST+= IDE/MSVS-2019-AZSPHERE/wolfssl_new_azsphere/HardwareDefinitions/avnet_mt3620_sk/template_appliance.json
EXTRA_DIST+= IDE/MSVS-2019-AZSPHERE/wolfssl_new_azsphere/HardwareDefinitions/mt3620_rdb/inc/hw/template_appliance.h
EXTRA_DIST+= IDE/MSVS-2019-AZSPHERE/wolfssl_new_azsphere/HardwareDefinitions/mt3620_rdb/template_appliance.json
EXTRA_DIST+= IDE/MSVS-2019-AZSPHERE/wolfssl_new_azsphere/HardwareDefinitions/seeed_mt3620_mdb/inc/hw/template_appliance.h
EXTRA_DIST+= IDE/MSVS-2019-AZSPHERE/wolfssl_new_azsphere/HardwareDefinitions/seeed_mt3620_mdb/template_appliance.json
EXTRA_DIST+= IDE/MSVS-2019-AZSPHERE/wolfssl_new_azsphere/app_manifest.json
EXTRA_DIST+= IDE/MSVS-2019-AZSPHERE/wolfssl_new_azsphere/applibs_versions.h
EXTRA_DIST+= IDE/MSVS-2019-AZSPHERE/wolfssl_new_azsphere/launch.vs.json
EXTRA_DIST+= IDE/MSVS-2019-AZSPHERE/wolfssl_new_azsphere/main.c
EXTRA_DIST+= IDE/MSVS-2019-AZSPHERE/README.md

View File

@ -0,0 +1,213 @@
/* server.c
*
* Copyright (C) 2006-2021 wolfSSL Inc.
*
* This file is part of wolfSSL.
*
* wolfSSL is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* wolfSSL is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
*/
#include "server.h"
/* the usual suspects */
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
/* socket includes */
#include <sys/socket.h>
#include <arpa/inet.h>
#include <netinet/in.h>
#include <unistd.h>
/* <shared/util.h> includes */
#include <shared/util.h>
/* wolfSSL */
#include <wolfssl/wolfcrypt/settings.h>
#include <wolfssl/ssl.h>
#include <wolfssl/certs_test.h>
/* Azure Sphere */
#include <applibs/log.h>
#include <applibs/networking.h>
#define BIND_PORT 11111
#define CERT_BUF server_cert_der_2048
#define SIZEOF_CERT_BUF sizeof_server_cert_der_2048
#define KEY_BUF server_key_der_2048
#define SIZEOF_KEY_BUF sizeof_server_key_der_2048
#ifndef NO_MAIN_DRIVER
int main(void)
#else
int azsphere_server_app(void)
#endif
{
bool isNetworkingReady = false;
int sockfd;
int connd;
struct sockaddr_in servAddr;
struct sockaddr_in clientAddr;
socklen_t size = sizeof(clientAddr);
char buff[256];
size_t len;
int shutdown = 0;
int ret;
const char* reply = "I hear ya fa shizzle!\n";
/* declare wolfSSL objects */
WOLFSSL_CTX* ctx = NULL;
WOLFSSL* ssl = NULL;
util_PrintIfAddr();
/* Check if the Azure Sphere Dev Board has network connectivity. */
if ((Networking_IsNetworkingReady(&isNetworkingReady) < 0) || !isNetworkingReady) {
fprintf(stderr,"Error: Network is not up.\n");
return -1;
}
/* Initialize wolfSSL */
wolfSSL_Init();
/* Create a socket that uses an internet IPv4 address,
* Sets the socket to be stream based (TCP),
* 0 means choose the default protocol. */
if ((sockfd = socket(AF_INET, SOCK_STREAM, 0)) == -1) {
fprintf(stderr, "ERROR: failed to create the socket\n");
util_Cleanup(sockfd, ctx, ssl);
return -1;
}
/* Create and initialize WOLFSSL_CTX */
if ((ctx = wolfSSL_CTX_new(wolfTLSv1_2_server_method())) == NULL) {
fprintf(stderr, "ERROR: failed to create WOLFSSL_CTX\n");
util_Cleanup(sockfd, ctx, ssl);
return -1;
}
/* Load server certificates into WOLFSSL_CTX */
if (wolfSSL_CTX_use_certificate_buffer(ctx, CERT_BUF, SIZEOF_CERT_BUF, SSL_FILETYPE_ASN1)
!= SSL_SUCCESS) {
fprintf(stderr, "ERROR: failed to load %s, please check the file.\n",
CERT_BUF);
util_Cleanup(sockfd, ctx, ssl);
return -1;
}
/* Load server key into WOLFSSL_CTX */
if (wolfSSL_CTX_use_PrivateKey_buffer(ctx, KEY_BUF, SIZEOF_KEY_BUF, SSL_FILETYPE_ASN1)
!= SSL_SUCCESS) {
fprintf(stderr, "ERROR: failed to load %s, please check the file.\n",
KEY_BUF);
util_Cleanup(sockfd, ctx, ssl);
return -1;
}
/* Initialize the server address struct with zeros */
memset(&servAddr, 0, sizeof(servAddr));
/* Fill in the server address */
servAddr.sin_family = AF_INET; /* using IPv4 */
servAddr.sin_port = htons(BIND_PORT); /* on BIND_PORT */
servAddr.sin_addr.s_addr = INADDR_ANY; /* from anywhere */
/* Bind the server socket to our port */
if (bind(sockfd, (struct sockaddr*)&servAddr, sizeof(servAddr)) == -1) {
fprintf(stderr, "ERROR: failed to bind\n");
util_Cleanup(sockfd, ctx, ssl);
return -1;
}
/* Listen for a new connection, allow 5 pending connections */
if (listen(sockfd, 5) == -1) {
fprintf(stderr, "ERROR: failed to listen\n");
util_Cleanup(sockfd, ctx, ssl);
return -1;
}
/* Continue to accept clients until shutdown is issued */
while (!shutdown) {
printf("Waiting for a connection...\n");
/* Accept client connections */
if ((connd = accept(sockfd, (struct sockaddr*)&clientAddr, &size))
== -1) {
fprintf(stderr, "ERROR: failed to accept the connection\n\n");
util_Cleanup(sockfd, ctx, ssl);
return -1;
}
/* Create a WOLFSSL object */
if ((ssl = wolfSSL_new(ctx)) == NULL) {
fprintf(stderr, "ERROR: failed to create WOLFSSL object\n");
util_Cleanup(sockfd, ctx, ssl);
return -1;
}
/* Attach wolfSSL to the socket */
wolfSSL_set_fd(ssl, connd);
/* Establish TLS connection */
ret = wolfSSL_accept(ssl);
if (ret != SSL_SUCCESS) {
fprintf(stderr, "wolfSSL_accept error = %d\n",
wolfSSL_get_error(ssl, ret));
util_Cleanup(sockfd, ctx, ssl);
return -1;
}
printf("Client connected successfully\n");
/* Read the client data into our buff array */
memset(buff, 0, sizeof(buff));
if (wolfSSL_read(ssl, buff, sizeof(buff)-1) == -1) {
fprintf(stderr, "ERROR: failed to read\n");
util_Cleanup(sockfd, ctx, ssl);
return -1;
}
/* Print to stdout any data the client sends */
printf("Client: %s\n", buff);
/* Check for server shutdown command */
if (strncmp(buff, "shutdown", 8) == 0) {
printf("Shutdown command issued!\n");
shutdown = 1;
}
/* Write our reply into buff */
memset(buff, 0, sizeof(buff));
memcpy(buff, reply, strlen(reply));
len = strnlen(buff, sizeof(buff));
/* Reply back to the client */
if (wolfSSL_write(ssl, buff, (int)len) != len) {
fprintf(stderr, "ERROR: failed to write\n");
util_Cleanup(sockfd, ctx, ssl);
return -1;
}
/* Cleanup after this connection */
wolfSSL_free(ssl); /* Free the wolfSSL object */
close(connd); /* Close the connection to the client */
}
printf("Shutdown complete\n");
/* Cleanup and return */
util_Cleanup(sockfd, ctx, ssl);
return 0; /* Return reporting a success */
}

View File

@ -1,40 +1,33 @@
/* hc128.h
*
* Copyright (C) 2006-2021 wolfSSL Inc.
*
* This file is part of wolfSSL.
*
* wolfSSL is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* wolfSSL is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
*/
#ifndef NO_HC128
#ifndef CTAO_CRYPT_HC128_H
#define CTAO_CRYPT_HC128_H
#include <wolfssl/wolfcrypt/hc128.h>
/* for hc128 reverse compatibility */
#ifdef HAVE_HC128
#define Hc128_Process wc_Hc128_Process
#define Hc128_SetKey wc_Hc128_SetKey
#endif
#endif /* CTAO_CRYPT_HC128_H */
#endif /* HAVE_HC128 */
/* server.h
*
* Copyright (C) 2006-2021 wolfSSL Inc.
*
* This file is part of wolfSSL.
*
* wolfSSL is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* wolfSSL is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
*/
#ifndef WOLFSSL_SERVER_H
#define WOLFSSL_SERVER_H
#include <wolfssl/wolfcrypt/settings.h>
#ifdef NO_MAIN_DRIVER
int azsphere_server_app(void);
#endif
#endif /* WOLFSSL_SERVER_H */

View File

@ -0,0 +1,82 @@
/* util.h
*
* Copyright (C) 2006-2022 wolfSSL Inc.
*
* This file is part of wolfSSL.
*
* wolfSSL is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* wolfSSL is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
*/
#ifndef _UTIL_H_
#define _UTIL_H_
#include <stdio.h>
#include <wolfssl/ssl.h>
#include <ifaddrs.h>
#include <applibs/log.h>
#define _GNU_SOURCE /* defines NI_NUMERICHOST */
#ifndef NI_MAXHOST
#define NI_MAXHOST 256
#endif
static void util_Cleanup(int sockfd, WOLFSSL_CTX* ctx, WOLFSSL* ssl)
{
wolfSSL_free(ssl); /* Free the wolfSSL object */
wolfSSL_CTX_free(ctx); /* Free the wolfSSL context object */
wolfSSL_Cleanup(); /* Cleanup the wolfSSL environment */
close(sockfd); /* Close the connection to the server */
}
/* Displays each AF_INET interface and it's IP Address
* Return: WOLFSSL_SUCCESS if print is successful else WOLFSSL_FAILURE
*/
static int util_PrintIfAddr(void)
{
char host[NI_MAXHOST];
struct ifaddrs* ifaddr, * nxt;
int family, info, n;
/* Get a linked list of 'struct ifaddrs*' */
if (getifaddrs(&ifaddr) != 0) {
fprintf(stderr, "ERROR: Getting network interface and IP address");
return WOLFSSL_FAILURE;
}
printf("\nInterface IP Address\n");
/* Traverse ifaddr linked list using nxt */
for (nxt = ifaddr; nxt != NULL; nxt = nxt->ifa_next) {
if (nxt->ifa_addr == NULL)
continue;
family = nxt->ifa_addr->sa_family;
/* Display the address of each AF_INET* interface */
if (family == AF_INET) {
info = getnameinfo(nxt->ifa_addr, sizeof(struct sockaddr_in),
host, NI_MAXHOST, NULL, 0, NI_NUMERICHOST);
if (info != 0) {
fprintf(stderr, "Failed to getnameinfo");
freeifaddrs(ifaddr);
return WOLFSSL_FAILURE;
}
/* Determine amount of space, n, to justify IP Address */
n = (int)strlen("Interface ") - (int)strlen(nxt->ifa_name);
n = (n > 0) ? n : 1; /* Set space to 1 if n is negative */
printf("%s %*c%s>\n", nxt->ifa_name, n, '<', host);
}
}
printf("\n");
freeifaddrs(ifaddr);
return WOLFSSL_SUCCESS;
}
#endif

View File

@ -0,0 +1,96 @@
/* user_settings.h
*
* Copyright (C) 2006-2022 wolfSSL Inc.
*
* This file is part of wolfSSL.
*
* wolfSSL is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* wolfSSL is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
*/
#ifndef _USER_SETTINGS_H_
#define _USER_SETTINGS_H_
#define SERVER_IP "192.168.1.123"
#define CUSTOM_SERVER_CONNECTION
#define WOLFSSL_AZSPHERE
/* Client connects to the server with these details. */
#ifdef CUSTOM_SERVER_CONNECTION
#ifndef SERVER_IP
#define SERVER_IP "192.168.1.200" /* Local Test Server IP */
#endif
#ifndef DEFAULT_PORT
#define DEFAULT_PORT 11111
#endif
#define CERT ca_cert_der_2048
#define SIZEOF_CERT sizeof_ca_cert_der_2048
static const char msg[] = "Are you listening wolfSSL Server?";
#else
#ifndef SERVER_IP
#define SERVER_IP "www.wolfssl.com"
#endif
#ifndef DEFAULT_PORT
#define DEFAULT_PORT 443
#endif
#define CERT wolfssl_website_root_ca
#define SIZEOF_CERT sizeof_wolfssl_website_root_ca
static const char msg[] = "GET /index.html HTTP/1.1\r\n\r\n";
#endif
/* Math: Normal (!USE_FAST_MATH) */
#define SIZEOF_LONG_LONG 8
#define WC_RSA_BLINDING
#define ECC_TIMING_RESISTANT
/* Enable options */
#define HAVE_CHACHA
#define HAVE_POLY1305
#define HAVE_ECC
#define HAVE_SUPPORTED_CURVES
#define HAVE_TLS_EXTENSIONS
#define HAVE_ONE_TIME_AUTH
#define HAVE_TRUNCATED_HMAC
#define HAVE_EXTENDED_MASTER
#define HAVE_ALPN
#define HAVE_SNI
#define HAVE_OCSP
#define HAVE_AESGCM
/* Disable options */
#define NO_PWDBASED
#define NO_DSA
#define NO_DES3
#define NO_RC4
#define NO_MD4
/* Benchmark / Testing */
#define BENCH_EMBEDDED
#define USE_CERT_BUFFERS_2048
#define USE_CERT_BUFFERS_256
/* OS */
#define SINGLE_THREADED
/* Filesystem */
#define NO_FILESYSTEM
/* Debug */
#include <applibs/log.h>
#define printf Log_Debug
#define WOLFIO_DEBUG
#define NO_MAIN_DRIVER
#endif /* _USER_SETTINGS_H_ */

View File

@ -0,0 +1,3 @@
# Ignore output directories
/out/
/install/

View File

@ -0,0 +1,58 @@
# CMakeList.txt
#
# Copyright (C) 2006-2022 wolfSSL Inc.
#
# This file is part of wolfSSL. (formerly known as CyaSSL)
#
# Usage:
# In MSVS 2019 with Azure Sphere plugin installed choose option
# "Open Local Folder" and browse to wolfssl-root/IDE/MSVS-2019-AZSPHERE"
# highlight wolfssl_new_azsphere and select "Open"
#
# To build:
# go to MSVS menu option "Build" and select "Build All"
#
# See https://docs.microsoft.com/en-us/azure-sphere/install/overview for how
# to get started with an Azure sphere device. Once you have completed the step
# to build/flash and run the Blinky example you will be ready to build/flash
# and run this example!
cmake_minimum_required (VERSION 3.4.1)
project (wolfssl_new_azsphere C)
azsphere_configure_tools(TOOLS_REVISION "22.02")
azsphere_configure_api(TARGET_API_SET "12")
# add wolfSSL preprocessor directives
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_USER_SETTINGS -Wno-conversion -Wno-sign-conversion")
# add a shared object for SSL/TLS and CRYPTO
set( SSL_SRC_DIR "../../../src" )
set( CRYPTO_SRC_DIR "../../../wolfcrypt/src" )
set( INCLUDE_DIR "../../.." )
aux_source_directory( ${SSL_SRC_DIR} SSL_SOURCES )
list( REMOVE_ITEM SSL_SOURCES ../../../src/bio.c )
list( REMOVE_ITEM SSL_SOURCES ../../../src/conf.c )
list( REMOVE_ITEM SSL_SOURCES ../../../src/x509.c )
list( REMOVE_ITEM SSL_SOURCES ../../../src/x509_str.c )
list( REMOVE_ITEM SSL_SOURCES ../../../src/pk.c )
aux_source_directory( ${CRYPTO_SRC_DIR} CRYPTO_SOURCES )
list( REMOVE_ITEM CRYPTO_SOURCES ../../../wolfcrypt/src/evp.c )
list( REMOVE_ITEM CRYPTO_SOURCES ../../../wolfcrypt/src/misc.c )
add_library( wolfssl STATIC ${SSL_SOURCES} ${CRYPTO_SOURCES} )
# Create executable that uses library
set( SERVER_APP_DIR "../server" )
set( CLIENT_APP_DIR "../client" )
set( USER_SETTINGS_DIR ".." )
set( APP_INCLUDE_DIRS ${SERVER_APP_DIR} ${CLIENT_APP_DIR} ${USER_SETTINGS_DIR} )
add_executable (${PROJECT_NAME} main.c ${SERVER_APP_DIR}/server.c ${CLIENT_APP_DIR}/client.c )
target_link_libraries (${PROJECT_NAME} applibs pthread gcc_s c wolfssl)
include_directories( ${INCLUDE_DIR} ${APP_INCLUDE_DIRS})
# azsphere_target_hardware_definition(${PROJECT_NAME} TARGET_DIRECTORY "HardwareDefinitions/mt3620_rdb" TARGET_DEFINITION "template_appliance.json")
azsphere_target_hardware_definition(${PROJECT_NAME} TARGET_DIRECTORY "HardwareDefinitions/seeed_mt3620_mdb" TARGET_DEFINITION "template_appliance.json")
azsphere_target_add_image_package(${PROJECT_NAME})

View File

@ -0,0 +1,47 @@
{
"environments": [
{
"environment": "AzureSphere"
}
],
"configurations": [
{
"name": "ARM-Debug",
"generator": "Ninja",
"configurationType": "Debug",
"inheritEnvironments": [
"AzureSphere"
],
"buildRoot": "${projectDir}\\out\\${name}",
"installRoot": "${projectDir}\\out\\${name}",
"cmakeToolchain": "${env.AzureSphereDefaultSDKDir}CMakeFiles\\AzureSphereToolchain.cmake",
"buildCommandArgs": "-v",
"ctestCommandArgs": "",
"variables": [
{
"name": "AZURE_SPHERE_TARGET_API_SET",
"value": "latest-lts"
}
]
},
{
"name": "ARM-Release",
"generator": "Ninja",
"configurationType": "Release",
"inheritEnvironments": [
"AzureSphere"
],
"buildRoot": "${projectDir}\\out\\${name}",
"installRoot": "${projectDir}\\out\\${name}",
"cmakeToolchain": "${env.AzureSphereDefaultSDKDir}CMakeFiles\\AzureSphereToolchain.cmake",
"buildCommandArgs": "-v",
"ctestCommandArgs": "",
"variables": [
{
"name": "AZURE_SPHERE_TARGET_API_SET",
"value": "latest-lts"
}
]
}
]
}

View File

@ -0,0 +1,36 @@
/* template_appliance.h
*
* Copyright (C) 2006-2021 wolfSSL Inc.
*
* This file is part of wolfSSL.
*
* wolfSSL is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* wolfSSL is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
*/
/* This file maps the Avnet MT3620 Starter Kit (SK)
* to the 'template appliance' abstraction used by the templates.
* Some peripherals are on-board, while other peripherals must be
* attached externally (conditionally).
* See https://aka.ms/AzureSphereHardwareDefinitions for more
* information on how to use hardware abstractions .
*/
#pragma once
#include "avnet_mt3620_sk.h"
/* MT3620 SK: wolfssl azsphere CI app */
#define WOLF_AZSPHERE AVNET_MT3620_SK_USER_LED_RED

View File

@ -0,0 +1,41 @@
{
"Metadata": {
"Type": "Azure Sphere Hardware Definition",
"Version": 1
},
"Description":
{
"Name": "Template hardware abstraction for Avnet MT3620 SK",
"MainCoreHeaderFileTopContent": [
"/* Copyright (C) 2006-2022 wolfSSL Inc.",
" * This file is part of wolfSSL.",
" *",
" * wolfSSL is free software; you can redistribute it and/or modify",
" * it under the terms of the GNU General Public License as published by",
" * the Free Software Foundation; either version 2 of the License, or",
" * (at your option) any later version.",
" *",
" * wolfSSL is distributed in the hope that it will be useful,",
" * but WITHOUT ANY WARRANTY; without even the implied warranty of",
" * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the",
" * GNU General Public License for more details.",
" *",
" * You should have received a copy of the GNU General Public License",
" * along with this program; if not, write to the Free Software",
" * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA",
" */",
"/* This file maps the Avnet MT3620 Starter Kit (SK)",
" * to the 'template appliance' abstraction used by the templates.",
" * Some peripherals are on-board, while other peripherals must be",
" * attached externally (conditionally).",
" * See https://aka.ms/AzureSphereHardwareDefinitions for more",
" * information on how to use hardware abstractions .",
" */"
]
},
"Imports" : [ {"Path": "avnet_mt3620_sk.json"} ],
"Peripherals": [
{"Name": "WOLF_AZSPHERE", "Type": "Gpio", "Mapping": "AVNET_MT3620_SK_USER_LED_RED", "Comment": "MT3620 SK: User LED."}
]
}

View File

@ -0,0 +1,32 @@
/* Copyright (C) 2006-2022 wolfSSL Inc.
* This file is part of wolfSSL.
*
* wolfSSL is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* wolfSSL is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
*/
/* This file maps the MT3620 reference development board (RDB)
* to the 'template appliance' abstraction used by the templates.
* Some peripherals are on-board, while other peripherals must be
* attached externally (conditionally).
* See https://aka.ms/AzureSphereHardwareDefinitions for more
* information on how to use hardware abstractions .
*/
#pragma once
#include "mt3620_rdb.h"
/* MT3620 SK: wolfssl azsphere CI app */
#define WOLF_AZSPHERE MT3620_RDB_LED1_RED

View File

@ -0,0 +1,41 @@
{
"Metadata": {
"Type": "Azure Sphere Hardware Definition",
"Version": 1
},
"Description":
{
"Name": "Template hardware abstraction for MT3620 RDB",
"MainCoreHeaderFileTopContent": [
"/* Copyright (C) 2006-2022 wolfSSL Inc.",
" * This file is part of wolfSSL.",
" *",
" * wolfSSL is free software; you can redistribute it and/or modify",
" * it under the terms of the GNU General Public License as published by",
" * the Free Software Foundation; either version 2 of the License, or",
" * (at your option) any later version.",
" *",
" * wolfSSL is distributed in the hope that it will be useful,",
" * but WITHOUT ANY WARRANTY; without even the implied warranty of",
" * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the",
" * GNU General Public License for more details.",
" *",
" * You should have received a copy of the GNU General Public License",
" * along with this program; if not, write to the Free Software",
" * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA",
" */",
"/* This file maps the MT3620 reference development board (RDB)",
" * to the 'template appliance' abstraction used by the templates.",
" * Some peripherals are on-board, while other peripherals must be",
" * attached externally (conditionally).",
" * See https://aka.ms/AzureSphereHardwareDefinitions for more",
" * information on how to use hardware abstractions .",
" */"
]
},
"Imports" : [ {"Path": "mt3620_rdb.json"} ],
"Peripherals": [
{"Name": "WOLF_AZSPHERE", "Type": "Gpio", "Mapping": "MT3620_RDB_LED1_RED", "Comment": "MT3620 RDB: LED 1 (red channel)"}
]
}

View File

@ -0,0 +1,35 @@
/* template_appliance.h
*
* Copyright (C) 2006-2021 wolfSSL Inc.
*
* This file is part of wolfSSL.
*
* wolfSSL is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* wolfSSL is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
*/
/* This file maps the Seeed MT3620 Mini Development Board (MDB)
* to the 'template appliance' abstraction used by the templates.
* Some peripherals are on-board, while other peripherals must be
* attached externally (conditionally).
* See https://aka.ms/AzureSphereHardwareDefinitions for more
* information on how to use hardware abstractions .
*/
#pragma once
#include "seeed_mt3620_mdb.h"
/* MT3620 SK: wolfssl azsphere CI app */
#define WOLF_AZSPHERE SEEED_MT3620_MDB_USER_LED

View File

@ -0,0 +1,41 @@
{
"Metadata": {
"Type": "Azure Sphere Hardware Definition",
"Version": 1
},
"Description":
{
"Name": "Template hardware abstraction for Seeed MT3620 MDB",
"MainCoreHeaderFileTopContent": [
"/* Copyright (C) 2006-2022 wolfSSL Inc.",
" * This file is part of wolfSSL.",
" *",
" * wolfSSL is free software; you can redistribute it and/or modify",
" * it under the terms of the GNU General Public License as published by",
" * the Free Software Foundation; either version 2 of the License, or",
" * (at your option) any later version.",
" *",
" * wolfSSL is distributed in the hope that it will be useful,",
" * but WITHOUT ANY WARRANTY; without even the implied warranty of",
" * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the",
" * GNU General Public License for more details.",
" *",
" * You should have received a copy of the GNU General Public License",
" * along with this program; if not, write to the Free Software",
" * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA",
" */",
"/* This file maps the Seeed MT3620 Mini Development Board (MDB)",
" * to the 'template appliance' abstraction used by the templates.",
" * Some peripherals are on-board, while other peripherals must be",
" * attached externally (conditionally).",
" * See https://aka.ms/AzureSphereHardwareDefinitions for more",
" * information on how to use hardware abstractions .",
" */"
]
},
"Imports" : [ {"Path": "seeed_mt3620_mdb.json"} ],
"Peripherals": [
{"Name": "WOLF_AZSPHERE", "Type": "Gpio", "Mapping": "SEEED_MT3620_MDB_USER_LED", "Comment": "MT3620 MDB: User LED."}
]
}

View File

@ -0,0 +1,12 @@
{
"SchemaVersion": 1,
"Name": "wolfssl_new_azsphere",
"ComponentId": "959b4478-a9a3-440a-b1e7-9bb0b1f1d357",
"EntryPoint": "/bin/app",
"CmdArgs": [],
"Capabilities": {
"Gpio": [ "$WOLF_AZSPHERE" ],
"AllowedApplicationConnections": []
},
"ApplicationType": "Default"
}

View File

@ -0,0 +1,25 @@
#pragma once
/// <summary>
/// This identifier should be defined before including any of the networking-related header files.
/// It indicates which version of the Wi-Fi data structures the application uses.
/// </summary>
#define NETWORKING_STRUCTS_VERSION 1
/// <summary>
/// This identifier must be defined before including any of the Wi-Fi related header files.
/// It indicates which version of the Wi-Fi data structures the application uses.
/// </summary>
#define WIFICONFIG_STRUCTS_VERSION 1
/// <summary>
/// This identifier must be defined before including any of the UART-related header files.
/// It indicates which version of the UART data structures the application uses.
/// </summary>
#define UART_STRUCTS_VERSION 1
/// <summary>
/// This identifier must be defined before including any of the SPI-related header files.
/// It indicates which version of the SPI data structures the application uses.
/// </summary>
#define SPI_STRUCTS_VERSION 1

View File

@ -0,0 +1,14 @@
{
"version": "0.2.1",
"configurations": [
{
"type": "azurespheredbg",
"name": "wolfssl_new_azsphere (HLCore)",
"project": "CMakeLists.txt",
"workingDirectory": "${workspaceRoot}",
"applicationPath": "${debugInfo.target}",
"imagePath": "${debugInfo.targetImage}",
"partnerComponents": []
}
]
}

View File

@ -0,0 +1,92 @@
/* main.c
*
* Copyright (C) 2006-2021 wolfSSL Inc.
*
* This file is part of wolfSSL.
*
* wolfSSL is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* wolfSSL is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
*/
#include <stdbool.h>
#include <errno.h>
#include <string.h>
#include <time.h>
#include <applibs/log.h>
#include <applibs/gpio.h>
#include <wolfssl/wolfcrypt/settings.h>
#ifndef WOLFSSL_USER_SETTINGS
#error "user_settings.h not included"
#endif
#include <server.h>
#include <client.h>
/*
* The following #include imports a "template appliance" definition. This app
* comes with multiple implementations of the template appliance, each in a
* separate directory, which allow the code to run unchanged on different
* hardware.
*
* By default, this app targets hardware that follows the MT3620-mini Reference
* Development Board (MDB) specification, such as the MT3620-mini Dev Kit from
* Seeed Studio.
*
* To target different hardware, you'll need to update CMakeLists.txt.
* For example, to target the Avnet MT3620 Starter Kit, make this update:
* azsphere_target_hardware_definition(${PROJECT_NAME}
* TARGET_DIRECTORY "HardwareDefinitions/avnet_mt3620_sk"
* TARGET_DEFINITION "template_appliance.json")
*
* See https://aka.ms/AzureSphereHardwareDefinitions for more details.
*/
#include <hw/template_appliance.h>
typedef enum {
ExitCode_Success = 0,
ExitCode_Main_Led = 1
} ExitCode;
int main(void)
{
Log_Debug(
"\nVisit https://github.com/Azure/azure-sphere-samples for other"
" examples.\n");
int ret;
int fd = GPIO_OpenAsOutput(WOLF_AZSPHERE, GPIO_OutputMode_PushPull, GPIO_Value_High);
if (fd < 0) {
Log_Debug(
"Error opening GPIO: %s (%d). Check that app_manifest.json includes"
" the GPIO used.\n",
strerror(errno), errno);
return ExitCode_Main_Led;
}
const struct timespec sleepTime = {.tv_sec = 1, .tv_nsec = 0};
printf("Launching the server...\n");
ret = azsphere_server_app();
printf("ret azsphere_server_app = %d\n", ret);
/* if server exists continually blink the red LED indicating server needs
* to be rebooted */
while (true) {
GPIO_SetValue(fd, GPIO_Value_Low);
nanosleep(&sleepTime, NULL);
GPIO_SetValue(fd, GPIO_Value_High);
nanosleep(&sleepTime, NULL);
}
}

View File

@ -27,16 +27,16 @@ INCLUDE_DIRECTORIES(
ADD_DEFINITIONS(${SSL_DEFINES})
SET(WOLFCRYPT_SOURCES src/aes.c src/arc4.c src/asn.c src/blake2b.c
src/camellia.c src/chacha.c src/coding.c src/compress.c src/des3.c
src/dh.c src/dsa.c src/ecc.c src/error.c src/hc128.c src/hmac.c
src/integer.c src/logging.c src/md2.c src/md4.c src/md5.c src/memory.c
src/pkcs7.c src/pkcs12.c src/poly1305.c src/pwdbased.c src/rabbit.c
src/dh.c src/dsa.c src/ecc.c src/error.c src/hmac.c
src/integer.c src/kdf.c src/logging.c src/md2.c src/md4.c src/md5.c src/memory.c
src/pkcs7.c src/pkcs12.c src/poly1305.c src/pwdbased.c
src/random.c src/ripemd.c src/rsa.c src/sha.c src/sha256.c src/sha512.c
src/tfm.c src/wc_port.c src/wc_encrypt.c src/hash.c src/wolfmath.c
../wolfssl/wolfcrypt/aes.h ../wolfssl/wolfcrypt/arc4.h ../wolfssl/wolfcrypt/asn.h ../wolfssl/wolfcrypt/blake2.h
../wolfssl/wolfcrypt/camellia.h ../wolfssl/wolfcrypt/chacha.h ../wolfssl/wolfcrypt/coding.h ../wolfssl/wolfcrypt/compress.h ../wolfssl/wolfcrypt/des3.h
../wolfssl/wolfcrypt/dh.h ../wolfssl/wolfcrypt/dsa.h ../wolfssl/wolfcrypt/ecc.h ../wolfssl/wolfcrypt/error-crypt.h ../wolfssl/wolfcrypt/hc128.h ../wolfssl/wolfcrypt/hmac.h
../wolfssl/wolfcrypt/dh.h ../wolfssl/wolfcrypt/dsa.h ../wolfssl/wolfcrypt/ecc.h ../wolfssl/wolfcrypt/error-crypt.h ../wolfssl/wolfcrypt/hmac.h
../wolfssl/wolfcrypt/integer.h ../wolfssl/wolfcrypt/logging.h ../wolfssl/wolfcrypt/md2.h ../wolfssl/wolfcrypt/md4.h ../wolfssl/wolfcrypt/md5.h ../wolfssl/wolfcrypt/memory.h
../wolfssl/wolfcrypt/misc.h ../wolfssl/wolfcrypt/pkcs7.h ../wolfssl/wolfcrypt/poly1305.h ../wolfssl/wolfcrypt/pwdbased.h ../wolfssl/wolfcrypt/rabbit.h
../wolfssl/wolfcrypt/misc.h ../wolfssl/wolfcrypt/pkcs7.h ../wolfssl/wolfcrypt/poly1305.h ../wolfssl/wolfcrypt/pwdbased.h
../wolfssl/wolfcrypt/random.h ../wolfssl/wolfcrypt/ripemd.h ../wolfssl/wolfcrypt/rsa.h ../wolfssl/wolfcrypt/sha.h ../wolfssl/wolfcrypt/sha256.h ../wolfssl/wolfcrypt/sha512.h
../wolfssl/wolfcrypt/tfm.h ../wolfssl/wolfcrypt/wc_port.h ../wolfssl/wolfcrypt/wc_encrypt.h
../wolfssl/wolfcrypt/hash.h

View File

@ -1,3 +1,5 @@
#!/bin/sh
# Place CMakeList in needed directories
cp CMakeLists_wolfSSL.txt ../../CMakeLists.txt

View File

@ -578,12 +578,6 @@ extern "C" {
#undef NO_OLD_TLS
#define NO_OLD_TLS
#undef NO_HC128
#define NO_HC128
#undef NO_RABBIT
#define NO_RABBIT
#undef NO_PSK
#define NO_PSK

View File

@ -45,8 +45,6 @@
#define ECC_SHAMIR
#define WOLFSSL_BASE64_ENCODE
#define NO_RC4
#define NO_HC128
#define NO_RABBIT
#define HAVE_HASHDRBG
#define HAVE_TLS_EXTENSIONS
#define HAVE_SUPPORTED_CURVES
@ -107,8 +105,6 @@
#define ECC_SHAMIR
#define WOLFSSL_BASE64_ENCODE
#define NO_RC4
#define NO_HC128
#define NO_RABBIT
#define HAVE_HASHDRBG
#define HAVE_TLS_EXTENSIONS
#define HAVE_SUPPORTED_CURVES

View File

@ -5,13 +5,16 @@ PLATFORM = armv7le
OUTPUT_DIR = build
TARGET = $(ARTIFACT)
CC = qcc -Vgcc_nto$(PLATFORM)
CC ?= qcc -Vgcc_nto$(PLATFORM)
CXX = qcc -lang-c++ -Vgcc_nto$(PLATFORM)
LD = $(CC)
INCLUDES += -I../../../ -I../../../wolfssl/wolfcrypt/port/caam/
CCFLAGS += -O2 -Wall
# For debugging print outs build with WOLFSSL_CAAM_PRINT defined
#CCFLAGS += -DWOLFSSL_CAAM_PRINT -O2 -Wall
SRCS = \
../../../wolfcrypt/src/port/caam/caam_driver.c \
../../../wolfcrypt/src/port/caam/caam_error.c \

View File

@ -5,7 +5,7 @@ PLATFORM = armv7le
OUTPUT_DIR = build
TARGET = $(ARTIFACT)
CC = qcc -Vgcc_nto$(PLATFORM)
CC ?= qcc -Vgcc_nto$(PLATFORM)
CXX = qcc -lang-c++ -Vgcc_nto$(PLATFORM)
LD = $(CC)

View File

@ -5,7 +5,7 @@ PLATFORM = armv7le
OUTPUT_DIR = build
TARGET = $(ARTIFACT)
CC = qcc -Vgcc_nto$(PLATFORM)
CC ?= qcc -Vgcc_nto$(PLATFORM)
CXX = qcc -lang-c++ -Vgcc_nto$(PLATFORM)
LD = $(CC)

View File

@ -5,7 +5,7 @@ PLATFORM = armv7le
OUTPUT_DIR = build
TARGET = $(ARTIFACT)
CC = qcc -Vgcc_nto$(PLATFORM)
CC ?= qcc -Vgcc_nto$(PLATFORM)
CXX = qcc -lang-c++ -Vgcc_nto$(PLATFORM)
LD = $(CC)

View File

@ -558,12 +558,6 @@ extern "C" {
#undef NO_OLD_TLS
#define NO_OLD_TLS
#undef NO_HC128
#define NO_HC128
#undef NO_RABBIT
#define NO_RABBIT
#undef NO_PSK
#define NO_PSK

View File

@ -407,12 +407,6 @@ extern unsigned int custom_rand_generate(void);
#undef NO_OLD_TLS
#define NO_OLD_TLS
#undef NO_HC128
#define NO_HC128
#undef NO_RABBIT
#define NO_RABBIT
#undef NO_PSK
#define NO_PSK

View File

@ -72,9 +72,7 @@
<file file_name="../../wolfcrypt/src/ge_operations.c" />
<file file_name="../../wolfcrypt/src/hash.c" />
<file file_name="../../wolfcrypt/src/kdf.c" />
<file file_name="../../wolfcrypt/src/hc128.c" />
<file file_name="../../wolfcrypt/src/hmac.c" />
<file file_name="../../wolfcrypt/src/idea.c" />
<file file_name="../../wolfcrypt/src/include.am" />
<file file_name="../../wolfcrypt/src/integer.c" />
<file file_name="../../wolfcrypt/src/logging.c" />
@ -91,7 +89,6 @@
<file file_name="../../wolfcrypt/src/pkcs7.c" />
<file file_name="../../wolfcrypt/src/poly1305.c" />
<file file_name="../../wolfcrypt/src/pwdbased.c" />
<file file_name="../../wolfcrypt/src/rabbit.c" />
<file file_name="../../wolfcrypt/src/random.c" />
<file file_name="../../wolfcrypt/src/ripemd.c" />
<file file_name="../../wolfcrypt/src/rsa.c" />

View File

@ -74,9 +74,7 @@
<file file_name="../../wolfcrypt/src/ge_operations.c" />
<file file_name="../../wolfcrypt/src/hash.c" />
<file file_name="../../wolfcrypt/src/kdf.c" />
<file file_name="../../wolfcrypt/src/hc128.c" />
<file file_name="../../wolfcrypt/src/hmac.c" />
<file file_name="../../wolfcrypt/src/idea.c" />
<file file_name="../../wolfcrypt/src/include.am" />
<file file_name="../../wolfcrypt/src/integer.c" />
<file file_name="../../wolfcrypt/src/logging.c" />
@ -93,7 +91,6 @@
<file file_name="../../wolfcrypt/src/pkcs7.c" />
<file file_name="../../wolfcrypt/src/poly1305.c" />
<file file_name="../../wolfcrypt/src/pwdbased.c" />
<file file_name="../../wolfcrypt/src/rabbit.c" />
<file file_name="../../wolfcrypt/src/random.c" />
<file file_name="../../wolfcrypt/src/ripemd.c" />
<file file_name="../../wolfcrypt/src/rsa.c" />

Some files were not shown because too many files have changed in this diff Show More