Compare commits

...

561 Commits

Author SHA1 Message Date
toddouska
d195009dcb Merge pull request #1090 from JacobBarthelmeh/Release
update readme for known issue
2017-08-07 13:36:53 -07:00
Jacob Barthelmeh
6717035563 update readme for known issue 2017-08-07 13:13:43 -06:00
toddouska
d949832059 Merge pull request #1088 from JacobBarthelmeh/Release
prepare for release v3.12.0
2017-08-07 11:49:27 -07:00
toddouska
e9c6fa5f22 Merge pull request #1089 from JacobBarthelmeh/StaticAnalysisTests
fix potential memory leaks
2017-08-07 11:47:33 -07:00
Jacob Barthelmeh
1dc2889388 fix potential memory leaks 2017-08-04 16:49:31 -06:00
Jacob Barthelmeh
b55f981d5b prepare for release v3.12.0 2017-08-04 15:32:27 -06:00
toddouska
df4387cff4 Merge pull request #1083 from dgarske/chacha_noasm
Option to disable Intel speedups for ChaCha using `--enable-chacha=noasm`
2017-08-03 15:45:47 -07:00
David Garske
3be4e0823e Adds option --enable-chacha=noasm to allow disabling the Intel AVX/AVX2 speedups when used with --enable-intelasm. 2017-08-03 13:39:46 -07:00
toddouska
4d6cb66bc1 Merge pull request #1082 from dgarske/fix_intelasm_aesgcm
Fixes for `intelasm` and AES GCM with AVX2
2017-08-03 12:35:00 -07:00
toddouska
3f2de7154f Merge pull request #1080 from abrahamsonn/vcxproj_update
added files to wolfssl.vcxproj includes list for windows config testing
2017-08-03 12:15:23 -07:00
toddouska
977e909f60 Merge pull request #1081 from dgarske/chacha20_asm
Fix for `intelasm` and ChaCha20
2017-08-03 12:11:59 -07:00
David Garske
4a5ecb8a15 Fix typo with xmm5 (was xxm5). Workaround for Clang issues with AVX2 and using register __m128i tmp3 asm("xmm6"); syntax by using NO_UNROLL option. 2017-08-03 10:47:21 -07:00
abrahamsonn
089a050d7a added files to wolfssl.vcxproj includes list for windows config testing 2017-08-03 11:00:30 -06:00
David Garske
b0eeed364b Fix for intelasm and ChaCha20 with causing "error: unknown type name '__m256i'" on some compilers. Fix is to change the __m128i and __m256i to arrays of word64 (source Sean PR #1079). 2017-08-03 10:00:20 -07:00
dgarske
80bc089cb5 Merge pull request #1078 from SparkiDev/intel_asm_fixup
Stop using positional parameters in inline asm. Fixes issue with `--enable-intelasm --enable-debug` for AES GCM.
2017-08-03 09:32:50 -07:00
Sean Parkinson
31854c1566 Stop using positional parameters in inline asm 2017-08-03 13:55:30 +10:00
dgarske
108f6a4958 Merge pull request #1077 from JacobBarthelmeh/StaticAnalysisTests
Static analysis tests
2017-08-02 15:08:32 -07:00
toddouska
635bacef28 Merge pull request #357 from kojo1/PIC32
Fixes for PIC32MZ
2017-08-02 13:14:06 -07:00
Jacob Barthelmeh
433ca50292 remove unneeded XMEMSETs 2017-08-02 14:04:41 -06:00
toddouska
e77e93ef2e Merge pull request #1065 from JacobBarthelmeh/Testing
update DTLS export session version and tests
2017-08-02 11:40:38 -07:00
Jacob Barthelmeh
edce23b563 use memset when initializing DecodedCert structure 2017-08-02 10:50:34 -06:00
Jacob Barthelmeh
43b04af388 adjust sanity check in integer.c to avoid reading uninitialized values 2017-08-02 10:39:05 -06:00
Jacob Barthelmeh
062f3efa6d adjust integer.c for loop range 2017-08-02 10:29:34 -06:00
David Garske
65b8389af0 Fix for handling hash copies to make sure copied buffer is not free’d. Resolves issues when testing TLS connection with wolfssl_tcp_client and openurl https://www.google.com/. 2017-08-02 08:42:04 -07:00
dgarske
9f1b17effc Merge pull request #1076 from JacobBarthelmeh/UnitTests
place macro guard on test of RSA-OAEP with SHA1 dependency
2017-08-01 14:05:58 -07:00
dgarske
2d94a3954a Merge pull request #1075 from JacobBarthelmeh/fast-rsa
add sanity check in fast-rsa and change loop behavior when generating…
2017-08-01 14:05:03 -07:00
dgarske
bd20729fba Merge pull request #1069 from ejohnstown/dtls-mac
DTLS Bad MAC Checks
2017-08-01 13:45:19 -07:00
Jacob Barthelmeh
c93d348ecd fix sesion export buffer to be not dependent on macros defined 2017-08-01 14:19:06 -06:00
David Garske
be432d8d3a Fix for building in Harmony with crypto.h path. 2017-08-01 12:48:44 -07:00
David Garske
4e735631e7 Fixes for PIC32MZ:
* Adds crypto HW support for AES Direct and AES CCM.
* Fixes to enable PIC32MZ hardware hashing where updates are cached via heap buffer and final performs single operations against hardware.
* Fix for benchmark with 1024-bit certs passing in wrong size for `wc_RsaPrivateDecrypt` when using `USE_CERT_BUFFERS_1024`.
* Fix to resolve missing `strncasecmp` for the Microchip XC32. Workaround to use case sensitive version instead. This error occurred when building with HAVE_ECC defined in Harmony with XC32.
* Cleanup of the PIC32MZ crypto and hashing hardware code. Replace `pic32mz-hash.c` with `pic32mz-crypt.c`
* Add user_settings.h for mplabx and mcapi examples.
* Sync up with Harmony changes for MCAPI.
2017-08-01 12:42:09 -07:00
Jacob Barthelmeh
af0514704f place macro guard on test of RSA-OAEP with SHA1 dependency 2017-08-01 11:46:49 -06:00
Jacob Barthelmeh
c20859e67d add sanity check in fast-rsa and change loop behavior when generating fast-rsa key 2017-08-01 11:29:16 -06:00
JacobBarthelmeh
b553d36548 Merge pull request #1074 from SparkiDev/tls13_cr
Add NULL check after signature alg extension search
2017-08-01 09:01:42 -06:00
Sean Parkinson
24e9f7c43d Add NULL check after signature alg extension search 2017-08-01 13:55:06 +10:00
dgarske
7cee1c5e8a Merge pull request #1072 from toddouska/alert
add AlertCount to detect dos attempt
2017-07-31 18:29:23 -07:00
toddouska
2296f4806c Merge pull request #1073 from JacobBarthelmeh/StaticAnalysisTests
Static analysis tests
2017-07-31 18:24:17 -07:00
toddouska
0c753718bd Merge pull request #1042 from SparkiDev/chacha_asm
Intel Assembly optimizations for ChaCha20 - AVX and AVX2
2017-07-31 16:27:17 -07:00
toddouska
a27738b5f9 Merge pull request #1071 from dgarske/cleanup_tests
Cleanup AES GCM large test
2017-07-31 16:13:06 -07:00
toddouska
a55e42c14f Merge pull request #1070 from dgarske/fix_qat_normal_math
Fix normal math issue with async and `mp_read_unsigned_bin`
2017-07-31 16:12:08 -07:00
Jacob Barthelmeh
01099fd97e cast for when compiling with g++-7 2017-07-31 16:58:53 -06:00
Jacob Barthelmeh
08da8df455 sanity check on peer sequence for static analysis report 2017-07-31 16:37:34 -06:00
toddouska
66852a9252 add AlertCount to detect dos attempt 2017-07-31 15:17:54 -07:00
David Garske
2051a05139 Cleanup AES GCM large test. Move test into stack and disable if using BENCH_EMBEDDED. 2017-07-31 14:09:30 -07:00
David Garske
8a11b78960 Fix for normal math mp_read_unsigned_bin where mp_zero was also resetting the raw source. This caused failures with QAT when using normal math. 2017-07-31 14:09:15 -07:00
John Safranek
36a539760a DTLS Bad MAC Checks
1. Make the decrypt and verify MAC failure cases behave the same with
   respect to DTLS messages. It should pretend the message never happened.
2. Allow the echoclient to survive the echoserver sending a message with
   a bad MAC.
3. Allow the server to survive the client sending a message with a bad MAC.
2017-07-31 13:54:53 -07:00
toddouska
fb53fac1c1 Merge pull request #1067 from JacobBarthelmeh/Memory
sanity check on index when adding cipher suites
2017-07-31 12:03:49 -07:00
toddouska
62ce8c8b81 Merge pull request #1066 from dgarske/no_certs
Fix for building with `NO_CERTS` or `NO_WOLFSSL_SERVER` defined.
2017-07-31 12:01:39 -07:00
toddouska
87611fdb5d Merge pull request #1064 from SparkiDev/cpuid_fix
Fix cpuid to work with different configs
2017-07-31 11:59:17 -07:00
Jacob Barthelmeh
5564be6113 sanity check on index when adding cipher suites 2017-07-28 17:42:52 -06:00
David Garske
3387b12a9a Fix for building with NO_CERTS or NO_WOLFSSL_SERVER defined. 2017-07-28 15:24:53 -07:00
Jacob Barthelmeh
e1ccc5acad update DTLS export session version and tests 2017-07-28 14:27:24 -06:00
Sean Parkinson
d452f97e99 Fix cpuid to work with different configs
Fix 'may be uninitialized' warning in aes.c
Fix memory overwrite in AES-CBC when using AESNI.
2017-07-28 08:41:49 +10:00
dgarske
bc72d0c2d5 Merge pull request #1063 from JacobBarthelmeh/Testing
C89 compliance with variable declaration
2017-07-26 16:19:25 -07:00
dgarske
d5cf5f9887 Merge pull request #1062 from JacobBarthelmeh/UnitTests
update sanity checks with ARMv8 port
2017-07-26 16:18:37 -07:00
Jacob Barthelmeh
0978dd4285 C89 compliance with variable declaration 2017-07-26 15:29:00 -06:00
JacobBarthelmeh
dc7acc0400 Merge pull request #1059 from dgarske/fix_leaks
Fix for PKCS12 dynamic type names
2017-07-26 11:52:42 -06:00
Jacob Barthelmeh
637ca44e6a update sanity checks with ARMv8 port 2017-07-26 11:05:20 -06:00
dgarske
05ed5cafc2 Merge pull request #1061 from SparkiDev/tls13_leantls
Fixes for LEANTLS and TLS13 builds
2017-07-25 21:01:00 -07:00
dgarske
41e2b236aa Merge pull request #1051 from kaleb-himes/fsanitize-fixes
Fsanitize fixes
2017-07-25 20:57:43 -07:00
dgarske
fbf4e94bcf Merge pull request #1060 from SparkiDev/tls13_memleak
Fix memory leak when not using fast math and TLS13.
2017-07-25 20:55:42 -07:00
Sean Parkinson
038d16212f Fixes for LEANTLS and TLS13 builds 2017-07-26 10:43:36 +10:00
Sean Parkinson
59450e83fa Fix memory leak when not using fast math. 2017-07-26 09:48:34 +10:00
Chris Conlon
e1830772de Merge pull request #1056 from JacobBarthelmeh/UnitTests
check return values with new unit tests
2017-07-25 16:34:41 -06:00
David Garske
55b07019a0 Fix for PKCS12 dynamic type names (also fix to use manual realloc since its NUMA type and that behaves different). 2017-07-25 15:19:34 -07:00
David Garske
c03487d463 Fix for dynamic type of ED25519 key and PK_CALLBACK buffer not being free’d. Fix for portNumber stack var being used out of scope. 2017-07-25 15:07:58 -07:00
Jacob Barthelmeh
4fead493e7 add to return values checked 2017-07-25 14:44:40 -06:00
Jacob Barthelmeh
4438b8e92d update unit test case with DES3 and FIPS 2017-07-25 14:42:17 -06:00
Jacob Barthelmeh
5b0022fba0 HMAC key size when testing with FIPS 2017-07-25 14:42:17 -06:00
Jacob Barthelmeh
1b80e5a75f check return values with new unit tests 2017-07-25 14:42:17 -06:00
toddouska
ef98e96767 Merge pull request #1058 from jrblixt/fix-AesFipsSanityCheck
Unit test GCM sanity check Fips change.
2017-07-25 13:30:35 -07:00
toddouska
a076a2f0d8 Merge pull request #1055 from JacobBarthelmeh/Memory
fix memory management with --enable-fast-rsa make key and free RSA ke…
2017-07-25 11:03:16 -07:00
toddouska
69d4bcbfd5 Merge pull request #1048 from dgarske/fix_custcurve
Fixes for using custom curves with `wc_ecc_set_custom_curve`
2017-07-25 10:59:58 -07:00
toddouska
f9dee9adcc Merge pull request #1057 from kaleb-himes/TIRTOS-UPDATE
Add dependancy file to tirtos package.bld
2017-07-25 10:25:52 -07:00
toddouska
4939c3eeef Merge pull request #1030 from SparkiDev/aesni_sha384
Assembly optimization for AES-NI, and AVX1 and AVX2
2017-07-25 09:35:43 -07:00
Chris Conlon
874144be73 Merge pull request #1046 from kojo1/zendesk-3052
io.h for VxWorks
2017-07-25 09:53:15 -06:00
jrblixt
f8e2f596d6 Unit test GCM sanity check Fips change. 2017-07-25 09:23:19 -06:00
Chris Conlon
e9f87b9f33 Merge pull request #1054 from jrblixt/fix-RsaSetRng
Fix rsa set rng
2017-07-25 09:16:14 -06:00
Sean Parkinson
e8e1504d9f Alignment fix 2017-07-25 15:41:33 +10:00
David Garske
08488b52b7 Fix for wolfCrypt test custom curve test not setting wc_ecc_set_custom_curvebefore calling wc_ecc_import_x963_ex. Fix for using ECC_CACHE_CURVE option and wc_ecc_set_custom_curve. Added error checking for wc_ecc_set_custom_curve calls. Reverted ASN header change in test.c. 2017-07-24 21:04:18 -07:00
David Garske
33e214ffc1 Fix to allow ECC set curve size with curve_id == 0. Added wolfCrypt tests / example for using wc_ecc_set_custom_curve for BRAINPOOLP256R1. 2017-07-24 17:24:23 -07:00
David Garske
5180cf4cce Fix ECC sign with custom curves so the custom params (dp) are passed to public key used for sign. 2017-07-24 17:21:51 -07:00
David Garske
f147b01674 Fixes for using WOLFSSL_CUSTOM_CURVES and wc_ecc_set_custom_curve. Fixes resolves issue with ->dp and ->idx getting reset which caused curve parameters to not be set correctly. Proper sequence for using custom curves is ‘wc_ecc_init, wc_ecc_set_custom_curve then wc_ecc_make_key_ex(…, ECC_CUSTOM_IDX)’ or wc_ecc_import_x963_ex(…, ECC_CUSTOM_IDX). Test case and example to follow shortly. 2017-07-24 17:21:51 -07:00
Sean Parkinson
b23f983604 Intel Assembly optimizations for ChaCha20 - AVX and AVX2 2017-07-25 10:19:02 +10:00
Takashi Kojo
2329e37d97 Remove options outside VxWorks 2017-07-25 09:07:30 +09:00
Sean Parkinson
8e38dcc347 Tidy code up - use local static for cpuid flags 2017-07-25 08:50:39 +10:00
Sean Parkinson
bde6a35ac4 Assembly optimization for AES-NI, and AVX1 and AVX2
Unroll the loop for 8.
Use new optimized maths.
Fix SHA-384 to use SHA-512 assembly code.
Only perform CPU id check in one place.
2017-07-25 08:50:39 +10:00
toddouska
36c2ee92dc Merge pull request #1050 from JacobBarthelmeh/ARMv8
Xilinx port
2017-07-24 15:37:05 -07:00
Jacob Barthelmeh
1040bbde16 fix memory management with --enable-fast-rsa make key and free RSA key before calling make key function 2017-07-24 16:20:27 -06:00
toddouska
be61d7fca3 Merge pull request #1044 from ejohnstown/dtls-multicast
DTLS Multicast
2017-07-24 14:20:26 -07:00
jrblixt
6df9bc07a4 RSA Fips harness fix. 2017-07-24 13:21:06 -06:00
jrblixt
e68ceb3d2c Guard against WC_RSA_BLINDING in api.c unit test. 2017-07-24 09:51:50 -06:00
toddouska
95664fdd05 Merge pull request #1041 from dgarske/armc0
Fixes for building with custom options
2017-07-24 08:40:51 -07:00
toddouska
9d919ca947 Merge pull request #1049 from dgarske/fix_asynchmac
Fixes for building with Async
2017-07-24 08:36:20 -07:00
kaleb-himes
0fed9c1dc5 Add dependancy file to tirtos package.bld 2017-07-24 08:32:01 -06:00
Jacob Barthelmeh
59a46d08d9 Xilinx port 2017-07-21 17:39:47 -06:00
David Garske
26ac5e1ab7 Fix for error: array subscript is below array bounds warning with GCC 7. Added check to prevent negative value from being used against array. 2017-07-21 12:00:28 -07:00
David Garske
b7dac4911b Fix for using Async and HMAC when its not Intel QuickAssist. 2017-07-21 11:43:01 -07:00
dgarske
9e3497b3d5 Merge pull request #1047 from JacobBarthelmeh/Testing
macro guard to check if ECC is enabled
2017-07-21 10:34:13 -07:00
David Garske
f0d6299581 Fix issue with benchmark_init refactor where malloc failure could use null pointer. Added error checking on the wolfCrypt_Init(). 2017-07-21 09:31:12 -07:00
Takashi Kojo
173283208b add WOLFSSL_HAVE_MAX in settings.h 2017-07-21 12:42:24 +09:00
Takashi Kojo
bd6633a31c #elif defined(WOLFSSL_VXWORKS) in io.h 2017-07-21 12:37:32 +09:00
Jacob Barthelmeh
e3ffd7d539 macro guard to check if ECC is enabled 2017-07-20 16:38:53 -06:00
David Garske
7a972d9611 Fix warning for signed/unsigned comparison. 2017-07-20 11:35:52 -07:00
toddouska
cf9dfac877 Merge pull request #1043 from SparkiDev/sha3_be
Big endian fix for SHA-3
2017-07-20 09:14:00 -07:00
Sean Parkinson
d6190507ac Big endian fix for SHA-3 2017-07-20 16:53:36 +10:00
dgarske
8bfbabd147 Merge pull request #1040 from jrblixt/fix-FreeToHash
Added Free functions to hash unit test.
2017-07-19 18:19:28 -07:00
David Garske
0a63221220 Fix for SHA3 benchmark digest size for 224. Fix for building track and debug memory together. Fix for hash test order of SHA256 wrong. Fix for asn SkipObjectId missing, when RSA and ECC disabled. Enhancement to allow individual bench calls with bench init/free. 2017-07-19 18:14:57 -07:00
dgarske
7d82d7235a Merge pull request #1038 from JacobBarthelmeh/Testing
fix warnings found building on a PPC
2017-07-19 16:54:50 -07:00
John Safranek
0fee243b75 Multicast DTLS
Restored the multicast key setting code that was lost during rebase.
2017-07-19 14:01:29 -07:00
John Safranek
935bf9028d DTLS Multicast
1. Keep track of the number of records a session drops for having a
   bad MAC or detected as replayed.
2. Add function to access the drop statistics.
2017-07-19 13:38:31 -07:00
John Safranek
3329aa7bef DTLS Multicast
Added an API so a session may be queried to see if it has seen any messages
from a specified peerId.
2017-07-19 13:38:31 -07:00
John Safranek
6223f4cd8e fix a couple rebase merge errors 2017-07-19 13:38:31 -07:00
John Safranek
43f3e304e6 DTLS Multicast
Added a parameter check to wolfSSL_mcast_read().
2017-07-19 13:36:42 -07:00
John Safranek
1d32409651 DTLS Multicast
1. Allow the MTU size to be changed at compile time for memory
   contrained environments using static memory.
2. Add compile time option to disable the check for DTLS messages
   in the current epoch with an outside-the-window sequence number.
2017-07-19 13:36:42 -07:00
John Safranek
3b5e537f08 DTLS Multicast
wolfSSL_set_secret() was checking the preMasterSz against the sizeof
the preMasterSecret member of the Arrays structure. That member
was changed to a pointer and allocated dynamically for the session
write-duping. The comparison between the passed in size and the size
of the parameter started failing. The check now uses the constant
that is used for allocating the preMasterSecret member.
2017-07-19 13:36:42 -07:00
John Safranek
4c5ddc8482 Multicast DTLS
Handshake resources are required for Multicast DTLS to calculate the
session keys. When the session key is set, free the handshake resources.
2017-07-19 13:36:42 -07:00
John Safranek
6509faa78d Several parameters stored with DTLS session export have moved into
a wrapper structure. Updated the references.
2017-07-19 13:36:42 -07:00
John Safranek
1d5c6cce00 Fix some small things compiling with a different compiler, and some
other options.
1. Missing prototype for the Mcast receive I/O callback.
2. When disabling SHA-1, the old DTLS cookie callback wouldn't work.
   Allow for SHA-256.
2017-07-19 13:36:42 -07:00
John Safranek
fbd7f7972b Multicast
1. Used quotes rather than angle-brackets when including
   user_settings.h.
2. Used angle-brackets rather than quotes when including
   the ThreadX and NetX headers.
3. Added a define flag to include types.h with NetX or ThreadX.
4. Added a void typecast to hush a warning about an unused variable
   in the I/O callbacks for NetX.
5. Clean up static analysis warning in the peer sequence
   number selection for DTLS.
2017-07-19 13:36:41 -07:00
David Garske
b40aad3f9e Added new “wolfSSL_mcast_get_max_peers” API. Minor cleanup with examples/client failure case. Fix possible unused var in wolfSSL_set_secret with DTLS disabled. 2017-07-19 13:35:59 -07:00
John Safranek
6097d29045 DTLS Multicast
1. Restore original EmbedRecvFrom callback.
2. Add new EmbedRecvFromMcast callback. (EmbedSendTo still the same.)
3. Set new receive from callback when setting the member ID.
4. Fixed bad rebase change.
2017-07-19 13:34:32 -07:00
John Safranek
af1a9ca908 Multicast
1. Squash a couple unused variable warnings.
2017-07-19 13:34:32 -07:00
John Safranek
1657569605 DTLS Multicast
1. Adding the prototypes for the sequence number high water callback.
2. Added the accessors to set the highwater callback function,
   trigger levels, and application context.
3. Calls the highwater callback at specified sequence number thresholds
   per peer.
2017-07-19 13:34:32 -07:00
John Safranek
96c25b2caa DTLS Multicast
1. Separated the peer ID from the array index into the peer sequence
   list. This allows peer IDs to range from 0..255, and to have an
   arbitrary size for the sequence list.
2. Add API to add and remove peer IDs from the sequence number list.
2017-07-19 13:33:58 -07:00
John Safranek
3f330a2b21 Multicast
1. Move the function `wolfSSL_mcast_read()` to
   follow `wolfSSL_read_internal()`.
2. Implemented `wolfSSL_mcast_read()`.
2017-07-19 13:33:58 -07:00
John Safranek
60c6c32ad3 Multicast DTLS
Tweak the size of the Peer Sequence list.
2017-07-19 13:33:58 -07:00
John Safranek
fa4a8fee8c DTLS Multicast
1. Temporary change to io.c to recieve datagrams from any peer.
2. Uses an array of Peer Sequence structures to track the current
   sequence number of all the peers.
2017-07-19 13:33:57 -07:00
John Safranek
0457df83d4 Multicast
1. When setting the key data, use same keys for server and client
   sides of the different keys. This feels a little kludgey, and
   won't work when using separate senders and listeners who may
   use unicast messages. But this works for the all peers are
   multicast senders case.
2017-07-19 13:33:57 -07:00
John Safranek
30a54a4860 Multicast
1. Add haveMcast as an exception case for needing a signing key along
   with havePSK and haveAnon.
2017-07-19 13:31:39 -07:00
John Safranek
41638b437b DTLS Multicast
1. Add configured group ID to outbound DTLS datagrams.
2. Parse the group ID from inbound DTLS datagrams.
2017-07-19 13:31:39 -07:00
John Safranek
dd9800856d Multicast DTLS
When setting the new secret, in DTLS mode, update the sequence
numbers, message windows, and epoch.
2017-07-19 13:31:39 -07:00
John Safranek
431a0cbea9 Multicast
1. Since multicast's only cipher suite uses null cipher
   automatically enable it.
2. Add options to example client and server to start
   testing multicast API. (Uses TLS over TCP.)
3. Updates to use the forced secrets set by API.
2017-07-19 13:31:39 -07:00
jrblixt
f83a593f27 Added Free functions to hash unit test. 2017-07-19 14:28:41 -06:00
John Safranek
b616b8df02 Multicast DTLS
1. Update API
2. Update unit test
3. Partially implemented wolfSSL_set_secret().
2017-07-19 13:26:23 -07:00
John Safranek
0838a3828b Multicast DTLS
1. Added new cipher suite for use with Multicast DTLS,
   WDM_WITH_NULL_SHA256. (It should be a private suite.)
2. Update the API test to use the new suite.
2017-07-19 13:26:23 -07:00
John Safranek
5154584576 Multicast DTLS
1. Add DTLS-multicast to the enable options.
2. Reorg DTLS related enable options together.
3. Update a couple enable option texts to use the AS_HELP_STRING() macro.
4. Add three new APIs for managing a DTLS Multicast session.
5. Add test code for new APIs.
6. Add stub code for the new APIs.
2017-07-19 13:26:23 -07:00
Chris Conlon
b3a20470fd Merge pull request #1036 from jrblixt/unitTest_api_addHc128-PR07182017
Unit test functions for HC128.
2017-07-19 13:29:18 -06:00
jrblixt
5c19b7bfe0 Changes per Chris. 2017-07-19 11:24:56 -06:00
Chris Conlon
667b8431cc Merge pull request #683 from moisesguimaraes/wolfssl-py
wolfssl python wrapper
2017-07-19 09:22:02 -07:00
Jacob Barthelmeh
81f09e575e fix warnings found building on a PPC 2017-07-19 09:24:45 -06:00
jrblixt
d2245b9614 Unit test functions for HC128. 2017-07-19 09:18:48 -06:00
Chris Conlon
5f17598d47 Merge pull request #1035 from jrblixt/Api_c-Fix
api.c fix.
2017-07-18 15:46:12 -07:00
Chris Conlon
0e6b0a6156 Merge pull request #1033 from jrblixt/unitTest_api_addAesCcm-PR07172017
Unit test functions for AES-CCM.
2017-07-18 15:44:12 -07:00
jrblixt
e68f1b2cec api.c fix. 2017-07-18 11:02:19 -06:00
Moisés Guimarães
c93a903cae atualiza lista de arquivos incluídos na versão de distribuição. 2017-07-18 11:36:07 -03:00
dgarske
47fd21dc63 Merge pull request #1032 from JacobBarthelmeh/SGX
fix macro check with SGX settings
2017-07-17 19:07:28 -07:00
jrblixt
5671a4cb49 Added unit test functions for AES-CCM. 2017-07-17 15:58:11 -06:00
Chris Conlon
808f4692c7 Merge pull request #993 from jrblixt/unitTest_api_addRsa-PR06222017
Add RSA to unit test.
2017-07-17 13:42:42 -07:00
jrblixt
fdb371e82e Changes per Chris. 2017-07-17 10:43:36 -06:00
Jacob Barthelmeh
c4f0bd6172 fix macro check with SGX settings 2017-07-17 09:36:45 -06:00
dgarske
cc4ca6a44a Merge pull request #1029 from kaleb-himes/RIOT_OS_PORTABILITY
Riot os portability and minor design modifications
2017-07-17 05:16:56 -07:00
kaleb-himes
a7390e32ec Identified two more old-style definitions in test app 2017-07-16 16:01:52 -06:00
kaleb-himes
e51225aca6 Address typo in RIOT_OS settings and removed ECC as a default feature 2017-07-16 14:22:15 -06:00
kaleb-himes
8acf709b59 Address some old-style function definitions found in RIOT testing 2017-07-16 14:18:58 -06:00
dgarske
f7cd8a0f15 Merge pull request #1028 from JacobBarthelmeh/SGX
update SGX macros for harden
2017-07-14 19:42:29 -07:00
Jacob Barthelmeh
12795e9a40 update SGX macros for harden 2017-07-14 16:59:11 -06:00
toddouska
9e9dbc5e97 Merge pull request #1026 from dgarske/curve_128bit
Fix for ARMv8 and Curve25519 with debug enabled
2017-07-14 13:27:22 -07:00
David Garske
8612d52844 Fix issue with ARMv8 not performing 128-bit math against constants correctly in debug builds. Fix was to use the __int128_t as const for integers. Also added ./configure --enable-curve25519=no128bit option to force FE to not use the int128_t math. 2017-07-14 10:39:30 -07:00
dgarske
8b55122ba0 Merge pull request #1024 from JacobBarthelmeh/UnitTests
adjust size of test buffer
2017-07-13 16:48:00 -07:00
dgarske
a0e918c350 Merge pull request #1022 from JacobBarthelmeh/curve25519
build for ed25519 only
2017-07-13 12:30:26 -07:00
Jacob Barthelmeh
ba48221c41 adjust size of test buffer 2017-07-13 13:21:09 -06:00
dgarske
af8b96e277 Merge pull request #1021 from toddouska/zeroret
don't treat peer closed / zero return as hard error in example servers
2017-07-13 09:11:31 -07:00
toddouska
4491102eed Merge pull request #1018 from dgarske/fix_tfm_rusb_max
Fix for fast math `fp_read_unsigned_bin` function to check max size
2017-07-13 09:27:02 -06:00
David Garske
d559eb0f4f Fix for fast math fp_read_unsigned_bin function to check max and correctly set a->used (is handled in fp_mul_2d). 2017-07-12 16:39:26 -07:00
Chris Conlon
43260f02f4 Merge pull request #1020 from toddouska/null
add NULL checks to check_domain_name()
2017-07-12 14:58:07 -07:00
toddouska
b12e3c6579 Merge pull request #1019 from JacobBarthelmeh/Testing
update AES CTR API with ARMv8 port
2017-07-12 15:57:25 -06:00
Jacob Barthelmeh
c4fe67b633 build for ed25519 only 2017-07-12 15:53:11 -06:00
JacobBarthelmeh
b4f9c46069 Merge pull request #1011 from dgarske/fixes_armv8
Fixes for building ARMv8 (--enable-armasm)
2017-07-12 15:44:31 -06:00
toddouska
19787e6d4f don't treat peer closed / zero return as hard error in example servers 2017-07-12 14:15:16 -06:00
David Garske
c777097e54 Fix wc_AesGcmDecrypt arg check for authIn. 2017-07-12 09:49:27 -07:00
toddouska
b02c995fff add NULL checks to check_domain_name() 2017-07-12 10:16:31 -06:00
David Garske
5bb8de627e Fixes based on peer review (thanks). 2017-07-12 09:04:10 -07:00
toddouska
43ad30d364 Merge pull request #1016 from dgarske/fix_harden
Warn if hardening options are not defined and not disabled using `WC_NO_HARDEN`
2017-07-12 09:27:32 -06:00
toddouska
dc5e6f789d Merge pull request #1017 from dgarske/bigend
Fix for big endian seg fault in `SendCertificateVerify`
2017-07-12 09:25:25 -06:00
Jacob Barthelmeh
9d7e8a83c9 update AES CTR API with ARMv8 port 2017-07-11 17:13:32 -06:00
toddouska
7853440d89 Merge pull request #1015 from dgarske/config_ignore_cleanup
Improve the Git ignore formula for `config`
2017-07-11 15:42:08 -07:00
toddouska
3ff088b92f Merge pull request #1014 from dgarske/atecc508a
Fixes for building with ATECC508A
2017-07-11 15:41:05 -07:00
jrblixt
00724c95a9 Add RSA to unit test. 2017-07-11 09:57:33 -06:00
Chris Conlon
f8c0a52170 Merge pull request #996 from jrblixt/unitTest_api_addAes-PR06152017
Unit test api add AES.
2017-07-11 08:36:13 -07:00
David Garske
69e9aa29f2 Fix for big endian platform in SendCertificateVerify where seg fault occurred due to passing a int pointer to a word16 pointer, which caused wrong bits to get set. Fix to replace int with word16. Tests pass now. Also searched for other (word16*)& scenarios and only other place was in ntru code, which was also fixed. 2017-07-10 20:00:37 -07:00
David Garske
a5cdbb18cb Reworked the AES Key Wrap to use existing code in aes.c (instead of duplicating code in armv8-aes.c). Cleanup for GE/FE math on 32-bit to remove duplicate #ifdef check. Fixed AES GCM arg check for authIn to allows NULL. 2017-07-10 19:12:41 -07:00
David Garske
792fcefbb7 Fix to not warn about WC_RSA_BLINDING in FIPS mode. Add WC_RSA_BLINDING to Windows user_settings.h. 2017-07-10 18:41:22 -07:00
David Garske
171796e8e2 Fix up for building without ./configure to warn if hardening options are not enabled. Currently ./configure defaults to --enable-harden, but if building sources directly and using settings.h or user_settings.h the hardening defines will not be set by default. If a user wants to use without hardening they can suppress the warning by defining WC_NO_HARDEN. 2017-07-10 14:40:07 -07:00
David Garske
cebcee34dd Improve the Git ignore formula for config. Fixes issue #1012. 2017-07-10 14:21:19 -07:00
dgarske
f9c949e7e5 Merge pull request #871 from danielinux/rm-wolfssl.pc
Remove automatically generated file wolfssl.pc
2017-07-10 14:16:48 -07:00
David Garske
58c05123da Fixes for building with ATECC508A. Allow ECC check key to pass if slot numb is valid. 2017-07-10 11:07:24 -07:00
David Garske
205da48416 Fixes for building ARMv8. Adds missing SHA224 and AES KeyWrap. Fixes for FE/GE warning with Aarch32. Fix possible build error with ed25519_test with ret not defined. 2017-07-07 15:12:51 -07:00
toddouska
b6854d620f Merge pull request #1009 from dgarske/fix_tls13_async_aes
Fix problem with async TLS 1.3 and raw AES encryption key change
2017-07-06 15:39:22 -07:00
toddouska
626eeaa63d Merge pull request #1005 from SparkiDev/nginx-1.13.2
Changes for Nginx
2017-07-06 14:33:46 -07:00
jrblixt
ced45ced41 Changes requested by Chris. 2017-07-06 13:42:54 -06:00
Sean Parkinson
31ac379c4f Code review fixes
Change verify depth and set curve to be compiled in whe using:
OPENSSL_EXTRA
Fix comparison of curve name strings to use ecc function.
Fix verify depth check when compiling with both OPENSSL_EXTRA and
WOLFSSL_TRUST_PEER_CERT.
2017-07-06 15:32:34 +10:00
toddouska
4b9069f786 Merge pull request #1008 from dgarske/fix_async_frag
Fixes for using async with max fragment
2017-07-05 11:00:26 -07:00
toddouska
e767d40656 Merge pull request #1006 from cconlon/mqx
Update MQX Classic, mmCAU Ports
2017-07-05 10:30:20 -07:00
David Garske
df119692d1 Fixes for using async with HAVE_MAX_FRAGMENT or --enable-maxfragment which affected TLS 1.2/1.3. Added TLS 1.2 test for using max fragment. 2017-07-03 19:57:37 -07:00
Sean Parkinson
5bddb2e4ef Changes for Nginx
Support TLS v1.3 clients connecting to Nginx.
Fix for PSS to not advertise hash unless the signature fits the private
key size.
Allow curves to be chosen by user.
Support maximum verification depth (maximum number of untrusted certs in
chain.)
Add support for SSL_is_server() API.
Fix number of certificates in chain when using
wolfSSL_CTX_add_extra_chain_cert().
Allow TLS v1.2 client hello parsing to call TLS v1.3 parsing when
SupportedVersions extension seen.
Minor fixes.
2017-07-04 09:37:44 +10:00
toddouska
2939fbe242 Merge pull request #1004 from dgarske/fix_qat_dh
Fixes for QAT with DH and HMAC
2017-07-03 12:31:48 -07:00
Moisés Guimarães
1729e0205f reads _CADATA from file 2017-07-03 12:39:42 -03:00
Moisés Guimarães
54177c14b4 imports certs from ./certs 2017-07-03 12:31:47 -03:00
Moisés Guimarães
bba3fcf772 removes certs 2017-07-03 12:22:22 -03:00
David Garske
c9a2c4ef02 Fix problem with async TLS 1.3 with hardware where encryption key is referenced into ssl->keys and changes before it should be used. Solution is to make raw copy of key and IV for async AES. 2017-06-30 16:41:01 -07:00
David Garske
6a695b76cb Fixed server side case for DH agree issue with QAT hardware where agreeSz is not set. Fix to allow QAT start failure to continue (this is useful since only one process can use hardware with default QAT configuration). 2017-06-30 11:48:59 -07:00
David Garske
a025417877 Fix issue with QAT and DH operations where key size is larger than block size. Fix issue with DhAgree in TLS not setting agreeSz, which caused result to not be returned. Renamed the internal.c HashType to HashAlgoToType static function because of name conflict with Cavium. Optimize the Hmac struct to replace keyRaw with ipad. Enable RNG HW for benchmark. Fixed missing AES free in AES 192/256 tests. 2017-06-30 11:35:51 -07:00
JacobBarthelmeh
a3375ef961 Merge pull request #997 from NickolasLapp/master
Updates to Linux-SGX README, and disable automatic include of
2017-06-30 11:48:12 -06:00
dgarske
d956181911 Merge pull request #1003 from jrblixt/asn_cMemLeak-fix
Fix possible memory leak in wc_SetKeyUsage.
2017-06-29 15:28:53 -07:00
jrblixt
baf6bdd6e1 asn.c memory leak fix. 2017-06-29 14:55:19 -06:00
toddouska
31e1d469c0 Merge pull request #1002 from SparkiDev/tls13_imprv
Improvements to TLS v1.3 code
2017-06-29 09:21:20 -07:00
Chris Conlon
bba914f92e protect wolfSSL_BN_print_fp with NO_STDIO_FILESYSTEM 2017-06-29 08:52:45 -06:00
Sean Parkinson
d2ce95955d Improvements to TLS v1.3 code
Reset list of supported sig algorithms before sending certificate
request on server.
Refactored setting of ticket for both TLS13 and earlier.
Remember the type of key for deciding which sig alg to use with TLS13
CertificateVerify.
RSA PKCS #1.5 not allowed in TLS13 for CertificateVerify.
Remove all remaining DTLS code as spec barely started.
Turn off SHA512 code where decision based on cipher suite hash.
Fix fragment handling to work with encrypted messages.
Test public APIS.
2017-06-29 09:00:44 +10:00
Chris Conlon
c099137450 add classic Kinetis mmCAU support, FREESCALE_USE_MMCAU_CLASSIC 2017-06-28 16:32:35 -06:00
Chris Conlon
15a1c9d48e fixes for MQX classic with Codewarrior 2017-06-28 12:28:40 -06:00
Chris Conlon
a89e50b7b7 include settings.h in wc_port.h to pick up user_settings.h 2017-06-28 12:25:44 -06:00
toddouska
c748d9dae9 Merge pull request #998 from dgarske/fix_no_server_or_client
Fix build with either `NO_WOLFSSL_SERVER` or `NO_WOLFSSL_CLIENT` defined
2017-06-28 10:30:08 -07:00
toddouska
b29cd414ef Merge pull request #995 from SparkiDev/tls13_cookie
Add TLS v1.3 Cookie extension support
2017-06-28 10:12:49 -07:00
David Garske
47cc3ffdbc Fix build with either NO_WOLFSSL_SERVER or NO_WOLFSSL_CLIENT defined. 2017-06-26 23:05:32 -07:00
Sean Parkinson
7aee92110b Code review fixes
Also put in configuration option for sending HRR Cookie extension with
state.
2017-06-27 08:52:53 +10:00
Sean Parkinson
9ca1903ac5 Change define name for sending HRR Cookie 2017-06-27 08:37:55 +10:00
Nickolas Lapp
d4e104231c Updates to Linux-SGX README, and disable automatic include of
benchmark/wolfcrypt tests in static library compile
2017-06-26 14:55:13 -07:00
jrblixt
a3b21f0394 Aes unit test functions. 2017-06-26 15:16:51 -06:00
Sean Parkinson
8bd6a1e727 Add TLS v1.3 Cookie extension support
Experimental stateless cookie
2017-06-26 16:41:05 +10:00
JacobBarthelmeh
3bdf8b3cfd remove fcntl.h include when custom generate seed macro is defined (#994) 2017-06-23 14:03:07 -07:00
Kincade Pavich
fbc4123ec0 Added -x option to allow example server to continue running when errors occur. 2017-06-22 21:19:59 -07:00
toddouska
8ef556c2a0 Merge pull request #991 from JacobBarthelmeh/Testing
update .am files for make dist
2017-06-22 15:02:12 -07:00
Jacob Barthelmeh
b0f87fdcf7 update .am files for make dist 2017-06-22 14:14:45 -06:00
toddouska
72da8a9a07 Merge pull request #731 from moisesguimaraes/fixes-ocsp-responder
adds OCSP Responder extKeyUsage validation
2017-06-22 11:43:51 -07:00
toddouska
d017274bff Merge pull request #976 from levi-wolfssl/PemToDer-overflow-fix
Fix potential buffer over-read in PemToDer()
2017-06-22 10:07:11 -07:00
David Garske
3a4edf75bd Rename the option to disable the new issuer sign check to ‘WOLFSSL_NO_OCSP_ISSUER_CHECK`. 2017-06-22 09:56:43 -07:00
dgarske
06fa3de31c Merge pull request #980 from SparkiDev/tls13_0rtt
TLS v1.3 0-RTT
2017-06-22 09:44:41 -07:00
Chris Conlon
ccb8e8c976 Merge pull request #988 from jrblixt/unitTest_api_addArc4-PR06212017
Add Arc4 to unit test.
2017-06-22 09:15:28 -06:00
Sean Parkinson
207b275d24 Fix HelloRetryRequest for Draft 18 2017-06-22 14:40:09 +10:00
Sean Parkinson
08a0b98f52 Updates from code review 2017-06-22 12:40:41 +10:00
Levi Rak
a37808b32c Sanity checkes added 2017-06-21 17:14:20 -06:00
jrblixt
1aee054902 Add Arc4 to unit test. 2017-06-21 17:03:27 -06:00
David Garske
a3578c6643 Adds WOLFSSL_NO_OCSP_EXTKEYUSE_OCSP_SIGN option to provide backwards compatibility option for OCSP checking. 2017-06-21 14:12:12 -07:00
David Garske
7a3769f435 Fix wolfCrypt errors test to allow -178. 2017-06-21 14:12:12 -07:00
Moisés Guimarães
4bb17205fe adds new ocsp test 2017-06-21 14:12:12 -07:00
Moisés Guimarães
a9d5dcae58 updates ocsp tests; adds check for OCSP response signed by issuer. 2017-06-21 14:12:12 -07:00
Moisés Guimarães
42a2f5858e adds OCSP Responder extKeyUsage validation 2017-06-21 14:12:12 -07:00
toddouska
9ead657723 Merge pull request #989 from dgarske/testing
Fixes for CRL handling and possible false failure in `wolfSSL_CTX_load_verify_locations`
2017-06-21 14:10:49 -07:00
toddouska
cd570a01f2 Merge pull request #975 from dgarske/ed_curve_small
Allow different Ed25519/Curve25519 math versions
2017-06-21 13:00:33 -07:00
Levi Rak
247388903b Remove double cast + move min() calls 2017-06-21 13:56:34 -06:00
David Garske
fec75e445e Fix for build error in master from QAT fixes in PR #967. Odd that this build error didn’t show up till just now. 2017-06-21 12:52:03 -07:00
Kaleb Himes
64873489ef Merge pull request #977 from cconlon/cms
add PKCS7/CMS decode support for KARI with IssuerAndSerialNumber
2017-06-21 11:54:20 -06:00
David Garske
d75a9f2436 Fix for wc_ReadDirFirst to return non-zero value if no files found. Fix for wolfSSL_CTX_load_verify_locations to not return failure due to wc_ReadDirNext “no more files” -1 response. 2017-06-21 10:36:49 -07:00
David Garske
2f9f746053 Fix for CRL serial number matching to also check length. Fix for testing the verify callback override ‘-j’ to not enable CRL since the CA’s are not loaded for this test. 2017-06-21 10:36:49 -07:00
David Garske
0fa99fcc2e Fix for openssl script test reporting ./scripts/openssl.test: line 219: psk: command not found. 2017-06-21 10:36:49 -07:00
David Garske
3e06beac19 Additional edge case build error with 32-bit and small where int32_t not defined due to stdint.h not being included. 2017-06-21 10:13:20 -07:00
Chris Conlon
c183e03802 Merge pull request #986 from jrblixt/unitTest_api_addRabbit-PR06192017
Add Rabbit unit test functions.
2017-06-21 10:45:41 -06:00
Sean Parkinson
decdf7ae8b Cleanup 2017-06-21 16:56:51 +10:00
Sean Parkinson
1549a60aa5 Put back Draft 18 code 2017-06-21 08:35:28 +10:00
Sean Parkinson
350ce5fcef TLS v1.3 0-RTT 2017-06-21 08:35:28 +10:00
Kaleb Himes
97906bfdb2 Merge pull request #982 from JacobBarthelmeh/Testing
set return code to TEST_SUCCESS on successful connection
2017-06-20 16:21:50 -06:00
toddouska
8b637cbd1b Merge pull request #967 from dgarske/fix_qat
Fixes and Improvements for Intel QuickAssist
2017-06-20 14:49:56 -07:00
toddouska
a555b5e54a Merge pull request #987 from SparkiDev/nginx_fix
Fix for Nginx - return specific error when at end of file
2017-06-20 14:28:34 -07:00
jrblixt
c14e2d5888 Add Rabbit unit test functions. 2017-06-20 15:16:12 -06:00
Daniele Lacamera
6e6b341b46 Removed automatically generated file wolfssl.pc 2017-06-20 10:39:02 +02:00
Sean Parkinson
d5b1698c43 Fix for Nginx - return specific error when at end of file 2017-06-20 09:27:24 +10:00
David Garske
4950c644cd Fix edge case on 32-bit with ED small only. 2017-06-19 10:15:05 -07:00
David Garske
7fdb7037d8 Fixes for building Ed/Curve for building on 32/64 bit with uint64_t. Fixes for build with Ed/Curve with ECC disabled. 2017-06-19 10:09:12 -07:00
Chris Conlon
2a688bf905 Merge pull request #972 from jrblixt/unitTest_api_addCamellia-PR06142017
Add Camellia unit test functions.
2017-06-19 09:33:19 -06:00
Jacob Barthelmeh
c118146803 set return code to TEST_SUCCESS on successful connection 2017-06-19 09:26:16 -06:00
David Garske
ee83710a0a Fix for building only curve small and ed disabled. Fix for client assuming supported curves is enabled with curve. 2017-06-16 16:17:01 -07:00
jrblixt
6a2824f199 Add Camellia unit test functions.. 2017-06-16 16:27:03 -06:00
Chris Conlon
e0e8d14630 Merge pull request #970 from jrblixt/unitTest_api_addChacha-PR06142017
Add ChaCha unit test functions.
2017-06-16 16:15:39 -06:00
Chris Conlon
816b0b058c add PKCS7/CMS decode support for KARI with IssuerAndSerialNumber 2017-06-16 15:16:32 -06:00
jrblixt
43d6b7a145 Add ChaCha unit test functions. 2017-06-16 13:00:17 -06:00
Levi Rak
17936d65e0 please Jenkins + a bit of cleanup 2017-06-16 12:27:59 -06:00
dgarske
2f36b24796 Merge pull request #973 from JacobBarthelmeh/Testing
add sanity check for wolfSSL_X509_NAME_oneline function
2017-06-16 10:54:02 -07:00
Levi Rak
4389d271cc Fixed potential buffer overflows when configured with --enable-opensslextra 2017-06-16 11:02:06 -06:00
David Garske
3c173ba366 Enhancement to support different sized Curve/Ed math library implementations for FE/GE. Remains backwards compatible with CURVED25519_SMALL define. Adds new defines CURVE25519_SMALL and ED25519_SMALL to allow individual enabling of math library choice (_low_mem or _operations). Example: ./configure --enable-ed25519=small --enable-curve25519. 2017-06-16 09:41:10 -07:00
Chris Conlon
e6f0ee84ec Merge pull request #971 from jrblixt/unitTest_api_addIdea-PR06142017
Add IDEA unit test functions.
2017-06-15 13:12:52 -06:00
Jacob Barthelmeh
bb6582896d add sanity check for wolfSSL_X509_NAME_oneline function 2017-06-15 11:55:37 -06:00
jrblixt
d5a43af751 Code review changes. Reviewer: Chris. 2017-06-15 11:12:01 -06:00
dgarske
1d303f5f61 Merge pull request #966 from cconlon/ecc_asn
fix wc_EccPrivateKeyDecode when pub exists
2017-06-15 08:42:09 -07:00
jrblixt
25ce52cd0c Add IDEA unit test functions. 2017-06-14 23:43:00 -06:00
dgarske
2b085351b6 Merge pull request #968 from JacobBarthelmeh/Testing
silence "may be used uninitialized" warning
2017-06-14 18:05:45 -07:00
toddouska
55d421d8b6 Merge pull request #964 from SparkiDev/ecc_priv_only
Ecc priv only
2017-06-14 16:42:24 -07:00
Jacob Barthelmeh
e1fef39aa2 silence "may be used uninitialized" warning 2017-06-14 16:58:22 -06:00
David Garske
f008350afd Added QAT DRBG support. 2017-06-14 15:45:34 -07:00
David Garske
73567853d3 Fix possible memory leak in DSA and ECC (mp_clear should always be called since async was implemented… even for fast math). Fix dynamic type mismatch in PKCS7. 2017-06-14 15:11:43 -07:00
David Garske
68439d4317 Completed refactor to cleanup dynamic types. Refined the tmp buffers to new types for more granularity. Fixed several places where malloc/free type was mis-matched. Cleanup of the PKCS12 code to improve cleanup handling. Fix wc_PKCS12_parse to return 0 on success else failure. 2017-06-14 15:11:43 -07:00
David Garske
88afc7a92f Progress on dynamic type cleanup for over-use of tmp_buffer. Increases performance on NUMA memory platform having ability to be more selective about the types that are NUMA allocated for use against QuickAssist hardware. 2017-06-14 15:11:43 -07:00
David Garske
40d94724eb Added async hardware support for p_hash (PRF). Fix BuildTls13HandshakeHmac to use async devId. Rename poor global variable names for rng with QSH/NTRU. 2017-06-14 15:11:43 -07:00
David Garske
131ccf289f Disable large alloc scrypt test. Fix unused ret warning in DH key gen from prev change. 2017-06-14 15:11:43 -07:00
David Garske
a77f9fe3e6 Fix for DH so software math is used if prime is under 768 bits. 2017-06-14 15:11:43 -07:00
toddouska
b778ddfea2 Merge pull request #957 from SparkiDev/tls13_updates
Tls13 updates
2017-06-14 14:59:11 -07:00
JacobBarthelmeh
c283d4aece Merge pull request #962 from NickolasLapp/linux-sgx
Add LINUX SGX Support for building of wolfSSL static library. See README
2017-06-14 15:56:30 -06:00
toddouska
70eddc4336 Merge pull request #965 from cconlon/threadx
ThreadX/NetX warning and optional dc_log_printf exclusion
2017-06-14 14:56:12 -07:00
Chris Conlon
ff48d19727 fix wc_EccPrivateKeyDecode when pub exists 2017-06-14 14:49:52 -06:00
Sean Parkinson
89e6ac91bf Improve PSK timeout checks
Post-handshake Authentication

Fix KeyUpdate to derive keys properly

Fix supported curves (not checking ctx extensions)
2017-06-14 11:28:53 -07:00
toddouska
6d5c257010 Merge pull request #963 from dgarske/fix_tls13_options
Fixes for TLS 1.3 without ECC or RSA
2017-06-14 11:19:14 -07:00
Chris Conlon
ea9e4887e9 ThreadX/NetX warning and optional dc_log_printf exclusion 2017-06-14 11:12:27 -06:00
Nickolas Lapp
1e94868432 Add LINUX SGX Support for building of wolfSSL static library. See README
in IDE/LINUX-SGX/README.md.
2017-06-13 17:34:45 -07:00
Sean Parkinson
13c4fe6cc4 Add test 2017-06-14 09:44:26 +10:00
Sean Parkinson
62ae1d3023 Fix for private key only ECC key. 2017-06-14 09:33:27 +10:00
toddouska
19f22edd9a Merge pull request #949 from cconlon/string_abstraction
Fix mystrnstr() prototype declaration
2017-06-13 16:06:31 -07:00
Chris Conlon
1ddd6fd3fe Merge pull request #933 from jrblixt/unitTest_api_add3des
Add 3Des to unit test.
2017-06-13 15:35:54 -06:00
dgarske
189d579bec Merge pull request #960 from levi-wolfssl/void
Add void to function prototype.
2017-06-13 13:58:34 -07:00
jrblixt
76aa1f855f Merge branch 'masterB' of https://github.com/jrblixt/wolfssl into unitTest_api_add3des-cpy 2017-06-13 14:06:30 -06:00
jrblixt
0ef1129f18 Changes WRT small stack. 2017-06-13 13:44:06 -06:00
Chris Conlon
042ee817f3 Merge pull request #757 from moisesguimaraes/updates-wolfcrypt-py-docs
Removes 3DES from the wolfCrypt Python docs
2017-06-13 10:55:21 -06:00
Chris Conlon
048b074894 Merge pull request #932 from jrblixt/unitTest_api_addHmac-mergeWolfMaster
Add HMAC test functions to unit test.
2017-06-13 10:53:09 -06:00
David Garske
adf819458c Fixes for TLS 1.3 without ECC or RSA. Fix for building without ECC where HAVE_SUPPORTED_CURVES was getting defined because of ENABLED_TLSX. 2017-06-13 09:44:14 -07:00
toddouska
a18e9a220f Merge pull request #956 from dgarske/fix_tls13_async
Fixes for asynchronous TLS 1.3
2017-06-13 08:08:34 -07:00
David Garske
af2cbcdbab Added new arg documentation for asyncOkay in doxygen style. 2017-06-12 11:42:48 -07:00
David Garske
ce231e0cbc Fixes for asynchronous TLS 1.3. Fixes for PK_CALLBACKS with async. New helper API's for wolfSSL_CTX_GetDevId and wolfSSL_CTX_GetHeap. Fix for build to not include tls13.c if not enabled to suppress empty object file warning. Fix typo in fe_low_mem.c. General cleanup. Extra tls13.c debug messages. 2017-06-12 11:42:48 -07:00
toddouska
1d2b4226a4 Merge pull request #959 from SparkiDev/tls_pss_fix
Fix check for PSS availability in peer
2017-06-12 11:20:29 -07:00
toddouska
894f4f6fa5 Merge pull request #954 from jrblixt/asn_cSetKeyUsage-fix
Fix wc_SetKeyUsage() value error.
2017-06-12 10:48:56 -07:00
toddouska
0fcd1617eb Merge pull request #952 from JacobBarthelmeh/Testing
sanity check on build with ECC or RSA
2017-06-12 10:47:53 -07:00
toddouska
7cc455259e Merge pull request #941 from SparkiDev/ed25519
ED25519 with certificates and TLS
2017-06-12 10:47:21 -07:00
Levi Rak
267753acdd add void to function prototype 2017-06-12 10:28:10 -06:00
Sean Parkinson
8dbd9a88ee Fix for CCM - TLS v1.3 needs all nonce/IV bytes 2017-06-12 14:21:43 +10:00
Sean Parkinson
044417ba01 Fix for cache only SNI and TLS v1.3 2017-06-12 09:46:50 +10:00
Sean Parkinson
fdcf25b6d1 Fix check for PSS availability in peer 2017-06-12 09:05:32 +10:00
dgarske
c70fa33094 Merge pull request #958 from kaleb-himes/OPENSSL_EVP
Fix compile time Error with openssl extra and cryptonly
2017-06-09 11:12:36 -07:00
kaleb-himes
86809cca74 Fix compile time warning with openssl extra and cryptonly 2017-06-08 20:14:15 -06:00
dgarske
90287c8857 Merge pull request #955 from kaleb-himes/ARG-ERR
Fix compile error, too many args with --enable-wpas
2017-06-08 14:59:55 -07:00
kaleb-himes
a00165768c Fix compile error, too many args with --enabl-wpas 2017-06-08 13:34:44 -06:00
Sean Parkinson
3429b5a3b5 Rework CheckPrivateKey 2017-06-08 09:26:49 +10:00
Sean Parkinson
1db52f0c04 Fix to use different PEM header for EDDSA keys
Include new cert and key files in distribution
Fix compile issue when only doing TLS13.
2017-06-08 09:26:49 +10:00
Sean Parkinson
a30e8eb4ad Fix for benchmarking X25519 2017-06-08 09:26:49 +10:00
Sean Parkinson
1bc862ae24 Ed25519 testing in test.c 2017-06-08 09:26:49 +10:00
Sean Parkinson
613d30bcae ED25519 TLS support 2017-06-08 09:26:49 +10:00
Sean Parkinson
4beda52dcd Ed25519 Certificates 2017-06-08 09:26:49 +10:00
toddouska
1be0b2aa30 Merge pull request #953 from SparkiDev/tls13_psk
External PSK working in TLS13
2017-06-07 13:58:03 -07:00
John Blixt
2c84eee2df Fix wc_SetKeyUsage() value error. 2017-06-07 13:58:13 -06:00
Sean Parkinson
5d5ff56336 External PSK working in TLS13 2017-06-07 17:20:22 +10:00
toddouska
26f106c42b Merge pull request #948 from SparkiDev/tls13_down
Implement TLS v1.3 specified downgrade protection mechanism
2017-06-05 16:17:49 -07:00
Jacob Barthelmeh
63c85f72d2 sanity check on build with ECC or RSA 2017-06-05 15:21:34 -06:00
toddouska
af03b7a4ff Merge pull request #944 from SparkiDev/tls13_20
Updates for Draft 20 of TLS v1.3
2017-06-05 14:06:09 -07:00
toddouska
026a95ff10 Merge pull request #950 from dgarske/fix_ocsp_crl
Fixes for OCSP and CRL with non-blocking sockets
2017-06-05 13:59:36 -07:00
Sean Parkinson
642795db1b Implement TLS v1.3 specified downgrade protection mechanism
TLS v1.2 implementations whould implement the downgrade protection
mechanism too and so is included.
2017-06-05 09:18:46 +10:00
David Garske
c55575665f Cleanup to use WANT_READ instead of async WC_PENDING_E for non-blocking OCSP and CRL. 2017-06-02 10:35:26 -07:00
toddouska
c3d29ddfe3 Merge pull request #946 from SparkiDev/jenkins
Fix NO_DH build issue
2017-06-02 09:46:55 -07:00
David Garske
b3a85bc2c7 Fixes for OCSP and CRL with non-blocking sockets. Fix for OCSP and CRL file descriptor check to allow 0. 2017-06-02 09:36:35 -07:00
Chris Conlon
3df565475a protect mystrnstr prototype with WOLFSSL_LEANPSK instead of STRING_USER 2017-06-02 09:26:40 -06:00
Sean Parkinson
0b32d0368f Updates for Draft 20 of TLS v1.3 2017-06-02 15:59:49 +10:00
Sean Parkinson
6b34a94589 Fix NO_DH build issue 2017-06-01 11:56:53 +10:00
Moisés Guimarães
7a52b5b394 fixes makefiles and requiremets 2017-05-29 20:44:28 -03:00
Moisés Guimarães
38c6d2e3eb Merge pull request #737 from embray/patch-1
wolfcrypt Python: work around minor issue in Random.__del__
2017-05-29 20:19:21 -03:00
toddouska
320ad56139 Merge pull request #939 from dgarske/fixes_async
Fixes for build with async
2017-05-26 17:04:57 -07:00
toddouska
c0408aebb4 Merge pull request #938 from dgarske/fix_asn_noocspoptcert
Fixes for OCSP workaround for incomplete cert chain
2017-05-26 17:02:31 -07:00
jrblixt
e345471b21 Logical error fix. 2017-05-26 13:27:27 -06:00
David Garske
a0345f6ba9 Fix for building without WOLFSSL_NO_TRUSTED_CERTS_VERIFY. 2017-05-26 10:53:42 -07:00
David Garske
53021a5df7 Increased security for WOLFSSL_NO_TRUSTED_CERTS_VERIFY workaround so it only applies to OCSP. Fix for the workaround to still return date or parsing errors. 2017-05-26 10:01:42 -07:00
jrblixt
1c0006882a Remove AssertIntEq from within function. 2017-05-26 09:44:12 -06:00
toddouska
a44df73151 Merge pull request #937 from SparkiDev/sha3
Initial revision of SHA-3
2017-05-25 10:48:28 -07:00
Sean Parkinson
7ef5aeaf13 Fixes from review and tidy up code. 2017-05-25 09:09:50 +10:00
Sean Parkinson
4134073c8d Initial revision of SHA-3 2017-05-25 09:09:50 +10:00
jrblixt
0e22752af4 Jenkins fixes. 2017-05-24 16:32:21 -06:00
jrblixt
47b0a62c88 Hmac unit test functions ready for PR. 2017-05-24 16:32:17 -06:00
jrblixt
edddd05226 Changes per Chris. 2017-05-24 11:50:18 -06:00
jrblixt
4d458831b7 Jenkins fixes. 2017-05-24 11:50:18 -06:00
jrblixt
b47fca5760 Patched and Clean up for PR. 2017-05-24 11:50:13 -06:00
Chris Conlon
60c51db831 Merge pull request #928 from jrblixt/unitTest_api_sha224-RipeMd
Add sha224 RipeMd to unit test
2017-05-24 09:00:35 -06:00
David Garske
c1664bd1a0 Fixes for async with benchmark tool. 2017-05-23 15:41:42 -07:00
David Garske
64de29f277 Fix for wolfCrypt test with enable-all and asynccrypt. 2017-05-23 15:23:58 -07:00
toddouska
77dbf539c8 Merge pull request #934 from JacobBarthelmeh/mysql
some MYSQL updates for cmake and with sun 64 bit
2017-05-23 15:01:39 -07:00
David Garske
720f3fdad2 Fixed a few minor build errors with async enabled. 2017-05-23 15:00:55 -07:00
toddouska
d2b6ab0796 Merge pull request #935 from JacobBarthelmeh/Testing
remove size_t dependency with default build
2017-05-23 14:58:50 -07:00
toddouska
6b09a7c6e1 Merge pull request #922 from SparkiDev/tls_pss
TLS v1.2 and v1.3 RSA PSS
2017-05-23 14:57:10 -07:00
David Garske
1880677232 Disable wc_scrypt tests that use high memory for BENCH_EMBEDDED. 2017-05-23 14:42:19 -07:00
jrblixt
fc5a37ac02 Changes per Chris. 2017-05-23 10:01:31 -06:00
toddouska
9f5f1dd00f Merge pull request #936 from SparkiDev/cplusplus
Compiling with g++ when configured with --enable-distro
2017-05-22 16:02:56 -07:00
toddouska
19edd47018 Merge pull request #917 from SparkiDev/tls_curve25519
Enable X25519 for Key Exchange in TLS
2017-05-22 16:00:00 -07:00
Sean Parkinson
47d04ebaff Fix from review. 2017-05-23 08:54:25 +10:00
toddouska
c85d07a49d Merge pull request #929 from dgarske/fix_asn_perm_dirname
Fix for parsing permitted name constraint for subject directory name
2017-05-22 09:55:49 -07:00
toddouska
a8f08d1d70 Merge pull request #807 from kojo1/AES-GCM-stm32f4
Fixes for STM32F4 AES GCM
2017-05-22 09:53:53 -07:00
toddouska
0e860b0d55 Merge pull request #925 from dgarske/enable_all
Added new `./configure --enable-all` option to enable all features
2017-05-22 09:22:50 -07:00
Sean Parkinson
15a2323c09 Compiling with g++ when configured with --enable-distro 2017-05-22 10:14:02 +10:00
Sean Parkinson
6c6069bed8 Fixes from review 2017-05-22 09:47:45 +10:00
Sean Parkinson
8920cd89e4 Fixes from review 2017-05-22 09:09:31 +10:00
dgarske
570c3f02b8 Merge pull request #931 from JacobBarthelmeh/Memory
add trackmemory enable option
2017-05-19 17:21:56 -07:00
Jacob Barthelmeh
398c27d848 remove size_t dependency with default build 2017-05-19 16:16:08 -06:00
Jacob Barthelmeh
b6c2e2acf9 require using wolfSSL memory when enabling trackmemory 2017-05-19 15:24:38 -06:00
David Garske
184e9c4090 Fix typo from intermediate change for unaligned CBC fixes. Thanks Nick. 2017-05-19 14:10:50 -07:00
David Garske
a616513860 Added support for AES GCM with STM32F2/STM32F4 using Standard Peripheral Library and CubeMX. Added AES ECB Decrypt for Standard Peripheral Library. Fixes for wolfCrypt test with STM32 crypto hardware for unsupported tests (AES CTR plus 9 and AES GCM with IV != 12). Improve AES CBC for STM32 to handle block aligned only. Added IDE example for SystemWorkbench for STM32 (Open STM32 tools) IDE. 2017-05-19 11:15:46 -07:00
David Garske
0a28b76e8b Refactor of the ./configure help to use AS_HELP_STRING. 2017-05-19 10:54:13 -07:00
David Garske
1cf3530124 Fix for building with WOLFSSL_NO_OCSP_OPTIONAL_CERTS defined. 2017-05-19 09:59:03 -07:00
toddouska
bdaa827114 Merge pull request #927 from dgarske/fix_nxp_ltc
Build fixes for NXP KSDK with MMCAU / LTC after Hexiwear changes
2017-05-19 08:49:54 -07:00
toddouska
7f01aa917a Merge pull request #930 from dgarske/fix_win
Fixes for building AES key wrap and PKCS7 on Windows
2017-05-19 08:16:21 -07:00
Sean Parkinson
4390f4c711 TLS v1.2 and PSS
Cleanup the TLS v1.3 PSS code as well.
Added RSA API wc_RsaPSS_CheckPadding() to check the padding - no longer
a simple memcmp with the digest.
2017-05-19 11:49:43 +10:00
Sean Parkinson
5ef977aa3d Put X25519 behind P256
Option to have X25519 prioritized.
Show curve name and DH key size in TLS v1.3.
2017-05-19 10:58:43 +10:00
toddouska
7f350a726b Merge pull request #926 from dgarske/bench_block_size
Added argument for benchmark block size
2017-05-18 16:45:00 -07:00
toddouska
452e057dbf Merge pull request #919 from dgarske/bshg
Add `WOLFSSL_NO_TRUSTED_CERTS_VERIFY` option
2017-05-18 16:44:14 -07:00
toddouska
c3a7497562 Merge pull request #923 from JacobBarthelmeh/staticmemory
updated static memory feature with pkcs7
2017-05-18 16:42:21 -07:00
Jacob Barthelmeh
4737b97503 add trackmemory enable option 2017-05-18 16:46:56 -06:00
David Garske
cbb2c73828 Improve NXP MMCAU/LTC AES CBC handling for unaligned sizes. Cleanup formatting in a few places. 2017-05-18 15:04:01 -07:00
David Garske
d61e0243a3 Fixes for building AES key wrap and PKCS7 on Windows. Cleanup snprintf to use XSNPRINTF and changed so define is always setup. 2017-05-18 14:44:19 -07:00
David Garske
36e1fb5e5b Fix for parsing permitted name constraint for subject directory name. Cleanup to use switch in ConfirmNameConstraints. 2017-05-18 14:06:56 -07:00
Jacob Barthelmeh
09ca962d66 use LP64 for CPU arch type when sun or __sun is defined 2017-05-18 14:39:26 -06:00
Jacob Barthelmeh
2086394a35 compatibility of get cipher list function and update cmake files 2017-05-18 14:36:34 -06:00
jrblixt
77ac61c0f4 Prepare for PR Add Sha224 and RipeMd to unit test. 2017-05-18 13:08:25 -06:00
David Garske
30db8e95a7 Build fixes for KSDK NXP MMCAU / LTC after Hexiwear changes. 2017-05-18 11:52:20 -07:00
David Garske
48895cf03b Added argument for benchmark block size. Usage: ./wolfcrypt/benchmark/benchmark 128. Automatic calculation for showing as bytes, KB or MB. 2017-05-18 11:24:32 -07:00
David Garske
7bd1e0b80a Added new ./configure --enable-all option to enable all features. Allows building all features without using the --enable-distro option, which only allows shared build and does not generate an options.h file. 2017-05-18 10:57:28 -07:00
David Garske
c5cc9f5392 Patch from customer that adds new WOLFSSL_NO_TRUSTED_CERTS_VERIFY option to load CA using subject and match using publicKey. This is a workaround for situation where entire cert chain is not loaded/available. This is not a secure solution because it does not perform PKI validation. 2017-05-18 09:55:39 -07:00
toddouska
4370a01778 Merge pull request #921 from dgarske/fix_crl
Fix for CRL issue with XFREE using invalid arg for heap.
2017-05-18 09:40:40 -07:00
jrblixt
b5e74878b3 Merge with wolfSSL master for PR includes RipeMd and Sha224 unit test
functions.
2017-05-18 10:05:22 -06:00
David Garske
4edcbc79c1 RipeMd and Sha224 added to unit test. 2017-05-18 09:32:11 -06:00
Jacob Barthelmeh
548c01ce54 updated static memory feature with pkcs7 2017-05-18 09:31:09 -06:00
Sean Parkinson
9fb6373cfb Get PSS going on server side 2017-05-18 15:36:01 +10:00
David Garske
c1f82ece7a Fix for CRL issue with XFREE using invalid arg for heap. 2017-05-17 16:39:35 -07:00
toddouska
2f15d57a6f Merge pull request #640 from jrblixt/unitTest_api_dev
unit test md5, sha, sha256, sha384, sha512
2017-05-17 09:17:32 -07:00
Sean Parkinson
63a6618feb Enable X25519 for Key Exchange in TLS 2017-05-17 08:58:12 +10:00
toddouska
4c451a6c61 Merge pull request #920 from dgarske/fix_sb_tls
Fix for scan-build warning for possible use of uninitialized `eccKey`
2017-05-16 12:56:50 -07:00
dgarske
5621fad02b Merge pull request #918 from cconlon/vxworksreadme
fix VxWorks README formatting
2017-05-16 12:46:26 -07:00
jrblixt
cb3b10054d unwanted removal added back. 2017-05-16 13:13:53 -06:00
jrblixt
270d6cbae3 Merge branch 'unitTest_api_dev' of https://github.com/jrblixt/wolfssl into unitTest_api_dev 2017-05-16 13:05:26 -06:00
jrblixt
6acd5dafa7 Changes from Todd's code review. 2017-05-16 12:58:07 -06:00
toddouska
81b6894f6f Merge pull request #841 from SparkiDev/nginx2
Fix loading of CRLs and certs from a file.
2017-05-16 09:13:29 -07:00
jrblixt
289f60e2c9 Changes from Todd's code review. 2017-05-16 10:04:30 -06:00
David Garske
79b0311952 Fix for scan-build warning src/tls.c:4898:20: warning: The left operand of '!=' is a garbage value. 2017-05-16 08:50:06 -07:00
Chris Conlon
c960faffeb fix VxWorks README formatting 2017-05-16 09:21:54 -06:00
Sean Parkinson
e5fe1a3750 Unlock on memory allocation failure. 2017-05-16 09:41:17 +10:00
toddouska
da15b54529 Merge pull request #915 from SparkiDev/blake2b_init
Blake2b fix for GCC 5.4
2017-05-15 08:59:54 -07:00
toddouska
bb60f7a4a4 Merge pull request #914 from JacobBarthelmeh/Testing
check return value of test case
2017-05-15 08:58:31 -07:00
dgarske
d53a77a589 Merge pull request #916 from SparkiDev/ecc_unused
Fix for scan_build_known_configs warning
2017-05-14 21:51:02 -07:00
Sean Parkinson
1a08143946 Fixup for async on master 2017-05-15 10:10:28 +10:00
Sean Parkinson
1e2a6412d7 Find the CRL entry again after lock 2017-05-15 10:10:28 +10:00
Sean Parkinson
ff4fcf21d6 Add test for private key only ecc key 2017-05-15 10:04:42 +10:00
Sean Parkinson
c6ce1fe330 Allow private key only ECC key to be loaded 2017-05-15 10:04:42 +10:00
Sean Parkinson
c7e57e9c6c Late CRL check - copy data before use 2017-05-15 10:04:42 +10:00
Sean Parkinson
c8e6c64e51 Fix warning when building for Windows 2017-05-15 10:04:42 +10:00
Sean Parkinson
4723b8470a Allow a CRL's signature to be verified on use 2017-05-15 10:04:42 +10:00
Sean Parkinson
4d77e80d04 Fix loading of CRLs and certs.
Change function wolfSSL_X509_LOOKUP_load_file to load multiple CRLs and
certificates from a file.
Change CRL loading to have a flag to not verify CRL signature - only do
this when using wolfSSL_X509_LOOKUP_load_file() as the certificate is
not always available.
Add test case for loading multiple CRLs in one file without certificate.
2017-05-15 10:04:42 +10:00
Sean Parkinson
224c1b2645 Fix for scan_build_known_configs warning 2017-05-15 09:59:34 +10:00
Sean Parkinson
f8023b808f Blake2b fix for GCC 5.4
Memsetting P and then setting non-zero fields works with GCC 5.4.
2017-05-15 09:47:11 +10:00
toddouska
3297280e62 Merge pull request #913 from JacobBarthelmeh/Compatibility-Layer
allow re-using WOLFSSL structure after calling shutdown
2017-05-12 16:50:14 -07:00
toddouska
dcd3a6a478 Merge pull request #907 from dgarske/fix_verifycb
Fixes for verify callback override
2017-05-12 16:45:55 -07:00
Jacob Barthelmeh
66e086a0bf check return value of test case 2017-05-12 16:40:37 -06:00
Jacob Barthelmeh
0374907acc allow re-using WOLFSSL structure after calling shutdown 2017-05-12 13:54:20 -06:00
toddouska
d03f97dafc Merge pull request #911 from dgarske/gcc_7
Fixes to work with gcc 7.1
2017-05-12 12:08:08 -07:00
jrblixt
606aca9916 Merge branch 'master' of https://github.com/jrblixt/wolfssl into unitTest_api_dev 2017-05-12 02:04:58 -06:00
toddouska
01a5f901d0 Merge pull request #909 from dgarske/fix_no_harden
Fix issue with --disable-harden
2017-05-11 16:42:19 -07:00
David Garske
53a837b230 Fix to only use FALL_THROUGH macro for GCC 7.1 or later. 2017-05-11 15:52:32 -07:00
David Garske
7c7503449f Removed the -Wimplicit-fallthrough=5 from autogen.sh, since older GCC throws “error: unknown warning option”. 2017-05-11 15:28:49 -07:00
David Garske
562db08c3d Implemented strict switch fall-through handling using new macro FALL_THROUGH. 2017-05-11 15:15:19 -07:00
David Garske
c0c98c8f64 Fixes to address build warnings for GCC 7. Used -Wimplicit-fallthrough=0 to suppress all switch fall-through warnings. 2017-05-11 15:12:16 -07:00
David Garske
f1e6f7d01d Attempt to fix Visual Studio 2012 compiler issue with test.h myVerify callback. 2017-05-11 13:53:04 -07:00
toddouska
ce42738198 Merge pull request #900 from dgarske/coverity_part3
Coverity fixes for TLS 1.3, async, small stack and normal math.
2017-05-11 13:05:53 -07:00
toddouska
5c652e398f Merge pull request #896 from dgarske/async_cleanups
Fixes for async and smallstack
2017-05-11 13:05:25 -07:00
toddouska
e12545ac38 Merge pull request #846 from SparkiDev/renum
Renumbered return values in test.c
2017-05-11 13:05:08 -07:00
David Garske
05d2032661 Fix for useVerifyCb variable not used warning with NO_CERTS defined. 2017-05-11 12:57:12 -07:00
David Garske
1b21df9b2b Fix issue with --disable-harden build due to wc_off_on_addr defined but not used. Cleanup of the wc_off_on_addr code to combine duplicate definitions. Fixes issue #908. 2017-05-11 12:49:34 -07:00
David Garske
2efa7d5b8b Fix for verify callback override, peerVerifyRet code on success and ensuring DOMAIN_NAME_MISMATCH error gets passed down in ECDSAk case. Added unit test case to verify callback override works. Fixes issue #905 and issue #904. Fix for async build goto label typo. 2017-05-11 12:23:17 -07:00
toddouska
a79f9c93c9 Merge pull request #906 from cconlon/tls13beta
wolfSSL 3.11.1 release, TLS 1.3 BETA
2017-05-11 11:46:10 -07:00
Chris Conlon
7d6597fe55 wolfSSL 3.11.1 release, TLS 1.3 BETA 2017-05-11 10:01:04 -06:00
toddouska
dcc9f9ae63 Merge pull request #903 from SparkiDev/tls13_interop3
Interop testing fixes
2017-05-10 23:04:56 -07:00
Sean Parkinson
22ce2f183d Interop testing fixes
Fix TLS13 cipher suite name to CHACHA20
Include SignatureAlgorithm in older versions of TLS when compiling for
TLS v1.3.
BIT STRING unused bits doesn't necessarily indicate last unused bit.
Fix ecc_dsa_sa_algo value.
2017-05-11 10:42:09 +10:00
toddouska
01586b26ae Merge pull request #902 from SparkiDev/tls13_interop2
TLS v1.3 Interop changes
2017-05-10 09:28:22 -07:00
Sean Parkinson
ec6d8f48b8 Add PSS for TLS v1.3 2017-05-10 17:22:53 +10:00
Sean Parkinson
df3abee72c TLS v1.3 Interop changes
Added Curve25519 for TLS v1.3 only. Curve25519 won't work with older
protocol versions.
Always send signature algorithm extension in TLS v1.3 for server
certificates. If only doing PSK doesn't need to be sent though.
2017-05-10 15:16:27 +10:00
David Garske
8d4f8c6d80 Fixes for build with distro for BuildTls13HandshakeHmac arg change. 2017-05-09 10:09:43 -07:00
David Garske
c47826cc8f Additional TLS 1.3 return code checking. 2017-05-09 09:45:40 -07:00
David Garske
e8cf4b5ff0 Coverity fixes for TLS 1.3, async, small stack and normal math. 2017-05-09 09:13:21 -07:00
toddouska
dea092fa0a Merge pull request #901 from SparkiDev/tls13_interop
TLS v1.3 interop fixes
2017-05-09 09:08:31 -07:00
Sean Parkinson
46c4adcf4c TLS v1.3 interop fixes 2017-05-09 14:49:21 +10:00
David Garske
2e016f3b25 Refactor of the rsa_test and dh_test to better handle cleanup. 2017-05-08 12:30:54 -07:00
JacobBarthelmeh
285a338054 Merge pull request #899 from kaleb-himes/release-update
Credit E.S. from W.A. with report of DTLS interop bug
2017-05-08 12:06:41 -06:00
kaleb-himes
7b6e2b1002 Credit E.S. from W.A. with report of DTLS interop bug 2017-05-08 10:26:08 -06:00
David Garske
5726c23d81 Fix for scan-build warning with ret not being read in DoServerHello. 2017-05-06 14:00:24 -07:00
David Garske
8cd78edac1 Fixes for building with smallstack 2017-05-06 00:39:12 -04:00
David Garske
011178994b Fix typos with goto exit labels and heap. 2017-05-06 00:32:02 -04:00
David Garske
6cc3983894 Fix for using async with —enable-eccencrypt. 2017-05-06 00:28:01 -04:00
David Garske
17587d38f8 Fix for new AES 192/256 tests to handle async wait. 2017-05-06 00:28:01 -04:00
toddouska
d23f1e5637 Merge pull request #895 from JacobBarthelmeh/Testing
use type with XFREE
2017-05-05 16:27:03 -07:00
toddouska
176193a835 Merge pull request #877 from dgarske/tls13
Add TLS 1.3 support
2017-05-05 12:50:40 -07:00
Jacob Barthelmeh
a4ceeed462 use type with XFREE 2017-05-05 13:27:33 -06:00
David Garske
fdb46ac24c Fix typo with blake2b_test return code. 2017-05-05 11:11:17 -07:00
David Garske
0ca2d7c137 Renumbered return values. 2017-05-04 14:53:39 -07:00
David Garske
af0103bc94 Fix for Valgrind memory leak with the “ssl->hsHashes”. The DTLS wolfSSL_connect for “IsDtlsNotSctpMode” at line 8134 calls InitHandshakeHashes, but doesn’t free existing. Best overall solution is to make sure and free an existing on InitHandshakeHashes, since WOLFSSL is memset to 0. 2017-05-04 14:51:31 -07:00
Sean Parkinson
758c2a761c Increase timeout on ready file for tls13.test 2017-05-04 14:51:31 -07:00
Sean Parkinson
902f5cf53f Stack size enabled config fix 2017-05-04 14:51:31 -07:00
Sean Parkinson
f0204de881 Fix for async and tls13 config 2017-05-04 14:51:31 -07:00
David Garske
570befb63f Fixes for using async. Combine duplicate DoCertificate and DoTls13Certificate code into ProcessPeerCerts. Cleanup of the XMALLOC/XFREE to use ssl->heap. 2017-05-04 14:51:31 -07:00
David Garske
efb4b3c183 Fix for unit test with non-blocking set. 2017-05-04 14:51:31 -07:00
David Garske
253140f37e Fixes for TLS 1.3. Fix issue with wc_AesGcmDecrypt checking for authIn arg (allowed to be NULL). Fix for preMasterSz in TLSX_KeyShare_ProcessEcc. Fix for building with --disable-asn (NO_CERTS). Fix to remove client “-t” option from help, which no longer exists. Added new WOLFSSL_DEBUG_TLS option for new messages added. 2017-05-04 14:51:31 -07:00
David Garske
77f9126edf Rebase fixes for TLS 1.3. Getting a decrypt error with the TLS 1.3 test from the SendTls13CertificateVerify. 2017-05-04 14:51:31 -07:00
Sean Parkinson
2b1e9973ec Add TLS v1.3 as an option 2017-05-04 14:51:30 -07:00
jrblixt
1215203c39 Update sha384 fips. 2017-04-18 12:53:54 -06:00
jrblixt
4a8259b2ad Jenkin's Fips corrections. 2017-04-18 11:29:35 -06:00
jrblixt
5486a60326 sha512.c updates. 2017-04-18 11:18:29 -06:00
jrblixt
f7c58b0643 Updated wolfcrypt/src/sha256.c. 2017-04-14 16:42:18 -06:00
jrblixt
3749988ee2 Updated wolfcrypt/src/sha.c. 2017-04-14 16:24:25 -06:00
jrblixt
5b5c8f1e95 Updated mcapi/mcapi_test.c ; wolfcrypt/src/md5.c ; wolfcrypt/src/pwdbased.c. 2017-04-14 16:12:29 -06:00
jrblixt
609ca3c823 Jenkin's Visual Studio status check correction. 2017-04-14 02:34:31 -06:00
jrblixt
b5d856eada Merge branch 'master' of https://github.com/wolfSSL/wolfssl into unitTest_api_dev 2017-04-14 02:17:57 -06:00
jrblixt
00ea508751 Param check fix in hash files. 2017-04-14 02:16:04 -06:00
jrblixt
ac6b840dc5 Merge Conflict with wolfSSL master. 2017-04-13 16:51:08 -06:00
jrblixt
85b78835a6 Merge branch 'master' into unitTest_api_dev
src/keys.c
	wolfcrypt/src/hmac.c
	wolfcrypt/src/md5.c
	wolfcrypt/src/sha256.c
	wolfcrypt/src/sha512.c
	wolfssl/wolfcrypt/md5.h
2017-04-13 16:33:23 -06:00
jrblixt
3478c9b937 Added return checks to src/keys.c. 2017-04-07 14:15:53 -06:00
jrblixt
6e16410e25 Modifications per Todd's requests. 2017-04-06 15:47:53 -06:00
jrblixt
d62d0aaa26 Changes made per Todd's instruction. 2017-04-06 14:42:42 -06:00
jrblixt
706c02deed Changes Chris requested. 2017-04-06 10:53:14 -06:00
jrblixt
d626c917dd Merge branch 'master' of https://github.com/wolfSSL/wolfssl into unitTest_api_dev 2017-03-31 14:18:27 -06:00
jrblixt
5f7e77f131 Merge branch 'master' of https://github.com/jrblixt/wolfssl into unitTest_api_dev 2017-03-21 16:48:55 -06:00
jrblixt
88679a6a0c Merge wolfSSL master. 2017-03-21 15:33:40 -06:00
jrblixt
739436d7a8 Merge with wolfSSL master. 2017-03-21 15:23:47 -06:00
jrblixt
d5d7a4ae7b Report failure but continue to run. 2017-02-28 14:44:11 -07:00
jrblixt
b2fc525a1d update MD5, SHA, SHA256, SHA384, SHA512 Update functions. 2017-02-24 15:58:47 -07:00
jrblixt
c467bbd776 Reasses return values on all Init, Update, Final functions. 2017-02-24 15:16:54 -07:00
jrblixt
6ca16b06d2 MergeConflicts 2017-02-23 11:13:32 -07:00
Moisés Guimarães
daafb2c5ac changes docs to single page 2017-02-05 18:56:19 -03:00
Moisés Guimarães
e33d4c0172 adds full docs 2017-02-05 18:51:13 -03:00
Moisés Guimarães
00a74d0da4 adds initial doc files 2017-02-05 16:43:43 -03:00
Erik Bray
bf12e4ecca wolfcrypt Python: work around minor issue in Random.__del__
During interpreter shutdown, depending on the order in which things happen, a module can be unloaded before all instances of classes defined in that module are garbage collected.

In particular, this means that any global variables (including imported modules) become `None` by the time the instances `__del__` is called, resulting in
```
AttributeError: 'NoneType' object has no attribute 'wc_FreeRng'
```
being displayed while the process exits.  This can be avoided simply by catching and ignoring the `AttributeError` in this case, since the process is shutting down anyways.
2017-02-02 16:51:41 +01:00
jrblixt
b11265dbf5 Merge branch 'master' of https://github.com/wolfSSL/wolfssl into unitTest_api_dev 2017-01-31 14:34:58 -07:00
jrblixt
de9f05f3c5 Update sha256.c function punctuation. 2017-01-31 14:33:21 -07:00
jrblixt
e4942eaa3d Reorder restore statement. 2017-01-26 17:03:05 -07:00
jrblixt
74f72b5c6b Jenkins fix. 2017-01-26 13:15:11 -07:00
jrblixt
3ca087e850 Merge branch 'master' of https://github.com/wolfSSL/wolfssl into unitTest_api_dev 2017-01-26 12:48:03 -07:00
jrblixt
79e8bd2f2b Restore the ssl->hsHashes->hashSha384 before returning on failure. 2017-01-26 12:44:20 -07:00
jrblixt
be768f5395 Made changes in api.c to reflect Update() changes. 2017-01-26 12:34:09 -07:00
Moisés Guimarães
d3d7446a24 removes 3DES from docs 2017-01-21 15:31:26 -02:00
jrblixt
3918cdef03 Wrapped functions. 2017-01-19 13:35:23 -07:00
Moisés Guimarães
a761a7fc64 updates provisioners 2017-01-18 19:19:03 -02:00
Moisés Guimarães
feb6617dc9 updates centos provisioner 2017-01-18 18:41:15 -02:00
Moisés Guimarães
51bf46288b adds client example 2017-01-18 18:18:19 -02:00
Moisés Guimarães
5c8e69eb5e updates vagrant configs; updates server example, updates copyright year. 2017-01-18 17:59:48 -02:00
jrblixt
c5bd24c1b7 Added changes Chris requested.
Moved error-crypt.h location and corrected FIPS return code.

Made requested changes to printf where 0 == 0.
2017-01-17 13:51:17 -07:00
Moisés Guimarães
bb97e03a44 initial server tests 2017-01-16 19:40:46 -02:00
Moisés Guimarães
089387906e updates tests 2017-01-16 18:52:34 -02:00
Moisés Guimarães
715d6afeda updates tox config 2017-01-16 18:48:01 -02:00
Moisés Guimarães
0a9f66338c adds coverity tests 2017-01-15 12:51:09 -02:00
Moisés Guimarães
2d56f09320 adds accept() behavior to SSLSocket; Migrates tests to pytest. 2017-01-15 12:26:22 -02:00
Moisés Guimarães
56091e267f moving source code into src 2017-01-12 19:27:36 -02:00
jrblixt
08f188ab44 Merge branch 'master' of https://github.com/wolfSSL/wolfssl into unitTest_api_dev 2017-01-06 11:26:06 -07:00
jrblixt
2c87f8d33c merge with wolfSSL master. 2017-01-06 11:06:01 -07:00
David Garske
050ba9d6e0 unit test md5, sha, sha256, sha384, sha512
Memory leak fix.
2017-01-06 10:57:50 -07:00
David Garske
cb0cc92ff2 Fixes for building with CRL monitor when not linux, OS X or FreeBSD and --enable-distro set. Cleanup of the crl.c HAVE_CRL_MONITOR checks for OS and make sure if StopMonitor preprocessor is defined the function will also be defined. 2017-01-04 15:27:15 -07:00
David Garske
2f3ec778bd For distro build don't install options.h (conflicts with multi-arch). Fix for BUILD_DISTRO excludes with indent. 2017-01-04 15:27:15 -07:00
David Garske
d3195d0b75 Pulled in patches from Debian package. 2017-01-04 15:27:15 -07:00
Moisés Guimarães
53d4c171c8 adds more client tests 2016-12-22 17:58:13 -02:00
Moisés Guimarães
35f03eb00a fixes docs. 2016-12-22 16:59:50 -02:00
Moisés Guimarães
1c9147a41e adds supported curves to context; fixes compatibility issues with py27 2016-12-22 15:01:58 -02:00
Moisés Guimarães
9b58ab0211 renames exceptions file 2016-12-22 15:01:58 -02:00
Moisés Guimarães
4b75d11164 fixes socket calls 2016-12-22 15:01:58 -02:00
Moisés Guimarães
f3c1522608 always treat native_object as a pointer 2016-12-22 15:01:58 -02:00
Moisés Guimarães
b9934695fb pretest version of SSLSocket 2016-12-22 15:01:58 -02:00
Moisés Guimarães
567dfd76b3 adds initial code for SSLSocket 2016-12-22 15:01:58 -02:00
Moisés Guimarães
2cbdd45e8f adds negotiate() to ssl interface 2016-12-22 15:01:58 -02:00
Moisés Guimarães
07072ef266 moving SSLContext and SSLSocket to __init__ to avoid ciclic includes 2016-12-22 15:01:58 -02:00
Moisés Guimarães
baeba53527 adds wrap_socket to the context 2016-12-22 15:01:58 -02:00
Moisés Guimarães
445e375daa adds ssl interface to ffi 2016-12-22 15:01:58 -02:00
Moisés Guimarães
52eb0becf0 adds set_ciphers to context 2016-12-22 15:01:58 -02:00
Moisés Guimarães
368f2baf88 adds verify_mode to context 2016-12-22 15:01:58 -02:00
Moisés Guimarães
8eec3cb874 adds initial code for SSLSocket 2016-12-22 15:01:58 -02:00
Moisés Guimarães
0ed0672b16 fixes pylint warnings 2016-12-22 15:01:58 -02:00
Moisés Guimarães
c0b59a585b adds support for buffered ca certificates 2016-12-22 15:01:58 -02:00
Moisés Guimarães
015ffecbab fixes unicode quotes and adds load_cert_chain test. 2016-12-22 15:01:58 -02:00
Moisés Guimarães
760ddd14f5 fixes pylint warnings;
adds more tests to load_verify_locations;
fixes data type when calling C functions;
fixes result verification when calling C functions.
2016-12-22 15:01:58 -02:00
Moisés Guimarães
7201435f2d adds initial context tests. 2016-12-22 15:01:58 -02:00
Moisés Guimarães
bd14611879 adds load_verify_locations and load_cert_chain implementations. 2016-12-22 15:01:58 -02:00
Moisés Guimarães
c8ae6abb43 adds context functions. 2016-12-22 15:01:58 -02:00
Moisés Guimarães
e1c01378c7 fixes ssl version in test to maintain backward compatibility. 2016-12-22 15:01:58 -02:00
Moisés Guimarães
20cfbe399c fixes integer comparison and adds virtual env to ignored files. 2016-12-22 15:01:58 -02:00
Moisés Guimarães
e06b17e170 adds methods and client tests;
adds context creation;
adds memory module;
removes init and cleanup functions.
2016-12-22 15:01:58 -02:00
Moisés Guimarães
0df897d4b9 adds methods 2016-12-22 15:01:58 -02:00
Moisés Guimarães
7b884ad72a removes non-ASCII chars from docs. 2016-12-22 15:01:58 -02:00
Moisés Guimarães
8b0edafef3 adds build_ffI.py 2016-12-22 15:01:58 -02:00
Moisés Guimarães
f4d6890b51 adds basic files and exception classes. 2016-12-22 15:01:58 -02:00
257 changed files with 50576 additions and 8138 deletions

15
.gitignore vendored
View File

@@ -9,7 +9,8 @@ ctaocrypt/src/src/
*.cache
.dirstamp
*.user
config*
configure
config.*
*Debug/
*Release/
*.ncb
@@ -127,6 +128,7 @@ autoscan.log
TAGS
.DS_Store
support/cyassl.pc
support/wolfssl.pc
cyassl/ctaocrypt/stamp-h1
swig/_cyassl.so
swig/_wolfssl.so
@@ -167,6 +169,12 @@ mplabx/wolfcrypt_test.X/nbproject/Makefile-*
mplabx/wolfcrypt_test.X/nbproject/Package-default.bash
mplabx/wolfssl.X/nbproject/Makefile-*
mplabx/wolfssl.X/nbproject/Package-default.bash
mplabx/wolfssl.X/nbproject/private
mplabx/wolfcrypt_test.X/nbproject/private
mplabx/wolfcrypt_benchmark.X/nbproject/private
mplabx/wolfssl.X/dist/default/
mplabx/wolfcrypt_test.X/dist/default/
mplabx/wolfcrypt_benchmark.X/dist/default/
*.dSYM
# Vagrant folder
@@ -213,5 +221,10 @@ IDE/INTIME-RTOS/Debug_*
# Hexiwear
IDE/HEXIWEAR/wolfSSL_HW/Debug
# Linux-SGX
IDE/LINUX-SGX/*.a
# Binaries
wolfcrypt/src/port/intel/qat_test
/mplabx/wolfssl.X/dist/default/
/mplabx/wolfcrypt_test.X/dist/default/

25
IDE/LINUX-SGX/README.md Normal file
View File

@@ -0,0 +1,25 @@
# Static Library: Building libwolfssl.sgx.static.lib.a for use with SGX Enclaves
### Requirements:
This code was created to use Intel's SGX hardware. It is expected that the user has gone through the steps of both turning on the hardware in bios if needed and has installed the necesary software from Intel to make use of the hardware. (https://software.intel.com/en-us/sgx) If these steps have not been done then it is expected that the user is familure with simulation software being used in place of hardware.
### Overview and Build:
This project creates a static library to then link with Enclaves. A simple example of an Enclave linking to the created wolfSSL library can be found in wolfssl-examples on github. This project has been tested with gcc 5.4.0 on Ubuntu 16.04.
To create the static library, simply call make:
`make -f sgx_t_static.mk all`
This will create a local static library, libwolfssl.sgx.static.lib.a, that can be linked with SGX enclaves to access wolfSSL APIs using SGX hardware.
### Customization:
To enable wolfssl debug, add CFLAGS=-DDEBUG_WOLFSSL.
To enable wolfssl benchmark tests with enclave, specify: HAVE_WOLFSSL_BENCHMARK at build
To enable wolfcrypt testsuite with enclave, specify: HAVE_WOLFSSL_TEST at build
For example, to enable all three:
`make -f sgx_t_static.mk CFLAGS=-DDEBUG_WOLFSSL HAVE_WOLFSSL_BENCHMARK=1 HAVE_WOLFSSL_TEST=1`
### Limitations:
Single Threaded (multiple threaded applications have not been tested)
AES-NI use with SGX has not been added in yet

6
IDE/LINUX-SGX/include.am Normal file
View File

@@ -0,0 +1,6 @@
# vim:ft=automake
# included from Top Level Makefile.am
# All paths should be given relative to the root
EXTRA_DIST+= IDE/LINUX-SGX/README.md
EXTRA_DIST+= IDE/LINUX-SGX/sgx_t_static.mk

View File

@@ -0,0 +1,145 @@
######## Intel(R) SGX SDK Settings ########
SGX_SDK ?= /opt/intel/sgxsdk
SGX_MODE ?= SIM
SGX_ARCH ?= x64
WOLFSSL_ROOT ?= $(shell readlink -f ../..)
ifeq ($(shell getconf LONG_BIT), 32)
SGX_ARCH := x86
else ifeq ($(findstring -m32, $(CXXFLAGS)), -m32)
SGX_ARCH := x86
endif
ifeq ($(SGX_ARCH), x86)
SGX_COMMON_CFLAGS := -m32
SGX_LIBRARY_PATH := $(SGX_SDK)/lib
SGX_ENCLAVE_SIGNER := $(SGX_SDK)/bin/x86/sgx_sign
SGX_EDGER8R := $(SGX_SDK)/bin/x86/sgx_edger8r
else
SGX_COMMON_CFLAGS := -m64
SGX_LIBRARY_PATH := $(SGX_SDK)/lib64
SGX_ENCLAVE_SIGNER := $(SGX_SDK)/bin/x64/sgx_sign
SGX_EDGER8R := $(SGX_SDK)/bin/x64/sgx_edger8r
endif
ifeq ($(SGX_DEBUG), 1)
ifeq ($(SGX_PRERELEASE), 1)
$(error Cannot set SGX_DEBUG and SGX_PRERELEASE at the same time!!)
endif
endif
ifeq ($(SGX_DEBUG), 1)
SGX_COMMON_CFLAGS += -O0 -g
else
SGX_COMMON_CFLAGS += -O2
endif
ifneq ($(SGX_MODE), HW)
Trts_Library_Name := sgx_trts_sim
Service_Library_Name := sgx_tservice_sim
else
Trts_Library_Name := sgx_trts
Service_Library_Name := sgx_tservice
endif
Crypto_Library_Name := sgx_tcrypto
Wolfssl_C_Extra_Flags := -DWOLFSSL_SGX
Wolfssl_C_Files :=$(WOLFSSL_ROOT)/wolfcrypt/src/aes.c\
$(WOLFSSL_ROOT)/wolfcrypt/src/arc4.c\
$(WOLFSSL_ROOT)/wolfcrypt/src/asn.c\
$(WOLFSSL_ROOT)/wolfcrypt/src/blake2b.c\
$(WOLFSSL_ROOT)/wolfcrypt/src/camellia.c\
$(WOLFSSL_ROOT)/wolfcrypt/src/coding.c\
$(WOLFSSL_ROOT)/wolfcrypt/src/chacha.c\
$(WOLFSSL_ROOT)/wolfcrypt/src/chacha20_poly1305.c\
$(WOLFSSL_ROOT)/src/crl.c\
$(WOLFSSL_ROOT)/wolfcrypt/src/des3.c\
$(WOLFSSL_ROOT)/wolfcrypt/src/dh.c\
$(WOLFSSL_ROOT)/wolfcrypt/src/tfm.c\
$(WOLFSSL_ROOT)/wolfcrypt/src/ecc.c\
$(WOLFSSL_ROOT)/wolfcrypt/src/error.c\
$(WOLFSSL_ROOT)/wolfcrypt/src/hash.c\
$(WOLFSSL_ROOT)/wolfcrypt/src/hc128.c\
$(WOLFSSL_ROOT)/wolfcrypt/src/hmac.c\
$(WOLFSSL_ROOT)/wolfcrypt/src/integer.c\
$(WOLFSSL_ROOT)/src/internal.c\
$(WOLFSSL_ROOT)/src/io.c\
$(WOLFSSL_ROOT)/src/keys.c\
$(WOLFSSL_ROOT)/wolfcrypt/src/logging.c\
$(WOLFSSL_ROOT)/wolfcrypt/src/md4.c\
$(WOLFSSL_ROOT)/wolfcrypt/src/md5.c\
$(WOLFSSL_ROOT)/wolfcrypt/src/memory.c\
$(WOLFSSL_ROOT)/src/ocsp.c\
$(WOLFSSL_ROOT)/wolfcrypt/src/pkcs7.c\
$(WOLFSSL_ROOT)/wolfcrypt/src/pkcs12.c\
$(WOLFSSL_ROOT)/wolfcrypt/src/poly1305.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\
$(WOLFSSL_ROOT)/wolfcrypt/src/dsa.c\
$(WOLFSSL_ROOT)/wolfcrypt/src/sha.c\
$(WOLFSSL_ROOT)/wolfcrypt/src/sha256.c\
$(WOLFSSL_ROOT)/wolfcrypt/src/sha512.c\
$(WOLFSSL_ROOT)/wolfcrypt/src/signature.c\
$(WOLFSSL_ROOT)/src/ssl.c\
$(WOLFSSL_ROOT)/src/tls.c\
$(WOLFSSL_ROOT)/wolfcrypt/src/wc_encrypt.c\
$(WOLFSSL_ROOT)/wolfcrypt/src/wolfevent.c\
Wolfssl_Include_Paths := -I$(WOLFSSL_ROOT)/ \
-I$(WOLFSSL_ROOT)/wolfcrypt/ \
-I$(SGX_SDK)/include -I$(SGX_SDK)/include/tlibc -I$(SGX_SDK)/include/stlport
ifeq ($(HAVE_WOLFSSL_TEST), 1)
Wolfssl_Include_Paths += -I$(WOLFSSL_ROOT)/wolfcrypt/test
Wolfssl_C_Files += $(WOLFSSL_ROOT)/wolfcrypt/test/test.c
endif
ifeq ($(HAVE_WOLFSSL_BENCHMARK), 1)
Wolfssl_C_Files += $(WOLFSSL_ROOT)/wolfcrypt/benchmark/benchmark.c
Wolfssl_Include_Paths += -I$(WOLFSSL_ROOT)/wolfcrypt/benchmark/
endif
Flags_Just_For_C := -Wno-implicit-function-declaration -std=c11
Common_C_Cpp_Flags := $(SGX_COMMON_CFLAGS) -nostdinc -fvisibility=hidden -fpie -fstack-protector $(Wolfssl_Include_Paths) -fno-builtin-printf -I.
Wolfssl_C_Flags := $(Flags_Just_For_C) $(Common_C_Cpp_Flags) $(Wolfssl_C_Extra_Flags)
Wolfssl_Link_Flags := $(SGX_COMMON_CFLAGS) -Wl,--no-undefined -nostdlib -nodefaultlibs -nostartfiles -L$(SGX_LIBRARY_PATH) \
-Wl,--whole-archive -l$(Trts_Library_Name) -Wl,--no-whole-archive \
-Wl,--start-group -lsgx_tstdc -lsgx_tstdcxx -l$(Crypto_Library_Name) -l$(Service_Library_Name) -Wl,--end-group \
-Wl,-Bstatic -Wl,-Bsymbolic -Wl,--no-undefined \
-Wl,-pie,-eenclave_entry -Wl,--export-dynamic \
-Wl,--defsym,__ImageBase=0 \
-Wl,--version-script=trusted/wolfcrypt.lds
Wolfssl_C_Objects := $(Wolfssl_C_Files:.c=.o)
ifeq ($(SGX_MODE), HW)
ifneq ($(SGX_DEBUG), 1)
ifneq ($(SGX_PRERELEASE), 1)
Build_Mode = HW_RELEASE
endif
endif
endif
override CFLAGS += $(Wolfssl_C_Flags)
.PHONY: all run
all: libwolfssl.sgx.static.lib.a
######## WolfSSL Objects ########
libwolfssl.sgx.static.lib.a: $(Wolfssl_C_Objects)
ar rcs libwolfssl.sgx.static.lib.a $(Wolfssl_C_Objects)
@echo "LINK => $@"
clean:
@rm -f wolfcrypt.* static_trusted/wolfssl_t.* libwolfssl.sgx.static.lib.a $(Wolfssl_C_Objects)

View File

@@ -27,9 +27,9 @@ 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/poly1305.c src/pwdbased.c src/rabbit.c
src/pkcs7.c src/pkcs12.c src/poly1305.c src/pwdbased.c src/rabbit.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/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
@@ -42,7 +42,6 @@ SET(WOLFCRYPT_SOURCES src/aes.c src/arc4.c src/asn.c src/blake2b.c
# misc.c is not compiled in since using INLINE
ADD_CONVENIENCE_LIBRARY(wolfcrypt ${WOLFCRYPT_SOURCES})
RESTRICT_SYMBOL_EXPORTS(wolfcrypt)
IF(MSVC)
INSTALL_DEBUG_TARGET(wolfcrypt DESTINATION ${INSTALL_LIBDIR}/debug)

View File

@@ -35,7 +35,6 @@ SET(WOLFSSL_SOURCES src/crl.c src/internal.c src/keys.c src/sniffer.c
../../client/get_password.c )
ADD_CONVENIENCE_LIBRARY(wolfssl ${WOLFSSL_SOURCES})
RESTRICT_SYMBOL_EXPORTS(wolfssl)
IF(MSVC)
INSTALL_DEBUG_TARGET(wolfssl DESTINATION ${INSTALL_LIBDIR}/debug)

148
IDE/OPENSTM32/.cproject Normal file
View File

@@ -0,0 +1,148 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
<storageModule moduleId="org.eclipse.cdt.core.settings">
<cconfiguration id="fr.ac6.managedbuild.config.gnu.cross.exe.debug.333134738">
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="fr.ac6.managedbuild.config.gnu.cross.exe.debug.333134738" moduleId="org.eclipse.cdt.core.settings" name="Debug">
<externalSettings/>
<extensions>
<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
</extensions>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
<configuration artifactExtension="elf" artifactName="wolfSTM32" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.debug,org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe" cleanCommand="rm -rf" description="" id="fr.ac6.managedbuild.config.gnu.cross.exe.debug.333134738" name="Debug" parent="fr.ac6.managedbuild.config.gnu.cross.exe.debug" postannouncebuildStep="Generating binary and Printing size information:" postbuildStep="arm-none-eabi-objcopy -O binary &quot;${BuildArtifactFileBaseName}.elf&quot; &quot;${BuildArtifactFileBaseName}.bin&quot; &amp;&amp; arm-none-eabi-size &quot;${BuildArtifactFileName}&quot;">
<folderInfo id="fr.ac6.managedbuild.config.gnu.cross.exe.debug.333134738." name="/" resourcePath="">
<toolChain id="fr.ac6.managedbuild.toolchain.gnu.cross.exe.debug.843637882" name="Ac6 STM32 MCU GCC" superClass="fr.ac6.managedbuild.toolchain.gnu.cross.exe.debug">
<option id="fr.ac6.managedbuild.option.gnu.cross.prefix.1949238642" name="Prefix" superClass="fr.ac6.managedbuild.option.gnu.cross.prefix" value="arm-none-eabi-" valueType="string"/>
<option id="fr.ac6.managedbuild.option.gnu.cross.mcu.376579966" name="Mcu" superClass="fr.ac6.managedbuild.option.gnu.cross.mcu" value="STM32F437IIHx" valueType="string"/>
<option id="fr.ac6.managedbuild.option.gnu.cross.board.1728284212" name="Board" superClass="fr.ac6.managedbuild.option.gnu.cross.board" value="wolfSTM32" valueType="string"/>
<option id="fr.ac6.managedbuild.option.gnu.cross.instructionSet.1788799131" name="Instruction Set" superClass="fr.ac6.managedbuild.option.gnu.cross.instructionSet" value="fr.ac6.managedbuild.option.gnu.cross.instructionSet.thumbII" valueType="enumerated"/>
<option id="fr.ac6.managedbuild.option.gnu.cross.fpu.1457764954" name="Floating point hardware" superClass="fr.ac6.managedbuild.option.gnu.cross.fpu" value="fr.ac6.managedbuild.option.gnu.cross.fpu.fpv4-sp-d16" valueType="enumerated"/>
<option id="fr.ac6.managedbuild.option.gnu.cross.floatabi.1684707596" name="Floating-point ABI" superClass="fr.ac6.managedbuild.option.gnu.cross.floatabi" value="fr.ac6.managedbuild.option.gnu.cross.floatabi.hard" valueType="enumerated"/>
<targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.ELF" id="fr.ac6.managedbuild.targetPlatform.gnu.cross.774322166" isAbstract="false" osList="all" superClass="fr.ac6.managedbuild.targetPlatform.gnu.cross"/>
<builder buildPath="${workspace_loc:/wolfSTM32}/Debug" id="fr.ac6.managedbuild.builder.gnu.cross.847313553" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="fr.ac6.managedbuild.builder.gnu.cross">
<outputEntries>
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="outputPath" name="Debug"/>
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="outputPath" name="Release"/>
</outputEntries>
</builder>
<tool id="fr.ac6.managedbuild.tool.gnu.cross.c.compiler.758134809" name="MCU GCC Compiler" superClass="fr.ac6.managedbuild.tool.gnu.cross.c.compiler">
<option defaultValue="gnu.c.optimization.level.none" id="fr.ac6.managedbuild.gnu.c.compiler.option.optimization.level.2077803707" name="Optimization Level" superClass="fr.ac6.managedbuild.gnu.c.compiler.option.optimization.level" useByScannerDiscovery="false" value="fr.ac6.managedbuild.gnu.c.optimization.level.size" valueType="enumerated"/>
<option id="gnu.c.compiler.option.debugging.level.256754301" name="Debug Level" superClass="gnu.c.compiler.option.debugging.level" useByScannerDiscovery="false" value="gnu.c.debugging.level.max" valueType="enumerated"/>
<option id="gnu.c.compiler.option.include.paths.32506161" name="Include paths (-I)" superClass="gnu.c.compiler.option.include.paths" useByScannerDiscovery="false" valueType="includePath">
<listOptionValue builtIn="false" value="../Inc"/>
<listOptionValue builtIn="false" value="../Middlewares/Third_Party/LwIP/src/include"/>
<listOptionValue builtIn="false" value="../Middlewares/Third_Party/LwIP/system"/>
<listOptionValue builtIn="false" value="../Drivers/STM32F4xx_HAL_Driver/Inc"/>
<listOptionValue builtIn="false" value="../Drivers/STM32F4xx_HAL_Driver/Inc/Legacy"/>
<listOptionValue builtIn="false" value="../Middlewares/Third_Party/FreeRTOS/Source/portable/GCC/ARM_CM4F"/>
<listOptionValue builtIn="false" value="../Middlewares/Third_Party/FreeRTOS/Source/include"/>
<listOptionValue builtIn="false" value="../Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS"/>
<listOptionValue builtIn="false" value="../Middlewares/Third_Party/LwIP/src/include/lwip"/>
<listOptionValue builtIn="false" value="../Middlewares/Third_Party/LwIP/src/include/lwip/apps"/>
<listOptionValue builtIn="false" value="../Middlewares/Third_Party/LwIP/src/include/lwip/priv"/>
<listOptionValue builtIn="false" value="../Middlewares/Third_Party/LwIP/src/include/netif"/>
<listOptionValue builtIn="false" value="../Middlewares/Third_Party/LwIP/src/include/netif/ppp"/>
<listOptionValue builtIn="false" value="../Middlewares/Third_Party/LwIP/src/include/netif/ppp/polarssl"/>
<listOptionValue builtIn="false" value="../Middlewares/Third_Party/LwIP/src/include/posix"/>
<listOptionValue builtIn="false" value="../Middlewares/Third_Party/LwIP/src/include/posix/sys"/>
<listOptionValue builtIn="false" value="../Middlewares/Third_Party/LwIP/system/arch"/>
<listOptionValue builtIn="false" value="../Drivers/CMSIS/Include"/>
<listOptionValue builtIn="false" value="../Drivers/CMSIS/Device/ST/STM32F4xx/Include"/>
<listOptionValue builtIn="false" value="../Middlewares/Third_Party/wolfSSL"/>
<listOptionValue builtIn="false" value="&quot;${ProjDirPath}/../..&quot;"/>
</option>
<option id="gnu.c.compiler.option.preprocessor.def.symbols.1556589411" name="Defined symbols (-D)" superClass="gnu.c.compiler.option.preprocessor.def.symbols" useByScannerDiscovery="false" valueType="definedSymbols">
<listOptionValue builtIn="false" value="__weak=&quot;__attribute__((weak))&quot;"/>
<listOptionValue builtIn="false" value="__packed=&quot;__attribute__((__packed__))&quot;"/>
<listOptionValue builtIn="false" value="USE_HAL_DRIVER"/>
<listOptionValue builtIn="false" value="STM32F437xx"/>
<listOptionValue builtIn="false" value="WOLFSSL_USER_SETTINGS"/>
</option>
<option id="fr.ac6.managedbuild.gnu.c.compiler.option.misc.other.220656184" superClass="fr.ac6.managedbuild.gnu.c.compiler.option.misc.other" useByScannerDiscovery="false" value="-fmessage-length=0" valueType="string"/>
<inputType id="fr.ac6.managedbuild.tool.gnu.cross.c.compiler.input.c.1396985810" superClass="fr.ac6.managedbuild.tool.gnu.cross.c.compiler.input.c"/>
<inputType id="fr.ac6.managedbuild.tool.gnu.cross.c.compiler.input.s.982473797" superClass="fr.ac6.managedbuild.tool.gnu.cross.c.compiler.input.s"/>
</tool>
<tool id="fr.ac6.managedbuild.tool.gnu.cross.cpp.compiler.126736225" name="MCU G++ Compiler" superClass="fr.ac6.managedbuild.tool.gnu.cross.cpp.compiler">
<option id="gnu.cpp.compiler.option.optimization.level.1227596527" name="Optimization Level" superClass="gnu.cpp.compiler.option.optimization.level" useByScannerDiscovery="false" value="gnu.cpp.compiler.optimization.level.none" valueType="enumerated"/>
<option id="gnu.cpp.compiler.option.debugging.level.681841413" name="Debug Level" superClass="gnu.cpp.compiler.option.debugging.level" useByScannerDiscovery="false" value="gnu.cpp.compiler.debugging.level.max" valueType="enumerated"/>
</tool>
<tool id="fr.ac6.managedbuild.tool.gnu.cross.c.linker.839339759" name="MCU GCC Linker" superClass="fr.ac6.managedbuild.tool.gnu.cross.c.linker">
<option id="fr.ac6.managedbuild.tool.gnu.cross.c.linker.script.1396145839" name="Linker Script (-T)" superClass="fr.ac6.managedbuild.tool.gnu.cross.c.linker.script" value="../STM32F437IIHx_FLASH.ld" valueType="string"/>
<option id="gnu.c.link.option.libs.1850337364" name="Libraries (-l)" superClass="gnu.c.link.option.libs"/>
<option id="gnu.c.link.option.paths.1061728683" name="Library search path (-L)" superClass="gnu.c.link.option.paths"/>
<option id="gnu.c.link.option.ldflags.484312202" name="Linker flags" superClass="gnu.c.link.option.ldflags" value="--specs=nosys.specs --specs=nano.specs -u _printf_float" valueType="string"/>
<inputType id="cdt.managedbuild.tool.gnu.c.linker.input.210434878" superClass="cdt.managedbuild.tool.gnu.c.linker.input">
<additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
<additionalInput kind="additionalinput" paths="$(LIBS)"/>
</inputType>
</tool>
<tool id="fr.ac6.managedbuild.tool.gnu.cross.cpp.linker.1401311113" name="MCU G++ Linker" superClass="fr.ac6.managedbuild.tool.gnu.cross.cpp.linker"/>
<tool id="fr.ac6.managedbuild.tool.gnu.archiver.801849405" name="MCU GCC Archiver" superClass="fr.ac6.managedbuild.tool.gnu.archiver"/>
<tool id="fr.ac6.managedbuild.tool.gnu.cross.assembler.1576695062" name="MCU GCC Assembler" superClass="fr.ac6.managedbuild.tool.gnu.cross.assembler">
<option id="gnu.both.asm.option.include.paths.2012591676" name="Include paths (-I)" superClass="gnu.both.asm.option.include.paths" valueType="includePath">
<listOptionValue builtIn="false" value=""/>
</option>
<inputType id="cdt.managedbuild.tool.gnu.assembler.input.1181863627" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
<inputType id="fr.ac6.managedbuild.tool.gnu.cross.assembler.input.1455097577" superClass="fr.ac6.managedbuild.tool.gnu.cross.assembler.input"/>
</tool>
</toolChain>
</folderInfo>
<folderInfo id="fr.ac6.managedbuild.config.gnu.cross.exe.debug.333134738.1915068927" name="/" resourcePath="Middlewares/Third_Party/wolfMQTT/examples/aws">
<toolChain id="fr.ac6.managedbuild.toolchain.gnu.cross.exe.debug.173956589" name="Ac6 STM32 MCU GCC" superClass="fr.ac6.managedbuild.toolchain.gnu.cross.exe.debug" unusedChildren="">
<option id="fr.ac6.managedbuild.option.gnu.cross.prefix.1949238642.698225202" name="Prefix" superClass="fr.ac6.managedbuild.option.gnu.cross.prefix.1949238642"/>
<option id="fr.ac6.managedbuild.option.gnu.cross.mcu.376579966.2068115060" name="Mcu" superClass="fr.ac6.managedbuild.option.gnu.cross.mcu.376579966"/>
<option id="fr.ac6.managedbuild.option.gnu.cross.board.1728284212.1905622558" name="Board" superClass="fr.ac6.managedbuild.option.gnu.cross.board.1728284212"/>
<option id="fr.ac6.managedbuild.option.gnu.cross.instructionSet.1788799131.1271602884" name="Instruction Set" superClass="fr.ac6.managedbuild.option.gnu.cross.instructionSet.1788799131"/>
<option id="fr.ac6.managedbuild.option.gnu.cross.fpu.1457764954.1755766601" name="Floating point hardware" superClass="fr.ac6.managedbuild.option.gnu.cross.fpu.1457764954"/>
<option id="fr.ac6.managedbuild.option.gnu.cross.floatabi.1684707596.2053579499" name="Floating-point ABI" superClass="fr.ac6.managedbuild.option.gnu.cross.floatabi.1684707596"/>
<targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.ELF" id="fr.ac6.managedbuild.targetPlatform.gnu.cross" isAbstract="false" osList="all" superClass="fr.ac6.managedbuild.targetPlatform.gnu.cross"/>
<tool id="fr.ac6.managedbuild.tool.gnu.cross.c.compiler.542548012" name="MCU GCC Compiler" superClass="fr.ac6.managedbuild.tool.gnu.cross.c.compiler.758134809">
<inputType id="fr.ac6.managedbuild.tool.gnu.cross.c.compiler.input.c.603917146" superClass="fr.ac6.managedbuild.tool.gnu.cross.c.compiler.input.c"/>
<inputType id="fr.ac6.managedbuild.tool.gnu.cross.c.compiler.input.s.834662647" superClass="fr.ac6.managedbuild.tool.gnu.cross.c.compiler.input.s"/>
</tool>
<tool id="fr.ac6.managedbuild.tool.gnu.cross.cpp.compiler.1959620380" name="MCU G++ Compiler" superClass="fr.ac6.managedbuild.tool.gnu.cross.cpp.compiler.126736225"/>
<tool id="fr.ac6.managedbuild.tool.gnu.cross.c.linker.625780673" name="MCU GCC Linker" superClass="fr.ac6.managedbuild.tool.gnu.cross.c.linker.839339759"/>
<tool id="fr.ac6.managedbuild.tool.gnu.cross.cpp.linker.2035924639" name="MCU G++ Linker" superClass="fr.ac6.managedbuild.tool.gnu.cross.cpp.linker.1401311113"/>
<tool id="fr.ac6.managedbuild.tool.gnu.archiver.859849169" name="MCU GCC Archiver" superClass="fr.ac6.managedbuild.tool.gnu.archiver.801849405"/>
<tool id="fr.ac6.managedbuild.tool.gnu.cross.assembler.322401756" name="MCU GCC Assembler" superClass="fr.ac6.managedbuild.tool.gnu.cross.assembler.1576695062">
<inputType id="cdt.managedbuild.tool.gnu.assembler.input.1288485713" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
<inputType id="fr.ac6.managedbuild.tool.gnu.cross.assembler.input.1780998132" superClass="fr.ac6.managedbuild.tool.gnu.cross.assembler.input"/>
</tool>
</toolChain>
</folderInfo>
<sourceEntries>
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="Drivers"/>
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="Inc"/>
<entry excluding="Third_Party/wolfSSL/src/bio.c|Third_Party/wolfSSL/wolfcrypt/src/evp.c|Third_Party/wolfSSL/wolfcrypt/src/misc.c|Third_Party/wolfSSL/wrapper|Third_Party/wolfSSL/support|Third_Party/wolfSSL/sslSniffer|Third_Party/wolfSSL/scripts|Third_Party/wolfSSL/rpm|Third_Party/wolfSSL/mcapi|Third_Party/wolfSSL/m4|Third_Party/wolfSSL/lib|Third_Party/wolfSSL/IPP|Third_Party/wolfSSL/examples|Third_Party/wolfSSL/doc|Third_Party/wolfSSL/cyassl|Third_Party/wolfSSL/ctaocrypt|Third_Party/wolfSSL/certs|Third_Party/wolfSSL/build-aux|Third_Party/wolfSSL/autom4te.cache|Third_Party/wolfSSL/IDE|Third_Party/wolfSSL/mplabx|Third_Party/wolfSSL/mqx|Third_Party/wolfSSL/swig|Third_Party/wolfSSL/tests|Third_Party/wolfSSL/testsuite|Third_Party/wolfSSL/tirtos|Third_Party/wolfSSL/wolfcrypt/src/aes_asm.s|Third_Party/wolfSSL/wolfcrypt/src/aes_asm.asm|Third_Party/wolfSSL/wolfcrypt/user-crypto" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="Middlewares"/>
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="Src"/>
</sourceEntries>
</configuration>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
</cconfiguration>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
<project id="wolfSTM32.fr.ac6.managedbuild.target.gnu.cross.exe.1782078835" name="Executable" projectType="fr.ac6.managedbuild.target.gnu.cross.exe"/>
</storageModule>
<storageModule moduleId="scannerConfiguration">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
<scannerConfigBuildInfo instanceId="fr.ac6.managedbuild.config.gnu.cross.exe.debug.333134738;fr.ac6.managedbuild.config.gnu.cross.exe.debug.333134738.;fr.ac6.managedbuild.tool.gnu.cross.c.compiler.758134809;fr.ac6.managedbuild.tool.gnu.cross.c.compiler.input.c.1396985810">
<autodiscovery enabled="false" problemReportingEnabled="true" selectedProfileId=""/>
</scannerConfigBuildInfo>
<!--scannerConfigBuildInfo instanceId="fr.ac6.managedbuild.config.gnu.cross.exe.release.$(RELEASE_CONFIG_UID);fr.ac6.managedbuild.config.gnu.cross.exe.release.$(RELEASE_CONFIG_UID).;fr.ac6.managedbuild.tool.gnu.cross.c.compiler.$(RELEASE_TOOL_COMPILER_UID);cdt.managedbuild.tool.gnu.c.compiler.input.$(RELEASE_TOOL_COMPILER_INPUT_UID)">
<autodiscovery enabled="false" problemReportingEnabled="true" selectedProfileId=""/>
</scannerConfigBuildInfo-->
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
<storageModule moduleId="refreshScope" versionNumber="2">
<configuration configurationName="Debug">
<resource resourceType="PROJECT" workspacePath="/wolfSTM32"/>
</configuration>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.internal.ui.text.commentOwnerProjectMappings"/>
</cproject>

2444
IDE/OPENSTM32/.project Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,105 @@
/* Define to prevent recursive inclusion --------------------------------------*/
#ifndef __LWIPOPTS__H__
#define __LWIPOPTS__H__
#include "stm32f4xx_hal.h"
/*-----------------------------------------------------------------------------*/
/* Current version of LwIP supported by CubeMx: 1.5.0_RC0_20160211 -*/
/*-----------------------------------------------------------------------------*/
/* Within 'USER CODE' section, code will be kept by default at each generation */
/* USER CODE BEGIN 0 */
/* USER CODE END 0 */
#ifdef __cplusplus
extern "C" {
#endif
/* STM32CubeMX Specific Parameters (not defined in opt.h) ---------------------*/
/* Parameters set in STM32CubeMX LwIP Configuration GUI -*/
/*----- WITH_RTOS enabled (Since FREERTOS is set) -----*/
#define WITH_RTOS 1
/*----- CHECKSUM_BY_HARDWARE disabled -----*/
#define CHECKSUM_BY_HARDWARE 0
/*-----------------------------------------------------------------------------*/
/* LwIP Stack Parameters (modified compared to initialization value in opt.h) -*/
/* Parameters set in STM32CubeMX LwIP Configuration GUI -*/
/*----- Value in opt.h for LWIP_DHCP: 0 -----*/
#define LWIP_DHCP 1
/*----- Value in opt.h for MEM_ALIGNMENT: 1 -----*/
#define MEM_ALIGNMENT 4
/*----- Value in opt.h for MEMP_NUM_SYS_TIMEOUT: (LWIP_TCP + IP_REASSEMBLY + LWIP_ARP + (2*LWIP_DHCP) + LWIP_AUTOIP + LWIP_IGMP + LWIP_DNS + (PPP_SUPPORT*6*MEMP_NUM_PPP_PCB) + (LWIP_IPV6 ? (1 + LWIP_IPV6_REASS + LWIP_IPV6_MLD) : 0)) -*/
//#define MEMP_NUM_SYS_TIMEOUT 5
/*----- Value in opt.h for LWIP_ETHERNET: LWIP_ARP || PPPOE_SUPPORT -*/
#define LWIP_ETHERNET 1
/*----- Value in opt.h for LWIP_DNS_SECURE: (LWIP_DNS_SECURE_RAND_XID | LWIP_DNS_SECURE_NO_MULTIPLE_OUTSTANDING | LWIP_DNS_SECURE_RAND_SRC_PORT) -*/
#define LWIP_DNS_SECURE 7
/*----- Value in opt.h for TCP_SND_QUEUELEN: (4*TCP_SND_BUF + (TCP_MSS - 1))/TCP_MSS -----*/
#define TCP_SND_QUEUELEN 9
/*----- Value in opt.h for TCP_SNDLOWAT: LWIP_MIN(LWIP_MAX(((TCP_SND_BUF)/2), (2 * TCP_MSS) + 1), (TCP_SND_BUF) - 1) -*/
#define TCP_SNDLOWAT 1071
/*----- Value in opt.h for TCP_SNDQUEUELOWAT: LWIP_MAX(TCP_SND_QUEUELEN)/2, 5) -*/
#define TCP_SNDQUEUELOWAT 5
/*----- Value in opt.h for TCP_WND_UPDATE_THRESHOLD: LWIP_MIN(TCP_WND/4, TCP_MSS*4) -----*/
#define TCP_WND_UPDATE_THRESHOLD 536
/*----- Value in opt.h for TCPIP_THREAD_STACKSIZE: 0 -----*/
#define TCPIP_THREAD_STACKSIZE 1024
/*----- Value in opt.h for TCPIP_THREAD_PRIO: 1 -----*/
#define TCPIP_THREAD_PRIO 3
/*----- Value in opt.h for SLIPIF_THREAD_STACKSIZE: 0 -----*/
#define SLIPIF_THREAD_STACKSIZE 1024
/*----- Value in opt.h for SLIPIF_THREAD_PRIO: 1 -----*/
#define SLIPIF_THREAD_PRIO 3
/*----- Value in opt.h for DEFAULT_THREAD_STACKSIZE: 0 -----*/
#define DEFAULT_THREAD_STACKSIZE 1024
/*----- Value in opt.h for DEFAULT_THREAD_PRIO: 1 -----*/
#define DEFAULT_THREAD_PRIO 3
/*----- Value in opt.h for LWIP_STATS: 1 -----*/
#define LWIP_STATS 0
/*----- Value in opt.h for CHECKSUM_GEN_IP: 1 -----*/
#define CHECKSUM_GEN_IP 0
/*----- Value in opt.h for CHECKSUM_GEN_UDP: 1 -----*/
#define CHECKSUM_GEN_UDP 0
/*----- Value in opt.h for CHECKSUM_GEN_TCP: 1 -----*/
#define CHECKSUM_GEN_TCP 0
/*----- Value in opt.h for CHECKSUM_GEN_ICMP: 1 -----*/
#define CHECKSUM_GEN_ICMP 0
/*----- Value in opt.h for CHECKSUM_GEN_ICMP6: 1 -----*/
#define CHECKSUM_GEN_ICMP6 0
/*----- Value in opt.h for CHECKSUM_CHECK_IP: 1 -----*/
#define CHECKSUM_CHECK_IP 0
/*----- Value in opt.h for CHECKSUM_CHECK_UDP: 1 -----*/
#define CHECKSUM_CHECK_UDP 0
/*----- Value in opt.h for CHECKSUM_CHECK_TCP: 1 -----*/
#define CHECKSUM_CHECK_TCP 0
/*----- Value in opt.h for CHECKSUM_CHECK_ICMP: 1 -----*/
#define CHECKSUM_CHECK_ICMP 0
/*----- Value in opt.h for CHECKSUM_CHECK_ICMP6: 1 -----*/
#define CHECKSUM_CHECK_ICMP6 0
/*-----------------------------------------------------------------------------*/
/* Parameter(s) not set in STM32CubeMX LwIP Configuration GUI -*/
/* LwIP Parameter(s) not in opt.h -----------------------------*/
#define LWIP_PROVIDE_ERRNO 1
#define LWIP_TIMEVAL_PRIVATE 0
#define LWIP_DEBUG 1
#define LWIP_DNS 1
#define LWIP_SOCKET 1
#define LWIP_RAW 1
#define LWIP_NETCONN 1
/* USER CODE BEGIN 1 */
/* USER CODE END 1 */
#ifdef __cplusplus
}
#endif
#endif /*__LWIPOPTS__H_H */

View File

@@ -0,0 +1,401 @@
/* Example wolfSSL user settings for STM32F4 with CubeMX */
#ifndef WOLFSSL_USER_SETTINGS_H
#define WOLFSSL_USER_SETTINGS_H
#ifdef __cplusplus
extern "C" {
#endif
/* ------------------------------------------------------------------------- */
/* Platform */
/* ------------------------------------------------------------------------- */
#undef WOLFSSL_GENERAL_ALIGNMENT
#define WOLFSSL_GENERAL_ALIGNMENT 4
#undef SINGLE_THREADED
#define SINGLE_THREADED
#undef WOLFSSL_SMALL_STACK
#define WOLFSSL_SMALL_STACK
#undef WOLFSSL_STM32F4
#define WOLFSSL_STM32F4
#undef WOLFSSL_STM32_CUBEMX
#define WOLFSSL_STM32_CUBEMX
#undef FREERTOS
//#define FREERTOS
#undef WOLFSSL_LWIP
//#define WOLFSSL_LWIP
#define HAVE_LWIP_NATIVE
/* ------------------------------------------------------------------------- */
/* Math Configuration */
/* ------------------------------------------------------------------------- */
#undef USE_FAST_MATH
#define USE_FAST_MATH
#ifdef USE_FAST_MATH
#undef TFM_TIMING_RESISTANT
#define TFM_TIMING_RESISTANT
#undef TFM_NO_ASM
//#define TFM_NO_ASM
/* Optimizations (TFM_ARM, TFM_ASM or none) */
//#define TFM_ASM
#endif
/* ------------------------------------------------------------------------- */
/* Crypto */
/* ------------------------------------------------------------------------- */
/* ECC */
#if 1
#undef HAVE_ECC
#define HAVE_ECC
/* Manually define enabled curves */
#undef ECC_USER_CURVES
#define ECC_USER_CURVES
//#define HAVE_ECC192
//#define HAVE_ECC224
#undef NO_ECC256
//#define HAVE_ECC384
//#define HAVE_ECC521
/* Fixed point cache (speeds repeated operations against same private key) */
#undef FP_ECC
//#define FP_ECC
#ifdef FP_ECC
/* Bits / Entries */
#undef FP_ENTRIES
#define FP_ENTRIES 2
#undef FP_LUT
#define FP_LUT 4
#endif
/* Optional ECC calculation method */
/* Note: doubles heap usage, but slightly faster */
#undef ECC_SHAMIR
#define ECC_SHAMIR
/* Reduces heap usage, but slower */
#undef ECC_TIMING_RESISTANT
#define ECC_TIMING_RESISTANT
#ifdef USE_FAST_MATH
/* use reduced size math buffers for ecc points */
#undef ALT_ECC_SIZE
#define ALT_ECC_SIZE
/* optionally override the default max ecc bits */
//#undef FP_MAX_BITS_ECC
//#define FP_MAX_BITS_ECC 512
/* Enable TFM optimizations for ECC */
//#define TFM_ECC192
//#define TFM_ECC224
//#define TFM_ECC256
//#define TFM_ECC384
//#define TFM_ECC521
#endif
#endif
/* RSA */
#undef NO_RSA
#if 1
#ifdef USE_FAST_MATH
/* Maximum math bits (Max RSA key bits * 2) */
#undef FP_MAX_BITS
#define FP_MAX_BITS 4096
#endif
/* half as much memory but twice as slow */
#undef RSA_LOW_MEM
//#define RSA_LOW_MEM
/* Enables blinding mode, to prevent timing attacks */
#undef WC_RSA_BLINDING
#define WC_RSA_BLINDING
#else
#define NO_RSA
#endif
/* AES */
#undef NO_AES
#if 1
#undef HAVE_AESGCM
#define HAVE_AESGCM
#ifdef HAVE_AESGCM
/* GCM with hardware acceleration requires AES counter/direct for unaligned sizes */
#undef WOLFSSL_AES_COUNTER
#define WOLFSSL_AES_COUNTER
#undef WOLFSSL_AES_DIRECT
#define WOLFSSL_AES_DIRECT
#endif
/* GCM Method: GCM_SMALL, GCM_WORD32 or GCM_TABLE */
#undef GCM_SMALL
#define GCM_SMALL
#else
#define NO_AES
#endif
/* ChaCha20 / Poly1305 */
#undef HAVE_CHACHA
#undef HAVE_POLY1305
#if 0
#define HAVE_CHACHA
#define HAVE_POLY1305
/* Needed for Poly1305 */
#undef HAVE_ONE_TIME_AUTH
#define HAVE_ONE_TIME_AUTH
#endif
/* Ed25519 / Curve25519 */
#undef HAVE_CURVE25519
#undef HAVE_ED25519
#if 0
#define HAVE_CURVE25519
#define HAVE_ED25519
/* Optionally use small math (less flash usage, but much slower) */
#if 0
#define CURVED25519_SMALL
#endif
#endif
/* ------------------------------------------------------------------------- */
/* Hashing */
/* ------------------------------------------------------------------------- */
/* Sha */
#undef NO_SHA
#if 1
/* 1k smaller, but 25% slower */
//#define USE_SLOW_SHA
#else
#define NO_SHA
#endif
/* Sha256 */
#undef NO_SHA256
#if 1
#else
#define NO_SHA256
#endif
/* Sha512 */
#undef WOLFSSL_SHA512
#if 1
#define WOLFSSL_SHA512
/* Sha384 */
#undef WOLFSSL_SHA384
#if 1
#define WOLFSSL_SHA384
#endif
/* over twice as small, but 50% slower */
//#define USE_SLOW_SHA2
#endif
/* MD5 */
#undef NO_MD5
#if 1
/* enabled */
#else
#define NO_MD5
#endif
/* ------------------------------------------------------------------------- */
/* HW Crypto Acceleration */
/* ------------------------------------------------------------------------- */
// See settings.h STM32F4 section
/* ------------------------------------------------------------------------- */
/* Benchmark / Test */
/* ------------------------------------------------------------------------- */
/* Use reduced benchmark / test sizes */
#undef BENCH_EMBEDDED
#define BENCH_EMBEDDED
#undef USE_CERT_BUFFERS_2048
#define USE_CERT_BUFFERS_2048
#undef USE_CERT_BUFFERS_256
#define USE_CERT_BUFFERS_256
/* ------------------------------------------------------------------------- */
/* Debugging */
/* ------------------------------------------------------------------------- */
#undef WOLFSSL_DEBUG
//#define WOLFSSL_DEBUG
#ifdef WOLFSSL_DEBUG
/* Use this to measure / print heap usage */
#if 0
#undef USE_WOLFSSL_MEMORY
#define USE_WOLFSSL_MEMORY
#undef WOLFSSL_TRACK_MEMORY
#define WOLFSSL_TRACK_MEMORY
#endif
#else
#undef NO_WOLFSSL_MEMORY
#define NO_WOLFSSL_MEMORY
#undef NO_ERROR_STRINGS
//#define NO_ERROR_STRINGS
#endif
/* ------------------------------------------------------------------------- */
/* Port */
/* ------------------------------------------------------------------------- */
/* Override Current Time */
/* Allows custom "custom_time()" function to be used for benchmark */
#define WOLFSSL_USER_CURRTIME
/* ------------------------------------------------------------------------- */
/* RNG */
/* ------------------------------------------------------------------------- */
/* Size of returned HW RNG value */
#define CUSTOM_RAND_TYPE unsigned int
#define NO_OLD_RNGNAME
/* Choose RNG method */
#if 0
#if 1
/* Use built-in P-RNG (SHA256 based) with HW RNG */
/* P-RNG + HW RNG (P-RNG is ~8K) */
#undef HAVE_HASHDRBG
#define HAVE_HASHDRBG
extern unsigned int custom_rand_generate(void);
#undef CUSTOM_RAND_GENERATE
#define CUSTOM_RAND_GENERATE custom_rand_generate
#else
/* Bypass P-RNG and use only HW RNG */
extern int custom_rand_generate_block(unsigned char* output, unsigned int sz);
#undef CUSTOM_RAND_GENERATE_BLOCK
#define CUSTOM_RAND_GENERATE_BLOCK custom_rand_generate_block
#endif
#endif
/* ------------------------------------------------------------------------- */
/* Enable Features */
/* ------------------------------------------------------------------------- */
#undef KEEP_PEER_CERT
//#define KEEP_PEER_CERT
#undef HAVE_COMP_KEY
//#define HAVE_COMP_KEY
#undef HAVE_TLS_EXTENSIONS
#define HAVE_TLS_EXTENSIONS
#undef HAVE_SUPPORTED_CURVES
#define HAVE_SUPPORTED_CURVES
#undef WOLFSSL_BASE64_ENCODE
//#define WOLFSSL_BASE64_ENCODE
/* TLS Session Cache */
#if 0
#define SMALL_SESSION_CACHE
#else
#define NO_SESSION_CACHE
#endif
/* ------------------------------------------------------------------------- */
/* Disable Features */
/* ------------------------------------------------------------------------- */
#undef NO_WOLFSSL_SERVER
//#define NO_WOLFSSL_SERVER
#undef NO_WOLFSSL_CLIENT
//#define NO_WOLFSSL_CLIENT
#undef NO_CRYPT_TEST
//#define NO_CRYPT_TEST
#undef NO_CRYPT_BENCHMARK
//#define NO_CRYPT_BENCHMARK
/* In-lining of misc.c functions */
/* If defined, must include wolfcrypt/src/misc.c in build */
/* Slower, but about 1k smaller */
#undef NO_INLINE
//#define NO_INLINE
#undef NO_FILESYSTEM
#define NO_FILESYSTEM
#undef NO_WRITEV
#define NO_WRITEV
#undef NO_MAIN_DRIVER
#define NO_MAIN_DRIVER
#undef NO_DEV_RANDOM
#define NO_DEV_RANDOM
#undef NO_DSA
#define NO_DSA
#undef NO_DH
#define NO_DH
#undef NO_DES3
#define NO_DES3
#undef NO_RC4
#define NO_RC4
#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
#undef NO_MD4
#define NO_MD4
#undef NO_PWDBASED
#define NO_PWDBASED
#undef NO_CODING
#define NO_CODING
#ifdef __cplusplus
}
#endif
#endif /* WOLFSSL_USER_SETTINGS_H */

View File

@@ -0,0 +1,14 @@
/*
* wolfssl_example.h
*
* Created on: Oct 3, 2016
* Author: davidgarske
*/
#ifndef WOLFSSL_EXAMPLE_H_
#define WOLFSSL_EXAMPLE_H_
void wolfCryptDemo(void const * argument);
#endif /* WOLFSSL_EXAMPLE_H_ */

27
IDE/OPENSTM32/README.md Normal file
View File

@@ -0,0 +1,27 @@
# wolfSSL STM32F2/F4 Example for Open STM32 Tools System Workbench
## Requirements
* STM32CubeMX: STM32 CubeMX HAL code generation tool - [http://www.st.com/en/development-tools/stm32cubemx.html](http://www.st.com/en/development-tools/stm32cubemx.html)
* SystemWorkbench for STM32 - [http://www.st.com/en/development-tools/sw4stm32.html](http://www.st.com/en/development-tools/sw4stm32.html)
## Setup
1. Using the STM32CubeMX tool, load the `<wolfssl-root>/IDE/OPENSTM32/wolfSTM32.ino` file.
2. Adjust the HAL options based on your specific micro-controller.
3. Generate source code.
4. Run `SystemWorkbench` and choose a new workspace location for this project.
5. Import `wolfSTM32' project from `<wolfssl-root>/IDE/OPENSTM32/`.
6. Adjust the micro-controller define in `Project Settings -> C/C++ General -> Paths and Symbols -> Symbols -> GNU C`. Example uses `STM32F437xx`, but should be changed to reflect your micro-controller type.
7. Build and Run
Note: You may need to manually copy over the CubeMX HAL files for `stm32f4xx_hal_cryp.c`, `stm32f4xx_hal_cryp_ex.c`, `stm32f4xx_hal_cryp.h`, `stm32f4xx_hal_cryp_ex.h`. Also uncomment the `#define HAL_CRYP_MODULE_ENABLED` line in `stm32f4xx_hal_conf.h`.
## Configuration
The settings for the wolfSTM32 project are located in `<wolfssl-root>/IDE/OPENSTM32/Inc/user_settings.h`.
## Support
For questions please email [support@wolfssl.com](mailto:support@wolfssl.com)

384
IDE/OPENSTM32/Src/main.c Normal file
View File

@@ -0,0 +1,384 @@
/* Includes ------------------------------------------------------------------*/
#include "stm32f4xx.h"
#include "cmsis_os.h"
#include "lwip.h"
#include "wolfssl_example.h"
/* USER CODE BEGIN Includes */
/* USER CODE END Includes */
/* Private variables ---------------------------------------------------------*/
CRC_HandleTypeDef hcrc;
RNG_HandleTypeDef hrng;
RTC_HandleTypeDef hrtc;
UART_HandleTypeDef huart4;
osThreadId defaultTaskHandle;
/* USER CODE BEGIN PV */
/* Private variables ---------------------------------------------------------*/
/* USER CODE END PV */
/* Private function prototypes -----------------------------------------------*/
void SystemClock_Config(void);
void Error_Handler(void);
static void MX_GPIO_Init(void);
static void MX_CRC_Init(void);
static void MX_RNG_Init(void);
static void MX_UART4_Init(void);
static void MX_RTC_Init(void);
/* USER CODE BEGIN PFP */
/* Private function prototypes -----------------------------------------------*/
/* USER CODE END PFP */
/* USER CODE BEGIN 0 */
/* USER CODE END 0 */
int main(void)
{
/* USER CODE BEGIN 1 */
/* USER CODE END 1 */
/* MCU Configuration----------------------------------------------------------*/
/* Reset of all peripherals, Initializes the Flash interface and the Systick. */
HAL_Init();
/* Configure the system clock */
SystemClock_Config();
/* Initialize all configured peripherals */
MX_GPIO_Init();
MX_CRC_Init();
MX_RNG_Init();
MX_UART4_Init();
MX_RTC_Init();
/* USER CODE BEGIN 2 */
/* USER CODE END 2 */
/* USER CODE BEGIN RTOS_MUTEX */
/* add mutexes, ... */
/* USER CODE END RTOS_MUTEX */
/* USER CODE BEGIN RTOS_SEMAPHORES */
/* add semaphores, ... */
/* USER CODE END RTOS_SEMAPHORES */
/* USER CODE BEGIN RTOS_TIMERS */
/* start timers, add new ones, ... */
/* USER CODE END RTOS_TIMERS */
/* Create the thread(s) */
/* definition and creation of defaultTask */
osThreadDef(defaultTask, wolfCryptDemo, osPriorityNormal, 0, 24000);
defaultTaskHandle = osThreadCreate(osThread(defaultTask), NULL);
/* USER CODE BEGIN RTOS_THREADS */
/* add threads, ... */
/* USER CODE END RTOS_THREADS */
/* USER CODE BEGIN RTOS_QUEUES */
/* add queues, ... */
/* USER CODE END RTOS_QUEUES */
/* Start scheduler */
osKernelStart();
/* We should never get here as control is now taken by the scheduler */
/* Infinite loop */
/* USER CODE BEGIN WHILE */
while (1)
{
/* USER CODE END WHILE */
/* USER CODE BEGIN 3 */
}
/* USER CODE END 3 */
}
/** System Clock Configuration
*/
#define SysTick_IRQn -1
void SystemClock_Config(void)
{
RCC_OscInitTypeDef RCC_OscInitStruct;
RCC_ClkInitTypeDef RCC_ClkInitStruct;
RCC_PeriphCLKInitTypeDef PeriphClkInitStruct;
__HAL_RCC_PWR_CLK_ENABLE();
__HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE3);
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE|RCC_OSCILLATORTYPE_LSE;
RCC_OscInitStruct.HSEState = RCC_HSE_ON;
RCC_OscInitStruct.LSEState = RCC_LSE_ON;
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE;
RCC_OscInitStruct.PLL.PLLM = 15;
RCC_OscInitStruct.PLL.PLLN = 144;
RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV2;
RCC_OscInitStruct.PLL.PLLQ = 5;
if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK)
{
Error_Handler();
}
RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK
|RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2;
RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV4;
RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV2;
if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_3) != HAL_OK)
{
Error_Handler();
}
PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_RTC;
PeriphClkInitStruct.RTCClockSelection = RCC_RTCCLKSOURCE_LSE;
if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct) != HAL_OK)
{
Error_Handler();
}
HAL_SYSTICK_Config(HAL_RCC_GetHCLKFreq()/1000);
HAL_SYSTICK_CLKSourceConfig(SYSTICK_CLKSOURCE_HCLK);
/* SysTick_IRQn interrupt configuration */
HAL_NVIC_SetPriority(SysTick_IRQn, 15, 0);
}
/* CRC init function */
static void MX_CRC_Init(void)
{
hcrc.Instance = CRC;
if (HAL_CRC_Init(&hcrc) != HAL_OK)
{
Error_Handler();
}
}
/* RNG init function */
static void MX_RNG_Init(void)
{
hrng.Instance = RNG;
if (HAL_RNG_Init(&hrng) != HAL_OK)
{
Error_Handler();
}
}
/* RTC init function */
#define RTC_ASYNCH_PREDIV 0x7F /* LSE as RTC clock */
#define RTC_SYNCH_PREDIV 0x00FF /* LSE as RTC clock */
static void MX_RTC_Init(void)
{
RTC_TimeTypeDef sTime;
RTC_DateTypeDef sDate;
/**Initialize RTC and set the Time and Date
*/
hrtc.Instance = RTC;
hrtc.Init.HourFormat = RTC_HOURFORMAT_24;
hrtc.Init.AsynchPrediv = RTC_ASYNCH_PREDIV;
hrtc.Init.SynchPrediv = RTC_SYNCH_PREDIV;
hrtc.Init.OutPut = RTC_OUTPUT_DISABLE;
hrtc.Init.OutPutPolarity = RTC_OUTPUT_POLARITY_HIGH;
hrtc.Init.OutPutType = RTC_OUTPUT_TYPE_OPENDRAIN;
if (HAL_RTC_Init(&hrtc) != HAL_OK)
{
Error_Handler();
}
sTime.Hours = 0x0;
sTime.Minutes = 0x0;
sTime.Seconds = 0x0;
sTime.DayLightSaving = RTC_DAYLIGHTSAVING_NONE;
sTime.StoreOperation = RTC_STOREOPERATION_RESET;
if (HAL_RTC_SetTime(&hrtc, &sTime, RTC_FORMAT_BCD) != HAL_OK)
{
Error_Handler();
}
sDate.WeekDay = RTC_WEEKDAY_MONDAY;
sDate.Month = RTC_MONTH_JANUARY;
sDate.Date = 0x1;
sDate.Year = 0x0;
if (HAL_RTC_SetDate(&hrtc, &sDate, RTC_FORMAT_BCD) != HAL_OK)
{
Error_Handler();
}
/**Enable the TimeStamp
*/
if (HAL_RTCEx_SetTimeStamp(&hrtc, RTC_TIMESTAMPEDGE_RISING, RTC_TIMESTAMPPIN_DEFAULT) != HAL_OK)
{
Error_Handler();
}
/**Enable the reference Clock input
*/
if (HAL_RTCEx_SetRefClock(&hrtc) != HAL_OK)
{
Error_Handler();
}
}
/* UART4 init function */
static void MX_UART4_Init(void)
{
huart4.Instance = UART4;
huart4.Init.BaudRate = 115200;
huart4.Init.WordLength = UART_WORDLENGTH_8B;
huart4.Init.StopBits = UART_STOPBITS_1;
huart4.Init.Parity = UART_PARITY_NONE;
huart4.Init.Mode = UART_MODE_TX_RX;
huart4.Init.HwFlowCtl = UART_HWCONTROL_NONE;
huart4.Init.OverSampling = UART_OVERSAMPLING_16;
if (HAL_UART_Init(&huart4) != HAL_OK)
{
Error_Handler();
}
// Turn off buffers, so I/O occurs immediately
setvbuf(stdin, NULL, _IONBF, 0);
setvbuf(stdout, NULL, _IONBF, 0);
setvbuf(stderr, NULL, _IONBF, 0);
}
int _write (int fd, char *ptr, int len)
{
(void)fd;
/* Write "len" of char from "ptr" to file id "fd"
* Return number of char written.
* Need implementing with UART here. */
HAL_UART_Transmit(&huart4, (uint8_t *)ptr, len, 0xFFFF);
return len;
}
int _read (int fd, char *ptr, int len)
{
/* Read "len" of char to "ptr" from file id "fd"
* Return number of char read.
* Need implementing with UART here. */
(void)fd;
return HAL_UART_Receive(&huart4, (uint8_t*)ptr, len, 0xFFFF);
}
void _ttywrch(int ch) {
/* Write one char "ch" to the default console
* Need implementing with UART here. */
_write(0, (char*)&ch, 1);
}
/** Configure pins as
* Analog
* Input
* Output
* EVENT_OUT
* EXTI
*/
static void MX_GPIO_Init(void)
{
/* GPIO Ports Clock Enable */
__HAL_RCC_GPIOE_CLK_ENABLE();
__HAL_RCC_GPIOG_CLK_ENABLE();
__HAL_RCC_GPIOB_CLK_ENABLE();
__HAL_RCC_GPIOA_CLK_ENABLE();
__HAL_RCC_GPIOC_CLK_ENABLE();
__HAL_RCC_GPIOH_CLK_ENABLE();
}
/* USER CODE BEGIN 4 */
/* USER CODE END 4 */
/**
* @brief Period elapsed callback in non blocking mode
* @note This function is called when TIM1 interrupt took place, inside
* HAL_TIM_IRQHandler(). It makes a direct call to HAL_IncTick() to increment
* a global variable "uwTick" used as application time base.
* @param htim : TIM handle
* @retval None
*/
void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim)
{
/* USER CODE BEGIN Callback 0 */
/* USER CODE END Callback 0 */
if (htim->Instance == TIM1) {
HAL_IncTick();
}
/* USER CODE BEGIN Callback 1 */
/* USER CODE END Callback 1 */
}
/**
* @brief This function is executed in case of error occurrence.
* @param None
* @retval None
*/
void Error_Handler(void)
{
/* USER CODE BEGIN Error_Handler */
/* User can add his own implementation to report the HAL error return state */
while(1)
{
}
/* USER CODE END Error_Handler */
}
#ifdef USE_FULL_ASSERT
/**
* @brief Reports the name of the source file and the source line number
* where the assert_param error has occurred.
* @param file: pointer to the source file name
* @param line: assert_param error line source number
* @retval None
*/
void assert_failed(uint8_t* file, uint32_t line)
{
/* USER CODE BEGIN 6 */
/* User can add his own implementation to report the file name and line number,
ex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */
/* USER CODE END 6 */
}
#endif

View File

@@ -0,0 +1,101 @@
#include <string.h>
#include "stm32f4xx_hal.h"
#include "cmsis_os.h"
#include "lwip.h"
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <wolfssl/wolfcrypt/settings.h>
#include <wolfssl/ssl.h>
#include <wolfcrypt/test/test.h>
#include <wolfcrypt/benchmark/benchmark.h>
/*****************************************************************************
* Private types/enumerations/variables
****************************************************************************/
/* UART definitions */
extern UART_HandleTypeDef huart4;
/*****************************************************************************
* Public types/enumerations/variables
****************************************************************************/
typedef struct func_args {
int argc;
char** argv;
int return_code;
} func_args;
const char menu1[] = "\r\n"
"\tt. WolfSSL Test\r\n"
"\tb. WolfSSL Benchmark\r\n";
/*****************************************************************************
* Private functions
****************************************************************************/
/*****************************************************************************
* Public functions
****************************************************************************/
void wolfCryptDemo(void const * argument)
{
uint8_t buffer[1] = {'t'};
func_args args;
/* init code for LWIP */
MX_LWIP_Init();
while (1) {
printf("\r\n\t\t\t\tMENU\r\n");
printf(menu1);
printf("Please select one of the above options: ");
HAL_UART_Receive(&huart4, buffer, sizeof(buffer), 1000);
switch (buffer[0]) {
case 't':
memset(&args, 0, sizeof(args));
printf("\nCrypt Test\n");
wolfcrypt_test(&args);
printf("Crypt Test: Return code %d\n", args.return_code);
break;
case 'b':
memset(&args, 0, sizeof(args));
printf("\nBenchmark Test\n");
benchmark_test(&args);
printf("Benchmark Test: Return code %d\n", args.return_code);
break;
// All other cases go here
default: printf("\r\nSelection out of range\r\n"); break;
}
}
}
extern RTC_HandleTypeDef hrtc;
double current_time()
{
RTC_TimeTypeDef time;
RTC_DateTypeDef date;
uint32_t subsec;
/* must get time and date here due to STM32 HW bug */
HAL_RTC_GetTime(&hrtc, &time, FORMAT_BIN);
HAL_RTC_GetDate(&hrtc, &date, FORMAT_BIN);
subsec = (255 - time.SubSeconds) * 1000 / 255;
(void)date;
/* return seconds.milliseconds */
return ((double)time.Hours * 24) +
((double)time.Minutes * 60) +
(double)time.Seconds +
((double)subsec/1000);
}

15
IDE/OPENSTM32/include.am Normal file
View File

@@ -0,0 +1,15 @@
# vim:ft=automake
# included from Top Level Makefile.am
# All paths should be given relative to the root
EXTRA_DIST+= IDE/OPENSTM32/README.md
EXTRA_DIST+= IDE/OPENSTM32/.cproject
EXTRA_DIST+= IDE/OPENSTM32/.project
EXTRA_DIST+= IDE/OPENSTM32/wolfSTM32.cfg
EXTRA_DIST+= IDE/OPENSTM32/wolfSTM32.ioc
EXTRA_DIST+= IDE/OPENSTM32/wolfSTM32.xml
EXTRA_DIST+= IDE/OPENSTM32/Src/main.c
EXTRA_DIST+= IDE/OPENSTM32/Src/wolfssl_example.c
EXTRA_DIST+= IDE/OPENSTM32/Inc/user_settings.h
EXTRA_DIST+= IDE/OPENSTM32/Inc/wolfssl_example.h
EXTRA_DIST+= IDE/OPENSTM32/Inc/lwipopts.h

View File

@@ -0,0 +1,13 @@
# This is an wolfSTM32 board with a single STM32F437IIHx chip.
# Generated by System Workbench for STM32
source [find interface/stlink-v2-1.cfg]
set WORKAREASIZE 0x30000
transport select "hla_jtag"
set CPUTAPID 0x4ba00477
source [find target/stm32f4x_stlink.cfg]
# use hardware reset, connect under reset
reset_config srst_only srst_nogate

213
IDE/OPENSTM32/wolfSTM32.ioc Normal file
View File

@@ -0,0 +1,213 @@
#MicroXplorer Configuration settings - do not modify
FREERTOS.IPParameters=Tasks01
FREERTOS.Tasks01=defaultTask,0,128,StartDefaultTask,Default
File.Version=6
KeepUserPlacement=false
LWIP.Version=v1.5.0_RC0_20160211_Cube
Mcu.Family=STM32F4
Mcu.IP0=CRC
Mcu.IP1=ETH
Mcu.IP2=FREERTOS
Mcu.IP3=LWIP
Mcu.IP4=NVIC
Mcu.IP5=RCC
Mcu.IP6=RNG
Mcu.IP7=RTC
Mcu.IP8=SYS
Mcu.IP9=UART4
Mcu.IPNb=10
Mcu.Name=STM32F437I(G-I)Hx
Mcu.Package=UFBGA176
Mcu.Pin0=PE2
Mcu.Pin1=PG14
Mcu.Pin10=PC10
Mcu.Pin11=PC13
Mcu.Pin12=PC14/OSC32_IN
Mcu.Pin13=PC15/OSC32_OUT
Mcu.Pin14=PH2
Mcu.Pin15=PH0/OSC_IN
Mcu.Pin16=PH3
Mcu.Pin17=PH1/OSC_OUT
Mcu.Pin18=PC1
Mcu.Pin19=PC2
Mcu.Pin2=PG13
Mcu.Pin20=PC3
Mcu.Pin21=PH6
Mcu.Pin22=PA1
Mcu.Pin23=PC4
Mcu.Pin24=PH7
Mcu.Pin25=PA2
Mcu.Pin26=PC5
Mcu.Pin27=PA7
Mcu.Pin28=PB15
Mcu.Pin29=VP_CRC_VS_CRC
Mcu.Pin3=PB4
Mcu.Pin30=VP_FREERTOS_VS_ENABLE
Mcu.Pin31=VP_LWIP_VS_Enabled
Mcu.Pin32=VP_RNG_VS_RNG
Mcu.Pin33=VP_SYS_VS_tim1
Mcu.Pin4=PB3
Mcu.Pin5=PA15
Mcu.Pin6=PA14
Mcu.Pin7=PA13
Mcu.Pin8=PG11
Mcu.Pin9=PC11
Mcu.PinsNb=34
Mcu.UserConstants=
Mcu.UserName=STM32F437IIHx
MxCube.Version=4.16.1
MxDb.Version=DB.4.0.161
NVIC.BusFault_IRQn=true\:0\:0\:false\:false\:true\:false
NVIC.DebugMonitor_IRQn=true\:0\:0\:false\:false\:true\:false
NVIC.ETH_IRQn=true\:0\:0\:false\:false\:true\:false
NVIC.HardFault_IRQn=true\:0\:0\:false\:false\:true\:false
NVIC.MemoryManagement_IRQn=true\:0\:0\:false\:false\:true\:false
NVIC.NonMaskableInt_IRQn=true\:0\:0\:false\:false\:true\:false
NVIC.PendSV_IRQn=true\:15\:0\:false\:false\:false\:true
NVIC.PriorityGroup=NVIC_PRIORITYGROUP_4
NVIC.SVCall_IRQn=true\:0\:0\:false\:false\:false\:false
NVIC.SysTick_IRQn=true\:15\:0\:false\:false\:true\:true
NVIC.TIM1_UP_TIM10_IRQn=true\:0\:0\:false\:false\:true\:false
NVIC.TimeBase=TIM1_UP_TIM10_IRQn
NVIC.TimeBaseIP=TIM1
NVIC.UsageFault_IRQn=true\:0\:0\:false\:false\:true\:false
PA1.Mode=MII
PA1.Signal=ETH_RX_CLK
PA13.Mode=JTAG_5_pins
PA13.Signal=SYS_JTMS-SWDIO
PA14.Mode=JTAG_5_pins
PA14.Signal=SYS_JTCK-SWCLK
PA15.Mode=JTAG_5_pins
PA15.Signal=SYS_JTDI
PA2.Mode=MII
PA2.Signal=ETH_MDIO
PA7.Mode=MII
PA7.Signal=ETH_RX_DV
PB15.Mode=Reference_Clock_Detection_Activate
PB15.Signal=RTC_REFIN
PB3.Mode=JTAG_5_pins
PB3.Signal=SYS_JTDO-SWO
PB4.Mode=JTAG_5_pins
PB4.Signal=SYS_JTRST
PC1.Mode=MII
PC1.Signal=ETH_MDC
PC10.Mode=Asynchronous
PC10.Signal=UART4_TX
PC11.Mode=Asynchronous
PC11.Signal=UART4_RX
PC13.Mode=Timestamp enabled - Input Enabled to AF1
PC13.Signal=RTC_AF1
PC14/OSC32_IN.Mode=LSE-External-Oscillator
PC14/OSC32_IN.Signal=RCC_OSC32_IN
PC15/OSC32_OUT.Mode=LSE-External-Oscillator
PC15/OSC32_OUT.Signal=RCC_OSC32_OUT
PC2.Mode=MII
PC2.Signal=ETH_TXD2
PC3.Mode=MII
PC3.Signal=ETH_TX_CLK
PC4.Mode=MII
PC4.Signal=ETH_RXD0
PC5.Mode=MII
PC5.Signal=ETH_RXD1
PCC.Checker=false
PCC.Line=STM32F427/437
PCC.MCU=STM32F437I(G-I)Hx
PCC.MXVersion=4.16.1
PCC.PartNumber=STM32F437IIHx
PCC.Seq0=0
PCC.Series=STM32F4
PCC.Temperature=25
PCC.Vdd=null
PE2.Mode=MII
PE2.Signal=ETH_TXD3
PG11.Mode=MII
PG11.Signal=ETH_TX_EN
PG13.Mode=MII
PG13.Signal=ETH_TXD0
PG14.Mode=MII
PG14.Signal=ETH_TXD1
PH0/OSC_IN.Mode=HSE-External-Oscillator
PH0/OSC_IN.Signal=RCC_OSC_IN
PH1/OSC_OUT.Mode=HSE-External-Oscillator
PH1/OSC_OUT.Signal=RCC_OSC_OUT
PH2.Mode=MII
PH2.Signal=ETH_CRS
PH3.Mode=MII
PH3.Signal=ETH_COL
PH6.Mode=MII
PH6.Signal=ETH_RXD2
PH7.Mode=MII
PH7.Signal=ETH_RXD3
ProjectManager.AskForMigrate=true
ProjectManager.BackupPrevious=false
ProjectManager.CompilerOptimize=2
ProjectManager.ComputerToolchain=false
ProjectManager.CoupleFile=false
ProjectManager.DeletePrevious=true
ProjectManager.DeviceId=STM32F437IIHx
ProjectManager.FirmwarePackage=STM32Cube FW_F4 V1.13.0
ProjectManager.FreePins=false
ProjectManager.HalAssertFull=false
ProjectManager.HeapSize=0x10000
ProjectManager.KeepUserCode=true
ProjectManager.LastFirmware=true
ProjectManager.LibraryCopy=1
ProjectManager.PreviousToolchain=SW4STM32
ProjectManager.ProjectBuild=false
ProjectManager.ProjectFileName=wolfSTM32.ioc
ProjectManager.ProjectName=wolfSTM32
ProjectManager.StackSize=0x4000
ProjectManager.TargetToolchain=SW4STM32
ProjectManager.ToolChainLocation=
ProjectManager.UnderRoot=true
ProjectManager.functionlistsort=1-MX_GPIO_Init-GPIO-false,2-MX_CRC_Init-CRC-false,3-MX_RNG_Init-RNG-false,4-MX_UART4_Init-UART4-false,5-MX_LWIP_Init-LWIP-false,6-MX_RTC_Init-RTC-false
RCC.48MHZClocksFreq_Value=48000000
RCC.AHBFreq_Value=120000000
RCC.APB1CLKDivider=RCC_HCLK_DIV4
RCC.APB1Freq_Value=30000000
RCC.APB1TimFreq_Value=60000000
RCC.APB2CLKDivider=RCC_HCLK_DIV2
RCC.APB2Freq_Value=60000000
RCC.APB2TimFreq_Value=120000000
RCC.CortexFreq_Value=120000000
RCC.EthernetFreq_Value=120000000
RCC.FCLKCortexFreq_Value=120000000
RCC.FamilyName=M
RCC.HCLKFreq_Value=120000000
RCC.HSE_VALUE=25000000
RCC.HSI_VALUE=16000000
RCC.I2SClocksFreq_Value=160000000
RCC.IPParameters=48MHZClocksFreq_Value,AHBFreq_Value,APB1CLKDivider,APB1Freq_Value,APB1TimFreq_Value,APB2CLKDivider,APB2Freq_Value,APB2TimFreq_Value,CortexFreq_Value,EthernetFreq_Value,FCLKCortexFreq_Value,FamilyName,HCLKFreq_Value,HSE_VALUE,HSI_VALUE,I2SClocksFreq_Value,LSI_VALUE,MCO2PinFreq_Value,PLLCLKFreq_Value,PLLM,PLLN,PLLQ,PLLQCLKFreq_Value,PLLSourceVirtual,RCC_RTC_Clock_Source,RTCFreq_Value,RTCHSEDivFreq_Value,SAI_AClocksFreq_Value,SAI_BClocksFreq_Value,SYSCLKFreq_VALUE,SYSCLKSource,VCOI2SOutputFreq_Value,VCOInputFreq_Value,VCOOutputFreq_Value,VCOSAIOutputFreq_Value,VCOSAIOutputFreq_ValueQ,VcooutputI2S,VcooutputI2SQ
RCC.LSI_VALUE=32000
RCC.MCO2PinFreq_Value=120000000
RCC.PLLCLKFreq_Value=120000000
RCC.PLLM=15
RCC.PLLN=144
RCC.PLLQ=5
RCC.PLLQCLKFreq_Value=48000000
RCC.PLLSourceVirtual=RCC_PLLSOURCE_HSE
RCC.RCC_RTC_Clock_Source=RCC_RTCCLKSOURCE_LSE
RCC.RTCFreq_Value=32768
RCC.RTCHSEDivFreq_Value=12500000
RCC.SAI_AClocksFreq_Value=20416666.666666668
RCC.SAI_BClocksFreq_Value=20416666.666666668
RCC.SYSCLKFreq_VALUE=120000000
RCC.SYSCLKSource=RCC_SYSCLKSOURCE_PLLCLK
RCC.VCOI2SOutputFreq_Value=320000000
RCC.VCOInputFreq_Value=1666666.6666666667
RCC.VCOOutputFreq_Value=240000000
RCC.VCOSAIOutputFreq_Value=81666666.66666667
RCC.VCOSAIOutputFreq_ValueQ=20416666.666666668
RCC.VcooutputI2S=160000000
RCC.VcooutputI2SQ=160000000
VP_CRC_VS_CRC.Mode=CRC_Activate
VP_CRC_VS_CRC.Signal=CRC_VS_CRC
VP_FREERTOS_VS_ENABLE.Mode=Enabled
VP_FREERTOS_VS_ENABLE.Signal=FREERTOS_VS_ENABLE
VP_LWIP_VS_Enabled.Mode=Enabled
VP_LWIP_VS_Enabled.Signal=LWIP_VS_Enabled
VP_RNG_VS_RNG.Mode=RNG_Activate
VP_RNG_VS_RNG.Signal=RNG_VS_RNG
VP_SYS_VS_tim1.Mode=TIM1
VP_SYS_VS_tim1.Signal=SYS_VS_tim1
board=wolfSTM32

View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<targetDefinitions xmlns="http://openstm32.org/stm32TargetDefinitions" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://openstm32.org/stm32TargetDefinitions stm32TargetDefinitions.xsd">
<board id="wolfstm32">
<name>wolfSTM32</name>
<mcuId>stm32f437iihx</mcuId>
<dbgIF>JTAG</dbgIF>
<dbgDEV>ST-LinkV2-1</dbgDEV>
</board>
</targetDefinitions>

View File

@@ -29,6 +29,12 @@ void __assert(const char *__expression, const char *__filename, int __line)
printf("Assert: %s, File %s (%d)\n", __expression, __filename, __line);
}
unsigned long ksdk_time(unsigned long* timer)
{
(void)timer;
return hw_get_time_sec();
}
unsigned int LowResTimer(void)
{
return hw_get_time_sec();

View File

@@ -7,6 +7,8 @@
extern "C" {
#endif
#include <stddef.h> /* for size_t */
/* ------------------------------------------------------------------------- */
/* Platform */
/* ------------------------------------------------------------------------- */
@@ -118,6 +120,11 @@ extern "C" {
/* half as much memory but twice as slow */
#undef RSA_LOW_MEM
//#define RSA_LOW_MEM
/* Enables blinding mode, to prevent timing attacks */
#undef WC_RSA_BLINDING
#define WC_RSA_BLINDING
#else
#define NO_RSA
#endif
@@ -270,6 +277,8 @@ extern "C" {
/* Allows custom "custom_time()" function to be used for benchmark */
#define WOLFSSL_USER_CURRTIME
#define USER_TICKS
extern unsigned long ksdk_time(unsigned long* timer);
#define XTIME ksdk_time
/* ------------------------------------------------------------------------- */

View File

@@ -22,20 +22,25 @@
#define NO_RABBIT
#define NO_DSA
#define NO_MD4
#elif defined(WOLFSSL_LIB)
/* The lib */
#define OPENSSL_EXTRA
#define WOLFSSL_RIPEMD
#define WOLFSSL_SHA512
#define NO_PSK
#define HAVE_EXTENDED_MASTER
#define WOLFSSL_SNIFFER
#define HAVE_TLS_EXTENSIONS
#define HAVE_SECURE_RENEGOTIATION
#else
/* The servers and clients */
#define OPENSSL_EXTRA
#define NO_PSK
/* Enables blinding mode, to prevent timing attacks */
#define WC_RSA_BLINDING
#if defined(WOLFSSL_LIB)
/* The lib */
#define OPENSSL_EXTRA
#define WOLFSSL_RIPEMD
#define WOLFSSL_SHA512
#define NO_PSK
#define HAVE_EXTENDED_MASTER
#define WOLFSSL_SNIFFER
#define HAVE_TLS_EXTENSIONS
#define HAVE_SECURE_RENEGOTIATION
#else
/* The servers and clients */
#define OPENSSL_EXTRA
#define NO_PSK
#endif
#endif /* HAVE_FIPS */
#endif /* _WIN_USER_SETTINGS_H_ */

View File

@@ -1,5 +1,5 @@
## Wind River Workbench using VxWorks with wolfSSL
####1 Steps to Add wolfSSL to Workbench Project
#### 1 Steps to Add wolfSSL to Workbench Project
1. Start by creating a new VxWorks image in Workbench by going to File > New >
Project and then selecting VxWorks Image Project.
@@ -52,8 +52,8 @@ workspace folder. This is where the simulator looks for the filesystem.
new project you created. Click "Ok".
- Rebuild the project.
####2 Testing wolfSSL with VxWorks:
#####2.1 wolfCrypt Test and Benchmark Applications
#### 2 Testing wolfSSL with VxWorks:
##### 2.1 wolfCrypt Test and Benchmark Applications
The wolfCrypt test application will test each of the cryptographic algorithms
and output the status for each as a success or failure. The benchmark application will output the runtime of the cryptographic algorithms in milliseconds.
@@ -85,7 +85,7 @@ by adding the following to the usrAppInit() function:
4. To run the VxWorks simulator, click the dropdown list next to "VxWorks Simulator" at the top of Workbench and go to "Open Connection Details". Add the correct Kernel Image file. This will be located in ```workspace/<project_name>/default/vxWorks```. Click Apply. Start the simulator by clicking the green, "Connect 'VxWorks Simulator'" button to the right of the "VxWorks Simulator" dropdown list. Verify in the simulator terminal that all wolfCrypt tests pass.
#####2.2 Example Client
##### 2.2 Example Client
The wolfSSL example client.c file can be found in ```<path_to_wolfssl>/wolfssl/examples/client```.
1. Add the following include to usrAppInit.c:
@@ -117,7 +117,7 @@ section, and add a call to the client function:
SSL cipher suite is TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
Server response: I hear you fa shizzle!
#####2.3 Example Server
##### 2.3 Example Server
The example server requires more configuration than the client if using the
VxWorks simulator.
@@ -164,7 +164,7 @@ Note: The wolfSSL example server and client cannot run at the same time on the V
SSL cipher suite is TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
Client message: hello wolfssl!
####3 Necessary Files if Using VxWorks Simulator
#### 3 Necessary Files if Using VxWorks Simulator
The following files are required to replicate this build:
* vxsim\_linux\_1\_0\_2\_2 (directory)
* compilers/gnu-4.8.1.5/include/c++/4.8

View File

@@ -5,9 +5,11 @@
include IDE/iOS/include.am
include IDE/WIN/include.am
include IDE/WIN-SGX/include.am
include IDE/LINUX-SGX/include.am
include IDE/WORKBENCH/include.am
include IDE/ROWLEY-CROSSWORKS-ARM/include.am
include IDE/ARDUINO/include.am
include IDE/INTIME-RTOS/include.am
include IDE/OPENSTM32/include.am
EXTRA_DIST+= IDE/IAR-EWARM IDE/MDK-ARM IDE/MDK5-ARM IDE/MYSQL IDE/LPCXPRESSO IDE/HEXIWEAR

73
README
View File

@@ -34,6 +34,77 @@ before calling wolfSSL_new(); Though it's not recommended.
*** end Notes ***
********* wolfSSL (Formerly CyaSSL) Release 3.12.0 (8/04/2017)
Release 3.12.0 of wolfSSL has bug fixes and new features including:
- TLS 1.3 with Nginx! TLS 1.3 with ARMv8! TLS 1.3 with Async Crypto! (--enable-tls13)
- TLS 1.3 0RTT feature added
- Added port for using Intel SGX with Linux
- Update and fix PIC32MZ port
- Additional unit testing for MD5, SHA, SHA224, SHA256, SHA384, SHA512, RipeMd, HMAC, 3DES, IDEA, ChaCha20, ChaCha20Poly1305 AEAD, Camellia, Rabbit, ARC4, AES, RSA, Hc128
- AVX and AVX2 assembly for improved ChaCha20 performance
- Intel QAT fixes for when using --disable-fastmath
- Update how DTLS handles decryption and MAC failures
- Update DTLS session export version number for --enable-sessionexport feature
- Add additional input argument sanity checks to ARMv8 assembly port
- Fix for making PKCS12 dynamic types match
- Fixes for potential memory leaks when using --enable-fast-rsa
- Fix for when using custom ECC curves and add BRAINPOOLP256R1 test
- Update TI-RTOS port for dependency on new wolfSSL source files
- DTLS multicast feature added, --enable-mcast
- Fix for Async crypto with GCC 7.1 and HMAC when not using Intel QuickAssist
- Improvements and enhancements to Intel QuickAssist support
- Added Xilinx port
- Added SHA3 Keccak feature, --enable-sha3
- Expand wolfSSL Python wrapper to now include a client side implementation
- Adjust example servers to not treat a peer closed error as a hard error
- Added more sanity checks to fp_read_unsigned_bin function
- Add SHA224 and AES key wrap to ARMv8 port
- Update MQX classics and mmCAU ports
- Fix for potential buffer over read with wolfSSL_CertPemToDer
- Add PKCS7/CMS decode support for KARI with IssuerAndSerialNumber
- Fix ThreadX/NetX warning
- Fixes for OCSP and CRL non blocking sockets and for incomplete cert chain with OCSP
- Added RSA PSS sign and verify
- Fix for STM32F4 AES-GCM
- Added enable all feature (--enable-all)
- Added trackmemory feature (--enable-trackmemory)
- Fixes for AES key wrap and PKCS7 on Windows VS
- Added benchmark block size argument
- Support use of staticmemory with PKCS7
- Fix for Blake2b build with GCC 5.4
- Fixes for compiling wolfSSL with GCC version 7, most dealing with switch statement fall through warnings.
- Added warning when compiling without hardened math operations
Note:
There is a known issue with using ChaCha20 AVX assembly on versions of GCC earlier than 5.2. This is encountered with using the wolfSSL enable options --enable-intelasm and --enable-chacha. To avoid this issue ChaCha20 can be enabled with --enable-chacha=noasm.
If using --enable-intelasm and also using --enable-sha224 or --enable-sha256 there is a known issue with trying to use -fsanitize=address.
This release of wolfSSL fixes 1 low level security vulnerability.
Low level fix for a potential DoS attack on a wolfSSL client. Previously a client would accept many warning alert messages without a limit. This fix puts a limit to the number of warning alert messages received and if this limit is reached a fatal error ALERT_COUNT_E is returned. The max number of warning alerts by default is set to 5 and can be adjusted with the macro WOLFSSL_ALERT_COUNT_MAX. Thanks for the report from Tarun Yadav and Koustav Sadhukhan from Defence Research and Development Organization, INDIA.
See INSTALL file for build instructions.
More info can be found on-line at http://wolfssl.com/wolfSSL/Docs.html
********* wolfSSL (Formerly CyaSSL) Release 3.11.1 (5/11/2017)
Release 3.11.1 of wolfSSL is a TLS 1.3 BETA release, which includes:
- TLS 1.3 client and server support for TLS 1.3 with Draft 18 support
This is strictly a BETA release, and designed for testing and user feedback.
Please send any comments, testing results, or feedback to wolfSSL at
support@wolfssl.com.
See INSTALL file for build instructions.
More info can be found on-line at http://wolfssl.com/wolfSSL/Docs.html
********* wolfSSL (Formerly CyaSSL) Release 3.11.0 (5/04/2017)
Release 3.11.0 of wolfSSL has bug fixes and new features including:
@@ -45,7 +116,7 @@ Release 3.11.0 of wolfSSL has bug fixes and new features including:
- Update Arduino script to handle recent files and additions
- Added support for PKCS#7 Signed Data with ECDSA
- Fix for interoperability with ChaCha20-Poly1305 suites using older draft versions
- DTLS update to allow multiple handshake messages in one DTLS record
- DTLS update to allow multiple handshake messages in one DTLS record. Thanks to Eric Samsel over at Welch Allyn for reporting this bug.
- Intel QuickAssist asynchronous support (PR #715 - https://www.wolfssl.com/wolfSSL/Blog/Entries/2017/1/18_wolfSSL_Asynchronous_Intel_QuickAssist_Support.html)
- Added support for HAproxy load balancer
- Added option to allow SHA1 with TLS 1.2 for IIS compatibility (WOLFSSL_ALLOW_TLS_SHA1)

View File

@@ -38,6 +38,77 @@ wolfSSL_CTX_set_verify(ctx, SSL_VERIFY_NONE, 0);
before calling wolfSSL_new(); Though it's not recommended.
```
# wolfSSL (Formerly CyaSSL) Release 3.12.0 (8/04/2017)
## Release 3.12.0 of wolfSSL has bug fixes and new features including:
- TLS 1.3 with Nginx! TLS 1.3 with ARMv8! TLS 1.3 with Async Crypto! (--enable-tls13)
- TLS 1.3 0RTT feature added
- Added port for using Intel SGX with Linux
- Update and fix PIC32MZ port
- Additional unit testing for MD5, SHA, SHA224, SHA256, SHA384, SHA512, RipeMd, HMAC, 3DES, IDEA, ChaCha20, ChaCha20Poly1305 AEAD, Camellia, Rabbit, ARC4, AES, RSA, Hc128
- AVX and AVX2 assembly for improved ChaCha20 performance
- Intel QAT fixes for when using --disable-fastmath
- Update how DTLS handles decryption and MAC failures
- Update DTLS session export version number for --enable-sessionexport feature
- Add additional input argument sanity checks to ARMv8 assembly port
- Fix for making PKCS12 dynamic types match
- Fixes for potential memory leaks when using --enable-fast-rsa
- Fix for when using custom ECC curves and add BRAINPOOLP256R1 test
- Update TI-RTOS port for dependency on new wolfSSL source files
- DTLS multicast feature added, --enable-mcast
- Fix for Async crypto with GCC 7.1 and HMAC when not using Intel QuickAssist
- Improvements and enhancements to Intel QuickAssist support
- Added Xilinx port
- Added SHA3 Keccak feature, --enable-sha3
- Expand wolfSSL Python wrapper to now include a client side implementation
- Adjust example servers to not treat a peer closed error as a hard error
- Added more sanity checks to fp_read_unsigned_bin function
- Add SHA224 and AES key wrap to ARMv8 port
- Update MQX classics and mmCAU ports
- Fix for potential buffer over read with wolfSSL_CertPemToDer
- Add PKCS7/CMS decode support for KARI with IssuerAndSerialNumber
- Fix ThreadX/NetX warning
- Fixes for OCSP and CRL non blocking sockets and for incomplete cert chain with OCSP
- Added RSA PSS sign and verify
- Fix for STM32F4 AES-GCM
- Added enable all feature (--enable-all)
- Added trackmemory feature (--enable-trackmemory)
- Fixes for AES key wrap and PKCS7 on Windows VS
- Added benchmark block size argument
- Support use of staticmemory with PKCS7
- Fix for Blake2b build with GCC 5.4
- Fixes for compiling wolfSSL with GCC version 7, most dealing with switch statement fall through warnings.
- Added warning when compiling without hardened math operations
Note:
There is a known issue with using ChaCha20 AVX assembly on versions of GCC earlier than 5.2. This is encountered with using the wolfSSL enable options --enable-intelasm and --enable-chacha. To avoid this issue ChaCha20 can be enabled with --enable-chacha=noasm.
If using --enable-intelasm and also using --enable-sha224 or --enable-sha256 there is a known issue with trying to use -fsanitize=address.
This release of wolfSSL fixes 1 low level security vulnerability.
Low level fix for a potential DoS attack on a wolfSSL client. Previously a client would accept many warning alert messages without a limit. This fix puts a limit to the number of warning alert messages received and if this limit is reached a fatal error ALERT_COUNT_E is returned. The max number of warning alerts by default is set to 5 and can be adjusted with the macro WOLFSSL_ALERT_COUNT_MAX. Thanks for the report from Tarun Yadav and Koustav Sadhukhan from Defence Research and Development Organization, INDIA.
See INSTALL file for build instructions.
More info can be found on-line at http://wolfssl.com/wolfSSL/Docs.html
# wolfSSL (Formerly CyaSSL) Release 3.11.1 (5/11/2017)
## Release 3.11.1 of wolfSSL is a TLS 1.3 BETA release, which includes:
- TLS 1.3 client and server support for TLS 1.3 with Draft 18 support
This is strictly a BETA release, and designed for testing and user feedback.
Please send any comments, testing results, or feedback to wolfSSL at
support@wolfssl.com.
See INSTALL file for build instructions.
More info can be found on-line at http://wolfssl.com/wolfSSL/Docs.html
# wolfSSL (Formerly CyaSSL) Release 3.11.0 (5/04/2017)
## Release 3.11.0 of wolfSSL has bug fixes and new features including:
@@ -49,7 +120,7 @@ before calling wolfSSL_new(); Though it's not recommended.
- Update Arduino script to handle recent files and additions
- Added support for PKCS#7 Signed Data with ECDSA
- Fix for interoperability with ChaCha20-Poly1305 suites using older draft versions
- DTLS update to allow multiple handshake messages in one DTLS record
- DTLS update to allow multiple handshake messages in one DTLS record. Thanks to Eric Samsel over at Welch Allyn for reporting this bug.
- Intel QuickAssist asynchronous support (PR #715 - https://www.wolfssl.com/wolfSSL/Blog/Entries/2017/1/18_wolfSSL_Asynchronous_Intel_QuickAssist_Support.html)
- Added support for HAproxy load balancer
- Added option to allow SHA1 with TLS 1.2 for IIS compatibility (WOLFSSL_ALLOW_TLS_SHA1)
@@ -84,7 +155,6 @@ session ID as part of session tickets
- Added a sanity check for minimum authentication tag size with AES-GCM. Thanks to Yueh-Hsun Lin and Peng Li at KNOX Security at Samsung Research America for suggesting this.
- Added a sanity check that subject key identifier is marked as non-critical and a check that no policy OIDS appear more than once in the cert policies extension. Thanks to the report from Professor Zhenhua Duan, Professor Cong Tian, and Ph.D candidate Chu Chen from Institute of Computing Theory and Technology (ICTT) of Xidian University, China. Profs. Zhenhua Duan and Cong Tian are supervisors of Ph.D candidate Chu Chen.
This release of wolfSSL fixes 5 low and 1 medium level security vulnerability.
3 Low level fixes reported by Yueh-Hsun Lin and Peng Li from KNOX Security, Samsung Research America.

80
certs/crl/crl2.pem Normal file
View File

@@ -0,0 +1,80 @@
Certificate Revocation List (CRL):
Version 2 (0x1)
Signature Algorithm: sha256WithRSAEncryption
Issuer: /C=US/ST=Montana/L=Bozeman/O=Sawtooth/OU=Consulting/CN=www.wolfssl.com/emailAddress=info@wolfssl.com
Last Update: Aug 11 20:07:38 2016 GMT
Next Update: May 8 20:07:38 2019 GMT
CRL extensions:
X509v3 CRL Number:
1
Revoked Certificates:
Serial Number: 02
Revocation Date: Aug 11 20:07:38 2016 GMT
Signature Algorithm: sha256WithRSAEncryption
35:c6:7f:57:9a:e5:86:5a:15:1a:e2:e5:2b:9f:54:79:2a:58:
51:a2:12:0c:4e:53:58:eb:99:e3:c2:ee:2b:d7:23:e4:3c:4d:
0a:ab:ae:71:9b:ce:b1:c1:75:a1:b6:e5:32:5f:10:b0:72:28:
2e:74:b1:99:dd:47:53:20:f6:9a:83:5c:bd:20:b0:aa:df:32:
f6:95:54:98:9e:59:96:55:7b:0a:74:be:94:66:44:b7:32:82:
f0:eb:16:f8:30:86:16:9f:73:43:98:82:b5:5e:ad:58:c0:c8:
79:da:ad:b1:b4:d7:fb:34:c1:cc:3a:67:af:a4:56:5a:70:5c:
2d:1f:73:16:78:92:01:06:e3:2c:fb:f1:ba:d5:8f:f9:be:dd:
e1:4a:ce:de:ca:e6:2d:96:09:24:06:40:9e:10:15:2e:f2:cd:
85:d6:84:88:db:9c:4a:7b:75:7a:06:0e:40:02:20:60:7e:91:
f7:92:53:1e:34:7a:ea:ee:df:e7:cd:a8:9e:a6:61:b4:56:50:
4d:dc:b1:78:0d:86:cf:45:c3:a6:0a:b9:88:2c:56:a7:b1:d3:
d3:0d:44:aa:93:a4:05:4d:ce:9f:01:b0:c6:1e:e4:ea:6b:92:
6f:93:dd:98:cf:fb:1d:06:72:ac:d4:99:e7:f2:b4:11:57:bd:
9d:63:e5:dc
-----BEGIN X509 CRL-----
MIICBDCB7QIBATANBgkqhkiG9w0BAQsFADCBlDELMAkGA1UEBhMCVVMxEDAOBgNV
BAgMB01vbnRhbmExEDAOBgNVBAcMB0JvemVtYW4xETAPBgNVBAoMCFNhd3Rvb3Ro
MRMwEQYDVQQLDApDb25zdWx0aW5nMRgwFgYDVQQDDA93d3cud29sZnNzbC5jb20x
HzAdBgkqhkiG9w0BCQEWEGluZm9Ad29sZnNzbC5jb20XDTE2MDgxMTIwMDczOFoX
DTE5MDUwODIwMDczOFowFDASAgECFw0xNjA4MTEyMDA3MzhaoA4wDDAKBgNVHRQE
AwIBATANBgkqhkiG9w0BAQsFAAOCAQEANcZ/V5rlhloVGuLlK59UeSpYUaISDE5T
WOuZ48LuK9cj5DxNCquucZvOscF1obblMl8QsHIoLnSxmd1HUyD2moNcvSCwqt8y
9pVUmJ5ZllV7CnS+lGZEtzKC8OsW+DCGFp9zQ5iCtV6tWMDIedqtsbTX+zTBzDpn
r6RWWnBcLR9zFniSAQbjLPvxutWP+b7d4UrO3srmLZYJJAZAnhAVLvLNhdaEiNuc
Snt1egYOQAIgYH6R95JTHjR66u7f582onqZhtFZQTdyxeA2Gz0XDpgq5iCxWp7HT
0w1EqpOkBU3OnwGwxh7k6muSb5PdmM/7HQZyrNSZ5/K0EVe9nWPl3A==
-----END X509 CRL-----
Certificate Revocation List (CRL):
Version 2 (0x1)
Signature Algorithm: sha256WithRSAEncryption
Issuer: /C=US/ST=Montana/L=Bozeman/O=wolfSSL_2048/OU=Programming-2048/CN=www.wolfssl.com/emailAddress=info@wolfssl.com
Last Update: Aug 11 20:07:38 2016 GMT
Next Update: May 8 20:07:38 2019 GMT
CRL extensions:
X509v3 CRL Number:
3
No Revoked Certificates.
Signature Algorithm: sha256WithRSAEncryption
14:85:d5:c8:db:62:74:48:94:5e:dc:52:0f:5e:43:8b:29:83:
32:e0:7a:4c:5c:76:e3:7e:c1:87:74:40:b2:6f:f8:33:4c:2c:
32:08:f0:5f:d9:85:b3:20:05:34:5d:15:4d:ba:45:bc:2d:9c:
ae:40:d0:d8:9a:b3:a1:4f:0b:94:ce:c4:23:c6:bf:a2:f8:a6:
02:4c:6d:ad:5a:59:b3:83:55:dd:37:91:f6:75:d4:6f:83:5f:
1c:29:94:cd:01:09:dc:38:d8:6c:c0:9f:1e:76:9d:f9:8f:70:
0d:48:e5:99:82:90:3a:36:f1:33:17:69:73:8a:ee:a7:22:4c:
58:93:a1:dc:59:b9:44:8f:88:99:0b:c4:d3:74:aa:02:9a:84:
36:48:d8:a0:05:73:bc:14:32:1e:76:23:85:c5:94:56:b2:2c:
61:3b:07:d7:bd:0c:27:f7:d7:23:40:bd:0c:6c:c7:e0:f7:28:
74:67:98:20:93:72:16:b6:6e:67:3f:9e:c9:34:c5:64:09:bf:
b1:ab:87:0c:80:b6:1f:89:d8:0e:67:c2:c7:19:df:ee:9f:b2:
e6:fb:64:3d:82:7a:47:e2:8d:a3:93:1d:29:f6:94:db:83:2f:
b6:0a:a0:da:77:e3:56:ec:d7:d2:22:3c:88:4d:4a:87:de:b5:
1c:eb:7b:08
-----BEGIN X509 CRL-----
MIIB+DCB4QIBATANBgkqhkiG9w0BAQsFADCBnjELMAkGA1UEBhMCVVMxEDAOBgNV
BAgMB01vbnRhbmExEDAOBgNVBAcMB0JvemVtYW4xFTATBgNVBAoMDHdvbGZTU0xf
MjA0ODEZMBcGA1UECwwQUHJvZ3JhbW1pbmctMjA0ODEYMBYGA1UEAwwPd3d3Lndv
bGZzc2wuY29tMR8wHQYJKoZIhvcNAQkBFhBpbmZvQHdvbGZzc2wuY29tFw0xNjA4
MTEyMDA3MzhaFw0xOTA1MDgyMDA3MzhaoA4wDDAKBgNVHRQEAwIBAzANBgkqhkiG
9w0BAQsFAAOCAQEAFIXVyNtidEiUXtxSD15DiymDMuB6TFx2437Bh3RAsm/4M0ws
MgjwX9mFsyAFNF0VTbpFvC2crkDQ2JqzoU8LlM7EI8a/ovimAkxtrVpZs4NV3TeR
9nXUb4NfHCmUzQEJ3DjYbMCfHnad+Y9wDUjlmYKQOjbxMxdpc4rupyJMWJOh3Fm5
RI+ImQvE03SqApqENkjYoAVzvBQyHnYjhcWUVrIsYTsH170MJ/fXI0C9DGzH4Pco
dGeYIJNyFrZuZz+eyTTFZAm/sauHDIC2H4nYDmfCxxnf7p+y5vtkPYJ6R+KNo5Md
KfaU24Mvtgqg2nfjVuzX0iI8iE1Kh961HOt7CA==
-----END X509 CRL-----

View File

@@ -6,7 +6,8 @@ EXTRA_DIST += \
certs/crl/crl.pem \
certs/crl/cliCrl.pem \
certs/crl/eccSrvCRL.pem \
certs/crl/eccCliCRL.pem
certs/crl/eccCliCRL.pem \
certs/crl/crl2.pem
EXTRA_DIST += \
certs/crl/crl.revoked

View File

@@ -0,0 +1,8 @@
-----BEGIN CERTIFICATE-----
MIIBJDCByaADAgECAgEAMAwGCCqGSM49BAMCBQAwGjELMAkGA1UEChMCV1IxCzAJBgNVBAYTAkRF
MB4XDTE3MDIwNjE0NTY0MVoXDTE4MDIwNjE0NTY0MVowGjELMAkGA1UEChMCV1IxCzAJBgNVBAYT
AkRFMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEJcD9Frgr8rgKHt2szmJSfFgKYH1Xddq9EcHV
KupUa3bmPTb33VGXa6gm/numvZZVhVCdmn5pAdhDRYnZ/korJjAMBggqhkjOPQQDAgUAA0gAMEUC
IDnBQOHgHIudh7nFB0wG/WFMoUutVFN0uQPbVJSWwbQHAiEAmw25n+eEMgMK4Gi7qH1lzxm11WX0
jM1gxQSGZTaja8s=
-----END CERTIFICATE-----

View File

@@ -0,0 +1,4 @@
-----BEGIN PRIVATE KEY-----
MEECAQAwEwYHKoZIzj0CAQYIKoZIzj0DAQcEJzAlAgEBBCBmlE/nixmHCpmplUopbqNEo+jJE40p
wfkxzH01tAWqcQ==
-----END PRIVATE KEY-----

4
certs/ecc-privkey.pem Normal file
View File

@@ -0,0 +1,4 @@
-----BEGIN EC PRIVATE KEY-----
MDECAQEEIEW2aQJznGyFoThbcujox6zEA41TNQT6bCjcNI3hqAmMoAoGCCqGSM49
AwEH
-----END EC PRIVATE KEY-----

Binary file not shown.

View File

@@ -0,0 +1,4 @@
-----BEGIN EDDSA PRIVATE KEY-----
MFICAQAwBQYDK2VwBCIEIE3EyZVR/gbofvUgIsCeuA3yZ9E7DbTQxW7HMDYQhbxl
oSIEIEEH7HUMaHISPASCB24Wb0BBbaSPCPLinadDwiQomH6s
-----END EDDSA PRIVATE KEY-----

Binary file not shown.

View File

@@ -0,0 +1,15 @@
-----BEGIN CERTIFICATE-----
MIICWTCCAgugAwIBAgIIAfbhPrx5oYUwBQYDK2VwMIGfMQswCQYDVQQGEwJVUzEQ
MA4GA1UECAwHTW9udGFuYTEQMA4GA1UEBwwHQm96ZW1hbjENMAsGA1UEBAwEUm9v
dDEQMA4GA1UECgwHd29sZlNTTDEQMA4GA1UECwwHRUQyNTUxOTEYMBYGA1UEAwwP
d3d3LndvbGZzc2wuY29tMR8wHQYJKoZIhvcNAQkBFhBpbmZvQHdvbGZzc2wuY29t
MCIYDzIwMTcwNTI4MjMyNjI5WhgPMjAxOTA1MjkyMzI2MjlaMIGdMQswCQYDVQQG
EwJVUzEQMA4GA1UECAwHTW9udGFuYTEQMA4GA1UEBwwHQm96ZW1hbjELMAkGA1UE
BAwCQ0ExEDAOBgNVBAoMB3dvbGZTU0wxEDAOBgNVBAsMB0VEMjU1MTkxGDAWBgNV
BAMMD3d3dy53b2xmc3NsLmNvbTEfMB0GCSqGSIb3DQEJARYQaW5mb0B3b2xmc3Ns
LmNvbTAqMAUGAytlcAMhAEEH7HUMaHISPASCB24Wb0BBbaSPCPLinadDwiQomH6s
o2EwXzAMBgNVHRMEBTADAQH/MB0GA1UdDgQWBBSS1Qva8QSLuaGLAwKfWAA1Ngd6
yTAfBgNVHSMEGDAWgBSGwCfpnvqFwf3jb/xUWXI3xzOSuzAPBgNVHQ8BAf8EBQMC
AcYAMAUGAytlcANBACIbBhfAEXQfZNGj9nsGABoLUI7rsWOSRbrc4sFoFCMMbiyV
PLEcGSeYUD5VUczESVivuUZP7ZxXOAQp1KkS/gg=
-----END CERTIFICATE-----

Binary file not shown.

View File

@@ -0,0 +1,4 @@
-----BEGIN EDDSA PRIVATE KEY-----
MFICAQAwBQYDK2VwBCIEIBGdNYxa3ommO8aYO1oGaGSRQBqDYB0sKOdR3bqejqIQ
oSIEIDY9UZ60w5FgsDoJuIdapQUPW1PlZBc+cLkNZhKk5fFR
-----END EDDSA PRIVATE KEY-----

Binary file not shown.

View File

@@ -0,0 +1,15 @@
-----BEGIN CERTIFICATE-----
MIICUTCCAgOgAwIBAgIIAckQps/YSE8wBQYDK2VwMIGhMQswCQYDVQQGEwJVUzEQ
MA4GA1UECAwHTW9udGFuYTEQMA4GA1UEBwwHQm96ZW1hbjEPMA0GA1UEBAwGY2xp
ZW50MRAwDgYDVQQKDAd3b2xmU1NMMRAwDgYDVQQLDAdFRDI1NTE5MRgwFgYDVQQD
DA93d3cud29sZnNzbC5jb20xHzAdBgkqhkiG9w0BCQEWEGluZm9Ad29sZnNzbC5j
b20wIhgPMjAxNzA1MjgyMzI2MjlaGA8yMDE5MDUyOTIzMjYyOVowgaExCzAJBgNV
BAYTAlVTMRAwDgYDVQQIDAdNb250YW5hMRAwDgYDVQQHDAdCb3plbWFuMQ8wDQYD
VQQEDAZjbGllbnQxEDAOBgNVBAoMB3dvbGZTU0wxEDAOBgNVBAsMB0VEMjU1MTkx
GDAWBgNVBAMMD3d3dy53b2xmc3NsLmNvbTEfMB0GCSqGSIb3DQEJARYQaW5mb0B3
b2xmc3NsLmNvbTAqMAUGAytlcAMhADY9UZ60w5FgsDoJuIdapQUPW1PlZBc+cLkN
ZhKk5fFRo1MwUTAdBgNVHQ4EFgQUppdwk1xpkyuWMh6Heza6k5opV/EwHwYDVR0j
BBgwFoAUppdwk1xpkyuWMh6Heza6k5opV/EwDwYDVR0PAQH/BAUDAgbAADAFBgMr
ZXADQQCUo3bb4Zv2vjs09vniOoogAIHBlj4tOdodJ/vVfSFRGfo5MTbFOa4RmAvZ
kz+W324RkBsIl8R8ksENe87bJwAP
-----END CERTIFICATE-----

Binary file not shown.

View File

@@ -0,0 +1,4 @@
-----BEGIN EDDSA PRIVATE KEY-----
MFICAQAwBQYDK2VwBCIEIFwOftlJ9QL4yEBIBh9UmTRwCu+A6puPK9OFmVk0A19P
oSIEIKZgKbt92EfL1B7QbQ9XANgqH1BqQrxd5bgZZbLfJK9Q
-----END EDDSA PRIVATE KEY-----

Binary file not shown.

View File

@@ -0,0 +1,15 @@
-----BEGIN CERTIFICATE-----
MIICWzCCAg2gAwIBAgIIAcUx7uhNOB4wBQYDK2VwMIGfMQswCQYDVQQGEwJVUzEQ
MA4GA1UECAwHTW9udGFuYTEQMA4GA1UEBwwHQm96ZW1hbjENMAsGA1UEBAwEUm9v
dDEQMA4GA1UECgwHd29sZlNTTDEQMA4GA1UECwwHRUQyNTUxOTEYMBYGA1UEAwwP
d3d3LndvbGZzc2wuY29tMR8wHQYJKoZIhvcNAQkBFhBpbmZvQHdvbGZzc2wuY29t
MCIYDzIwMTcwNTI4MjMyNjI5WhgPMjAxOTA1MjkyMzI2MjlaMIGfMQswCQYDVQQG
EwJVUzEQMA4GA1UECAwHTW9udGFuYTEQMA4GA1UEBwwHQm96ZW1hbjENMAsGA1UE
BAwEUm9vdDEQMA4GA1UECgwHd29sZlNTTDEQMA4GA1UECwwHRUQyNTUxOTEYMBYG
A1UEAwwPd3d3LndvbGZzc2wuY29tMR8wHQYJKoZIhvcNAQkBFhBpbmZvQHdvbGZz
c2wuY29tMCowBQYDK2VwAyEApmApu33YR8vUHtBtD1cA2CofUGpCvF3luBllst8k
r1CjYTBfMAwGA1UdEwQFMAMBAf8wHQYDVR0OBBYEFIbAJ+me+oXB/eNv/FRZcjfH
M5K7MB8GA1UdIwQYMBaAFIbAJ+me+oXB/eNv/FRZcjfHM5K7MA8GA1UdDwEB/wQF
AwIBxgAwBQYDK2VwA0EAGj129Ed4mXezQYuGBMzeglOtvFvz3UqPLBGTRI49gqqw
2/VnVoX532VvhensyCrk3/tRluh1wMnenEQlncm/CQ==
-----END CERTIFICATE-----

Binary file not shown.

View File

@@ -0,0 +1,4 @@
-----BEGIN EDDSA PRIVATE KEY-----
MFICAQAwBQYDK2VwBCIEINjpdrI/H/eIdfXd+HrGSTBu6Z/LnR4rwBjvu3WJ5ndn
oSIEIBowiBhHL5faBPSk471sDBa5SMHRQteOkoSgdCpDng4p
-----END EDDSA PRIVATE KEY-----

Binary file not shown.

View File

@@ -0,0 +1,30 @@
-----BEGIN CERTIFICATE-----
MIICSzCCAf2gAwIBAgIIAdCSEGpaRlcwBQYDK2VwMIGdMQswCQYDVQQGEwJVUzEQ
MA4GA1UECAwHTW9udGFuYTEQMA4GA1UEBwwHQm96ZW1hbjELMAkGA1UEBAwCQ0Ex
EDAOBgNVBAoMB3dvbGZTU0wxEDAOBgNVBAsMB0VEMjU1MTkxGDAWBgNVBAMMD3d3
dy53b2xmc3NsLmNvbTEfMB0GCSqGSIb3DQEJARYQaW5mb0B3b2xmc3NsLmNvbTAi
GA8yMDE3MDUyODIzMjYyOVoYDzIwMTkwNTI5MjMyNjI5WjCBnzELMAkGA1UEBhMC
VVMxEDAOBgNVBAgMB01vbnRhbmExEDAOBgNVBAcMB0JvemVtYW4xDTALBgNVBAQM
BExlYWYxEDAOBgNVBAoMB3dvbGZTU0wxEDAOBgNVBAsMB0VEMjU1MTkxGDAWBgNV
BAMMD3d3dy53b2xmc3NsLmNvbTEfMB0GCSqGSIb3DQEJARYQaW5mb0B3b2xmc3Ns
LmNvbTAqMAUGAytlcAMhABowiBhHL5faBPSk471sDBa5SMHRQteOkoSgdCpDng4p
o1MwUTAdBgNVHQ4EFgQU9rKEGpW0cDJT/tnrmymAS9a18cAwHwYDVR0jBBgwFoAU
ktUL2vEEi7mhiwMCn1gANTYHeskwDwYDVR0PAQH/BAUDAgbAADAFBgMrZXADQQAS
VncMlkKY2skVbE5IlQUd0Hgy+IZGmkabZIsxsBlrd5mL//wCNgULaTeHYnXaUCwt
XVKUPwCdGEVvNxKO9OQA
-----END CERTIFICATE-----
-----BEGIN CERTIFICATE-----
MIICWTCCAgugAwIBAgIIAfbhPrx5oYUwBQYDK2VwMIGfMQswCQYDVQQGEwJVUzEQ
MA4GA1UECAwHTW9udGFuYTEQMA4GA1UEBwwHQm96ZW1hbjENMAsGA1UEBAwEUm9v
dDEQMA4GA1UECgwHd29sZlNTTDEQMA4GA1UECwwHRUQyNTUxOTEYMBYGA1UEAwwP
d3d3LndvbGZzc2wuY29tMR8wHQYJKoZIhvcNAQkBFhBpbmZvQHdvbGZzc2wuY29t
MCIYDzIwMTcwNTI4MjMyNjI5WhgPMjAxOTA1MjkyMzI2MjlaMIGdMQswCQYDVQQG
EwJVUzEQMA4GA1UECAwHTW9udGFuYTEQMA4GA1UEBwwHQm96ZW1hbjELMAkGA1UE
BAwCQ0ExEDAOBgNVBAoMB3dvbGZTU0wxEDAOBgNVBAsMB0VEMjU1MTkxGDAWBgNV
BAMMD3d3dy53b2xmc3NsLmNvbTEfMB0GCSqGSIb3DQEJARYQaW5mb0B3b2xmc3Ns
LmNvbTAqMAUGAytlcAMhAEEH7HUMaHISPASCB24Wb0BBbaSPCPLinadDwiQomH6s
o2EwXzAMBgNVHRMEBTADAQH/MB0GA1UdDgQWBBSS1Qva8QSLuaGLAwKfWAA1Ngd6
yTAfBgNVHSMEGDAWgBSGwCfpnvqFwf3jb/xUWXI3xzOSuzAPBgNVHQ8BAf8EBQMC
AcYAMAUGAytlcANBACIbBhfAEXQfZNGj9nsGABoLUI7rsWOSRbrc4sFoFCMMbiyV
PLEcGSeYUD5VUczESVivuUZP7ZxXOAQp1KkS/gg=
-----END CERTIFICATE-----

23
certs/external/ca-digicert-ev.pem vendored Normal file
View File

@@ -0,0 +1,23 @@
-----BEGIN CERTIFICATE-----
MIIDxTCCAq2gAwIBAgIQAqxcJmoLQJuPC3nyrkYldzANBgkqhkiG9w0BAQUFADBs
MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3
d3cuZGlnaWNlcnQuY29tMSswKQYDVQQDEyJEaWdpQ2VydCBIaWdoIEFzc3VyYW5j
ZSBFViBSb290IENBMB4XDTA2MTExMDAwMDAwMFoXDTMxMTExMDAwMDAwMFowbDEL
MAkGA1UEBhMCVVMxFTATBgNVBAoTDERpZ2lDZXJ0IEluYzEZMBcGA1UECxMQd3d3
LmRpZ2ljZXJ0LmNvbTErMCkGA1UEAxMiRGlnaUNlcnQgSGlnaCBBc3N1cmFuY2Ug
RVYgUm9vdCBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMbM5XPm
+9S75S0tMqbf5YE/yc0lSbZxKsPVlDRnogocsF9ppkCxxLeyj9CYpKlBWTrT3JTW
PNt0OKRKzE0lgvdKpVMSOO7zSW1xkX5jtqumX8OkhPhPYlG++MXs2ziS4wblCJEM
xChBVfvLWokVfnHoNb9Ncgk9vjo4UFt3MRuNs8ckRZqnrG0AFFoEt7oT61EKmEFB
Ik5lYYeBQVCmeVyJ3hlKV9Uu5l0cUyx+mM0aBhakaHPQNAQTXKFx01p8VdteZOE3
hzBWBOURtCmAEvF5OYiiAhF8J2a3iLd48soKqDirCmTCv2ZdlYTBoSUeh10aUAsg
EsxBu24LUTi4S8sCAwEAAaNjMGEwDgYDVR0PAQH/BAQDAgGGMA8GA1UdEwEB/wQF
MAMBAf8wHQYDVR0OBBYEFLE+w2kD+L9HAdSYJhoIAu9jZCvDMB8GA1UdIwQYMBaA
FLE+w2kD+L9HAdSYJhoIAu9jZCvDMA0GCSqGSIb3DQEBBQUAA4IBAQAcGgaX3Nec
nzyIZgYIVyHbIUf4KmeqvxgydkAQV8GK83rZEWWONfqe/EW1ntlMMUu4kehDLI6z
eM7b41N5cdblIZQB2lWHmiRk9opmzN6cN82oNLFpmyPInngiK3BD41VHMWEZ71jF
hS9OMPagMRYjyOfiZRYzy78aG6A9+MpeizGLYAiJLQwGXFK3xPkKmNEVX58Svnw2
Yzi9RKR/5CYrCsSXaQ3pjOLAEFe4yHYSkVXySGnYvCoCWw9E1CAx2/S6cCZdkGCe
vEsXCS+0yx5DaMkHJ8HSXPfqIbloEpw8nL+e/IBcm2PN7EeqJSdnoDfzAIJ9VNep
+OkuE6N36B9K
-----END CERTIFICATE-----

View File

@@ -9,6 +9,7 @@ EXTRA_DIST += \
certs/client-keyEnc.pem \
certs/client-key.pem \
certs/ecc-key.pem \
certs/ecc-privkey.pem \
certs/ecc-keyPkcs8Enc.pem \
certs/ecc-key-comp.pem \
certs/ecc-keyPkcs8.pem \
@@ -33,7 +34,9 @@ EXTRA_DIST += \
certs/server-revoked-key.pem \
certs/wolfssl-website-ca.pem \
certs/test-servercert.p12 \
certs/dsaparams.pem
certs/dsaparams.pem \
certs/ecc-privOnlyKey.pem \
certs/ecc-privOnlyCert.pem
EXTRA_DIST += \
certs/ca-key.der \
certs/ca-cert.der \
@@ -53,7 +56,24 @@ EXTRA_DIST += \
certs/server-ecc-comp.der \
certs/server-ecc.der \
certs/server-ecc-rsa.der \
certs/server-cert-chain.der
certs/server-cert-chain.der
EXTRA_DIST += \
certs/ed25519/ca-ed25519.der \
certs/ed25519/ca-ed25519-key.der \
certs/ed25519/ca-ed25519-key.pem \
certs/ed25519/ca-ed25519.pem \
certs/ed25519/client-ed25519.der \
certs/ed25519/client-ed25519-key.der \
certs/ed25519/client-ed25519-key.pem \
certs/ed25519/client-ed25519.pem \
certs/ed25519/root-ed25519.der \
certs/ed25519/root-ed25519-key.der \
certs/ed25519/root-ed25519-key.pem \
certs/ed25519/root-ed25519.pem \
certs/ed25519/server-ed25519.der \
certs/ed25519/server-ed25519-key.der \
certs/ed25519/server-ed25519-key.pem \
certs/ed25519/server-ed25519.pem
dist_doc_DATA+= certs/taoCert.txt

View File

@@ -3,15 +3,11 @@
#
EXTRA_DIST += \
certs/ocsp/index0.txt \
certs/ocsp/index1.txt \
certs/ocsp/index2.txt \
certs/ocsp/index3.txt \
certs/ocsp/index-ca-and-intermediate-cas.txt \
certs/ocsp/index-intermediate1-ca-issued-certs.txt \
certs/ocsp/index-intermediate3-ca-issued-certs.txt \
certs/ocsp/index-intermediate3-ca-issued-certs.txt \
certs/ocsp/openssl.cnf \
certs/ocsp/ocspd0.sh \
certs/ocsp/ocspd1.sh \
certs/ocsp/ocspd2.sh \
certs/ocsp/ocspd3.sh \
certs/ocsp/intermediate1-ca-key.pem \
certs/ocsp/intermediate1-ca-cert.pem \
certs/ocsp/intermediate2-ca-key.pem \

View File

@@ -0,0 +1,8 @@
#!/bin/sh
openssl ocsp -port 22221 -nmin 1 \
-index certs/ocsp/index-intermediate1-ca-issued-certs.txt \
-rsigner certs/ocsp/intermediate1-ca-cert.pem \
-rkey certs/ocsp/intermediate1-ca-key.pem \
-CA certs/ocsp/intermediate1-ca-cert.pem \
$@

View File

@@ -0,0 +1,8 @@
#!/bin/sh
openssl ocsp -port 22221 -nmin 1 \
-index certs/ocsp/index-intermediate1-ca-issued-certs.txt \
-rsigner certs/ocsp/ocsp-responder-cert.pem \
-rkey certs/ocsp/ocsp-responder-key.pem \
-CA certs/ocsp/intermediate1-ca-cert.pem \
$@

View File

@@ -0,0 +1,8 @@
#!/bin/sh
openssl ocsp -port 22222 -nmin 1 \
-index certs/ocsp/index-intermediate2-ca-issued-certs.txt \
-rsigner certs/ocsp/ocsp-responder-cert.pem \
-rkey certs/ocsp/ocsp-responder-key.pem \
-CA certs/ocsp/intermediate2-ca-cert.pem \
$@

View File

@@ -0,0 +1,8 @@
#!/bin/sh
openssl ocsp -port 22223 -nmin 1 \
-index certs/ocsp/index-intermediate3-ca-issued-certs.txt \
-rsigner certs/ocsp/ocsp-responder-cert.pem \
-rkey certs/ocsp/ocsp-responder-key.pem \
-CA certs/ocsp/intermediate3-ca-cert.pem \
$@

View File

@@ -0,0 +1,8 @@
#!/bin/sh
openssl ocsp -port 22220 -nmin 1 \
-index certs/ocsp/index-ca-and-intermediate-cas.txt \
-rsigner certs/ocsp/ocsp-responder-cert.pem \
-rkey certs/ocsp/ocsp-responder-key.pem \
-CA certs/ocsp/root-ca-cert.pem \
$@

View File

@@ -1,8 +0,0 @@
#!/bin/sh
openssl ocsp -port 22220 -nmin 1 \
-index certs/ocsp/index0.txt \
-rsigner certs/ocsp/ocsp-responder-cert.pem \
-rkey certs/ocsp/ocsp-responder-key.pem \
-CA certs/ocsp/root-ca-cert.pem \
$@

View File

@@ -1,8 +0,0 @@
#!/bin/sh
openssl ocsp -port 22221 -nmin 1 \
-index certs/ocsp/index1.txt \
-rsigner certs/ocsp/ocsp-responder-cert.pem \
-rkey certs/ocsp/ocsp-responder-key.pem \
-CA certs/ocsp/intermediate1-ca-cert.pem \
$@

View File

@@ -1,8 +0,0 @@
#!/bin/sh
openssl ocsp -port 22222 -nmin 1 \
-index certs/ocsp/index2.txt \
-rsigner certs/ocsp/ocsp-responder-cert.pem \
-rkey certs/ocsp/ocsp-responder-key.pem \
-CA certs/ocsp/intermediate2-ca-cert.pem \
$@

View File

@@ -1,8 +0,0 @@
#!/bin/sh
openssl ocsp -port 22223 -nmin 1 \
-index certs/ocsp/index3.txt \
-rsigner certs/ocsp/ocsp-responder-cert.pem \
-rkey certs/ocsp/ocsp-responder-key.pem \
-CA certs/ocsp/intermediate3-ca-cert.pem \
$@

File diff suppressed because it is too large Load Diff

View File

@@ -48,6 +48,8 @@
#include "examples/client/client.h"
#ifndef NO_WOLFSSL_CLIENT
#ifdef WOLFSSL_ASYNC_CRYPT
static int devId = INVALID_DEVID;
#endif
@@ -59,28 +61,51 @@
* test mode and (2) the testsuite which uses this code and sets up the correct
* port numbers when the internal thread using the server code using port 0. */
#ifdef WOLFSSL_CALLBACKS
int handShakeCB(HandShakeInfo*);
int timeoutCB(TimeoutInfo*);
Timeval timeout;
static int handShakeCB(HandShakeInfo* info)
{
(void)info;
return 0;
}
static int timeoutCB(TimeoutInfo* info)
{
(void)info;
return 0;
}
#endif
#ifdef HAVE_SESSION_TICKET
int sessionTicketCB(WOLFSSL*, const unsigned char*, int, void*);
static int sessionTicketCB(WOLFSSL* ssl,
const unsigned char* ticket, int ticketSz,
void* ctx)
{
(void)ssl;
(void)ticket;
printf("Session Ticket CB: ticketSz = %d, ctx = %s\n",
ticketSz, (char*)ctx);
return 0;
}
#endif
static int NonBlockingSSL_Connect(WOLFSSL* ssl)
{
#ifndef WOLFSSL_CALLBACKS
int ret = wolfSSL_connect(ssl);
#else
int ret = wolfSSL_connect_ex(ssl, handShakeCB, timeoutCB, timeout);
#endif
int error = wolfSSL_get_error(ssl, 0);
SOCKET_T sockfd = (SOCKET_T)wolfSSL_get_fd(ssl);
int ret;
int error;
SOCKET_T sockfd;
int select_ret = 0;
#ifndef WOLFSSL_CALLBACKS
ret = wolfSSL_connect(ssl);
#else
ret = wolfSSL_connect_ex(ssl, handShakeCB, timeoutCB, timeout);
#endif
error = wolfSSL_get_error(ssl, 0);
sockfd = (SOCKET_T)wolfSSL_get_fd(ssl);
while (ret != SSL_SUCCESS && (error == SSL_ERROR_WANT_READ ||
error == SSL_ERROR_WANT_WRITE ||
error == WC_PENDING_E)) {
@@ -156,7 +181,8 @@ static void ShowVersions(void)
/* Measures average time to create, connect and disconnect a connection (TPS).
Benchmark = number of connections. */
static int ClientBenchmarkConnections(WOLFSSL_CTX* ctx, char* host, word16 port,
int dtlsUDP, int dtlsSCTP, int benchmark, int resumeSession)
int dtlsUDP, int dtlsSCTP, int benchmark, int resumeSession, int useX25519,
int helloRetry)
{
/* time passed in number of connects give average */
int times = benchmark;
@@ -165,7 +191,14 @@ static int ClientBenchmarkConnections(WOLFSSL_CTX* ctx, char* host, word16 port,
#ifndef NO_SESSION_CACHE
WOLFSSL_SESSION* benchSession = NULL;
#endif
#ifdef WOLFSSL_TLS13
byte* reply[80];
static const char msg[] = "hello wolfssl!";
#endif
(void)resumeSession;
(void)useX25519;
(void)helloRetry;
while (loops--) {
#ifndef NO_SESSION_CACHE
@@ -179,11 +212,31 @@ static int ClientBenchmarkConnections(WOLFSSL_CTX* ctx, char* host, word16 port,
if (ssl == NULL)
err_sys("unable to get SSL object");
#ifdef WOLFSSL_TLS13
if (helloRetry)
wolfSSL_NoKeyShares(ssl);
#endif
tcp_connect(&sockfd, host, port, dtlsUDP, dtlsSCTP, ssl);
#ifndef NO_SESSION_CACHE
if (benchResume)
wolfSSL_set_session(ssl, benchSession);
#endif
#ifdef WOLFSSL_TLS13
#ifdef HAVE_CURVE25519
#ifndef NO_SESSION_CACHE
if (benchResume) {
}
else
#endif
if (useX25519) {
if (wolfSSL_UseKeyShare(ssl, WOLFSSL_ECC_X25519)
!= SSL_SUCCESS) {
err_sys("unable to use curve x25519");
}
}
#endif
#endif
if (wolfSSL_set_fd(ssl, sockfd) != SSL_SUCCESS) {
err_sys("error in setting fd");
@@ -206,6 +259,16 @@ static int ClientBenchmarkConnections(WOLFSSL_CTX* ctx, char* host, word16 port,
err_sys("SSL_connect failed");
}
#ifdef WOLFSSL_TLS13
if (resumeSession) {
if (wolfSSL_write(ssl, msg, sizeof(msg)-1) <= 0)
err_sys("SSL_write failed");
if (wolfSSL_read(ssl, reply, sizeof(reply)-1) <= 0)
err_sys("SSL_read failed");
}
#endif
wolfSSL_shutdown(ssl);
#ifndef NO_SESSION_CACHE
if (i == (times-1) && resumeSession) {
@@ -231,7 +294,7 @@ static int ClientBenchmarkConnections(WOLFSSL_CTX* ctx, char* host, word16 port,
/* Measures throughput in kbps. Throughput = number of bytes */
static int ClientBenchmarkThroughput(WOLFSSL_CTX* ctx, char* host, word16 port,
int dtlsUDP, int dtlsSCTP, int throughput)
int dtlsUDP, int dtlsSCTP, int throughput, int useX25519)
{
double start, conn_time = 0, tx_time = 0, rx_time = 0;
SOCKET_T sockfd;
@@ -242,11 +305,24 @@ static int ClientBenchmarkThroughput(WOLFSSL_CTX* ctx, char* host, word16 port,
ssl = wolfSSL_new(ctx);
if (ssl == NULL)
err_sys("unable to get SSL object");
tcp_connect(&sockfd, host, port, dtlsUDP, dtlsSCTP, ssl);
if (wolfSSL_set_fd(ssl, sockfd) != SSL_SUCCESS) {
err_sys("error in setting fd");
}
(void)useX25519;
#ifdef WOLFSSL_TLS13
#ifdef HAVE_CURVE25519
if (useX25519) {
if (wolfSSL_UseKeyShare(ssl, WOLFSSL_ECC_X25519)
!= SSL_SUCCESS) {
err_sys("unable to use curve x25519");
}
}
#endif
#endif
do {
err = 0; /* reset error */
ret = wolfSSL_connect(ssl);
@@ -511,6 +587,60 @@ static int SMTP_Shutdown(WOLFSSL* ssl, int wc_shutdown)
return SSL_SUCCESS;
}
static void ClientWrite(WOLFSSL* ssl, char* msg, int msgSz)
{
int ret, err;
char buffer[WOLFSSL_MAX_ERROR_SZ];
do {
err = 0; /* reset error */
ret = wolfSSL_write(ssl, msg, msgSz);
if (ret <= 0) {
err = wolfSSL_get_error(ssl, 0);
#ifdef WOLFSSL_ASYNC_CRYPT
if (err == WC_PENDING_E) {
ret = wolfSSL_AsyncPoll(ssl, WOLF_POLL_FLAG_CHECK_HW);
if (ret < 0) break;
}
#endif
}
} while (err == WC_PENDING_E);
if (ret != msgSz) {
printf("SSL_write msg error %d, %s\n", err,
wolfSSL_ERR_error_string(err, buffer));
err_sys("SSL_write failed");
}
}
static void ClientRead(WOLFSSL* ssl, char* reply, int replyLen, int mustRead)
{
int ret, err;
char buffer[WOLFSSL_MAX_ERROR_SZ];
do {
err = 0; /* reset error */
ret = wolfSSL_read(ssl, reply, replyLen);
if (ret <= 0) {
err = wolfSSL_get_error(ssl, 0);
#ifdef WOLFSSL_ASYNC_CRYPT
if (err == WC_PENDING_E) {
ret = wolfSSL_AsyncPoll(ssl, WOLF_POLL_FLAG_CHECK_HW);
if (ret < 0) break;
}
else
#endif
if (err != SSL_ERROR_WANT_READ) {
printf("SSL_read reply error %d, %s\n", err,
wolfSSL_ERR_error_string(err, buffer));
err_sys("SSL_read failed");
}
}
} while (err == WC_PENDING_E || (mustRead && err == SSL_ERROR_WANT_READ));
if (ret > 0) {
reply[ret] = 0;
printf("%s\n", reply);
}
}
static void Usage(void)
{
@@ -519,9 +649,15 @@ static void Usage(void)
printf("-? Help, print this usage\n");
printf("-h <host> Host to connect to, default %s\n", wolfSSLIP);
printf("-p <num> Port to connect on, not 0, default %d\n", wolfSSLPort);
#ifndef WOLFSSL_TLS13
printf("-v <num> SSL version [0-3], SSLv3(0) - TLS1.2(3)), default %d\n",
CLIENT_DEFAULT_VERSION);
printf("-V Prints valid ssl version numbers, SSLv3(0) - TLS1.2(3)\n");
#else
printf("-v <num> SSL version [0-4], SSLv3(0) - TLS1.3(4)), default %d\n",
CLIENT_DEFAULT_VERSION);
printf("-V Prints valid ssl version numbers, SSLv3(0) - TLS1.3(4)\n");
#endif
printf("-l <str> Cipher suite list (: delimited)\n");
printf("-c <file> Certificate file, default %s\n", cliCertFile);
printf("-k <file> Key file, default %s\n", cliKeyFile);
@@ -558,6 +694,7 @@ static void Usage(void)
printf("-f Fewer packets/group messages\n");
printf("-x Disable client cert/key loading\n");
printf("-X Driven by eXternal test case\n");
printf("-j Use verify callback override\n");
#ifdef SHOW_SIZES
printf("-z Print structure sizes\n");
#endif
@@ -598,9 +735,34 @@ static void Usage(void)
#endif
#ifdef HAVE_WNR
printf("-q <file> Whitewood config file, default %s\n", wnrConfig);
#endif
printf("-H Force use of the default cipher suite list\n");
#ifdef WOLFSSL_TLS13
printf("-J Use HelloRetryRequest to choose group for KE\n");
printf("-K Key Exchange for PSK not using (EC)DHE\n");
printf("-I Update keys and IVs before sending data\n");
#ifndef NO_DH
printf("-y Key Share with FFDHE named groups only\n");
#endif
#ifdef HAVE_ECC
printf("-Y Key Share with ECC named groups only\n");
#endif
#endif /* WOLFSSL_TLS13 */
#ifdef HAVE_CURVE25519
printf("-t Use X25519 for key exchange\n");
#endif
#if defined(WOLFSSL_TLS13) && defined(WOLFSSL_POST_HANDSHAKE_AUTH)
printf("-Q Support requesting certificate post-handshake\n");
#endif
#ifdef WOLFSSL_EARLY_DATA
printf("-0 Early data sent to server (0-RTT handshake)\n");
#endif
#ifdef WOLFSSL_MULTICAST
printf("-3 <grpid> Multicast, grpid < 256\n");
#endif
}
THREAD_RETURN WOLFSSL_THREAD client_test(void* args)
{
SOCKET_T sockfd = WOLFSSL_SOCKET_INVALID;
@@ -640,6 +802,7 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args)
int doDTLS = 0;
int dtlsUDP = 0;
int dtlsSCTP = 0;
int doMcast = 0;
int matchName = 0;
int doPeerCheck = 1;
int nonBlocking = 0;
@@ -669,6 +832,7 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args)
int doSTARTTLS = 0;
char* starttlsProt = NULL;
int useVerifyCb = 0;
#ifdef WOLFSSL_TRUST_PEER_CERT
const char* trustCert = NULL;
@@ -690,11 +854,27 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args)
#ifdef HAVE_EXTENDED_MASTER
byte disableExtMasterSecret = 0;
#endif
int helloRetry = 0;
#ifdef WOLFSSL_TLS13
int onlyKeyShare = 0;
int noPskDheKe = 0;
#ifdef WOLFSSL_POST_HANDSHAKE_AUTH
int postHandAuth = 0;
#endif
#endif
int updateKeysIVs = 0;
#ifdef WOLFSSL_EARLY_DATA
int earlyData = 0;
#endif
#ifdef WOLFSSL_MULTICAST
byte mcastID = 0;
#endif
#ifdef HAVE_OCSP
int useOcsp = 0;
char* ocspUrl = NULL;
#endif
int useX25519 = 0;
#ifdef HAVE_WNR
const char* wnrConfigFile = wnrConfig;
@@ -727,14 +907,18 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args)
(void)minDhKeyBits;
(void)alpnList;
(void)alpn_opt;
(void)updateKeysIVs;
(void)useX25519;
(void)helloRetry;
StackTrap();
#ifndef WOLFSSL_VXWORKS
/* Not used: j, t, y, I, J, K, Q, Y */
/* Not used: All used */
while ((ch = mygetopt(argc, argv, "?"
"ab:c:defgh:ik:l:mnop:q:rsuv:wxz"
"A:B:CDE:F:GHL:M:NO:PRS:TUVW:XZ:")) != -1) {
"ab:c:defgh:ijk:l:mnop:q:rstuv:wxyz"
"A:B:CDE:F:GHIJKL:M:NO:PQRS:TUVW:XYZ:"
"03:")) != -1) {
switch (ch) {
case '?' :
Usage();
@@ -827,7 +1011,7 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args)
case 'v' :
version = atoi(myoptarg);
if (version < 0 || version > 3) {
if (version < 0 || version > 4) {
Usage();
exit(MY_EX_USAGE);
}
@@ -1004,6 +1188,69 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args)
#endif
break;
case 'J' :
#ifdef WOLFSSL_TLS13
helloRetry = 1;
#endif
break;
case 'K' :
#ifdef WOLFSSL_TLS13
noPskDheKe = 1;
#endif
break;
case 'I' :
#ifdef WOLFSSL_TLS13
updateKeysIVs = 1;
#endif
break;
case 'y' :
#if defined(WOLFSSL_TLS13) && !defined(NO_DH)
onlyKeyShare = 1;
#endif
break;
case 'Y' :
#if defined(WOLFSSL_TLS13) && defined(HAVE_ECC)
onlyKeyShare = 2;
#endif
break;
case 'j' :
useVerifyCb = 1;
break;
case 't' :
#ifdef HAVE_CURVE25519
useX25519 = 1;
#if defined(WOLFSSL_TLS13) && defined(HAVE_ECC)
onlyKeyShare = 2;
#endif
#endif
break;
case 'Q' :
#if defined(WOLFSSL_TLS13) && \
defined(WOLFSSL_POST_HANDSHAKE_AUTH)
postHandAuth = 1;
#endif
break;
case '0' :
#ifdef WOLFSSL_EARLY_DATA
earlyData = 1;
#endif
break;
case '3' :
#ifdef WOLFSSL_MULTICAST
doMcast = 1;
mcastID = (byte)(atoi(myoptarg) & 0xFF);
#endif
break;
default:
Usage();
exit(MY_EX_USAGE);
@@ -1127,6 +1374,11 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args)
case 3:
method = wolfTLSv1_2_client_method();
break;
#ifdef WOLFSSL_TLS13
case 4:
method = wolfTLSv1_3_client_method();
break;
#endif
#endif
#ifdef WOLFSSL_DTLS
@@ -1191,13 +1443,18 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args)
wolfSSL_CTX_set_psk_client_callback(ctx, my_psk_client_cb);
if (cipherList == NULL) {
const char *defaultCipherList;
#if defined(HAVE_AESGCM) && !defined(NO_DH)
defaultCipherList = "DHE-PSK-AES128-GCM-SHA256";
#elif defined(HAVE_NULL_CIPHER)
defaultCipherList = "PSK-NULL-SHA256";
#if defined(HAVE_AESGCM) && !defined(NO_DH)
#ifdef WOLFSSL_TLS13
defaultCipherList = "DHE-PSK-AES128-GCM-SHA256:"
"TLS13-AES128-GCM-SHA256";
#else
defaultCipherList = "PSK-AES128-CBC-SHA256";
defaultCipherList = "DHE-PSK-AES128-GCM-SHA256";
#endif
#elif defined(HAVE_NULL_CIPHER)
defaultCipherList = "PSK-NULL-SHA256";
#else
defaultCipherList = "PSK-AES128-CBC-SHA256";
#endif
if (wolfSSL_CTX_set_cipher_list(ctx,defaultCipherList)
!=SSL_SUCCESS) {
wolfSSL_CTX_free(ctx);
@@ -1265,9 +1522,6 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args)
wolfSSL_CTX_SetCACb(ctx, CaCb);
#endif
#ifdef VERIFY_CALLBACK
wolfSSL_CTX_set_verify(ctx, SSL_VERIFY_PEER, myVerify);
#endif
#if !defined(NO_CERTS)
if (useClientCert){
#if !defined(NO_FILESYSTEM)
@@ -1290,7 +1544,7 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args)
#endif /* !defined(NO_FILESYSTEM) */
}
if (!usePsk && !useAnon) {
if (!usePsk && !useAnon && !useVerifyCb) {
#if !defined(NO_FILESYSTEM)
if (wolfSSL_CTX_load_verify_locations(ctx, verifyCert,0)
!= SSL_SUCCESS) {
@@ -1321,9 +1575,11 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args)
}
#endif /* WOLFSSL_TRUST_PEER_CERT && !NO_FILESYSTEM */
}
if (!usePsk && !useAnon && doPeerCheck == 0)
if (useVerifyCb)
wolfSSL_CTX_set_verify(ctx, SSL_VERIFY_PEER, myVerify);
else if (!usePsk && !useAnon && doPeerCheck == 0)
wolfSSL_CTX_set_verify(ctx, SSL_VERIFY_NONE, 0);
if (!usePsk && !useAnon && overrideDateErrors == 1)
else if (!usePsk && !useAnon && overrideDateErrors == 1)
wolfSSL_CTX_set_verify(ctx, SSL_VERIFY_PEER, myDateCb);
#endif /* !defined(NO_CERTS) */
@@ -1370,11 +1626,24 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args)
err_sys("DisableExtendedMasterSecret failed");
}
#endif
#if defined(HAVE_CURVE25519) && defined(HAVE_SUPPORTED_CURVES)
if (useX25519) {
if (wolfSSL_CTX_UseSupportedCurve(ctx, WOLFSSL_ECC_X25519)
!= SSL_SUCCESS) {
err_sys("unable to support X25519");
}
if (wolfSSL_CTX_UseSupportedCurve(ctx, WOLFSSL_ECC_SECP256R1)
!= SSL_SUCCESS) {
err_sys("unable to support secp256r1");
}
}
#endif /* HAVE_CURVE25519 && HAVE_SUPPORTED_CURVES */
if (benchmark) {
((func_args*)args)->return_code =
ClientBenchmarkConnections(ctx, host, port, dtlsUDP, dtlsSCTP,
benchmark, resumeSession);
benchmark, resumeSession, useX25519,
helloRetry);
wolfSSL_CTX_free(ctx);
exit(EXIT_SUCCESS);
}
@@ -1382,7 +1651,7 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args)
if(throughput) {
((func_args*)args)->return_code =
ClientBenchmarkThroughput(ctx, host, port, dtlsUDP, dtlsSCTP,
throughput);
throughput, useX25519);
wolfSSL_CTX_free(ctx);
exit(EXIT_SUCCESS);
}
@@ -1402,6 +1671,25 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args)
}
#endif
#ifdef WOLFSSL_TLS13
if (noPskDheKe)
wolfSSL_CTX_no_dhe_psk(ctx);
#endif
#if defined(WOLFSSL_TLS13) && defined(WOLFSSL_POST_HANDSHAKE_AUTH)
if (postHandAuth)
wolfSSL_CTX_allow_post_handshake_auth(ctx);
#endif
if (doMcast) {
#ifdef WOLFSSL_MULTICAST
wolfSSL_CTX_mcast_set_member_id(ctx, mcastID);
if (wolfSSL_CTX_set_cipher_list(ctx, "WDM-NULL-SHA256") != SSL_SUCCESS) {
wolfSSL_CTX_free(ctx);
err_sys("Couldn't set multicast cipher list.");
}
#endif
}
ssl = wolfSSL_new(ctx);
if (ssl == NULL) {
wolfSSL_CTX_free(ctx);
@@ -1412,46 +1700,63 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args)
wolfSSL_KeepArrays(ssl);
#endif
#if 0 /* all enabled and supported ECC curves will be added automatically */
#ifdef HAVE_SUPPORTED_CURVES /* add curves to supported curves extension */
if (wolfSSL_UseSupportedCurve(ssl, WOLFSSL_ECC_SECP256R1)
!= SSL_SUCCESS) {
wolfSSL_free(ssl);
wolfSSL_CTX_free(ctx);
err_sys("unable to set curve secp256r1");
#ifdef WOLFSSL_TLS13
if (!helloRetry) {
if (onlyKeyShare == 0 || onlyKeyShare == 2) {
#ifdef HAVE_CURVE25519
if (useX25519) {
if (wolfSSL_UseKeyShare(ssl, WOLFSSL_ECC_X25519)
!= SSL_SUCCESS) {
err_sys("unable to use curve x25519");
}
}
#endif
#ifdef HAVE_ECC
#if defined(HAVE_ECC256) || defined(HAVE_ALL_CURVES)
if (wolfSSL_UseKeyShare(ssl, WOLFSSL_ECC_SECP256R1)
!= SSL_SUCCESS) {
err_sys("unable to use curve secp256r1");
}
#endif
#if defined(HAVE_ECC384) || defined(HAVE_ALL_CURVES)
if (wolfSSL_UseKeyShare(ssl, WOLFSSL_ECC_SECP384R1)
!= SSL_SUCCESS) {
err_sys("unable to use curve secp384r1");
}
#endif
#endif
}
if (wolfSSL_UseSupportedCurve(ssl, WOLFSSL_ECC_SECP384R1)
!= SSL_SUCCESS) {
wolfSSL_free(ssl);
wolfSSL_CTX_free(ctx);
err_sys("unable to set curve secp384r1");
}
if (wolfSSL_UseSupportedCurve(ssl, WOLFSSL_ECC_SECP521R1)
!= SSL_SUCCESS) {
wolfSSL_free(ssl);
wolfSSL_CTX_free(ctx);
err_sys("unable to set curve secp521r1");
}
if (wolfSSL_UseSupportedCurve(ssl, WOLFSSL_ECC_SECP224R1)
!= SSL_SUCCESS) {
wolfSSL_free(ssl);
wolfSSL_CTX_free(ctx);
err_sys("unable to set curve secp224r1");
}
if (wolfSSL_UseSupportedCurve(ssl, WOLFSSL_ECC_SECP192R1)
!= SSL_SUCCESS) {
wolfSSL_free(ssl);
wolfSSL_CTX_free(ctx);
err_sys("unable to set curve secp192r1");
}
if (wolfSSL_UseSupportedCurve(ssl, WOLFSSL_ECC_SECP160R1)
!= SSL_SUCCESS) {
wolfSSL_free(ssl);
wolfSSL_CTX_free(ctx);
err_sys("unable to set curve secp160r1");
if (onlyKeyShare == 0 || onlyKeyShare == 1) {
#ifdef HAVE_FFDHE_2048
if (wolfSSL_UseKeyShare(ssl, WOLFSSL_FFDHE_2048) != SSL_SUCCESS) {
err_sys("unable to use DH 2048-bit parameters");
}
#endif
}
}
else {
wolfSSL_NoKeyShares(ssl);
}
#endif
#endif
if (doMcast) {
#ifdef WOLFSSL_MULTICAST
byte pms[512]; /* pre master secret */
byte cr[32]; /* client random */
byte sr[32]; /* server random */
const byte suite[2] = {0, 0xfe}; /* WDM_WITH_NULL_SHA256 */
XMEMSET(pms, 0x23, sizeof(pms));
XMEMSET(cr, 0xA5, sizeof(cr));
XMEMSET(sr, 0x5A, sizeof(sr));
if (wolfSSL_set_secret(ssl, 1, pms, sizeof(pms), cr, sr, suite)
!= SSL_SUCCESS) {
wolfSSL_CTX_free(ctx);
err_sys("unable to set mcast secret");
}
#endif
}
#ifdef HAVE_SESSION_TICKET
wolfSSL_set_SessionTicket_cb(ssl, sessionTicketCB, (void*)"initial session");
@@ -1525,7 +1830,7 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args)
}
#ifdef HAVE_CRL
if (disableCRL == 0) {
if (disableCRL == 0 && !useVerifyCb) {
#ifdef HAVE_IO_TIMEOUT
wolfIO_SetTimeout(DEFAULT_TIMEOUT_SEC);
#endif
@@ -1715,76 +2020,21 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args)
#endif
#endif /* WOLFSSL_SESSION_EXPORT_DEBUG */
do {
err = 0; /* reset error */
ret = wolfSSL_write(ssl, msg, msgSz);
if (ret <= 0) {
err = wolfSSL_get_error(ssl, 0);
#ifdef WOLFSSL_ASYNC_CRYPT
if (err == WC_PENDING_E) {
ret = wolfSSL_AsyncPoll(ssl, WOLF_POLL_FLAG_CHECK_HW);
if (ret < 0) break;
}
#endif
}
} while (err == WC_PENDING_E);
if (ret != msgSz) {
printf("SSL_write msg error %d, %s\n", err,
wolfSSL_ERR_error_string(err, buffer));
wolfSSL_free(ssl);
wolfSSL_CTX_free(ctx);
err_sys("SSL_write failed");
}
#ifdef WOLFSSL_TLS13
if (updateKeysIVs)
wolfSSL_update_keys(ssl);
#endif
do {
err = 0; /* reset error */
ret = wolfSSL_read(ssl, reply, sizeof(reply)-1);
if (ret <= 0) {
err = wolfSSL_get_error(ssl, 0);
#ifdef WOLFSSL_ASYNC_CRYPT
if (err == WC_PENDING_E) {
ret = wolfSSL_AsyncPoll(ssl, WOLF_POLL_FLAG_CHECK_HW);
if (ret < 0) break;
}
#endif
}
} while (err == WC_PENDING_E);
if (ret > 0) {
reply[ret] = 0;
printf("Server response: %s\n", reply);
ClientWrite(ssl, msg, msgSz);
if (sendGET) { /* get html */
while (1) {
do {
err = 0; /* reset error */
ret = wolfSSL_read(ssl, reply, sizeof(reply)-1);
if (ret <= 0) {
err = wolfSSL_get_error(ssl, 0);
#ifdef WOLFSSL_ASYNC_CRYPT
if (err == WC_PENDING_E) {
ret = wolfSSL_AsyncPoll(ssl, WOLF_POLL_FLAG_CHECK_HW);
if (ret < 0) break;
}
#endif
}
} while (err == WC_PENDING_E);
if (ret > 0) {
reply[ret] = 0;
printf("%s\n", reply);
}
else
break;
}
}
}
if (ret < 0) {
if (err != SSL_ERROR_WANT_READ) {
printf("SSL_read reply error %d, %s\n", err,
wolfSSL_ERR_error_string(err, buffer));
wolfSSL_free(ssl);
wolfSSL_CTX_free(ctx);
err_sys("SSL_read failed");
}
ClientRead(ssl, reply, sizeof(reply)-1, 1);
#if defined(WOLFSSL_TLS13) && defined(WOLFSSL_POST_HANDSHAKE_AUTH)
if (postHandAuth)
ClientWrite(ssl, msg, msgSz);
#endif
if (sendGET) { /* get html */
ClientRead(ssl, reply, sizeof(reply)-1, 0);
}
#ifndef NO_SESSION_CACHE
@@ -1849,46 +2099,31 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args)
wolfSSL_set_SessionTicket_cb(sslResume, sessionTicketCB,
(void*)"resumed session");
#endif
#if 0 /* all enabled and supported ECC curves will be added automatically */
#ifdef HAVE_SUPPORTED_CURVES /* add curves to supported curves extension */
if (wolfSSL_UseSupportedCurve(sslResume, WOLFSSL_ECC_SECP256R1)
!= SSL_SUCCESS) {
wolfSSL_free(sslResume);
wolfSSL_CTX_free(ctx);
err_sys("unable to set curve secp256r1");
}
if (wolfSSL_UseSupportedCurve(sslResume, WOLFSSL_ECC_SECP384R1)
!= SSL_SUCCESS) {
wolfSSL_free(sslResume);
wolfSSL_CTX_free(ctx);
err_sys("unable to set curve secp384r1");
}
if (wolfSSL_UseSupportedCurve(sslResume, WOLFSSL_ECC_SECP521R1)
!= SSL_SUCCESS) {
wolfSSL_free(sslResume);
wolfSSL_CTX_free(ctx);
err_sys("unable to set curve secp521r1");
}
if (wolfSSL_UseSupportedCurve(sslResume, WOLFSSL_ECC_SECP224R1)
!= SSL_SUCCESS) {
wolfSSL_free(sslResume);
wolfSSL_CTX_free(ctx);
err_sys("unable to set curve secp224r1");
}
if (wolfSSL_UseSupportedCurve(sslResume, WOLFSSL_ECC_SECP192R1)
!= SSL_SUCCESS) {
wolfSSL_free(sslResume);
wolfSSL_CTX_free(ctx);
err_sys("unable to set curve secp192r1");
}
if (wolfSSL_UseSupportedCurve(sslResume, WOLFSSL_ECC_SECP160R1)
!= SSL_SUCCESS) {
wolfSSL_free(sslResume);
wolfSSL_CTX_free(ctx);
err_sys("unable to set curve secp160r1");
#ifdef WOLFSSL_TLS13
#ifdef HAVE_CURVE25519
if (useX25519) {
if (wolfSSL_UseKeyShare(ssl, WOLFSSL_ECC_X25519) != SSL_SUCCESS) {
err_sys("unable to use curve x25519");
}
}
#endif
#ifdef HAVE_ECC
if (wolfSSL_UseKeyShare(sslResume,
WOLFSSL_ECC_SECP256R1) != SSL_SUCCESS) {
err_sys("unable to use curve secp256r1");
}
if (wolfSSL_UseKeyShare(sslResume,
WOLFSSL_ECC_SECP384R1) != SSL_SUCCESS) {
err_sys("unable to use curve secp384r1");
}
#endif
#ifdef HAVE_FFDHE_2048
if (wolfSSL_UseKeyShare(sslResume, WOLFSSL_FFDHE_2048) != SSL_SUCCESS) {
err_sys("unable to use DH 2048-bit parameters");
}
#endif
#endif
#ifndef WOLFSSL_CALLBACKS
if (nonBlocking) {
@@ -1897,6 +2132,59 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args)
ret = NonBlockingSSL_Connect(sslResume);
}
else {
#ifdef WOLFSSL_EARLY_DATA
#ifndef HAVE_SESSION_TICKET
if (!usePsk) {
}
else
#endif
if (earlyData) {
do {
err = 0; /* reset error */
ret = wolfSSL_write_early_data(sslResume, msg, msgSz,
&msgSz);
if (ret <= 0) {
err = wolfSSL_get_error(sslResume, 0);
#ifdef WOLFSSL_ASYNC_CRYPT
if (err == WC_PENDING_E) {
ret = wolfSSL_AsyncPoll(sslResume,
WOLF_POLL_FLAG_CHECK_HW);
if (ret < 0) break;
}
#endif
}
} while (err == WC_PENDING_E);
if (ret != msgSz) {
printf("SSL_write_early_data msg error %d, %s\n", err,
wolfSSL_ERR_error_string(err, buffer));
wolfSSL_free(sslResume);
wolfSSL_CTX_free(ctx);
err_sys("SSL_write_early_data failed");
}
do {
err = 0; /* reset error */
ret = wolfSSL_write_early_data(sslResume, msg, msgSz,
&msgSz);
if (ret <= 0) {
err = wolfSSL_get_error(sslResume, 0);
#ifdef WOLFSSL_ASYNC_CRYPT
if (err == WC_PENDING_E) {
ret = wolfSSL_AsyncPoll(sslResume,
WOLF_POLL_FLAG_CHECK_HW);
if (ret < 0) break;
}
#endif
}
} while (err == WC_PENDING_E);
if (ret != msgSz) {
printf("SSL_write_early_data msg error %d, %s\n", err,
wolfSSL_ERR_error_string(err, buffer));
wolfSSL_free(sslResume);
wolfSSL_CTX_free(ctx);
err_sys("SSL_write_early_data failed");
}
}
#endif
do {
err = 0; /* reset error */
ret = wolfSSL_connect(sslResume);
@@ -2085,12 +2373,15 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args)
(void) verifyCert;
(void) ourCert;
(void) ourKey;
(void) useVerifyCb;
#if !defined(WOLFSSL_TIRTOS)
return 0;
#endif
}
#endif /* !NO_WOLFSSL_CLIENT */
/* so overall tests can pull in test function */
#ifndef NO_MAIN_DRIVER
@@ -2111,10 +2402,12 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args)
wolfSSL_Init();
ChangeToWolfRoot();
#ifndef NO_WOLFSSL_CLIENT
#ifdef HAVE_STACK_SIZE
StackSizeCheck(&args, client_test);
#else
client_test(&args);
#endif
#endif
wolfSSL_Cleanup();
@@ -2130,38 +2423,3 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args)
char* myoptarg = NULL;
#endif /* NO_MAIN_DRIVER */
#ifdef WOLFSSL_CALLBACKS
int handShakeCB(HandShakeInfo* info)
{
(void)info;
return 0;
}
int timeoutCB(TimeoutInfo* info)
{
(void)info;
return 0;
}
#endif
#ifdef HAVE_SESSION_TICKET
int sessionTicketCB(WOLFSSL* ssl,
const unsigned char* ticket, int ticketSz,
void* ctx)
{
(void)ssl;
(void)ticket;
printf("Session Ticket CB: ticketSz = %d, ctx = %s\n",
ticketSz, (char*)ctx);
return 0;
}
#endif

View File

@@ -25,10 +25,12 @@
#endif
#include <cyassl/ctaocrypt/settings.h>
/* let's use cyassl layer AND cyassl openssl layer */
#include <cyassl/ssl.h>
#include <cyassl/openssl/ssl.h>
#ifdef CYASSL_DTLS
#include <cyassl/error-ssl.h>
#endif
#if defined(WOLFSSL_MDK_ARM) || defined(WOLFSSL_KEIL_TCP_NET)
#include <stdio.h>
@@ -52,6 +54,8 @@
#include "examples/echoclient/echoclient.h"
#ifndef NO_WOLFSSL_CLIENT
#ifdef WOLFSSL_ASYNC_CRYPT
static int devId = INVALID_DEVID;
#endif
@@ -264,6 +268,14 @@ void echoclient_test(void* args)
fflush(fout) ;
sendSz -= ret;
}
#ifdef CYASSL_DTLS
else if (wolfSSL_dtls(ssl) && err == DECRYPT_ERROR) {
/* This condition is OK. The packet should be dropped
* silently when there is a decrypt or MAC error on
* a DTLS record. */
sendSz = 0;
}
#endif
else {
printf("SSL_read msg error %d, %s\n", err,
ERR_error_string(err, buffer));
@@ -313,6 +325,7 @@ void echoclient_test(void* args)
((func_args*)args)->return_code = 0;
}
#endif /* !NO_WOLFSSL_CLIENT */
/* so overall tests can pull in test function */
#ifndef NO_MAIN_DRIVER
@@ -338,7 +351,9 @@ void echoclient_test(void* args)
#ifndef CYASSL_TIRTOS
ChangeToWolfRoot();
#endif
#ifndef NO_WOLFSSL_CLIENT
echoclient_test(&args);
#endif
CyaSSL_Cleanup();
@@ -351,5 +366,3 @@ void echoclient_test(void* args)
}
#endif /* NO_MAIN_DRIVER */

View File

@@ -53,6 +53,8 @@
#include "examples/echoserver/echoserver.h"
#ifndef NO_WOLFSSL_SERVER
#ifdef WOLFSSL_ASYNC_CRYPT
static int devId = INVALID_DEVID;
#endif
@@ -335,7 +337,7 @@ THREAD_RETURN CYASSL_THREAD echoserver_test(void* args)
}
} while (err == WC_PENDING_E);
if (ret <= 0) {
if (err != SSL_ERROR_WANT_READ) {
if (err != SSL_ERROR_WANT_READ && err != SSL_ERROR_ZERO_RETURN){
printf("SSL_read echo error %d, %s!\n", err,
CyaSSL_ERR_error_string(err, buffer));
}
@@ -392,7 +394,7 @@ THREAD_RETURN CYASSL_THREAD echoserver_test(void* args)
err = 0; /* reset error */
ret = CyaSSL_write(write_ssl, command, echoSz);
if (ret <= 0) {
err = CyaSSL_get_error(ssl, 0);
err = CyaSSL_get_error(write_ssl, 0);
#ifdef WOLFSSL_ASYNC_CRYPT
if (err == WC_PENDING_E) {
ret = wolfSSL_AsyncPoll(write_ssl, WOLF_POLL_FLAG_CHECK_HW);
@@ -481,6 +483,8 @@ THREAD_RETURN CYASSL_THREAD echoserver_test(void* args)
#endif
}
#endif /* !NO_WOLFSSL_SERVER */
/* so overall tests can pull in test function */
#ifndef NO_MAIN_DRIVER
@@ -504,7 +508,9 @@ THREAD_RETURN CYASSL_THREAD echoserver_test(void* args)
CyaSSL_Debugging_ON();
#endif
ChangeToWolfRoot();
#ifndef NO_WOLFSSL_SERVER
echoserver_test(&args);
#endif
CyaSSL_Cleanup();
#ifdef HAVE_WNR
@@ -515,7 +521,4 @@ THREAD_RETURN CYASSL_THREAD echoserver_test(void* args)
return args.return_code;
}
#endif /* NO_MAIN_DRIVER */

View File

@@ -1,6 +1,6 @@
/* server.c
*
* Copyright (C) 2006-2016 wolfSSL Inc.
* Copyright (C) 2006-2017 wolfSSL Inc.
*
* This file is part of wolfSSL.
*
@@ -47,9 +47,14 @@
#endif
#include <cyassl/openssl/ssl.h>
#include <cyassl/test.h>
#ifdef CYASSL_DTLS
#include <cyassl/error-ssl.h>
#endif
#include "examples/server/server.h"
#ifndef NO_WOLFSSL_SERVER
#ifdef WOLFSSL_ASYNC_CRYPT
static int devId = INVALID_DEVID;
#endif
@@ -59,16 +64,6 @@
* test.h will write the actual port number into the ready file for use
* by the client. */
#ifdef CYASSL_CALLBACKS
int srvHandShakeCB(HandShakeInfo*);
int srvTimeoutCB(TimeoutInfo*);
Timeval srvTo;
#endif
#ifndef NO_HANDSHAKE_DONE_CB
int myHsDoneCb(WOLFSSL* ssl, void* user_ctx);
#endif
static const char webServerMsg[] =
"HTTP/1.1 200 OK\n"
"Content-Type: text/html\n"
@@ -83,6 +78,49 @@ static const char webServerMsg[] =
"</body>\n"
"</html>\n";
int runWithErrors = 0; /* Used with -x flag to run err_sys vs. print errors */
#ifdef CYASSL_CALLBACKS
Timeval srvTo;
static int srvHandShakeCB(HandShakeInfo* info)
{
(void)info;
return 0;
}
static int srvTimeoutCB(TimeoutInfo* info)
{
(void)info;
return 0;
}
#endif
#ifndef NO_HANDSHAKE_DONE_CB
static int myHsDoneCb(WOLFSSL* ssl, void* user_ctx)
{
(void)user_ctx;
(void)ssl;
/* printf("Notified HandShake done\n"); */
/* return negative number to end TLS connection now */
return 0;
}
#endif
static void err_sys_ex(int out, const char* msg)
{
if (out == 1) { /* if server is running w/ -x flag, print error w/o exit */
printf("wolfSSL error: %s\n", msg);
printf("Continuing server execution...\n\n");
} else {
err_sys(msg);
}
}
static int NonBlockingSSL_Accept(SSL* ssl)
{
#ifndef CYASSL_CALLBACKS
@@ -156,7 +194,7 @@ int ServerEchoData(SSL* ssl, int clientfd, int echoData, int throughput)
buffer = (char*)malloc(TEST_BUFFER_SIZE);
if (!buffer) {
err_sys("Server buffer malloc failed");
err_sys_ex(runWithErrors, "Server buffer malloc failed");
}
while ((echoData && throughput == 0) ||
@@ -184,9 +222,10 @@ int ServerEchoData(SSL* ssl, int clientfd, int echoData, int throughput)
}
else
#endif
if (err != SSL_ERROR_WANT_READ) {
if (err != SSL_ERROR_WANT_READ &&
err != SSL_ERROR_ZERO_RETURN) {
printf("SSL_read echo error %d\n", err);
err_sys("SSL_read failed");
err_sys_ex(runWithErrors, "SSL_read failed");
}
}
else {
@@ -214,7 +253,7 @@ int ServerEchoData(SSL* ssl, int clientfd, int echoData, int throughput)
} while (err == WC_PENDING_E);
if (ret != len) {
printf("SSL_write echo error %d\n", err);
err_sys("SSL_write failed");
err_sys_ex(runWithErrors, "SSL_write failed");
}
if (throughput) {
@@ -240,6 +279,69 @@ int ServerEchoData(SSL* ssl, int clientfd, int echoData, int throughput)
return EXIT_SUCCESS;
}
static void ServerRead(WOLFSSL* ssl, char* input, int inputLen)
{
int ret, err;
char buffer[CYASSL_MAX_ERROR_SZ];
/* Read data */
do {
err = 0; /* reset error */
ret = SSL_read(ssl, input, inputLen);
if (ret < 0) {
err = SSL_get_error(ssl, 0);
#ifdef WOLFSSL_ASYNC_CRYPT
if (err == WC_PENDING_E) {
ret = wolfSSL_AsyncPoll(ssl, WOLF_POLL_FLAG_CHECK_HW);
if (ret < 0) break;
}
else
#endif
#ifdef CYASSL_DTLS
if (wolfSSL_dtls(ssl) && err == DECRYPT_ERROR) {
printf("Dropped client's message due to a bad MAC\n");
}
else
#endif
if (err != SSL_ERROR_WANT_READ) {
printf("SSL_read input error %d, %s\n", err,
ERR_error_string(err, buffer));
err_sys_ex(runWithErrors, "SSL_read failed");
}
}
} while (err == WC_PENDING_E);
if (ret > 0) {
input[ret] = 0; /* null terminate message */
printf("Client message: %s\n", input);
}
}
static void ServerWrite(WOLFSSL* ssl, const char* output, int outputLen)
{
int ret, err;
char buffer[CYASSL_MAX_ERROR_SZ];
do {
err = 0; /* reset error */
ret = SSL_write(ssl, output, outputLen);
if (ret <= 0) {
err = SSL_get_error(ssl, 0);
#ifdef WOLFSSL_ASYNC_CRYPT
if (err == WC_PENDING_E) {
ret = wolfSSL_AsyncPoll(ssl, WOLF_POLL_FLAG_CHECK_HW);
if (ret < 0) break;
}
#endif
}
} while (err == WC_PENDING_E || err == SSL_ERROR_WANT_WRITE);
if (ret != outputLen) {
printf("SSL_write msg error %d, %s\n", err,
ERR_error_string(err, buffer));
err_sys_ex(runWithErrors, "SSL_write failed");
}
}
static void Usage(void)
{
@@ -247,8 +349,13 @@ static void Usage(void)
" NOTE: All files relative to wolfSSL home dir\n");
printf("-? Help, print this usage\n");
printf("-p <num> Port to listen on, not 0, default %d\n", yasslPort);
#ifndef WOLFSSL_TLS13
printf("-v <num> SSL version [0-3], SSLv3(0) - TLS1.2(3)), default %d\n",
SERVER_DEFAULT_VERSION);
#else
printf("-v <num> SSL version [0-4], SSLv3(0) - TLS1.3(4)), default %d\n",
SERVER_DEFAULT_VERSION);
#endif
printf("-l <str> Cipher suite list (: delimited)\n");
printf("-c <file> Certificate file, default %s\n", svrCertFile);
printf("-k <file> Key file, default %s\n", svrKeyFile);
@@ -265,7 +372,6 @@ static void Usage(void)
printf("-d Disable client cert check\n");
printf("-b Bind to any interface instead of localhost only\n");
printf("-s Use pre Shared keys\n");
printf("-t Track wolfSSL memory use\n");
printf("-u Use UDP DTLS,"
" add -v 2 for DTLSv1, -v 3 for DTLSv1.2 (default)\n");
#ifdef WOLFSSL_SCTP
@@ -290,6 +396,7 @@ static void Usage(void)
#ifndef NO_PSK
printf("-I Do not send PSK identity hint\n");
#endif
printf("-x Print server errors but do not close connection\n");
printf("-i Loop indefinitely (allow repeated connections)\n");
printf("-e Echo data mode (return raw bytes received)\n");
#ifdef HAVE_NTRU
@@ -304,7 +411,23 @@ static void Usage(void)
#endif
printf("-g Return basic HTML web page\n");
printf("-C <num> The number of connections to accept, default: 1\n");
printf("-U Force use of the default cipher suite list\n");
printf("-H Force use of the default cipher suite list\n");
#ifdef WOLFSSL_TLS13
printf("-K Key Exchange for PSK not using (EC)DHE\n");
printf("-U Update keys and IVs before sending\n");
#ifdef WOLFSSL_POST_HANDSHAKE_AUTH
printf("-Q Request certificate from client post-handshake\n");
#endif
#ifdef WOLFSSL_SEND_HRR_COOKIE
printf("-J Server sends Cookie Extension containing state\n");
#endif
#endif
#ifdef WOLFSSL_EARLY_DATA
printf("-0 Early data read from client (0-RTT handshake)\n");
#endif
#ifdef WOLFSSL_MULTICAST
printf("-3 <grpid> Multicast, grpid < 256\n");
#endif
}
THREAD_RETURN CYASSL_THREAD server_test(void* args)
@@ -334,6 +457,7 @@ THREAD_RETURN CYASSL_THREAD server_test(void* args)
int doDTLS = 0;
int dtlsUDP = 0;
int dtlsSCTP = 0;
int doMcast = 0;
int needDH = 0;
int useNtruKey = 0;
int nonBlocking = 0;
@@ -386,6 +510,20 @@ THREAD_RETURN CYASSL_THREAD server_test(void* args)
const char* wnrConfigFile = wnrConfig;
#endif
char buffer[CYASSL_MAX_ERROR_SZ];
#ifdef WOLFSSL_TLS13
int noPskDheKe = 0;
#endif
int updateKeysIVs = 0;
#if defined(WOLFSSL_TLS13) && defined(WOLFSSL_POST_HANDSHAKE_AUTH)
int postHandAuth = 0;
#endif
#ifdef WOLFSSL_EARLY_DATA
int earlyData = 0;
#endif
#ifdef WOLFSSL_SEND_HRR_COOKIE
int hrrCookie = 0;
#endif
byte mcastID = 0;
#ifdef WOLFSSL_STATIC_MEMORY
#if (defined(HAVE_ECC) && !defined(ALT_ECC_SIZE)) \
@@ -421,6 +559,8 @@ THREAD_RETURN CYASSL_THREAD server_test(void* args)
(void)alpn_opt;
(void)crlFlags;
(void)readySignal;
(void)updateKeysIVs;
(void)mcastID;
#ifdef CYASSL_TIRTOS
fdOpenSession(Task_self());
@@ -429,15 +569,20 @@ THREAD_RETURN CYASSL_THREAD server_test(void* args)
#ifdef WOLFSSL_VXWORKS
useAnyAddr = 1;
#else
/* Not Used: h, m, t, x, y, z, F, J, K, M, Q, T, U, V, W, X, Y */
/* Not Used: h, m, t, y, z, F, M, T, V, W, X, Y */
while ((ch = mygetopt(argc, argv, "?"
"abc:defgijk:l:nop:q:rsuv:w"
"A:B:C:D:E:GHIL:NO:PR:S:YZ:")) != -1) {
"abc:defgijk:l:nop:q:rsuv:wx"
"A:B:C:D:E:GHIJKL:NO:PQR:S:UYZ:"
"03:")) != -1) {
switch (ch) {
case '?' :
Usage();
exit(EXIT_SUCCESS);
case 'x' :
runWithErrors = 1;
break;
case 'd' :
doCliCertCheck = 0;
break;
@@ -500,7 +645,7 @@ THREAD_RETURN CYASSL_THREAD server_test(void* args)
case 'v' :
version = atoi(myoptarg);
if (version < 0 || version > 3) {
if (version < 0 || version > 4) {
Usage();
exit(MY_EX_USAGE);
}
@@ -634,6 +779,44 @@ THREAD_RETURN CYASSL_THREAD server_test(void* args)
useWebServerMsg = 1;
break;
case 'K' :
#ifdef WOLFSSL_TLS13
noPskDheKe = 1;
#endif
break;
case 'U' :
#ifdef WOLFSSL_TLS13
updateKeysIVs = 1;
#endif
break;
case 'Q' :
#if defined(WOLFSSL_TLS13) && defined(WOLFSSL_POST_HANDSHAKE_AUTH)
postHandAuth = 1;
doCliCertCheck = 0;
#endif
break;
case 'J' :
#ifdef WOLFSSL_SEND_HRR_COOKIE
hrrCookie = 1;
#endif
break;
case '0' :
#ifdef WOLFSSL_EARLY_DATA
earlyData = 1;
#endif
break;
case '3' :
#ifdef WOLFSSL_MULTICAST
doMcast = 1;
mcastID = (byte)(atoi(myoptarg) & 0xFF);
#endif
break;
default:
Usage();
exit(MY_EX_USAGE);
@@ -645,7 +828,7 @@ THREAD_RETURN CYASSL_THREAD server_test(void* args)
/* Can only use DTLS over UDP or SCTP, can't do both. */
if (dtlsUDP && dtlsSCTP) {
err_sys("Cannot use DTLS with both UDP and SCTP.");
err_sys_ex(runWithErrors, "Cannot use DTLS with both UDP and SCTP.");
}
/* sort out DTLS versus TLS versions */
@@ -666,7 +849,7 @@ THREAD_RETURN CYASSL_THREAD server_test(void* args)
#ifdef HAVE_WNR
if (wc_InitNetRandom(wnrConfigFile, NULL, 5000) != 0)
err_sys("can't load whitewood net random config file");
err_sys_ex(runWithErrors, "can't load whitewood net random config file");
#endif
switch (version) {
@@ -696,6 +879,12 @@ THREAD_RETURN CYASSL_THREAD server_test(void* args)
break;
#endif
#ifdef WOLFSSL_TLS13
case 4:
method = wolfTLSv1_3_server_method_ex;
break;
#endif
#ifdef CYASSL_DTLS
#ifndef NO_OLD_TLS
case -1:
@@ -709,11 +898,11 @@ THREAD_RETURN CYASSL_THREAD server_test(void* args)
#endif
default:
err_sys("Bad SSL version");
err_sys_ex(runWithErrors, "Bad SSL version");
}
if (method == NULL)
err_sys("unable to get method");
err_sys_ex(runWithErrors, "unable to get method");
#ifdef WOLFSSL_STATIC_MEMORY
#ifdef DEBUG_WOLFSSL
@@ -730,29 +919,29 @@ THREAD_RETURN CYASSL_THREAD server_test(void* args)
if (wolfSSL_CTX_load_static_memory(&ctx, method, memory, sizeof(memory),0,1)
!= SSL_SUCCESS)
err_sys("unable to load static memory and create ctx");
err_sys_ex(runWithErrors, "unable to load static memory and create ctx");
/* load in a buffer for IO */
if (wolfSSL_CTX_load_static_memory(&ctx, NULL, memoryIO, sizeof(memoryIO),
WOLFMEM_IO_POOL_FIXED | WOLFMEM_TRACK_STATS, 1)
!= SSL_SUCCESS)
err_sys("unable to load static memory and create ctx");
err_sys_ex(runWithErrors, "unable to load static memory and create ctx");
#else
ctx = SSL_CTX_new(method(NULL));
#endif /* WOLFSSL_STATIC_MEMORY */
if (ctx == NULL)
err_sys("unable to get ctx");
err_sys_ex(runWithErrors, "unable to get ctx");
#if defined(HAVE_SESSION_TICKET) && defined(HAVE_CHACHA) && \
defined(HAVE_POLY1305)
if (TicketInit() != 0)
err_sys("unable to setup Session Ticket Key context");
err_sys_ex(runWithErrors, "unable to setup Session Ticket Key context");
wolfSSL_CTX_set_TicketEncCb(ctx, myTicketEncCb);
#endif
if (cipherList && !useDefCipherList) {
if (SSL_CTX_set_cipher_list(ctx, cipherList) != SSL_SUCCESS)
err_sys("server can't set cipher list 1");
err_sys_ex(runWithErrors, "server can't set cipher list 1");
}
#ifdef CYASSL_LEANPSK
@@ -784,7 +973,7 @@ THREAD_RETURN CYASSL_THREAD server_test(void* args)
#if !defined(NO_FILESYSTEM)
if (SSL_CTX_use_certificate_chain_file(ctx, ourCert)
!= SSL_SUCCESS)
err_sys("can't load server cert file, check file and run from"
err_sys_ex(runWithErrors, "can't load server cert file, check file and run from"
" wolfSSL home dir");
#else
/* loads cert chain file using buffer API */
@@ -795,17 +984,17 @@ THREAD_RETURN CYASSL_THREAD server_test(void* args)
#ifndef NO_DH
if (wolfSSL_CTX_SetMinDhKey_Sz(ctx, (word16)minDhKeyBits) != SSL_SUCCESS) {
err_sys("Error setting minimum DH key size");
err_sys_ex(runWithErrors, "Error setting minimum DH key size");
}
#endif
#ifndef NO_RSA
if (wolfSSL_CTX_SetMinRsaKey_Sz(ctx, minRsaKeyBits) != SSL_SUCCESS){
err_sys("Error setting minimum RSA key size");
err_sys_ex(runWithErrors, "Error setting minimum RSA key size");
}
#endif
#ifdef HAVE_ECC
if (wolfSSL_CTX_SetMinEccKey_Sz(ctx, minEccKeyBits) != SSL_SUCCESS){
err_sys("Error setting minimum ECC key size");
err_sys_ex(runWithErrors, "Error setting minimum ECC key size");
}
#endif
@@ -813,7 +1002,7 @@ THREAD_RETURN CYASSL_THREAD server_test(void* args)
if (useNtruKey) {
if (CyaSSL_CTX_use_NTRUPrivateKey_file(ctx, ourKey)
!= SSL_SUCCESS)
err_sys("can't load ntru key file, "
err_sys_ex(runWithErrors, "can't load ntru key file, "
"Please run from wolfSSL home dir");
}
#endif
@@ -822,7 +1011,7 @@ THREAD_RETURN CYASSL_THREAD server_test(void* args)
#if !defined(NO_FILESYSTEM)
if (SSL_CTX_use_PrivateKey_file(ctx, ourKey, SSL_FILETYPE_PEM)
!= SSL_SUCCESS)
err_sys("can't load server private key file, check file and run "
err_sys_ex(runWithErrors, "can't load server private key file, check file and run "
"from wolfSSL home dir");
#else
/* loads private key file using buffer API */
@@ -840,16 +1029,21 @@ THREAD_RETURN CYASSL_THREAD server_test(void* args)
if (cipherList == NULL && !usePskPlus) {
const char *defaultCipherList;
#if defined(HAVE_AESGCM) && !defined(NO_DH)
defaultCipherList = "DHE-PSK-AES128-GCM-SHA256";
needDH = 1;
#elif defined(HAVE_NULL_CIPHER)
defaultCipherList = "PSK-NULL-SHA256";
#if defined(HAVE_AESGCM) && !defined(NO_DH)
#ifdef WOLFSSL_TLS13
defaultCipherList = "DHE-PSK-AES128-GCM-SHA256:"
"TLS13-AES128-GCM-SHA256";
#else
defaultCipherList = "PSK-AES128-CBC-SHA256";
defaultCipherList = "DHE-PSK-AES128-GCM-SHA256";
#endif
needDH = 1;
#elif defined(HAVE_NULL_CIPHER)
defaultCipherList = "PSK-NULL-SHA256";
#else
defaultCipherList = "PSK-AES128-CBC-SHA256";
#endif
if (SSL_CTX_set_cipher_list(ctx, defaultCipherList) != SSL_SUCCESS)
err_sys("server can't set cipher list 2");
err_sys_ex(runWithErrors, "server can't set cipher list 2");
}
#endif
}
@@ -859,7 +1053,7 @@ THREAD_RETURN CYASSL_THREAD server_test(void* args)
CyaSSL_CTX_allow_anon_cipher(ctx);
if (cipherList == NULL || (cipherList && useDefCipherList)) {
if (SSL_CTX_set_cipher_list(ctx, "ADH-AES128-SHA") != SSL_SUCCESS)
err_sys("server can't set cipher list 4");
err_sys_ex(runWithErrors, "server can't set cipher list 4");
}
#endif
}
@@ -872,12 +1066,12 @@ THREAD_RETURN CYASSL_THREAD server_test(void* args)
((usePskPlus)? SSL_VERIFY_FAIL_EXCEPT_PSK :
SSL_VERIFY_FAIL_IF_NO_PEER_CERT),0);
if (SSL_CTX_load_verify_locations(ctx, verifyCert, 0) != SSL_SUCCESS)
err_sys("can't load ca file, Please run from wolfSSL home dir");
err_sys_ex(runWithErrors, "can't load ca file, Please run from wolfSSL home dir");
#ifdef WOLFSSL_TRUST_PEER_CERT
if (trustCert) {
if ((ret = wolfSSL_CTX_trust_peer_cert(ctx, trustCert,
SSL_FILETYPE_PEM)) != SSL_SUCCESS) {
err_sys("can't load trusted peer cert file");
err_sys_ex(runWithErrors, "can't load trusted peer cert file");
}
}
#endif /* WOLFSSL_TRUST_PEER_CERT */
@@ -888,7 +1082,7 @@ THREAD_RETURN CYASSL_THREAD server_test(void* args)
/* don't use EDH, can't sniff tmp keys */
if (cipherList == NULL) {
if (SSL_CTX_set_cipher_list(ctx, "AES128-SHA") != SSL_SUCCESS)
err_sys("server can't set cipher list 3");
err_sys_ex(runWithErrors, "server can't set cipher list 3");
}
#endif
@@ -896,7 +1090,7 @@ THREAD_RETURN CYASSL_THREAD server_test(void* args)
if (sniHostName)
if (CyaSSL_CTX_UseSNI(ctx, CYASSL_SNI_HOST_NAME, sniHostName,
XSTRLEN(sniHostName)) != SSL_SUCCESS)
err_sys("UseSNI failed");
err_sys_ex(runWithErrors, "UseSNI failed");
#endif
#ifdef USE_WINDOWS_API
@@ -914,6 +1108,11 @@ THREAD_RETURN CYASSL_THREAD server_test(void* args)
wolfSSL_CTX_UseAsync(ctx, devId);
#endif /* WOLFSSL_ASYNC_CRYPT */
#ifdef WOLFSSL_TLS13
if (noPskDheKe)
wolfSSL_CTX_no_dhe_psk(ctx);
#endif
while (1) {
/* allow resume option */
if (resumeCount > 1) {
@@ -928,7 +1127,7 @@ THREAD_RETURN CYASSL_THREAD server_test(void* args)
clientfd = sockfd;
}
if (WOLFSSL_SOCKET_IS_INVALID(clientfd)) {
err_sys("tcp accept failed");
err_sys_ex(runWithErrors, "tcp accept failed");
}
}
#if defined(WOLFSSL_STATIC_MEMORY) && defined(DEBUG_WOLFSSL)
@@ -936,30 +1135,61 @@ THREAD_RETURN CYASSL_THREAD server_test(void* args)
WOLFSSL_MEM_STATS mem_stats;
fprintf(stderr, "Before creating SSL\n");
if (wolfSSL_CTX_is_static_memory(ctx, &mem_stats) != 1)
err_sys("ctx not using static memory");
err_sys_ex(runWithErrors, "ctx not using static memory");
if (wolfSSL_PrintStats(&mem_stats) != 1) /* function in test.h */
err_sys("error printing out memory stats");
err_sys_ex(runWithErrors, "error printing out memory stats");
}
#endif
if (doMcast) {
#ifdef WOLFSSL_MULTICAST
wolfSSL_CTX_mcast_set_member_id(ctx, mcastID);
if (wolfSSL_CTX_set_cipher_list(ctx, "WDM-NULL-SHA256") != SSL_SUCCESS)
err_sys("Couldn't set multicast cipher list.");
#endif
}
ssl = SSL_new(ctx);
if (ssl == NULL)
err_sys("unable to get SSL");
err_sys_ex(runWithErrors, "unable to get SSL");
#ifdef OPENSSL_EXTRA
wolfSSL_KeepArrays(ssl);
#endif
#ifdef WOLFSSL_SEND_HRR_COOKIE
if (hrrCookie && wolfSSL_send_hrr_cookie(ssl, NULL, 0) != SSL_SUCCESS) {
err_sys("unable to set use of cookie with HRR msg");
}
#endif
#if defined(WOLFSSL_STATIC_MEMORY) && defined(DEBUG_WOLFSSL)
{
WOLFSSL_MEM_STATS mem_stats;
fprintf(stderr, "After creating SSL\n");
if (wolfSSL_CTX_is_static_memory(ctx, &mem_stats) != 1)
err_sys("ctx not using static memory");
err_sys_ex(runWithErrors, "ctx not using static memory");
if (wolfSSL_PrintStats(&mem_stats) != 1) /* function in test.h */
err_sys("error printing out memory stats");
err_sys_ex(runWithErrors, "error printing out memory stats");
}
#endif
if (doMcast) {
#ifdef WOLFSSL_MULTICAST
byte pms[512];
byte cr[32];
byte sr[32];
const byte suite[2] = {0, 0xfe}; /* WDM_WITH_NULL_SHA256 */
XMEMSET(pms, 0x23, sizeof(pms));
XMEMSET(cr, 0xA5, sizeof(cr));
XMEMSET(sr, 0x5A, sizeof(sr));
if (wolfSSL_set_secret(ssl, 1, pms, sizeof(pms), cr, sr, suite)
!= SSL_SUCCESS)
err_sys("unable to set mcast secret");
#endif
}
#ifndef NO_HANDSHAKE_DONE_CB
wolfSSL_SetHsDoneCb(ssl, myHsDoneCb, NULL);
#endif
@@ -968,12 +1198,12 @@ THREAD_RETURN CYASSL_THREAD server_test(void* args)
crlFlags = CYASSL_CRL_MONITOR | CYASSL_CRL_START_MON;
#endif
if (CyaSSL_EnableCRL(ssl, 0) != SSL_SUCCESS)
err_sys("unable to enable CRL");
err_sys_ex(runWithErrors, "unable to enable CRL");
if (CyaSSL_LoadCRL(ssl, crlPemDir, SSL_FILETYPE_PEM, crlFlags)
!= SSL_SUCCESS)
err_sys("unable to load CRL");
err_sys_ex(runWithErrors, "unable to load CRL");
if (CyaSSL_SetCRL_Cb(ssl, CRL_CallBack) != SSL_SUCCESS)
err_sys("unable to set CRL callback url");
err_sys_ex(runWithErrors, "unable to set CRL callback url");
#endif
#ifdef HAVE_OCSP
if (useOcsp) {
@@ -989,13 +1219,13 @@ THREAD_RETURN CYASSL_THREAD server_test(void* args)
#if defined(HAVE_CERTIFICATE_STATUS_REQUEST) \
|| defined(HAVE_CERTIFICATE_STATUS_REQUEST_V2)
if (wolfSSL_CTX_EnableOCSPStapling(ctx) != SSL_SUCCESS)
err_sys("can't enable OCSP Stapling Certificate Manager");
err_sys_ex(runWithErrors, "can't enable OCSP Stapling Certificate Manager");
if (SSL_CTX_load_verify_locations(ctx, "certs/ocsp/intermediate1-ca-cert.pem", 0) != SSL_SUCCESS)
err_sys("can't load ca file, Please run from wolfSSL home dir");
err_sys_ex(runWithErrors, "can't load ca file, Please run from wolfSSL home dir");
if (SSL_CTX_load_verify_locations(ctx, "certs/ocsp/intermediate2-ca-cert.pem", 0) != SSL_SUCCESS)
err_sys("can't load ca file, Please run from wolfSSL home dir");
err_sys_ex(runWithErrors, "can't load ca file, Please run from wolfSSL home dir");
if (SSL_CTX_load_verify_locations(ctx, "certs/ocsp/intermediate3-ca-cert.pem", 0) != SSL_SUCCESS)
err_sys("can't load ca file, Please run from wolfSSL home dir");
err_sys_ex(runWithErrors, "can't load ca file, Please run from wolfSSL home dir");
#endif
#ifdef HAVE_PK_CALLBACKS
if (pkCallbacks)
@@ -1012,7 +1242,7 @@ THREAD_RETURN CYASSL_THREAD server_test(void* args)
doListen = 0; /* Don't listen next time */
if (SSL_set_fd(ssl, clientfd) != SSL_SUCCESS) {
err_sys("error in setting fd");
err_sys_ex(runWithErrors, "error in setting fd");
}
#ifdef HAVE_ALPN
@@ -1035,7 +1265,7 @@ THREAD_RETURN CYASSL_THREAD server_test(void* args)
n = (int)recvfrom(sockfd, (char*)b, sizeof(b), MSG_PEEK,
(struct sockaddr*)&cliaddr, &len);
if (n <= 0)
err_sys("recvfrom failed");
err_sys_ex(runWithErrors, "recvfrom failed");
wolfSSL_dtls_set_peer(ssl, &cliaddr, len);
}
@@ -1061,6 +1291,29 @@ THREAD_RETURN CYASSL_THREAD server_test(void* args)
ret = NonBlockingSSL_Accept(ssl);
}
else {
#ifdef WOLFSSL_EARLY_DATA
if (earlyData) {
do {
int len;
err = 0; /* reset error */
ret = wolfSSL_read_early_data(ssl, input, sizeof(input)-1,
&len);
if (ret != SSL_SUCCESS) {
err = SSL_get_error(ssl, 0);
#ifdef WOLFSSL_ASYNC_CRYPT
if (err == WC_PENDING_E) {
ret = wolfSSL_AsyncPoll(ssl, WOLF_POLL_FLAG_CHECK_HW);
if (ret < 0) break;
}
#endif
}
if (ret > 0) {
input[ret] = 0; /* null terminate message */
printf("Early Data Client message: %s\n", input);
}
} while (err == WC_PENDING_E || ret > 0);
}
#endif
do {
err = 0; /* reset error */
ret = SSL_accept(ssl);
@@ -1082,12 +1335,12 @@ THREAD_RETURN CYASSL_THREAD server_test(void* args)
err = SSL_get_error(ssl, 0);
printf("SSL_accept error %d, %s\n", err,
ERR_error_string(err, buffer));
err_sys("SSL_accept failed");
err_sys_ex(runWithErrors, "SSL_accept failed");
}
showPeer(ssl);
if (SSL_state(ssl) != 0) {
err_sys("SSL in error state");
err_sys_ex(runWithErrors, "SSL in error state");
}
#ifdef OPENSSL_EXTRA
@@ -1099,23 +1352,29 @@ THREAD_RETURN CYASSL_THREAD server_test(void* args)
/* get size of buffer then print */
size = wolfSSL_get_server_random(NULL, NULL, 0);
if (size == 0) {
err_sys("error getting server random buffer size");
err_sys_ex(runWithErrors, "error getting server random buffer size");
}
rnd = (byte*)XMALLOC(size, NULL, DYNAMIC_TYPE_TMP_BUFFER);
if (rnd == NULL) {
err_sys("error creating server random buffer");
err_sys_ex(runWithErrors, "error creating server random buffer");
}
size = wolfSSL_get_server_random(ssl, rnd, size);
if (size == 0) {
XFREE(rnd, NULL, DYNAMIC_TYPE_TMP_BUFFER);
err_sys("error getting server random buffer");
err_sys_ex(runWithErrors, "error getting server random buffer");
}
printf("Server Random : ");
for (pt = rnd; pt < rnd + size; pt++) printf("%02X", *pt);
printf("\n");
pt = rnd;
if (pt != NULL) {
for (pt = rnd; pt < rnd + size; pt++) printf("%02X", *pt);
printf("\n");
} else {
err_sys_ex(runWithErrors, "error: attempted to dereference null "
"pointer");
}
XFREE(rnd, NULL, DYNAMIC_TYPE_TMP_BUFFER);
}
#endif
@@ -1144,35 +1403,43 @@ THREAD_RETURN CYASSL_THREAD server_test(void* args)
free(list);
}
#endif
#if !defined(NO_FILESYSTEM) && !defined(NO_CERTS)
#if defined(WOLFSSL_TLS13) && defined(WOLFSSL_POST_HANDSHAKE_AUTH)
if (postHandAuth) {
SSL_CTX_set_verify(ctx, SSL_VERIFY_PEER |
((usePskPlus)? SSL_VERIFY_FAIL_EXCEPT_PSK :
SSL_VERIFY_FAIL_IF_NO_PEER_CERT),0);
if (SSL_CTX_load_verify_locations(ctx, verifyCert, 0)
!= SSL_SUCCESS) {
err_sys_ex(runWithErrors, "can't load ca file, Please run from wolfSSL home dir");
}
#ifdef WOLFSSL_TRUST_PEER_CERT
if (trustCert) {
if ((ret = wolfSSL_CTX_trust_peer_cert(ctx, trustCert,
SSL_FILETYPE_PEM)) != SSL_SUCCESS) {
err_sys_ex(runWithErrors, "can't load trusted peer cert file");
}
}
#endif /* WOLFSSL_TRUST_PEER_CERT */
}
#endif
#endif
if (echoData == 0 && throughput == 0) {
const char* write_msg;
int write_msg_sz;
/* Read data */
do {
err = 0; /* reset error */
ret = SSL_read(ssl, input, sizeof(input)-1);
if (ret < 0) {
err = SSL_get_error(ssl, 0);
ServerRead(ssl, input, sizeof(input)-1);
#ifdef WOLFSSL_ASYNC_CRYPT
if (err == WC_PENDING_E) {
ret = wolfSSL_AsyncPoll(ssl, WOLF_POLL_FLAG_CHECK_HW);
if (ret < 0) break;
}
else
#endif
if (err != SSL_ERROR_WANT_READ) {
printf("SSL_read input error %d, %s\n", err,
ERR_error_string(err, buffer));
err_sys("SSL_read failed");
}
}
} while (err == WC_PENDING_E);
if (ret > 0) {
input[ret] = 0; /* null terminate message */
printf("Client message: %s\n", input);
}
#ifdef WOLFSSL_TLS13
if (updateKeysIVs)
wolfSSL_update_keys(ssl);
#endif
#if defined(WOLFSSL_TLS13) && defined(WOLFSSL_POST_HANDSHAKE_AUTH)
if (postHandAuth)
wolfSSL_request_certificate(ssl);
#endif
/* Write data */
if (!useWebServerMsg) {
@@ -1183,25 +1450,14 @@ THREAD_RETURN CYASSL_THREAD server_test(void* args)
write_msg = webServerMsg;
write_msg_sz = sizeof(webServerMsg);
}
do {
err = 0; /* reset error */
ret = SSL_write(ssl, write_msg, write_msg_sz);
if (ret <= 0) {
err = SSL_get_error(ssl, 0);
ServerWrite(ssl, write_msg, write_msg_sz);
#ifdef WOLFSSL_ASYNC_CRYPT
if (err == WC_PENDING_E) {
ret = wolfSSL_AsyncPoll(ssl, WOLF_POLL_FLAG_CHECK_HW);
if (ret < 0) break;
}
#endif
}
} while (err == WC_PENDING_E);
if (ret != write_msg_sz) {
printf("SSL_write msg error %d, %s\n", err,
ERR_error_string(err, buffer));
err_sys("SSL_write failed");
#if defined(WOLFSSL_TLS13) && defined(WOLFSSL_POST_HANDSHAKE_AUTH)
if (postHandAuth) {
ServerWrite(ssl, write_msg, write_msg_sz);
ServerRead(ssl, input, sizeof(input)-1);
}
#endif
}
else {
ServerEchoData(ssl, clientfd, echoData, throughput);
@@ -1221,7 +1477,7 @@ THREAD_RETURN CYASSL_THREAD server_test(void* args)
/* display collected statistics */
#ifdef WOLFSSL_STATIC_MEMORY
if (wolfSSL_is_static_memory(ssl, &ssl_stats) != 1)
err_sys("static memory was not used with ssl");
err_sys_ex(runWithErrors, "static memory was not used with ssl");
fprintf(stderr, "\nprint off SSL memory stats\n");
fprintf(stderr, "*** This is memory state before wolfSSL_free is called\n");
@@ -1287,6 +1543,8 @@ THREAD_RETURN CYASSL_THREAD server_test(void* args)
#endif
}
#endif /* !NO_WOLFSSL_SERVER */
/* so overall tests can pull in test function */
#ifndef NO_MAIN_DRIVER
@@ -1310,17 +1568,22 @@ THREAD_RETURN CYASSL_THREAD server_test(void* args)
CyaSSL_Init();
ChangeToWolfRoot();
#ifndef NO_WOLFSSL_SERVER
#ifdef HAVE_STACK_SIZE
StackSizeCheck(&args, server_test);
#else
server_test(&args);
#endif
#else
printf("Server not compiled in!\n");
#endif
CyaSSL_Cleanup();
FreeTcpReady(&ready);
#ifdef HAVE_WNR
if (wc_FreeNetRandom() < 0)
err_sys("Failed to free netRandom context");
err_sys_ex(runWithErrors, "Failed to free netRandom context");
#endif /* HAVE_WNR */
return args.return_code;
@@ -1330,34 +1593,3 @@ THREAD_RETURN CYASSL_THREAD server_test(void* args)
char* myoptarg = NULL;
#endif /* NO_MAIN_DRIVER */
#ifdef CYASSL_CALLBACKS
int srvHandShakeCB(HandShakeInfo* info)
{
(void)info;
return 0;
}
int srvTimeoutCB(TimeoutInfo* info)
{
(void)info;
return 0;
}
#endif
#ifndef NO_HANDSHAKE_DONE_CB
int myHsDoneCb(WOLFSSL* ssl, void* user_ctx)
{
(void)user_ctx;
(void)ssl;
/* printf("Notified HandShake done\n"); */
/* return negative number to end TLS connection now */
return 0;
}
#endif

View File

@@ -1,28 +1,75 @@
void _mon_putc(char c);
static void init_serial() {
#ifdef MICROCHIP_PIC32
#if defined (__32MZ2048ECH144__) || (__32MZ2048ECM144__)
/* Set up PB2 divisor for UART2 */
SYSKEY = 0x00000000;
SYSKEY = 0xAA996655;
SYSKEY = 0x556699AA;
PB2DIV = 0x00008018;
SYSKEY = 0x33333333;
/* UART2 Init */
// U2BRG = 0x0C;
U2BRG = 0x7;
#define BAUD_GEN(sysclk, baud) ((sysclk / (16 * baud)) - 1)
#ifdef MICROCHIP_PIC32
#if defined (__32MZ2048ECH144__) || defined(__32MZ2048ECM144__) || defined(__32MZ2048EFM144__)
/* Code generated from Harmony example then exported using Window -> PIC32 Memory View -> Configuration Bits into system_config.h */
#define SYS_CLK_FREQ 200000000ul
#define SYS_CLK_BUS_PERIPHERAL_2 100000000ul
// DEVCFG3
#pragma config FMIIEN = ON // Ethernet RMII/MII Enable (MII Enabled)
#pragma config FETHIO = ON // Ethernet I/O Pin Select (Default Ethernet I/O)
#pragma config PGL1WAY = ON // Permission Group Lock One Way Configuration (Allow only one reconfiguration)
#pragma config PMDL1WAY = ON // Peripheral Module Disable Configuration (Allow only one reconfiguration)
#pragma config IOL1WAY = ON // Peripheral Pin Select Configuration (Allow only one reconfiguration)
#pragma config FUSBIDIO = ON // USB USBID Selection (Controlled by the USB Module)
// DEVCFG2
#pragma config FPLLIDIV = DIV_1 // System PLL Input Divider (1x Divider)
#pragma config FPLLRNG = RANGE_5_10_MHZ // System PLL Input Range (5-10 MHz Input)
#pragma config FPLLICLK = PLL_FRC // System PLL Input Clock Selection (FRC is input to the System PLL)
#pragma config FPLLMULT = MUL_50 // System PLL Multiplier (PLL Multiply by 50)
#pragma config FPLLODIV = DIV_2 // System PLL Output Clock Divider (2x Divider)
#pragma config UPLLFSEL = FREQ_24MHZ // USB PLL Input Frequency Selection (USB PLL input is 24 MHz)
// DEVCFG1
#pragma config FNOSC = SPLL // Oscillator Selection Bits (System PLL)
#pragma config DMTINTV = WIN_127_128 // DMT Count Window Interval (Window/Interval value is 127/128 counter value)
#pragma config FSOSCEN = OFF // Secondary Oscillator Enable (Disable SOSC)
#pragma config IESO = OFF // Internal/External Switch Over (Disabled)
#pragma config POSCMOD = OFF // Primary Oscillator Configuration (Primary osc disabled)
#pragma config OSCIOFNC = OFF // CLKO Output Signal Active on the OSCO Pin (Disabled)
#pragma config FCKSM = CSECME // Clock Switching and Monitor Selection (Clock Switch Enabled, FSCM Enabled)
#pragma config WDTPS = PS1048576 // Watchdog Timer Postscaler (1:1048576)
#pragma config WDTSPGM = STOP // Watchdog Timer Stop During Flash Programming (WDT stops during Flash programming)
#pragma config WINDIS = NORMAL // Watchdog Timer Window Mode (Watchdog Timer is in non-Window mode)
#pragma config FWDTEN = OFF // Watchdog Timer Enable (WDT Disabled)
#pragma config FWDTWINSZ = WINSZ_25 // Watchdog Timer Window Size (Window size is 25%)
#pragma config DMTCNT = DMT31 // Deadman Timer Count Selection (2^31 (2147483648))
#pragma config FDMTEN = OFF // Deadman Timer Enable (Deadman Timer is disabled)
// DEVCFG0
#pragma config ICESEL = ICS_PGx2 // ICE/ICD Comm Channel Select (Communicate on PGEC2/PGED2)
// DEVCP0
#pragma config CP = OFF // Code Protect (Protection Disabled)
#include <xc.h>
#endif
#endif
static void init_serial(unsigned int sysClk) {
#ifdef MICROCHIP_PIC32
#if defined (__32MZ2048ECH144__) || defined(__32MZ2048ECM144__) || defined(__32MZ2048EFM144__)
/* This is for pin B14 which is connected to the USB to UART connector J11 located under Ethernet connector */
/* Setup UART2 */
#ifdef SYS_CLK_BUS_PERIPHERAL_2
U2BRG = BAUD_GEN(SYS_CLK_BUS_PERIPHERAL_2, 115200);
#else
if (sysClk > 100000000)
sysClk /= 2;
U2BRG = BAUD_GEN(sysClk, 115200);
#endif
ANSELBCLR = 0x4000;
ANSELGCLR = 0x0040;
RPB14R = 0x02;
U2RXR = 0x01;
U2MODE = 0x8000;
U2STA = 0x400;
#elif defined __PIC32MX__
SYSTEMConfigPerformance(80000000);
DBINIT();
#endif
#endif
(void)sysClk;
}

View File

@@ -20,29 +20,33 @@
*/
/* Implements Microchip CRYPTO API layer */
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#ifdef MICROCHIP_MPLAB_HARMONY
#include "system_config.h"
#include "crypto/crypto.h"
#else
#include "crypto.h"
#endif
#include <wolfssl/wolfcrypt/settings.h>
#include <wolfssl/wolfcrypt/md5.h>
#include <wolfssl/wolfcrypt/sha.h>
#include <wolfssl/wolfcrypt/sha256.h>
#include <wolfssl/wolfcrypt/sha512.h>
#include <wolfssl/wolfcrypt/hmac.h>
#include <wolfssl/wolfcrypt/compress.h>
#include <wolfssl/wolfcrypt/random.h>
#include <wolfssl/wolfcrypt/des3.h>
#include <wolfssl/wolfcrypt/aes.h>
#include <wolfssl/wolfcrypt/rsa.h>
#include <wolfssl/wolfcrypt/ecc.h>
#include <wolfssl/wolfcrypt/error-crypt.h>
#include "crypto.h"
#include <cyassl/ctaocrypt/settings.h>
#include <cyassl/ctaocrypt/md5.h>
#include <cyassl/ctaocrypt/sha.h>
#include <cyassl/ctaocrypt/sha256.h>
#include <cyassl/ctaocrypt/sha512.h>
#include <cyassl/ctaocrypt/hmac.h>
#include <cyassl/ctaocrypt/compress.h>
#include <cyassl/ctaocrypt/random.h>
#include <cyassl/ctaocrypt/des3.h>
#include <cyassl/ctaocrypt/aes.h>
#include <cyassl/ctaocrypt/rsa.h>
#include <cyassl/ctaocrypt/ecc.h>
#include <cyassl/ctaocrypt/error-crypt.h>
#ifndef NO_MD5
/* Initialize MD5 */
int CRYPT_MD5_Initialize(CRYPT_MD5_CTX* md5)
{
@@ -52,9 +56,7 @@ int CRYPT_MD5_Initialize(CRYPT_MD5_CTX* md5)
if (md5 == NULL)
return BAD_FUNC_ARG;
wc_InitMd5((Md5*)md5);
return 0;
return wc_InitMd5((Md5*)md5);
}
@@ -65,9 +67,7 @@ int CRYPT_MD5_DataAdd(CRYPT_MD5_CTX* md5, const unsigned char* input,
if (md5 == NULL || input == NULL)
return BAD_FUNC_ARG;
wc_Md5Update((Md5*)md5, input, sz);
return 0;
return wc_Md5Update((Md5*)md5, input, sz);
}
@@ -77,11 +77,11 @@ int CRYPT_MD5_Finalize(CRYPT_MD5_CTX* md5, unsigned char* digest)
if (md5 == NULL || digest == NULL)
return BAD_FUNC_ARG;
wc_Md5Final((Md5*)md5, digest);
return 0;
return wc_Md5Final((Md5*)md5, digest);
}
#endif
#ifndef NO_SHA
/* Initialize SHA */
int CRYPT_SHA_Initialize(CRYPT_SHA_CTX* sha)
@@ -115,7 +115,9 @@ int CRYPT_SHA_Finalize(CRYPT_SHA_CTX* sha, unsigned char* digest)
return wc_ShaFinal((Sha*)sha, digest);
}
#endif
#ifndef NO_SHA256
/* Initialize SHA-256 */
int CRYPT_SHA256_Initialize(CRYPT_SHA256_CTX* sha256)
@@ -149,8 +151,10 @@ int CRYPT_SHA256_Finalize(CRYPT_SHA256_CTX* sha256, unsigned char* digest)
return wc_Sha256Final((Sha256*)sha256, digest);
}
#endif
#ifdef WOLFSSL_SHA512
#ifdef WOLFSSL_SHA384
/* Initialize SHA-384 */
int CRYPT_SHA384_Initialize(CRYPT_SHA384_CTX* sha384)
{
@@ -183,6 +187,7 @@ int CRYPT_SHA384_Finalize(CRYPT_SHA384_CTX* sha384, unsigned char* digest)
return wc_Sha384Final((Sha384*)sha384, digest);
}
#endif
/* Initialize SHA-512 */
@@ -217,8 +222,9 @@ int CRYPT_SHA512_Finalize(CRYPT_SHA512_CTX* sha512, unsigned char* digest)
return wc_Sha512Final((Sha512*)sha512, digest);
}
#endif
#ifndef NO_HMAC
/* Set HMAC key with type */
int CRYPT_HMAC_SetKey(CRYPT_HMAC_CTX* hmac, int type, const unsigned char* key,
unsigned int sz)
@@ -258,6 +264,9 @@ int CRYPT_HMAC_Finalize(CRYPT_HMAC_CTX* hmac, unsigned char* digest)
return wc_HmacFinal((Hmac*)hmac, digest);
}
#endif
#ifdef HAVE_LIBZ
/* Huffman Compression, set flag to do static, otherwise dynamic */
/* return compressed size, otherwise < 0 for error */
@@ -268,7 +277,7 @@ int CRYPT_HUFFMAN_Compress(unsigned char* out, unsigned int outSz,
if (out == NULL || in == NULL)
return BAD_FUNC_ARG;
return Compress(out, outSz, in, inSz, flags);
return wc_Compress(out, outSz, in, inSz, flags);
}
@@ -280,9 +289,12 @@ int CRYPT_HUFFMAN_DeCompress(unsigned char* out, unsigned int outSz,
if (out == NULL || in == NULL)
return BAD_FUNC_ARG;
return DeCompress(out, outSz, in, inSz);
return wc_DeCompress(out, outSz, in, inSz);
}
#endif
#ifndef NO_RNG
/* RNG Initialize, < 0 on error */
int CRYPT_RNG_Initialize(CRYPT_RNG_CTX* rng)
@@ -293,7 +305,7 @@ int CRYPT_RNG_Initialize(CRYPT_RNG_CTX* rng)
if (rng == NULL)
return BAD_FUNC_ARG;
return InitRng((WC_RNG*)rng);
return wc_InitRng((WC_RNG*)rng);
}
@@ -303,7 +315,7 @@ int CRYPT_RNG_Get(CRYPT_RNG_CTX* rng, unsigned char* b)
if (rng == NULL || b == NULL)
return BAD_FUNC_ARG;
return RNG_GenerateByte((WC_RNG*)rng, (byte*)b);
return wc_RNG_GenerateByte((WC_RNG*)rng, (byte*)b);
}
@@ -314,10 +326,12 @@ int CRYPT_RNG_BlockGenerate(CRYPT_RNG_CTX* rng, unsigned char* b,
if (rng == NULL || b == NULL)
return BAD_FUNC_ARG;
return RNG_GenerateBlock((WC_RNG*)rng, b, sz);
return wc_RNG_GenerateBlock((WC_RNG*)rng, b, sz);
}
#endif
#ifndef NO_DES3
/* Triple DES Key Set, may have iv, will have direction */
int CRYPT_TDES_KeySet(CRYPT_TDES_CTX* tdes, const unsigned char* key,
const unsigned char* iv, int dir)
@@ -328,7 +342,7 @@ int CRYPT_TDES_KeySet(CRYPT_TDES_CTX* tdes, const unsigned char* key,
if (tdes == NULL || key == NULL)
return BAD_FUNC_ARG;
return Des3_SetKey((Des3*)tdes, key, iv, dir);
return wc_Des3_SetKey((Des3*)tdes, key, iv, dir);
}
@@ -360,9 +374,12 @@ int CRYPT_TDES_CBC_Decrypt(CRYPT_TDES_CTX* tdes, unsigned char* out,
if (tdes == NULL || out == NULL || in == NULL)
return BAD_FUNC_ARG;
return Des3_CbcDecrypt((Des3*)tdes, out, in, inSz);
return wc_Des3_CbcDecrypt((Des3*)tdes, out, in, inSz);
}
#endif
#ifndef NO_AES
/* AES Key Set, may have iv, will have direction */
int CRYPT_AES_KeySet(CRYPT_AES_CTX* aes, const unsigned char* key,
@@ -406,10 +423,11 @@ int CRYPT_AES_CBC_Decrypt(CRYPT_AES_CTX* aes, unsigned char* out,
if (aes == NULL || out == NULL || in == NULL)
return BAD_FUNC_ARG;
return AesCbcDecrypt((Aes*)aes, out, in, inSz);
return wc_AesCbcDecrypt((Aes*)aes, out, in, inSz);
}
#endif
#ifdef WOLFSSL_AES_COUNTER
/* AES CTR Encrypt (used for decrypt too, with ENCRYPT key setup) */
int CRYPT_AES_CTR_Encrypt(CRYPT_AES_CTX* aes, unsigned char* out,
const unsigned char* in, unsigned int inSz)
@@ -417,11 +435,11 @@ int CRYPT_AES_CTR_Encrypt(CRYPT_AES_CTX* aes, unsigned char* out,
if (aes == NULL || out == NULL || in == NULL)
return BAD_FUNC_ARG;
wc_AesCtrEncrypt((Aes*)aes, out, in, inSz);
return 0;
return wc_AesCtrEncrypt((Aes*)aes, out, in, inSz);
}
#endif
#ifdef WOLFSSL_AES_DIRECT
/* AES Direct mode encrypt, one block at a time */
int CRYPT_AES_DIRECT_Encrypt(CRYPT_AES_CTX* aes, unsigned char* out,
@@ -447,7 +465,9 @@ int CRYPT_AES_DIRECT_Decrypt(CRYPT_AES_CTX* aes, unsigned char* out,
return 0;
}
#endif
#ifndef NO_RSA
/* RSA Initialize */
int CRYPT_RSA_Initialize(CRYPT_RSA_CTX* rsa)
@@ -459,7 +479,7 @@ int CRYPT_RSA_Initialize(CRYPT_RSA_CTX* rsa)
if (rsa->holder == NULL)
return -1;
return InitRsaKey((RsaKey*)rsa->holder, NULL);
return wc_InitRsaKey((RsaKey*)rsa->holder, NULL);
}
@@ -469,7 +489,7 @@ int CRYPT_RSA_Free(CRYPT_RSA_CTX* rsa)
if (rsa == NULL)
return BAD_FUNC_ARG;
FreeRsaKey((RsaKey*)rsa->holder);
wc_FreeRsaKey((RsaKey*)rsa->holder);
XFREE(rsa->holder, NULL, DYNAMIC_TYPE_RSA);
rsa->holder = NULL;
@@ -487,7 +507,7 @@ int CRYPT_RSA_PublicKeyDecode(CRYPT_RSA_CTX* rsa, const unsigned char* in,
if (rsa == NULL || in == NULL)
return BAD_FUNC_ARG;
return RsaPublicKeyDecode(in, &idx, (RsaKey*)rsa->holder, inSz);
return wc_RsaPublicKeyDecode(in, &idx, (RsaKey*)rsa->holder, inSz);
}
@@ -501,7 +521,7 @@ int CRYPT_RSA_PrivateKeyDecode(CRYPT_RSA_CTX* rsa, const unsigned char* in,
if (rsa == NULL || in == NULL)
return BAD_FUNC_ARG;
return RsaPrivateKeyDecode(in, &idx, (RsaKey*)rsa->holder, inSz);
return wc_RsaPrivateKeyDecode(in, &idx, (RsaKey*)rsa->holder, inSz);
}
@@ -513,7 +533,7 @@ int CRYPT_RSA_PublicEncrypt(CRYPT_RSA_CTX* rsa, unsigned char* out,
if (rsa == NULL || in == NULL || out == NULL || rng == NULL)
return BAD_FUNC_ARG;
return RsaPublicEncrypt(in, inSz, out, outSz, (RsaKey*)rsa->holder,
return wc_RsaPublicEncrypt(in, inSz, out, outSz, (RsaKey*)rsa->holder,
(WC_RNG*)rng);
}
@@ -526,17 +546,17 @@ int CRYPT_RSA_PrivateDecrypt(CRYPT_RSA_CTX* rsa, unsigned char* out,
if (rsa == NULL || in == NULL || out == NULL)
return BAD_FUNC_ARG;
return RsaPrivateDecrypt(in, inSz, out, outSz, (RsaKey*)rsa->holder);
return wc_RsaPrivateDecrypt(in, inSz, out, outSz, (RsaKey*)rsa->holder);
}
/* RSA Get Encrypt size helper */
int CRYPT_RSA_EncryptSizeGet(CRYPT_RSA_CTX* rsa)
int CRYPT_RSA_EncryptSizeGet(CRYPT_RSA_CTX* rsa)
{
if (rsa == NULL)
return BAD_FUNC_ARG;
return RsaEncryptSize((RsaKey*)rsa->holder);
return wc_RsaEncryptSize((RsaKey*)rsa->holder);
}
@@ -553,7 +573,9 @@ int CRYPT_RSA_SetRng(CRYPT_RSA_CTX* rsa, CRYPT_RNG_CTX* rng)
return 0;
#endif
}
#endif
#ifdef HAVE_ECC
/* ECC init */
int CRYPT_ECC_Initialize(CRYPT_ECC_CTX* ecc)
@@ -706,6 +728,7 @@ int CRYPT_ECC_SignatureSizeGet(CRYPT_ECC_CTX* ecc)
return wc_ecc_sig_size((ecc_key*)ecc->holder);
}
#endif
/* Save error string from err to str which needs to be >= 80 chars */
int CRYPT_ERROR_StringGet(int err, char* str)
@@ -713,7 +736,7 @@ int CRYPT_ERROR_StringGet(int err, char* str)
if (str == NULL)
return BAD_FUNC_ARG;
CTaoCryptErrorString(err, str);
wc_ErrorString(err, str);
return 0;
}

View File

@@ -48,7 +48,7 @@ enum {
/* SHA */
typedef struct CRYPT_SHA_CTX {
int holder[28]; /* big enough to hold internal, but check on init */
int holder[29]; /* big enough to hold internal, but check on init */
} CRYPT_SHA_CTX;
int CRYPT_SHA_Initialize(CRYPT_SHA_CTX*);
@@ -164,7 +164,7 @@ enum {
/* AES */
typedef struct CRYPT_AES_CTX {
int holder[78]; /* big enough to hold internal, but check on init */
int holder[90]; /* big enough to hold internal, but check on init */
} CRYPT_AES_CTX;
/* key */

View File

@@ -15,5 +15,5 @@ noinst_HEADERS += mcapi/crypto.h
EXTRA_DIST += \
mcapi/README \
mcapi/PIC32MZ-serial.h
mcapi/PIC32MZ-serial.h \
mcapi/user_settings.h

View File

@@ -1,4 +1,4 @@
/* test.c
/* mcapi_test.c
*
* Copyright (C) 2006-2016 wolfSSL Inc.
*
@@ -59,6 +59,8 @@
#include <stdio.h>
#include <stdlib.h>
#include <p32xxxx.h>
#define _SUPPRESS_PLIB_WARNING
#define _DISABLE_OPENADC10_CONFIGPORT_WARNING
#include <plib.h>
#include <sys/appio.h>
#define init_serial() /* void out init_serial() */
@@ -214,25 +216,30 @@ static int check_md5(void)
{
CRYPT_MD5_CTX mcMd5;
Md5 defMd5;
int ret;
byte mcDigest[CRYPT_MD5_DIGEST_SIZE];
byte defDigest[MD5_DIGEST_SIZE];
CRYPT_MD5_Initialize(&mcMd5);
wc_InitMd5(&defMd5);
ret = wc_InitMd5(&defMd5);
CRYPT_MD5_DataAdd(&mcMd5, ourData, OUR_DATA_SIZE);
wc_Md5Update(&defMd5, ourData, OUR_DATA_SIZE);
if (ret == 0) {
CRYPT_MD5_DataAdd(&mcMd5, ourData, OUR_DATA_SIZE);
ret = wc_Md5Update(&defMd5, ourData, OUR_DATA_SIZE);
}
CRYPT_MD5_Finalize(&mcMd5, mcDigest);
wc_Md5Final(&defMd5, defDigest);
if (ret == 0) {
CRYPT_MD5_Finalize(&mcMd5, mcDigest);
ret = wc_Md5Final(&defMd5, defDigest);
}
if (memcmp(mcDigest, defDigest, CRYPT_MD5_DIGEST_SIZE) != 0) {
printf("md5 final memcmp fialed\n");
return -1;
}
}
printf("md5 mcapi test passed\n");
return 0;
return ret;
}
@@ -261,7 +268,7 @@ static int check_sha(void)
if (memcmp(mcDigest, defDigest, CRYPT_SHA_DIGEST_SIZE) != 0) {
printf("sha final memcmp failed\n");
return -1;
}
}
printf("sha mcapi test passed\n");
return 0;
@@ -301,7 +308,7 @@ static int check_sha256(void)
if (memcmp(mcDigest, defDigest, CRYPT_SHA256_DIGEST_SIZE) != 0) {
printf("sha256 final memcmp fialed\n");
return -1;
}
}
printf("sha256 mcapi test passed\n");
return 0;
@@ -341,7 +348,7 @@ static int check_sha384(void)
if (memcmp(mcDigest, defDigest, CRYPT_SHA384_DIGEST_SIZE) != 0) {
printf("sha384 final memcmp fialed\n");
return -1;
}
}
printf("sha384 mcapi test passed\n");
return 0;
@@ -381,7 +388,7 @@ static int check_sha512(void)
if (memcmp(mcDigest, defDigest, CRYPT_SHA512_DIGEST_SIZE) != 0) {
printf("sha512 final memcmp fialed\n");
return -1;
}
}
printf("sha512 mcapi test passed\n");
return 0;
@@ -424,7 +431,7 @@ static int check_hmac(void)
if (memcmp(mcDigest, defDigest, CRYPT_SHA_DIGEST_SIZE) != 0) {
printf("hmac sha final memcmp fialed\n");
return -1;
}
}
printf("hmac sha mcapi test passed\n");
/* SHA-256 */
@@ -452,7 +459,7 @@ static int check_hmac(void)
if (memcmp(mcDigest, defDigest, CRYPT_SHA256_DIGEST_SIZE) != 0) {
printf("hmac sha256 final memcmp fialed\n");
return -1;
}
}
printf("hmac sha256 mcapi test passed\n");
/* SHA-384 */
@@ -480,7 +487,7 @@ static int check_hmac(void)
if (memcmp(mcDigest, defDigest, CRYPT_SHA384_DIGEST_SIZE) != 0) {
printf("hmac sha384 final memcmp fialed\n");
return -1;
}
}
printf("hmac sha384 mcapi test passed\n");
/* SHA-512 */
@@ -508,7 +515,7 @@ static int check_hmac(void)
if (memcmp(mcDigest, defDigest, CRYPT_SHA512_DIGEST_SIZE) != 0) {
printf("hmac sha512 final memcmp fialed\n");
return -1;
}
}
printf("hmac sha512 mcapi test passed\n");
return 0;
@@ -621,7 +628,7 @@ static int check_compress(void)
static int check_rng(void)
{
int ret;
int i;
int i;
byte in[RANDOM_BYTE_SZ];
byte out[RANDOM_BYTE_SZ];
@@ -955,8 +962,11 @@ static int check_aesctr(void)
printf("mcapi aes-128 ctr encrypt failed\n");
return -1;
}
wc_AesCtrEncrypt(&defAes, out2, ourData, AES_TEST_SIZE);
ret = wc_AesCtrEncrypt(&defAes, out2, ourData, AES_TEST_SIZE);
if (ret != 0) {
printf("mcapi aes-128 ctr encrypt set failed\n");
return -1;
}
if (memcmp(out1, out2, AES_TEST_SIZE) != 0) {
printf("mcapi aes-128 ctr encrypt cmp failed\n");
return -1;
@@ -1002,8 +1012,11 @@ static int check_aesctr(void)
printf("mcapi aes-192 ctr encrypt failed\n");
return -1;
}
wc_AesCtrEncrypt(&defAes, out2, ourData, AES_TEST_SIZE);
ret = wc_AesCtrEncrypt(&defAes, out2, ourData, AES_TEST_SIZE);
if (ret != 0) {
printf("mcapi aes-192 ctr encrypt set failed\n");
return -1;
}
if (memcmp(out1, out2, AES_TEST_SIZE) != 0) {
printf("mcapi aes-192 ctr encrypt cmp failed\n");
return -1;
@@ -1049,8 +1062,11 @@ static int check_aesctr(void)
printf("mcapi aes-256 ctr encrypt failed\n");
return -1;
}
wc_AesCtrEncrypt(&defAes, out2, ourData, AES_TEST_SIZE);
ret = wc_AesCtrEncrypt(&defAes, out2, ourData, AES_TEST_SIZE);
if (ret != 0) {
printf("mcapi aes-256 ctr encrypt set failed\n");
return -1;
}
if (memcmp(out1, out2, AES_TEST_SIZE) != 0) {
printf("mcapi aes-256 ctr encrypt cmp failed\n");
return -1;
@@ -1326,7 +1342,7 @@ static int check_rsa(void)
return -1;
}
ret = CRYPT_RSA_PrivateDecrypt(&mcRsa, out2, sizeof(out2), out1, ret);
ret = CRYPT_RSA_PrivateDecrypt(&mcRsa, out2, sizeof(out2), out1, ret);
if (ret < 0) {
printf("mcapi rsa private derypt failed\n");
return -1;
@@ -1348,7 +1364,7 @@ static int check_rsa(void)
printf("mcapi rsa free failed\n");
return -1;
}
printf("rsa mcapi test passed\n");
return 0;
@@ -1358,7 +1374,7 @@ static int check_rsa(void)
/* check mcapi ecc */
static int check_ecc(void)
{
CRYPT_ECC_CTX userA;
CRYPT_ECC_CTX userA;
CRYPT_ECC_CTX userB;
int ret;
byte sharedA[100];
@@ -1463,7 +1479,7 @@ static int check_ecc(void)
printf("mcapi ecc public export failed\n");
return -1;
}
ret = CRYPT_ECC_PublicImport(&userB, sharedA, usedA);
if (ret != 0) {
printf("mcapi ecc public import failed\n");

386
mcapi/user_settings.h Normal file
View File

@@ -0,0 +1,386 @@
/* Example custom user settings for wolfSSL */
#ifndef WOLFSSL_USER_SETTINGS_H
#define WOLFSSL_USER_SETTINGS_H
#ifdef __cplusplus
extern "C" {
#endif
#include <stddef.h> /* for size_t */
/* ------------------------------------------------------------------------- */
/* Platform */
/* ------------------------------------------------------------------------- */
#undef WOLFSSL_GENERAL_ALIGNMENT
#define WOLFSSL_GENERAL_ALIGNMENT 4
#undef SINGLE_THREADED
#define SINGLE_THREADED
#undef WOLFSSL_SMALL_STACK
#define WOLFSSL_SMALL_STACK
#undef MICROCHIP_PIC32
#define MICROCHIP_PIC32
#undef WOLFSSL_MICROCHIP_PIC32MZ
#define WOLFSSL_MICROCHIP_PIC32MZ
/* ------------------------------------------------------------------------- */
/* Math Configuration */
/* ------------------------------------------------------------------------- */
#undef USE_FAST_MATH
#define USE_FAST_MATH
#ifdef USE_FAST_MATH
#undef TFM_TIMING_RESISTANT
#define TFM_TIMING_RESISTANT
/* Optimizations */
//#define TFM_MIPS
#endif
/* ------------------------------------------------------------------------- */
/* Crypto */
/* ------------------------------------------------------------------------- */
/* ECC */
#if 1
#undef HAVE_ECC
#define HAVE_ECC
/* Manually define enabled curves */
#undef ECC_USER_CURVES
#define ECC_USER_CURVES
//#define HAVE_ECC192
//#define HAVE_ECC224
#undef NO_ECC256
//#define HAVE_ECC384
//#define HAVE_ECC521
/* Fixed point cache (speeds repeated operations against same private key) */
#undef FP_ECC
//#define FP_ECC
#ifdef FP_ECC
/* Bits / Entries */
#undef FP_ENTRIES
#define FP_ENTRIES 2
#undef FP_LUT
#define FP_LUT 4
#endif
/* Optional ECC calculation method */
/* Note: doubles heap usage, but slightly faster */
#undef ECC_SHAMIR
#define ECC_SHAMIR
/* Reduces heap usage, but slower */
#undef ECC_TIMING_RESISTANT
#define ECC_TIMING_RESISTANT
#ifdef USE_FAST_MATH
/* use reduced size math buffers for ecc points */
#undef ALT_ECC_SIZE
#define ALT_ECC_SIZE
/* Enable TFM optimizations for ECC */
#if defined(HAVE_ECC192) || defined(HAVE_ALL_CURVES)
#define TFM_ECC192
#endif
#if defined(HAVE_ECC224) || defined(HAVE_ALL_CURVES)
#define TFM_ECC224
#endif
#if !defined(NO_ECC256) || defined(HAVE_ALL_CURVES)
#define TFM_ECC256
#endif
#if defined(HAVE_ECC384) || defined(HAVE_ALL_CURVES)
#define TFM_ECC384
#endif
#if defined(HAVE_ECC521) || defined(HAVE_ALL_CURVES)
#define TFM_ECC521
#endif
#endif
#endif
/* RSA */
#undef NO_RSA
#if 1
#ifdef USE_FAST_MATH
/* Maximum math bits (Max RSA key bits * 2) */
#undef FP_MAX_BITS
#define FP_MAX_BITS 2048
#endif
/* half as much memory but twice as slow */
#undef RSA_LOW_MEM
//#define RSA_LOW_MEM
/* timing resistance */
#undef WC_RSA_BLINDING
#define WC_RSA_BLINDING
#else
#define NO_RSA
#endif
/* AES */
#undef NO_AES
#if 1
#undef HAVE_AES_DECRYPT
#define HAVE_AES_DECRYPT
#undef HAVE_AESGCM
#define HAVE_AESGCM
/* GCM Method: GCM_SMALL, GCM_WORD32 or GCM_TABLE */
#undef GCM_SMALL
#define GCM_SMALL
#undef HAVE_AESCCM
#define HAVE_AESCCM
#undef WOLFSSL_AES_COUNTER
#define WOLFSSL_AES_COUNTER
#undef WOLFSSL_AES_DIRECT
#define WOLFSSL_AES_DIRECT
#else
#define NO_AES
#endif
/* DES3 */
#undef NO_DES3
#if 1
#undef WOLFSSL_DES_ECB
#define WOLFSSL_DES_ECB
#else
#define NO_DES3
#endif
/* ChaCha20 / Poly1305 */
#undef HAVE_CHACHA
#undef HAVE_POLY1305
#if 0
#define HAVE_CHACHA
#define HAVE_POLY1305
/* Needed for Poly1305 */
#undef HAVE_ONE_TIME_AUTH
#define HAVE_ONE_TIME_AUTH
#endif
/* Ed25519 / Curve25519 */
#undef HAVE_CURVE25519
#undef HAVE_ED25519
#if 0
#define HAVE_CURVE25519
#define HAVE_ED25519
/* Optionally use small math (less flash usage, but much slower) */
#if 0
#define CURVED25519_SMALL
#endif
#endif
/* ------------------------------------------------------------------------- */
/* Hashing */
/* ------------------------------------------------------------------------- */
/* Sha */
#undef NO_SHA
#if 1
/* 1k smaller, but 25% slower */
//#define USE_SLOW_SHA
#else
#define NO_SHA
#endif
/* Sha256 */
#undef NO_SHA256
#if 1
#else
#define NO_SHA256
#endif
/* Sha512 */
#undef WOLFSSL_SHA512
#if 1
#define WOLFSSL_SHA512
/* Sha384 */
#undef WOLFSSL_SHA384
#if 1
#define WOLFSSL_SHA384
#endif
/* over twice as small, but 50% slower */
//#define USE_SLOW_SHA2
#endif
/* MD5 */
#undef NO_MD5
#if 1
#else
#define NO_MD5
#endif
/* ------------------------------------------------------------------------- */
/* Benchmark / Test */
/* ------------------------------------------------------------------------- */
/* Use reduced benchmark / test sizes */
#undef BENCH_EMBEDDED
#define BENCH_EMBEDDED
#undef USE_CERT_BUFFERS_2048
//#define USE_CERT_BUFFERS_2048
#undef USE_CERT_BUFFERS_1024
#define USE_CERT_BUFFERS_1024
#undef USE_CERT_BUFFERS_256
#define USE_CERT_BUFFERS_256
/* ------------------------------------------------------------------------- */
/* Time */
/* ------------------------------------------------------------------------- */
#if 0
/* Override Current Time */
/* Allows custom "custom_time()" function to be used for benchmark */
#define WOLFSSL_USER_CURRTIME
#define USER_TICKS
extern unsigned long custom_time(unsigned long* timer);
#define XTIME custom_time
#else
#warning Time/RTC disabled
#undef NO_ASN_TIME
#define NO_ASN_TIME
#endif
/* ------------------------------------------------------------------------- */
/* Debugging */
/* ------------------------------------------------------------------------- */
#undef DEBUG_WOLFSSL
#define DEBUG_WOLFSSL
#ifdef DEBUG_WOLFSSL
/* Use this to measure / print heap usage */
#if 0
#undef USE_WOLFSSL_MEMORY
#define USE_WOLFSSL_MEMORY
#undef WOLFSSL_TRACK_MEMORY
#define WOLFSSL_TRACK_MEMORY
#endif
#else
#undef NO_WOLFSSL_MEMORY
#define NO_WOLFSSL_MEMORY
#undef NO_ERROR_STRINGS
//#define NO_ERROR_STRINGS
#endif
/* ------------------------------------------------------------------------- */
/* Enable Features */
/* ------------------------------------------------------------------------- */
#undef KEEP_PEER_CERT
//#define KEEP_PEER_CERT
#undef HAVE_COMP_KEY
//#define HAVE_COMP_KEY
#undef HAVE_TLS_EXTENSIONS
//#define HAVE_TLS_EXTENSIONS
#undef HAVE_SUPPORTED_CURVES
//#define HAVE_SUPPORTED_CURVES
#undef WOLFSSL_BASE64_ENCODE
//#define WOLFSSL_BASE64_ENCODE
/* TLS Session Cache */
#if 0
#define SMALL_SESSION_CACHE
#else
#define NO_SESSION_CACHE
#endif
/* ------------------------------------------------------------------------- */
/* Disable Features */
/* ------------------------------------------------------------------------- */
#undef NO_WOLFSSL_SERVER
//#define NO_WOLFSSL_SERVER
#undef NO_WOLFSSL_CLIENT
//#define NO_WOLFSSL_CLIENT
#undef NO_CRYPT_TEST
//#define NO_CRYPT_TEST
#undef NO_CRYPT_BENCHMARK
//#define NO_CRYPT_BENCHMARK
/* In-lining of misc.c functions */
/* If defined, must include wolfcrypt/src/misc.c in build */
/* Slower, but about 1k smaller */
#undef NO_INLINE
//#define NO_INLINE
#undef NO_FILESYSTEM
#define NO_FILESYSTEM
#undef NO_WRITEV
#define NO_WRITEV
#undef NO_MAIN_DRIVER
#define NO_MAIN_DRIVER
#undef NO_DEV_RANDOM
#define NO_DEV_RANDOM
#undef NO_DSA
#define NO_DSA
#undef NO_DH
#define NO_DH
#undef NO_RC4
#define NO_RC4
#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
#undef NO_MD4
#define NO_MD4
#undef NO_PWDBASED
#define NO_PWDBASED
#undef NO_CODING
//#define NO_CODING
/* Suppress array-bounds */
#pragma GCC diagnostic ignored "-Warray-bounds"
#ifdef __cplusplus
}
#endif
#endif /* WOLFSSL_USER_SETTINGS_H */

View File

@@ -4,6 +4,7 @@
<logicalFolder name="HeaderFiles"
displayName="Header Files"
projectFiles="true">
<itemPath>../user_settings.h</itemPath>
</logicalFolder>
<logicalFolder name="LinkerScript"
displayName="Linker Files"
@@ -110,8 +111,7 @@
<property key="place-data-into-section" value="false"/>
<property key="post-instruction-scheduling" value="default"/>
<property key="pre-instruction-scheduling" value="default"/>
<property key="preprocessor-macros"
value="WOLFSSL_SHA384;WOLFSSL_SHA512;HAVE_ECC;HAVE_LIBZ;HAVE_MCAPI"/>
<property key="preprocessor-macros" value="WOLFSSL_USER_SETTINGS;HAVE_LIBZ;HAVE_MCAPI"/>
<property key="strict-ansi" value="false"/>
<property key="support-ansi" value="false"/>
<property key="use-cci" value="false"/>
@@ -149,7 +149,7 @@
<property key="preprocessor-macros" value=""/>
<property key="remove-unused-sections" value="false"/>
<property key="report-memory-usage" value="false"/>
<property key="stack-size" value="2048"/>
<property key="stack-size" value="20480"/>
<property key="symbol-stripping" value=""/>
<property key="trace-symbols" value=""/>
<property key="warn-section-align" value="false"/>

View File

@@ -4,6 +4,7 @@
<logicalFolder name="HeaderFiles"
displayName="Header Files"
projectFiles="true">
<itemPath>../user_settings.h</itemPath>
</logicalFolder>
<logicalFolder name="LinkerScript"
displayName="Linker Files"
@@ -110,8 +111,7 @@
<property key="place-data-into-section" value="false"/>
<property key="post-instruction-scheduling" value="default"/>
<property key="pre-instruction-scheduling" value="default"/>
<property key="preprocessor-macros"
value="NO_MAIN_DRIVER;USE_CERT_BUFFERS_1024;WOLFSSL_SHA384;WOLFSSL_SHA512;HAVE_ECC;HAVE_LIBZ;HAVE_MCAPI"/>
<property key="preprocessor-macros" value="WOLFSSL_USER_SETTINGS;HAVE_LIBZ;HAVE_MCAPI"/>
<property key="strict-ansi" value="false"/>
<property key="support-ansi" value="false"/>
<property key="use-cci" value="false"/>

View File

@@ -4,6 +4,7 @@
<logicalFolder name="HeaderFiles"
displayName="Header Files"
projectFiles="true">
<itemPath>../user_settings.h</itemPath>
</logicalFolder>
<logicalFolder name="LinkerScript"
displayName="Linker Files"
@@ -37,10 +38,8 @@
<itemPath>../../wolfcrypt/src/md5.c</itemPath>
<itemPath>../../wolfcrypt/src/memory.c</itemPath>
<itemPath>../../wolfcrypt/src/misc.c</itemPath>
<itemPath>../../wolfcrypt/src/pic32mz-hash.c</itemPath>
<itemPath>../../wolfcrypt/src/pkcs7.c</itemPath>
<itemPath>../../wolfcrypt/src/poly1305.c</itemPath>
<itemPath>../../wolfcrypt/src/pw.c</itemPath>
<itemPath>../../wolfcrypt/src/pwdbased.c</itemPath>
<itemPath>../../wolfcrypt/src/rabbit.c</itemPath>
<itemPath>../../wolfcrypt/src/random.c</itemPath>
@@ -51,6 +50,21 @@
<itemPath>../../wolfcrypt/src/sha512.c</itemPath>
<itemPath>../../wolfcrypt/src/tfm.c</itemPath>
<itemPath>../../wolfcrypt/src/wc_port.c</itemPath>
<itemPath>../../wolfcrypt/src/port/pic32/pic32mz-hash.c</itemPath>
<itemPath>../../wolfcrypt/src/port/pic32/pic32mz-crypt.c</itemPath>
<itemPath>../../wolfcrypt/src/hash.c</itemPath>
<itemPath>../../wolfcrypt/src/chacha20_poly1305.c</itemPath>
<itemPath>../../wolfcrypt/src/curve25519.c</itemPath>
<itemPath>../../wolfcrypt/src/ed25519.c</itemPath>
<itemPath>../../wolfcrypt/src/fe_low_mem.c</itemPath>
<itemPath>../../wolfcrypt/src/fe_operations.c</itemPath>
<itemPath>../../wolfcrypt/src/ge_low_mem.c</itemPath>
<itemPath>../../wolfcrypt/src/ge_operations.c</itemPath>
<itemPath>../../wolfcrypt/src/wc_encrypt.c</itemPath>
<itemPath>../../wolfcrypt/src/pkcs12.c</itemPath>
<itemPath>../../wolfcrypt/src/signature.c</itemPath>
<itemPath>../../wolfcrypt/src/wolfevent.c</itemPath>
<itemPath>../../wolfcrypt/src/wolfmath.c</itemPath>
</logicalFolder>
<logicalFolder name="src" displayName="wolfssl" projectFiles="true">
<itemPath>../../src/crl.c</itemPath>
@@ -61,6 +75,7 @@
<itemPath>../../src/sniffer.c</itemPath>
<itemPath>../../src/ssl.c</itemPath>
<itemPath>../../src/tls.c</itemPath>
<itemPath>../../src/tls13.c</itemPath>
</logicalFolder>
</logicalFolder>
<logicalFolder name="ExternalFiles"
@@ -118,7 +133,7 @@
<property key="enable-unroll-loops" value="false"/>
<property key="exclude-floating-point" value="false"/>
<property key="extra-include-directories"
value="../../;../../mcapi;../../zlib-1.2.8;/Users/chrisc/yaSSL/products/cyassl/git/cyassl57/zlib-1.2.7"/>
value="../../;../../mcapi;../../mplabx;../../zlib-1.2.8"/>
<property key="generate-16-bit-code" value="false"/>
<property key="generate-micro-compressed-code" value="false"/>
<property key="isolate-each-function" value="false"/>
@@ -127,8 +142,7 @@
<property key="place-data-into-section" value="false"/>
<property key="post-instruction-scheduling" value="default"/>
<property key="pre-instruction-scheduling" value="default"/>
<property key="preprocessor-macros"
value="WOLFSSL_SHA512;WOLFSSL_SHA384;WOLFSSL_AES_COUNTER;WOLFSSL_AES_DIRECT;HAVE_ECC;HAVE_LIBZ;HAVE_MCAPI"/>
<property key="preprocessor-macros" value="WOLFSSL_USER_SETTINGS;HAVE_LIBZ;HAVE_MCAPI"/>
<property key="strict-ansi" value="false"/>
<property key="support-ansi" value="false"/>
<property key="use-cci" value="false"/>

View File

@@ -1,28 +1,96 @@
void _mon_putc(char c);
static void init_serial() {
#ifdef MICROCHIP_PIC32
#if defined (__32MZ2048ECH144__) || (__32MZ2048ECM144__)
/* Set up PB2 divisor for UART2 */
SYSKEY = 0x00000000;
SYSKEY = 0xAA996655;
SYSKEY = 0x556699AA;
PB2DIV = 0x00008808;
SYSKEY = 0x33333333;
/* UART2 Init */
// U2BRG = 0x0C;
U2BRG = 0x047;
#define BAUD_GEN(sysclk, baud) ((sysclk / (16 * baud)) - 1)
#ifdef MICROCHIP_PIC32
#if defined (__32MZ2048ECH144__) || defined(__32MZ2048ECM144__) || defined(__32MZ2048EFM144__)
/* Code generated from Harmony example then exported using Window -> PIC32 Memory View -> Configuration Bits into system_config.h */
#define SYS_CLK_FREQ 200000000ul
#define SYS_CLK_BUS_PERIPHERAL_2 100000000ul
/* PIC32MZ2048EFM144 Configuration Bit Settings */
/*** DEVCFG0 ***/
#pragma config DEBUG = OFF
#pragma config JTAGEN = OFF
#pragma config ICESEL = ICS_PGx2
#pragma config TRCEN = OFF
#pragma config BOOTISA = MIPS32
#pragma config FECCCON = OFF_UNLOCKED
#pragma config FSLEEP = OFF
#pragma config DBGPER = PG_ALL
#pragma config SMCLR = MCLR_NORM
#pragma config SOSCGAIN = GAIN_2X
#pragma config SOSCBOOST = ON
#pragma config POSCGAIN = GAIN_2X
#pragma config POSCBOOST = ON
#pragma config EJTAGBEN = NORMAL
#pragma config CP = OFF
/*** DEVCFG1 ***/
#pragma config FNOSC = SPLL
#pragma config DMTINTV = WIN_127_128
#pragma config FSOSCEN = OFF
#pragma config IESO = OFF
#pragma config POSCMOD = EC
#pragma config OSCIOFNC = OFF
#pragma config FCKSM = CSECME
#pragma config WDTPS = PS1048576
#pragma config WDTSPGM = STOP
#pragma config FWDTEN = OFF
#pragma config WINDIS = NORMAL
#pragma config FWDTWINSZ = WINSZ_25
#pragma config DMTCNT = DMT31
#pragma config FDMTEN = OFF
/*** DEVCFG2 ***/
#pragma config FPLLIDIV = DIV_3
#pragma config FPLLRNG = RANGE_5_10_MHZ
#pragma config FPLLICLK = PLL_POSC
#pragma config FPLLMULT = MUL_50
#pragma config FPLLODIV = DIV_2
#pragma config UPLLFSEL = FREQ_24MHZ
/*** DEVCFG3 ***/
#pragma config USERID = 0xffff
#pragma config FMIIEN = ON
#pragma config FETHIO = ON
#pragma config PGL1WAY = ON
#pragma config PMDL1WAY = ON
#pragma config IOL1WAY = ON
#pragma config FUSBIDIO = ON
/*** BF1SEQ0 ***/
#pragma config TSEQ = 0x0000
#pragma config CSEQ = 0xffff
/* #pragma config statements should precede project file includes. */
/* Use project enums instead of #define for ON and OFF. */
#include <xc.h>
#endif
#endif
static void init_serial(unsigned int sysClk) {
#ifdef MICROCHIP_PIC32
#if defined (__32MZ2048ECH144__) || defined(__32MZ2048ECM144__) || defined(__32MZ2048EFM144__)
/* This is for pin B14 which is connected to the USB to UART connector J11 located under Ethernet connector */
/* Setup UART2 */
#ifdef SYS_CLK_BUS_PERIPHERAL_2
U2BRG = BAUD_GEN(SYS_CLK_BUS_PERIPHERAL_2, 115200);
#else
if (sysClk > 100000000)
sysClk /= 2;
U2BRG = BAUD_GEN(sysClk, 115200);
#endif
ANSELBCLR = 0x4000;
ANSELGCLR = 0x0040;
RPB14R = 0x02;
U2RXR = 0x01;
U2MODE = 0x8000;
U2STA = 0x400;
#elif defined __PIC32MX__
SYSTEMConfigPerformance(80000000);
DBINIT();
#endif
#endif
(void)sysClk;
}

View File

@@ -14,8 +14,8 @@ Included Project Files
1. wolfSSL library (wolfssl.X)
This project builds a static wolfSSL library. Prior to building this
project, uncomment the MICROCHIP_PIC32 define located in:
This project builds a static wolfSSL library. The settings for this project
are in `user_settings.h`:
<wolfssl_root>/wolfssl/wolfcrypt/settings.h
@@ -39,9 +39,10 @@ Included Project Files
PIC32MX/PIC32MZ
---------------
The projects are set for PIC32MX by default. For PIC32MZ, change project
properties->Devices and add "WOLFSSL_MICROCHIP_PIC32MZ" to
XC32-gcc->Preprocessing and messages-> Preprocessor macros.
The projects are set for PIC32MZ by default. For PIC32MX, comment out the
`WOLFSSL_MICROCHIP_PIC32MZ` line in `user_settings.h`.
You also need to adjust the microcontroller device in the project properties.
MIPS16 and MIPS32 Support
@@ -51,6 +52,14 @@ These projects support both MIPS16 and MIPS32 instruction sets. Switching
between these two instruction sets can be done in each project's properties
settings by checking the "Generate 16-bit code" checkbox.
Legacy Peripheral Libraries
___________________________
If you get a linker error locating `ReadCoreTimer` and `WriteCoreTimer` you
can enable wrappers in benchmark_main.c and test_main.c.
Support
-------
Please send questions or comments to support@wolfssl.com

View File

@@ -24,114 +24,55 @@
#endif
#include <wolfssl/wolfcrypt/settings.h>
#include <wolfcrypt/benchmark/benchmark.h>
#if defined(WOLFSSL_MICROCHIP_PIC32MZ)
#define MICROCHIP_PIC32
#include <xc.h>
#pragma config ICESEL = ICS_PGx2
/* ICE/ICD Comm Channel Select (Communicate on PGEC2/PGED2) */
#include <stdio.h>
#include <stdlib.h>
#include "PIC32MZ-serial.h"
#define SYSTEMConfigPerformance /* void out SYSTEMConfigPerformance(); */
#include <xc.h>
#define SYSTEMConfigPerformance(a) /* void out SYSTEMConfigPerformance(); */
#define SYS_CLK 200000000
#else
#define PIC32_STARTER_KIT
#include <p32xxxx.h>
#define _SUPPRESS_PLIB_WARNING
#define _DISABLE_OPENADC10_CONFIGPORT_WARNING
#include <plib.h>
#include <sys/appio.h>
#define init_serial() /* void out init_serial() ; */
#define SYS_CLK 80000000
#endif
void bench_des(void);
void bench_arc4(void);
void bench_hc128(void);
void bench_rabbit(void);
void bench_aes(int);
void bench_aesgcm(void);
void bench_md5(void);
void bench_sha(void);
void bench_sha256(void);
void bench_sha512(void);
void bench_ripemd(void);
void bench_rsa(void);
void bench_rsaKeyGen(void);
void bench_dh(void);
#ifdef HAVE_ECC
void bench_eccKeyGen(void);
void bench_eccKeyAgree(void);
#if 1
/* enable this if ReadCoreTimer and WriteCoreTimer are missing */
unsigned int ReadCoreTimer(void)
{
unsigned int timer;
timer = __builtin_mfc0(9, 0);
return timer;
}
void WriteCoreTimer(unsigned int t)
{
/* do nothing here */
(void)t;
}
#endif
/*
* Main driver for wolfCrypt benchmarks.
*/
int main(int argc, char** argv) {
volatile int i ;
int j ;
PRECONbits.PFMWS = 2;
PRECONbits.PREFEN = 0b11;
init_serial() ; /* initialize PIC32MZ serial I/O */
SYSTEMConfigPerformance(80000000);
int main(int argc, char** argv)
{
SYSTEMConfigPerformance(SYS_CLK);
DBINIT();
init_serial(SYS_CLK) ; /* initialize PIC32MZ serial I/O */
printf("wolfCrypt Benchmark:\n");
#ifndef NO_AES
bench_aes(0);
bench_aes(1);
#endif
#ifdef HAVE_AESGCM
bench_aesgcm();
#endif
#ifndef NO_RC4
bench_arc4();
#endif
#ifdef HAVE_HC128
bench_hc128();
#endif
#ifndef NO_RABBIT
bench_rabbit();
#endif
#ifndef NO_DES3
bench_des();
#endif
benchmark_test(NULL);
printf("\n");
#ifndef NO_MD5
bench_md5();
#endif
bench_sha();
#ifndef NO_SHA256
bench_sha256();
#endif
#ifdef WOLFSSL_SHA512
bench_sha512();
#endif
#ifdef CYASSL_RIPEMD
bench_ripemd();
#endif
printf("\n");
#ifndef NO_RSA
bench_rsa();
#endif
#ifndef NO_DH
bench_dh();
#endif
#if defined(WOLFSSL_KEY_GEN) && !defined(NO_RSA)
bench_rsaKeyGen();
#endif
#ifdef HAVE_ECC
bench_eccKeyGen();
bench_eccKeyAgree();
#endif
printf("End of wolfCrypt Benchmark:\n");
return 0;
}

View File

@@ -3,8 +3,8 @@
#
EXTRA_DIST += \
mplabx/PIC32MZ-serial.h \
mplabx/README \
mplabx/benchmark_main.c \
mplabx/test_main.c
mplabx/test_main.c \
mplabx/PIC32MZ-serial.h \
mplabx/user_settings.h

View File

@@ -25,24 +25,27 @@
#endif
#include <wolfssl/wolfcrypt/settings.h>
#include <wolfcrypt/test/test.h>
#if defined(WOLFSSL_MICROCHIP_PIC32MZ)
#define MICROCHIP_PIC32
#include <xc.h>
#pragma config ICESEL = ICS_PGx2
/* ICE/ICD Comm Channel Select (Communicate on PGEC2/PGED2) */
#include <stdio.h>
#include <stdlib.h>
#include "PIC32MZ-serial.h"
#define SYSTEMConfigPerformance /* void out SYSTEMConfigPerformance(); */
#include <xc.h>
#define SYSTEMConfigPerformance(a) /* void out SYSTEMConfigPerformance(); */
#define SYS_CLK 200000000
#else
#define PIC32_STARTER_KIT
#include <stdio.h>
#include <stdlib.h>
#include <p32xxxx.h>
#define _SUPPRESS_PLIB_WARNING
#define _DISABLE_OPENADC10_CONFIGPORT_WARNING
#include <plib.h>
#include <sys/appio.h>
#define init_serial() /* void out init_serial() */
#define SYS_CLK 80000000
#endif
/* func_args from test.h, so don't have to pull in other junk */
@@ -52,17 +55,35 @@ typedef struct func_args {
int return_code;
} func_args;
#if 1
/* enable this if ReadCoreTimer and WriteCoreTimer are missing */
unsigned int ReadCoreTimer(void)
{
unsigned int timer;
timer = __builtin_mfc0(9, 0);
return timer;
}
void WriteCoreTimer(unsigned int t)
{
/* do nothing here */
(void)t;
}
#endif
/*
* Main driver for WolfCrypt tests.
*/
int main(int argc, char** argv) {
int i ;
init_serial() ; /* initialize PIC32MZ serial I/O */
SYSTEMConfigPerformance(80000000);
DBINIT();
printf("WolfCrypt Test:\n");
int main(int argc, char** argv)
{
func_args args;
SYSTEMConfigPerformance(SYS_CLK);
DBINIT();
init_serial(SYS_CLK) ; /* initialize PIC32MZ serial I/O */
printf("WolfCrypt Test:\n");
args.argc = argc;
args.argv = argv;
@@ -72,7 +93,7 @@ int main(int argc, char** argv) {
if (args.return_code == 0) {
printf("All tests passed!\n");
}
return 0;
}

386
mplabx/user_settings.h Normal file
View File

@@ -0,0 +1,386 @@
/* Example custom user settings for wolfSSL */
#ifndef WOLFSSL_USER_SETTINGS_H
#define WOLFSSL_USER_SETTINGS_H
#ifdef __cplusplus
extern "C" {
#endif
#include <stddef.h> /* for size_t */
/* ------------------------------------------------------------------------- */
/* Platform */
/* ------------------------------------------------------------------------- */
#undef WOLFSSL_GENERAL_ALIGNMENT
#define WOLFSSL_GENERAL_ALIGNMENT 4
#undef SINGLE_THREADED
#define SINGLE_THREADED
#undef WOLFSSL_SMALL_STACK
#define WOLFSSL_SMALL_STACK
#undef MICROCHIP_PIC32
#define MICROCHIP_PIC32
#undef WOLFSSL_MICROCHIP_PIC32MZ
#define WOLFSSL_MICROCHIP_PIC32MZ
/* ------------------------------------------------------------------------- */
/* Math Configuration */
/* ------------------------------------------------------------------------- */
#undef USE_FAST_MATH
#define USE_FAST_MATH
#ifdef USE_FAST_MATH
#undef TFM_TIMING_RESISTANT
#define TFM_TIMING_RESISTANT
/* Optimizations */
//#define TFM_MIPS
#endif
/* ------------------------------------------------------------------------- */
/* Crypto */
/* ------------------------------------------------------------------------- */
/* ECC */
#if 1
#undef HAVE_ECC
#define HAVE_ECC
/* Manually define enabled curves */
#undef ECC_USER_CURVES
#define ECC_USER_CURVES
//#define HAVE_ECC192
//#define HAVE_ECC224
#undef NO_ECC256
//#define HAVE_ECC384
//#define HAVE_ECC521
/* Fixed point cache (speeds repeated operations against same private key) */
#undef FP_ECC
//#define FP_ECC
#ifdef FP_ECC
/* Bits / Entries */
#undef FP_ENTRIES
#define FP_ENTRIES 2
#undef FP_LUT
#define FP_LUT 4
#endif
/* Optional ECC calculation method */
/* Note: doubles heap usage, but slightly faster */
#undef ECC_SHAMIR
#define ECC_SHAMIR
/* Reduces heap usage, but slower */
#undef ECC_TIMING_RESISTANT
#define ECC_TIMING_RESISTANT
#ifdef USE_FAST_MATH
/* use reduced size math buffers for ecc points */
#undef ALT_ECC_SIZE
#define ALT_ECC_SIZE
/* Enable TFM optimizations for ECC */
#if defined(HAVE_ECC192) || defined(HAVE_ALL_CURVES)
#define TFM_ECC192
#endif
#if defined(HAVE_ECC224) || defined(HAVE_ALL_CURVES)
#define TFM_ECC224
#endif
#if !defined(NO_ECC256) || defined(HAVE_ALL_CURVES)
#define TFM_ECC256
#endif
#if defined(HAVE_ECC384) || defined(HAVE_ALL_CURVES)
#define TFM_ECC384
#endif
#if defined(HAVE_ECC521) || defined(HAVE_ALL_CURVES)
#define TFM_ECC521
#endif
#endif
#endif
/* RSA */
#undef NO_RSA
#if 1
#ifdef USE_FAST_MATH
/* Maximum math bits (Max RSA key bits * 2) */
#undef FP_MAX_BITS
#define FP_MAX_BITS 2048
#endif
/* half as much memory but twice as slow */
#undef RSA_LOW_MEM
//#define RSA_LOW_MEM
/* timing resistance */
#undef WC_RSA_BLINDING
#define WC_RSA_BLINDING
#else
#define NO_RSA
#endif
/* AES */
#undef NO_AES
#if 1
#undef HAVE_AES_DECRYPT
#define HAVE_AES_DECRYPT
#undef HAVE_AESGCM
#define HAVE_AESGCM
/* GCM Method: GCM_SMALL, GCM_WORD32 or GCM_TABLE */
#undef GCM_SMALL
#define GCM_SMALL
#undef HAVE_AESCCM
#define HAVE_AESCCM
#undef WOLFSSL_AES_COUNTER
#define WOLFSSL_AES_COUNTER
#undef WOLFSSL_AES_DIRECT
#define WOLFSSL_AES_DIRECT
#else
#define NO_AES
#endif
/* DES3 */
#undef NO_DES3
#if 1
#undef WOLFSSL_DES_ECB
#define WOLFSSL_DES_ECB
#else
#define NO_DES3
#endif
/* ChaCha20 / Poly1305 */
#undef HAVE_CHACHA
#undef HAVE_POLY1305
#if 0
#define HAVE_CHACHA
#define HAVE_POLY1305
/* Needed for Poly1305 */
#undef HAVE_ONE_TIME_AUTH
#define HAVE_ONE_TIME_AUTH
#endif
/* Ed25519 / Curve25519 */
#undef HAVE_CURVE25519
#undef HAVE_ED25519
#if 0
#define HAVE_CURVE25519
#define HAVE_ED25519
/* Optionally use small math (less flash usage, but much slower) */
#if 0
#define CURVED25519_SMALL
#endif
#endif
/* ------------------------------------------------------------------------- */
/* Hashing */
/* ------------------------------------------------------------------------- */
/* Sha */
#undef NO_SHA
#if 1
/* 1k smaller, but 25% slower */
//#define USE_SLOW_SHA
#else
#define NO_SHA
#endif
/* Sha256 */
#undef NO_SHA256
#if 1
#else
#define NO_SHA256
#endif
/* Sha512 */
#undef WOLFSSL_SHA512
#if 1
#define WOLFSSL_SHA512
/* Sha384 */
#undef WOLFSSL_SHA384
#if 1
#define WOLFSSL_SHA384
#endif
/* over twice as small, but 50% slower */
//#define USE_SLOW_SHA2
#endif
/* MD5 */
#undef NO_MD5
#if 1
#else
#define NO_MD5
#endif
/* ------------------------------------------------------------------------- */
/* Benchmark / Test */
/* ------------------------------------------------------------------------- */
/* Use reduced benchmark / test sizes */
#undef BENCH_EMBEDDED
#define BENCH_EMBEDDED
#undef USE_CERT_BUFFERS_2048
//#define USE_CERT_BUFFERS_2048
#undef USE_CERT_BUFFERS_1024
#define USE_CERT_BUFFERS_1024
#undef USE_CERT_BUFFERS_256
#define USE_CERT_BUFFERS_256
/* ------------------------------------------------------------------------- */
/* Time */
/* ------------------------------------------------------------------------- */
#if 0
/* Override Current Time */
/* Allows custom "custom_time()" function to be used for benchmark */
#define WOLFSSL_USER_CURRTIME
#define USER_TICKS
extern unsigned long custom_time(unsigned long* timer);
#define XTIME custom_time
#else
#warning Time/RTC disabled
#undef NO_ASN_TIME
#define NO_ASN_TIME
#endif
/* ------------------------------------------------------------------------- */
/* Debugging */
/* ------------------------------------------------------------------------- */
#undef DEBUG_WOLFSSL
#define DEBUG_WOLFSSL
#ifdef DEBUG_WOLFSSL
/* Use this to measure / print heap usage */
#if 0
#undef USE_WOLFSSL_MEMORY
#define USE_WOLFSSL_MEMORY
#undef WOLFSSL_TRACK_MEMORY
#define WOLFSSL_TRACK_MEMORY
#endif
#else
#undef NO_WOLFSSL_MEMORY
#define NO_WOLFSSL_MEMORY
#undef NO_ERROR_STRINGS
//#define NO_ERROR_STRINGS
#endif
/* ------------------------------------------------------------------------- */
/* Enable Features */
/* ------------------------------------------------------------------------- */
#undef KEEP_PEER_CERT
//#define KEEP_PEER_CERT
#undef HAVE_COMP_KEY
//#define HAVE_COMP_KEY
#undef HAVE_TLS_EXTENSIONS
//#define HAVE_TLS_EXTENSIONS
#undef HAVE_SUPPORTED_CURVES
//#define HAVE_SUPPORTED_CURVES
#undef WOLFSSL_BASE64_ENCODE
//#define WOLFSSL_BASE64_ENCODE
/* TLS Session Cache */
#if 0
#define SMALL_SESSION_CACHE
#else
#define NO_SESSION_CACHE
#endif
/* ------------------------------------------------------------------------- */
/* Disable Features */
/* ------------------------------------------------------------------------- */
#undef NO_WOLFSSL_SERVER
//#define NO_WOLFSSL_SERVER
#undef NO_WOLFSSL_CLIENT
//#define NO_WOLFSSL_CLIENT
#undef NO_CRYPT_TEST
//#define NO_CRYPT_TEST
#undef NO_CRYPT_BENCHMARK
//#define NO_CRYPT_BENCHMARK
/* In-lining of misc.c functions */
/* If defined, must include wolfcrypt/src/misc.c in build */
/* Slower, but about 1k smaller */
#undef NO_INLINE
//#define NO_INLINE
#undef NO_FILESYSTEM
#define NO_FILESYSTEM
#undef NO_WRITEV
#define NO_WRITEV
#undef NO_MAIN_DRIVER
#define NO_MAIN_DRIVER
#undef NO_DEV_RANDOM
#define NO_DEV_RANDOM
#undef NO_DSA
#define NO_DSA
#undef NO_DH
#define NO_DH
#undef NO_RC4
#define NO_RC4
#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
#undef NO_MD4
#define NO_MD4
#undef NO_PWDBASED
#define NO_PWDBASED
#undef NO_CODING
//#define NO_CODING
/* Suppress array-bounds */
#pragma GCC diagnostic ignored "-Warray-bounds"
#ifdef __cplusplus
}
#endif
#endif /* WOLFSSL_USER_SETTINGS_H */

View File

@@ -4,6 +4,7 @@
<logicalFolder name="HeaderFiles"
displayName="Header Files"
projectFiles="true">
<itemPath>../user_settings.h</itemPath>
</logicalFolder>
<logicalFolder name="LinkerScript"
displayName="Linker Files"
@@ -84,17 +85,16 @@
<property key="enable-symbols" value="true"/>
<property key="enable-unroll-loops" value="false"/>
<property key="exclude-floating-point" value="false"/>
<property key="extra-include-directories" value="../../"/>
<property key="extra-include-directories" value="../../;../"/>
<property key="generate-16-bit-code" value="false"/>
<property key="generate-micro-compressed-code" value="false"/>
<property key="isolate-each-function" value="false"/>
<property key="make-warnings-into-errors" value="false"/>
<property key="optimization-level" value="-O1"/>
<property key="optimization-level" value="-O3"/>
<property key="place-data-into-section" value="false"/>
<property key="post-instruction-scheduling" value="default"/>
<property key="pre-instruction-scheduling" value="default"/>
<property key="preprocessor-macros"
value="NO_MAIN_DRIVER;USE_CERT_BUFFERS_1024;BENCH_EMBEDDED;HAVE_ECC;WOLFSSL_SHA512"/>
<property key="preprocessor-macros" value="WOLFSSL_USER_SETTINGS"/>
<property key="strict-ansi" value="false"/>
<property key="support-ansi" value="false"/>
<property key="use-cci" value="false"/>

View File

@@ -8,7 +8,7 @@
<make-project-type>0</make-project-type>
<c-extensions>c</c-extensions>
<cpp-extensions/>
<header-extensions/>
<header-extensions>h</header-extensions>
<sourceEncoding>ISO-8859-1</sourceEncoding>
<asminc-extensions/>
<make-dep-projects>

View File

@@ -4,6 +4,7 @@
<logicalFolder name="HeaderFiles"
displayName="Header Files"
projectFiles="true">
<itemPath>../user_settings.h</itemPath>
</logicalFolder>
<logicalFolder name="LinkerScript"
displayName="Linker Files"
@@ -84,7 +85,7 @@
<property key="enable-symbols" value="false"/>
<property key="enable-unroll-loops" value="false"/>
<property key="exclude-floating-point" value="false"/>
<property key="extra-include-directories" value="../../"/>
<property key="extra-include-directories" value="../../;../"/>
<property key="generate-16-bit-code" value="false"/>
<property key="generate-micro-compressed-code" value="false"/>
<property key="isolate-each-function" value="false"/>
@@ -93,8 +94,7 @@
<property key="place-data-into-section" value="false"/>
<property key="post-instruction-scheduling" value="default"/>
<property key="pre-instruction-scheduling" value="default"/>
<property key="preprocessor-macros"
value="NO_MAIN_DRIVER;USE_CERT_BUFFERS_1024;WOLFSSL_SHA384;WOLFSSL_SHA512;HAVE_ECC"/>
<property key="preprocessor-macros" value="WOLFSSL_USER_SETTINGS"/>
<property key="strict-ansi" value="false"/>
<property key="support-ansi" value="false"/>
<property key="use-cci" value="false"/>
@@ -148,7 +148,7 @@
<property key="preprocessor-macros" value=""/>
<property key="remove-unused-sections" value="true"/>
<property key="report-memory-usage" value="false"/>
<property key="stack-size" value=""/>
<property key="stack-size" value="20480"/>
<property key="symbol-stripping" value=""/>
<property key="trace-symbols" value=""/>
<property key="warn-section-align" value="false"/>

View File

@@ -8,7 +8,7 @@
<make-project-type>0</make-project-type>
<c-extensions>c</c-extensions>
<cpp-extensions/>
<header-extensions/>
<header-extensions>h</header-extensions>
<sourceEncoding>ISO-8859-1</sourceEncoding>
<asminc-extensions/>
<make-dep-projects>

View File

@@ -4,6 +4,7 @@
<logicalFolder name="HeaderFiles"
displayName="Header Files"
projectFiles="true">
<itemPath>../user_settings.h</itemPath>
</logicalFolder>
<logicalFolder name="LinkerScript"
displayName="Linker Files"
@@ -49,7 +50,7 @@
<itemPath>../../wolfcrypt/src/sha512.c</itemPath>
<itemPath>../../wolfcrypt/src/tfm.c</itemPath>
<itemPath>../../wolfcrypt/src/wc_port.c</itemPath>
<itemPath>../../wolfcrypt/src/port/pic32/pic32mz-hash.c</itemPath>
<itemPath>../../wolfcrypt/src/port/pic32/pic32mz-crypt.c</itemPath>
<itemPath>../../wolfcrypt/src/hash.c</itemPath>
<itemPath>../../wolfcrypt/src/chacha20_poly1305.c</itemPath>
<itemPath>../../wolfcrypt/src/curve25519.c</itemPath>
@@ -59,6 +60,10 @@
<itemPath>../../wolfcrypt/src/ge_low_mem.c</itemPath>
<itemPath>../../wolfcrypt/src/ge_operations.c</itemPath>
<itemPath>../../wolfcrypt/src/wc_encrypt.c</itemPath>
<itemPath>../../wolfcrypt/src/pkcs12.c</itemPath>
<itemPath>../../wolfcrypt/src/signature.c</itemPath>
<itemPath>../../wolfcrypt/src/wolfevent.c</itemPath>
<itemPath>../../wolfcrypt/src/wolfmath.c</itemPath>
</logicalFolder>
<logicalFolder name="f1" displayName="wolfssl" projectFiles="true">
<itemPath>../../src/crl.c</itemPath>
@@ -69,6 +74,7 @@
<itemPath>../../src/sniffer.c</itemPath>
<itemPath>../../src/ssl.c</itemPath>
<itemPath>../../src/tls.c</itemPath>
<itemPath>../../src/tls13.c</itemPath>
</logicalFolder>
</logicalFolder>
<logicalFolder name="ExternalFiles"
@@ -126,7 +132,7 @@
<property key="enable-symbols" value="false"/>
<property key="enable-unroll-loops" value="false"/>
<property key="exclude-floating-point" value="false"/>
<property key="extra-include-directories" value="../../;..\"/>
<property key="extra-include-directories" value="../../;../"/>
<property key="generate-16-bit-code" value="false"/>
<property key="generate-micro-compressed-code" value="false"/>
<property key="isolate-each-function" value="false"/>
@@ -135,8 +141,7 @@
<property key="place-data-into-section" value="false"/>
<property key="post-instruction-scheduling" value="default"/>
<property key="pre-instruction-scheduling" value="default"/>
<property key="preprocessor-macros"
value="WOLFSSL_SHA512;WOLFSSL_SHA384;HAVE_ECC"/>
<property key="preprocessor-macros" value="WOLFSSL_USER_SETTINGS"/>
<property key="strict-ansi" value="false"/>
<property key="support-ansi" value="false"/>
<property key="use-cci" value="false"/>

View File

@@ -8,7 +8,7 @@
<make-project-type>0</make-project-type>
<c-extensions>c</c-extensions>
<cpp-extensions/>
<header-extensions/>
<header-extensions>h</header-extensions>
<sourceEncoding>ISO-8859-1</sourceEncoding>
<asminc-extensions/>
<make-dep-projects/>

View File

@@ -73,7 +73,7 @@ mkdir -p $RPM_BUILD_ROOT/
%{_libdir}/libwolfssl.la
%{_libdir}/libwolfssl.so
%{_libdir}/libwolfssl.so.12
%{_libdir}/libwolfssl.so.12.0.0
%{_libdir}/libwolfssl.so.12.1.0
%files devel
%defattr(-,root,root,-)
@@ -187,6 +187,7 @@ mkdir -p $RPM_BUILD_ROOT/
%{_includedir}/wolfssl/wolfcrypt/chacha20_poly1305.h
%{_includedir}/wolfssl/wolfcrypt/coding.h
%{_includedir}/wolfssl/wolfcrypt/compress.h
%{_includedir}/wolfssl/wolfcrypt/cpuid.h
%{_includedir}/wolfssl/wolfcrypt/curve25519.h
%{_includedir}/wolfssl/wolfcrypt/des3.h
%{_includedir}/wolfssl/wolfcrypt/dh.h
@@ -223,6 +224,7 @@ mkdir -p $RPM_BUILD_ROOT/
%{_includedir}/wolfssl/wolfcrypt/settings.h
%{_includedir}/wolfssl/wolfcrypt/signature.h
%{_includedir}/wolfssl/wolfcrypt/sha.h
%{_includedir}/wolfssl/wolfcrypt/sha3.h
%{_includedir}/wolfssl/wolfcrypt/sha256.h
%{_includedir}/wolfssl/wolfcrypt/sha512.h
%{_includedir}/wolfssl/wolfcrypt/srp.h
@@ -280,6 +282,8 @@ mkdir -p $RPM_BUILD_ROOT/
%{_libdir}/pkgconfig/wolfssl.pc
%changelog
* Fri Aug 04 2017 Jacob Barthelmeh <jacob@wolfssl.com>
- Added header for wolfssl/wolfcrypt/cpuid.h, wolfssl/wolfcrypt/sha3.h
* Thu May 04 2017 Jacob Barthelmeh <jacob@wolfssl.com>
- Added header for wolfssl/io.h, wolfssl/openssl/ssl23.h, cyassl/openssl/ssl23.h
* Thu Feb 09 2017 Jacob Barthelmeh <jacob@wolfssl.com>

View File

@@ -26,13 +26,15 @@ endif
if BUILD_OCSP_STAPLING
dist_noinst_SCRIPTS+= scripts/ocsp-stapling.test
scripts/ocsp-stapling.log: scripts/ocsp.log
dist_noinst_SCRIPTS+= scripts/ocsp-stapling-with-ca-as-responder.test
scripts/ocsp-stapling-with-ca-as-responder.log: scripts/ocsp-stapling.log
endif
if BUILD_OCSP_STAPLING_V2
dist_noinst_SCRIPTS+= scripts/ocsp-stapling2.test
if BUILD_OCSP_STAPLING
scripts/ocsp-stapling2.log: scripts/ocsp-stapling.log
scripts/ocsp-stapling2.log: scripts/ocsp-stapling-with-ca-as-responder.log
else
scripts/ocsp-stapling2.log: scripts/ocsp.log
endif
@@ -52,6 +54,10 @@ dist_noinst_SCRIPTS+= scripts/pkcallbacks.test
scripts/pkcallbacks.log: scripts/resume.log
endif
if BUILD_TLS13
dist_noinst_SCRIPTS+= scripts/tls13.test
endif
endif # end of BUILD_EXAMPLE_SERVERS
if BUILD_EXAMPLE_CLIENTS

View File

@@ -0,0 +1,39 @@
#!/bin/sh
# ocsp-stapling.test
trap 'for i in `jobs -p`; do pkill -TERM -P $i; kill $i; done' EXIT
server=login.live.com
ca=certs/external/ca-verisign-g5.pem
[ ! -x ./examples/client/client ] && echo -e "\n\nClient doesn't exist" && exit 1
# is our desired server there? - login.live.com doesn't answers PING
#./scripts/ping.test $server 2
# client test against the server
./examples/client/client -X -C -h $server -p 443 -A $ca -g -W 1
RESULT=$?
[ $RESULT -ne 0 ] && echo -e "\n\nClient connection failed" && exit 1
# setup ocsp responder
./certs/ocsp/ocspd-intermediate1-ca-issued-certs-with-ca-as-responder.sh &
sleep 1
[ $(jobs -r | wc -l) -ne 1 ] && echo -e "\n\nSetup ocsp responder failed, skipping" && exit 0
# client test against our own server - GOOD CERT
./examples/server/server -c certs/ocsp/server1-cert.pem -k certs/ocsp/server1-key.pem &
sleep 1
./examples/client/client -C -A certs/ocsp/root-ca-cert.pem -W 1
RESULT=$?
[ $RESULT -ne 0 ] && echo -e "\n\nClient connection failed" && exit 1
# client test against our own server - REVOKED CERT
./examples/server/server -c certs/ocsp/server2-cert.pem -k certs/ocsp/server2-key.pem &
sleep 1
./examples/client/client -C -A certs/ocsp/root-ca-cert.pem -W 1
RESULT=$?
[ $RESULT -ne 1 ] && echo -e "\n\nClient connection suceeded $RESULT" && exit 1
exit 0

View File

@@ -18,7 +18,7 @@ RESULT=$?
[ $RESULT -ne 0 ] && echo -e "\n\nClient connection failed" && exit 1
# setup ocsp responder
./certs/ocsp/ocspd1.sh &
./certs/ocsp/ocspd-intermediate1-ca-issued-certs.sh &
sleep 1
[ $(jobs -r | wc -l) -ne 1 ] && echo -e "\n\nSetup ocsp responder failed, skipping" && exit 0

View File

@@ -7,9 +7,9 @@ trap 'for i in `jobs -p`; do pkill -TERM -P $i; kill $i; done' EXIT
[ ! -x ./examples/client/client ] && echo -e "\n\nClient doesn't exist" && exit 1
# setup ocsp responders
./certs/ocsp/ocspd0.sh &
./certs/ocsp/ocspd2.sh &
./certs/ocsp/ocspd3.sh &
./certs/ocsp/ocspd-root-ca-and-intermediate-cas.sh &
./certs/ocsp/ocspd-intermediate2-ca-issued-certs.sh &
./certs/ocsp/ocspd-intermediate3-ca-issued-certs.sh &
sleep 1
[ $(jobs -r | wc -l) -ne 3 ] && echo -e "\n\nSetup ocsp responder failed, skipping" && exit 0

View File

@@ -216,7 +216,7 @@ do
fi
# check for psk suite and turn on client psk if so
psk = ""
psk=""
case $wolfSuite in
*PSK*)
psk="-s " ;;

440
scripts/tls13.test Executable file
View File

@@ -0,0 +1,440 @@
#!/bin/sh
# tls13.test
# copyright wolfSSL 2016
# getting unique port is modeled after resume.test script
# need a unique port since may run the same time as testsuite
# use server port zero hack to get one
port=0
no_pid=-1
server_pid=$no_pid
counter=0
# let's use absolute path to a local dir (make distcheck may be in sub dir)
# also let's add some randomness by adding pid in case multiple 'make check's
# per source tree
ready_file=`pwd`/wolfssl_psk_ready$$
echo "ready file $ready_file"
create_port() {
while [ ! -s $ready_file -a "$counter" -lt 50 ]; do
echo -e "waiting for ready file..."
sleep 0.1
counter=$((counter+ 1))
done
if test -e $ready_file; then
echo -e "found ready file, starting client..."
# get created port 0 ephemeral port
port=`cat $ready_file`
else
echo -e "NO ready file ending test..."
do_cleanup
fi
}
remove_ready_file() {
if test -e $ready_file; then
echo -e "removing existing ready file"
rm $ready_file
fi
}
do_cleanup() {
echo "in cleanup"
if [ $server_pid != $no_pid ]
then
echo "killing server"
kill -9 $server_pid
fi
remove_ready_file
}
do_trap() {
echo "got trap"
do_cleanup
exit -1
}
trap do_trap INT TERM
[ ! -x ./examples/client/client ] && echo -e "\n\nClient doesn't exist" && exit 1
# Usual TLS v1.3 server / TLS v1.3 client.
echo -e "\n\nTLS v1.3 server with TLS v1.3 client"
port=0
./examples/server/server -v 4 -R $ready_file -p $port &
server_pid=$!
create_port
./examples/client/client -v 4 -p $port
RESULT=$?
remove_ready_file
if [ $RESULT -ne 0 ]; then
echo -e "\n\nTLS v1.3 not enabled"
do_cleanup
exit 1
fi
echo ""
# Usual TLS v1.3 server / TLS v1.3 client - fragment.
echo -e "\n\nTLS v1.3 server with TLS v1.3 client - fragment"
port=0
./examples/server/server -v 4 -R $ready_file -p $port &
server_pid=$!
create_port
./examples/client/client -v 4 -F 1 -p $port
RESULT=$?
remove_ready_file
if [ $RESULT -ne 0 ]; then
echo -e "\n\nTLS v1.3 and fragments not working"
do_cleanup
exit 1
fi
echo ""
# Use HelloRetryRequest with TLS v1.3 server / TLS v1.3 client.
echo -e "\n\nTLS v1.3 HelloRetryRequest"
port=0
./examples/server/server -v 4 -R $ready_file -p $port &
server_pid=$!
create_port
./examples/client/client -v 4 -J -p $port
RESULT=$?
remove_ready_file
if [ $RESULT -ne 0 ]; then
echo -e "\n\nTLS v1.3 HelloRetryRequest not working"
do_cleanup
exit 1
fi
echo ""
# Use HelloRetryRequest with TLS v1.3 server / TLS v1.3 client using cookie
echo -e "\n\nTLS v1.3 HelloRetryRequest with cookie"
port=0
./examples/server/server -v 4 -J -R $ready_file -p $port &
server_pid=$!
create_port
./examples/client/client -v 4 -J -p $port
RESULT=$?
remove_ready_file
if [ $RESULT -ne 0 ]; then
echo -e "\n\nTLS v1.3 HelloRetryRequest with cookie not working"
do_cleanup
exit 1
fi
echo ""
# Use HelloRetryRequest with TLS v1.3 server / TLS v1.3 client - SHA384.
echo -e "\n\nTLS v1.3 HelloRetryRequest - SHA384"
port=0
./examples/server/server -v 4 -l TLS13-AES256-GCM-SHA384 -R $ready_file -p $port &
server_pid=$!
create_port
./examples/client/client -v 4 -J -p $port
RESULT=$?
remove_ready_file
if [ $RESULT -ne 0 ]; then
echo -e "\n\nTLS v1.3 HelloRetryRequest with SHA384 not working"
do_cleanup
exit 1
fi
echo ""
# Resumption TLS v1.3 server / TLS v1.3 client.
echo -e "\n\nTLS v1.3 resumption"
port=0
./examples/server/server -v 4 -r -R $ready_file -p $port &
server_pid=$!
create_port
./examples/client/client -v 4 -r -p $port
RESULT=$?
remove_ready_file
if [ $RESULT -ne 0 ]; then
echo -e "\n\nTLS v1.3 resumption not working"
do_cleanup
exit 1
fi
echo ""
# Resumption TLS v1.3 server / TLS v1.3 client - SHA384
echo -e "\n\nTLS v1.3 resumption - SHA384"
port=0
./examples/server/server -v 4 -l TLS13-AES256-GCM-SHA384 -r -R $ready_file -p $port &
server_pid=$!
create_port
./examples/client/client -v 4 -l TLS13-AES256-GCM-SHA384 -r -p $port
RESULT=$?
remove_ready_file
if [ $RESULT -ne 0 ]; then
echo -e "\n\nTLS v1.3 resumption with SHA384 not working"
do_cleanup
exit 1
fi
echo ""
# Usual TLS v1.3 server / TLS v1.3 client and ECC certificates.
echo -e "\n\nTLS v1.3 server with TLS v1.3 client - ECC certificates"
port=0
./examples/server/server -v 4 -A certs/client-ecc-cert.pem -c certs/server-ecc.pem -k certs/ecc-key.pem -R $ready_file -p $port &
server_pid=$!
create_port
./examples/client/client -v 4 -A certs/server-ecc.pem -c certs/client-ecc-cert.pem -k certs/ecc-client-key.pem -p $port
RESULT=$?
remove_ready_file
if [ $RESULT -ne 0 ]; then
echo -e "\n\nTLS v1.3 ECC certificates not working"
do_cleanup
exit 1
fi
echo ""
# Usual TLS v1.3 server / TLS v1.3 client and no client certificate.
echo -e "\n\nTLS v1.3 server with TLS v1.3 client - no client cretificate"
port=0
./examples/server/server -v 4 -R $ready_file -p $port &
server_pid=$!
create_port
./examples/client/client -v 4 -x -p $port
RESULT=$?
remove_ready_file
if [ $RESULT -ne 0 ]; then
echo -e "\n\nTLS v1.3 and no client certificate not working"
do_cleanup
exit 1
fi
echo ""
# Usual TLS v1.3 server / TLS v1.3 client and DH Key.
echo -e "\n\nTLS v1.3 server with TLS v1.3 client - DH Key Exchange"
port=0
./examples/server/server -v 4 -R $ready_file -p $port &
server_pid=$!
create_port
./examples/client/client -v 4 -y -p $port
RESULT=$?
remove_ready_file
if [ $RESULT -ne 0 ]; then
echo -e "\n\nTLS v1.3 DH Key Exchange not working"
do_cleanup
exit 1
fi
echo ""
# Usual TLS v1.3 server / TLS v1.3 client and ECC Key.
echo -e "\n\nTLS v1.3 server with TLS v1.3 client - ECC Key Exchange"
port=0
./examples/server/server -v 4 -R $ready_file -p $port &
server_pid=$!
create_port
./examples/client/client -v 4 -Y -p $port
RESULT=$?
remove_ready_file
if [ $RESULT -ne 0 ]; then
echo -e "\n\nTLS v1.3 ECDH Key Exchange not working"
do_cleanup
exit 1
fi
echo ""
# TLS 1.3 cipher suites server / client.
echo -e "\n\nOnly TLS v1.3 cipher suites"
port=0
./examples/server/server -v 4 -R $ready_file -p $port -l TLS13-AES128-GCM-SHA256:TLS13-AES256-GCM-SHA384:TLS13-CHACHA20-POLY1305-SHA256:TLS13-AES128-CCM-SHA256:TLS13-AES128-CCM-8-SHA256 &
server_pid=$!
create_port
./examples/client/client -v 4 -p $port
RESULT=$?
remove_ready_file
if [ $RESULT -ne 0 ]; then
echo -e "\n\nIssue with TLS v1.3 cipher suites - only TLS v1.3"
do_cleanup
exit 1
fi
echo ""
# TLS 1.3 cipher suites server / client.
echo -e "\n\nOnly TLS v1.3 cipher suite - AES128-GCM SHA-256"
port=0
./examples/server/server -v 4 -R $ready_file -p $port -l TLS13-AES128-GCM-SHA256 &
server_pid=$!
create_port
./examples/client/client -v 4 -p $port
RESULT=$?
remove_ready_file
if [ $RESULT -ne 0 ]; then
echo -e "\n\nIssue with TLS v1.3 cipher suites - AES128-GCM SHA-256"
do_cleanup
exit 1
fi
echo ""
# TLS 1.3 cipher suites server / client.
echo -e "\n\nOnly TLS v1.3 cipher suite - AES256-GCM SHA-384"
port=0
./examples/server/server -v 4 -R $ready_file -p $port -l TLS13-AES256-GCM-SHA384 &
server_pid=$!
create_port
./examples/client/client -v 4 -p $port
RESULT=$?
remove_ready_file
if [ $RESULT -ne 0 ]; then
echo -e "\n\nIssue with TLS v1.3 cipher suites - AES256-GCM SHA-384"
do_cleanup
exit 1
fi
echo ""
# TLS 1.3 cipher suites server / client.
echo -e "\n\nOnly TLS v1.3 cipher suite - CHACHA20-POLY1305 SHA-256"
port=0
./examples/server/server -v 4 -R $ready_file -p $port -l TLS13-CHACHA20-POLY1305-SHA256 &
server_pid=$!
create_port
./examples/client/client -v 4 -p $port
RESULT=$?
remove_ready_file
if [ $RESULT -ne 0 ]; then
echo -e "\n\nIssue with TLS v1.3 cipher suites - CHACHA20-POLY1305 SHA-256"
do_cleanup
exit 1
fi
echo ""
./examples/client/client -v 4 -e 2>&1 | grep -- '-CCM'
if [ $? -eq 0 ]; then
# TLS 1.3 cipher suites server / client.
echo -e "\n\nOnly TLS v1.3 cipher suite - AES128-CCM SHA-256"
port=0
./examples/server/server -v 4 -R $ready_file -p $port -l TLS13-AES128-CCM-SHA256 &
server_pid=$!
create_port
./examples/client/client -v 4 -p $port
RESULT=$?
remove_ready_file
if [ $RESULT -ne 0 ]; then
echo -e "\n\nIssue with TLS v1.3 cipher suites - AES128-CCM SHA-256"
do_cleanup
exit 1
fi
echo ""
# TLS 1.3 cipher suites server / client.
echo -e "\n\nOnly TLS v1.3 cipher suite - AES128-CCM-8 SHA-256"
port=0
./examples/server/server -v 4 -R $ready_file -p $port -l TLS13-AES128-CCM-8-SHA256 &
server_pid=$!
create_port
./examples/client/client -v 4 -p $port
RESULT=$?
remove_ready_file
if [ $RESULT -ne 0 ]; then
echo -e "\n\nIssue with TLS v1.3 cipher suites - AES128-CCM-8 SHA-256"
do_cleanup
exit 1
fi
echo ""
fi
# TLS 1.3 cipher suites server / client.
echo -e "\n\nTLS v1.3 cipher suite mismatch"
port=0
./examples/server/server -v 4 -R $ready_file -p $port -l TLS13-CHACHA20-POLY1305-SHA256 &
server_pid=$!
create_port
./examples/client/client -v 4 -p $port -l TLS13-AES256-GCM-SHA384
RESULT=$?
remove_ready_file
if [ $RESULT -ne 1 ]; then
echo -e "\n\nIssue with mismatched TLS v1.3 cipher suites"
do_cleanup
exit 1
fi
echo ""
# TLS 1.3 server / TLS 1.2 client.
echo -e "\n\nTLS v1.3 server downgrading to TLS v1.2"
port=0
./examples/server/server -v 4 -R $ready_file -p $port &
server_pid=$!
create_port
./examples/client/client -v 3 -p $port
RESULT=$?
remove_ready_file
if [ $RESULT -ne 0 ]; then
echo -e "\n\nIssue with TLS v1.3 server downgrading to TLS v1.2"
do_cleanup
exit 1
fi
echo ""
# TLS 1.2 server / TLS 1.3 client.
echo -e "\n\nTLS v1.3 client downgrading to TLS v1.2"
port=0
./examples/server/server -v 3 -R $ready_file -p $port &
server_pid=$!
create_port
./examples/client/client -v 4 -p $port
RESULT=$?
remove_ready_file
if [ $RESULT -ne 0 ]; then
echo -e "\n\nIssue with TLS v1.3 client downgrading to TLS v1.2"
do_cleanup
exit 1
fi
echo ""
# TLS 1.3 server / TLS 1.3 client send KeyUpdate before sending app data.
echo -e "\n\nTLS v1.3 KeyUpdate"
port=0
./examples/server/server -v 4 -U -R $ready_file -p $port &
server_pid=$!
create_port
./examples/client/client -v 4 -I -p $port
RESULT=$?
remove_ready_file
if [ $RESULT -ne 0 ]; then
echo -e "\n\nIssue with TLS v1.3 KeyUpdate"
do_cleanup
exit 1
fi
echo ""
# TLS 1.3 server / TLS 1.3 client don't use (EC)DHE with PSK.
echo -e "\n\nTLS v1.3 KeyUpdate"
port=0
./examples/server/server -v 4 -r -R $ready_file -p $port &
server_pid=$!
create_port
./examples/client/client -v 4 -r -K -p $port
RESULT=$?
remove_ready_file
if [ $RESULT -ne 0 ]; then
echo -e "\n\nIssue with TLS v1.3 KeyUpdate"
do_cleanup
exit 1
fi
echo ""
# TLS 1.3 server / TLS 1.3 client and Post-Handshake Authentication.
echo -e "\n\nTLS v1.3 Post-Handshake Authentication"
port=0
./examples/server/server -v 4 -Q -R $ready_file -p $port &
server_pid=$!
create_port
./examples/client/client -v 4 -Q -p $port
RESULT=$?
remove_ready_file
if [ $RESULT -ne 0 ]; then
echo -e "\n\nIssue with TLS v1.3 Post-Handshake Auth"
do_cleanup
exit 1
fi
echo ""
echo -e "\nALL Tests Passed"
exit 0

View File

@@ -19,6 +19,10 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
*/
#if !defined(WOLFSSL_BIO_INCLUDED)
#warning bio.c does not need to be compiled seperatly from ssl.c
#else
/*** TBD ***/
WOLFSSL_API long wolfSSL_BIO_ctrl(WOLFSSL_BIO *bio, int cmd, long larg, void *parg)
{
@@ -444,3 +448,5 @@ long wolfSSL_BIO_set_mem_eof_return(WOLFSSL_BIO *bio, int v)
return 0;
}
#endif /* WOLFSSL_BIO_INCLUDED */

152
src/crl.c
View File

@@ -74,7 +74,8 @@ int InitCRL(WOLFSSL_CRL* crl, WOLFSSL_CERT_MANAGER* cm)
/* Initialize CRL Entry */
static int InitCRL_Entry(CRL_Entry* crle, DecodedCRL* dcrl)
static int InitCRL_Entry(CRL_Entry* crle, DecodedCRL* dcrl, const byte* buff,
int verified, void* heap)
{
WOLFSSL_ENTER("InitCRL_Entry");
@@ -89,6 +90,35 @@ static int InitCRL_Entry(CRL_Entry* crle, DecodedCRL* dcrl)
crle->certs = dcrl->certs; /* take ownsership */
dcrl->certs = NULL;
crle->totalCerts = dcrl->totalCerts;
crle->verified = verified;
if (!verified) {
crle->tbsSz = dcrl->sigIndex - dcrl->certBegin;
crle->signatureSz = dcrl->sigLength;
crle->signatureOID = dcrl->signatureOID;
crle->toBeSigned = (byte*)XMALLOC(crle->tbsSz, heap,
DYNAMIC_TYPE_CRL_ENTRY);
if (crle->toBeSigned == NULL)
return -1;
crle->signature = (byte*)XMALLOC(crle->signatureSz, heap,
DYNAMIC_TYPE_CRL_ENTRY);
if (crle->signature == NULL) {
XFREE(crle->toBeSigned, heap, DYNAMIC_TYPE_CRL_ENTRY);
return -1;
}
XMEMCPY(crle->toBeSigned, buff + dcrl->certBegin, crle->tbsSz);
XMEMCPY(crle->signature, dcrl->signature, crle->signatureSz);
#if !defined(NO_SKID) && defined(CRL_SKID_READY)
crle->extAuthKeyIdSet = dcrl->extAuthKeyIdSet;
if (crle->extAuthKeyIdSet)
XMEMCPY(crle->extAuthKeyId, dcrl->extAuthKeyId, KEYID_SIZE);
#endif
}
else {
crle->toBeSigned = NULL;
crle->signature = NULL;
}
(void)verified;
return 0;
}
@@ -98,14 +128,19 @@ static int InitCRL_Entry(CRL_Entry* crle, DecodedCRL* dcrl)
static void FreeCRL_Entry(CRL_Entry* crle, void* heap)
{
RevokedCert* tmp = crle->certs;
RevokedCert* next;
WOLFSSL_ENTER("FreeCRL_Entry");
while(tmp) {
RevokedCert* next = tmp->next;
while (tmp) {
next = tmp->next;
XFREE(tmp, heap, DYNAMIC_TYPE_REVOKED);
tmp = next;
}
if (crle->signature != NULL)
XFREE(crle->signature, heap, DYNAMIC_TYPE_REVOKED);
if (crle->toBeSigned != NULL)
XFREE(crle->toBeSigned, heap, DYNAMIC_TYPE_REVOKED);
(void)heap;
}
@@ -167,6 +202,95 @@ static int CheckCertCRLList(WOLFSSL_CRL* crl, DecodedCert* cert, int *pFoundEntr
int doNextDate = 1;
WOLFSSL_MSG("Found CRL Entry on list");
if (crle->verified == 0) {
Signer* ca;
#if !defined(NO_SKID) && defined(CRL_SKID_READY)
byte extAuthKeyId[KEYID_SIZE]
#endif
byte issuerHash[CRL_DIGEST_SIZE];
byte* tbs = NULL;
word32 tbsSz = crle->tbsSz;
byte* sig = NULL;
word32 sigSz = crle->signatureSz;
word32 sigOID = crle->signatureOID;
SignatureCtx sigCtx;
tbs = (byte*)XMALLOC(tbsSz, crl->heap, DYNAMIC_TYPE_CRL_ENTRY);
if (tbs == NULL) {
wc_UnLockMutex(&crl->crlLock);
return MEMORY_E;
}
sig = (byte*)XMALLOC(sigSz, crl->heap, DYNAMIC_TYPE_CRL_ENTRY);
if (sig == NULL) {
XFREE(tbs, crl->heap, DYNAMIC_TYPE_CRL_ENTRY);
wc_UnLockMutex(&crl->crlLock);
return MEMORY_E;
}
XMEMCPY(tbs, crle->toBeSigned, tbsSz);
XMEMCPY(sig, crle->signature, sigSz);
#if !defined(NO_SKID) && defined(CRL_SKID_READY)
XMEMCMPY(extAuthKeyId, crle->extAuthKeyId,
sizeof(extAuthKeyId));
#endif
XMEMCPY(issuerHash, crle->issuerHash, sizeof(issuerHash));
wc_UnLockMutex(&crl->crlLock);
#if !defined(NO_SKID) && defined(CRL_SKID_READY)
if (crle->extAuthKeyIdSet)
ca = GetCA(crl->cm, extAuthKeyId);
if (ca == NULL)
ca = GetCAByName(crl->cm, issuerHash);
#else /* NO_SKID */
ca = GetCA(crl->cm, issuerHash);
#endif /* NO_SKID */
if (ca == NULL) {
WOLFSSL_MSG("Did NOT find CRL issuer CA");
return ASN_CRL_NO_SIGNER_E;
}
ret = VerifyCRL_Signature(&sigCtx, tbs, tbsSz, sig, sigSz,
sigOID, ca, crl->heap);
XFREE(sig, crl->heap, DYNAMIC_TYPE_CRL_ENTRY);
XFREE(tbs, crl->heap, DYNAMIC_TYPE_CRL_ENTRY);
if (wc_LockMutex(&crl->crlLock) != 0) {
WOLFSSL_MSG("wc_LockMutex failed");
return BAD_MUTEX_E;
}
crle = crl->crlList;
while (crle) {
if (XMEMCMP(crle->issuerHash, cert->issuerHash,
CRL_DIGEST_SIZE) == 0) {
if (ret == 0)
crle->verified = 1;
else
crle->verified = ret;
XFREE(crle->toBeSigned, crl->heap,
DYNAMIC_TYPE_CRL_ENTRY);
crle->toBeSigned = NULL;
XFREE(crle->signature, crl->heap,
DYNAMIC_TYPE_CRL_ENTRY);
crle->signature = NULL;
break;
}
crle = crle->next;
}
if (crle == NULL || crle->verified < 0)
break;
}
else if (crle->verified < 0) {
WOLFSSL_MSG("Cannot use CRL as it didn't verify");
ret = crle->verified;
break;
}
WOLFSSL_MSG("Checking next date validity");
#ifdef WOLFSSL_NO_CRL_NEXT_DATE
@@ -194,7 +318,8 @@ static int CheckCertCRLList(WOLFSSL_CRL* crl, DecodedCert* cert, int *pFoundEntr
RevokedCert* rc = crle->certs;
while (rc) {
if (XMEMCMP(rc->serialNumber, cert->serial, rc->serialSz) == 0) {
if (rc->serialSz == cert->serialSz &&
XMEMCMP(rc->serialNumber, cert->serial, rc->serialSz) == 0) {
WOLFSSL_MSG("Cert revoked");
ret = CRL_CERT_REVOKED;
break;
@@ -226,7 +351,10 @@ int CheckCertCRL(WOLFSSL_CRL* crl, DecodedCert* cert)
if (crl->crlIOCb) {
ret = crl->crlIOCb(crl, (const char*)cert->extCrlInfo,
cert->extCrlInfoSz);
if (ret >= 0) {
if (ret == WOLFSSL_CBIO_ERR_WANT_READ) {
ret = WANT_READ;
}
else if (ret >= 0) {
/* try again */
ret = CheckCertCRLList(crl, cert, &foundEntry);
}
@@ -260,7 +388,8 @@ int CheckCertCRL(WOLFSSL_CRL* crl, DecodedCert* cert)
/* Add Decoded CRL, 0 on success */
static int AddCRL(WOLFSSL_CRL* crl, DecodedCRL* dcrl)
static int AddCRL(WOLFSSL_CRL* crl, DecodedCRL* dcrl, const byte* buff,
int verified)
{
CRL_Entry* crle;
@@ -272,7 +401,7 @@ static int AddCRL(WOLFSSL_CRL* crl, DecodedCRL* dcrl)
return -1;
}
if (InitCRL_Entry(crle, dcrl) < 0) {
if (InitCRL_Entry(crle, dcrl, buff, verified, crl->heap) < 0) {
WOLFSSL_MSG("Init CRL Entry failed");
XFREE(crle, crl->heap, DYNAMIC_TYPE_CRL_ENTRY);
return -1;
@@ -293,7 +422,8 @@ static int AddCRL(WOLFSSL_CRL* crl, DecodedCRL* dcrl)
/* Load CRL File of type, SSL_SUCCESS on ok */
int BufferLoadCRL(WOLFSSL_CRL* crl, const byte* buff, long sz, int type)
int BufferLoadCRL(WOLFSSL_CRL* crl, const byte* buff, long sz, int type,
int noVerify)
{
int ret = SSL_SUCCESS;
const byte* myBuffer = buff; /* if DER ok, otherwise switch */
@@ -336,11 +466,11 @@ int BufferLoadCRL(WOLFSSL_CRL* crl, const byte* buff, long sz, int type)
InitDecodedCRL(dcrl, crl->heap);
ret = ParseCRL(dcrl, myBuffer, (word32)sz, crl->cm);
if (ret != 0) {
if (ret != 0 && !(ret == ASN_CRL_NO_SIGNER_E && noVerify)) {
WOLFSSL_MSG("ParseCRL error");
}
else {
ret = AddCRL(crl, dcrl);
ret = AddCRL(crl, dcrl, myBuffer, ret != ASN_CRL_NO_SIGNER_E);
if (ret != 0) {
WOLFSSL_MSG("AddCRL error");
}
@@ -870,7 +1000,7 @@ int LoadCRL(WOLFSSL_CRL* crl, const char* path, int type, int monitor)
ret = SSL_SUCCESS; /* load failures not reported, for backwards compat */
#ifdef WOLFSSL_SMALL_STACK
XFREE(readCtx, ctx->heap, DYNAMIC_TYPE_TMP_BUFFER);
XFREE(readCtx, crl->heap, DYNAMIC_TYPE_TMP_BUFFER);
#endif
if (monitor & WOLFSSL_CRL_MONITOR) {

View File

@@ -61,7 +61,8 @@ endif
src_libwolfssl_la_SOURCES += \
wolfcrypt/src/hmac.c \
wolfcrypt/src/hash.c
wolfcrypt/src/hash.c \
wolfcrypt/src/cpuid.c
if BUILD_RNG
src_libwolfssl_la_SOURCES += wolfcrypt/src/random.c
@@ -92,10 +93,9 @@ endif
endif
if BUILD_AES
src_libwolfssl_la_SOURCES += wolfcrypt/src/aes.c
if BUILD_ARMASM
src_libwolfssl_la_SOURCES += wolfcrypt/src/port/arm/armv8-aes.c
else
src_libwolfssl_la_SOURCES += wolfcrypt/src/aes.c
endif
endif
@@ -115,6 +115,10 @@ if BUILD_SHA512
src_libwolfssl_la_SOURCES += wolfcrypt/src/sha512.c
endif
if BUILD_SHA3
src_libwolfssl_la_SOURCES += wolfcrypt/src/sha3.c
endif
src_libwolfssl_la_SOURCES += \
wolfcrypt/src/logging.c \
wolfcrypt/src/wc_encrypt.c \
@@ -224,7 +228,7 @@ src_libwolfssl_la_SOURCES += wolfcrypt/src/ed25519.c
endif
if BUILD_FEMATH
if BUILD_CURVED25519_SMALL
if BUILD_CURVE25519_SMALL
src_libwolfssl_la_SOURCES += wolfcrypt/src/fe_low_mem.c
else
src_libwolfssl_la_SOURCES += wolfcrypt/src/fe_operations.c
@@ -232,10 +236,19 @@ endif
endif
if BUILD_GEMATH
if BUILD_CURVED25519_SMALL
if BUILD_ED25519_SMALL
src_libwolfssl_la_SOURCES += wolfcrypt/src/ge_low_mem.c
if !BUILD_CURVE25519_SMALL
src_libwolfssl_la_SOURCES += wolfcrypt/src/fe_low_mem.c
endif
else
src_libwolfssl_la_SOURCES += wolfcrypt/src/ge_operations.c
if !BUILD_FEMATH
src_libwolfssl_la_SOURCES += wolfcrypt/src/fe_operations.c
endif
if BUILD_CURVE25519_SMALL
src_libwolfssl_la_SOURCES += wolfcrypt/src/fe_operations.c
endif
endif
endif
@@ -264,6 +277,10 @@ src_libwolfssl_la_SOURCES += \
src/ssl.c \
src/tls.c
if BUILD_TLS13
src_libwolfssl_la_SOURCES += src/tls13.c
endif
if BUILD_OCSP
src_libwolfssl_la_SOURCES += src/ocsp.c
endif

File diff suppressed because it is too large Load Diff

View File

@@ -296,7 +296,7 @@ int EmbedReceiveFrom(WOLFSSL *ssl, char *buf, int sz, void *ctx)
if (dtlsCtx->peer.sz > 0
&& peerSz != (XSOCKLENT)dtlsCtx->peer.sz
&& XMEMCMP(&peer, dtlsCtx->peer.sa, peerSz) != 0) {
WOLFSSL_MSG("\tIgnored packet from invalid peer");
WOLFSSL_MSG(" Ignored packet from invalid peer");
return WOLFSSL_CBIO_ERR_WANT_READ;
}
}
@@ -354,6 +354,61 @@ int EmbedSendTo(WOLFSSL* ssl, char *buf, int sz, void *ctx)
}
#ifdef WOLFSSL_MULTICAST
/* The alternate receive embedded callback for Multicast
* return : nb bytes read, or error
*/
int EmbedReceiveFromMcast(WOLFSSL *ssl, char *buf, int sz, void *ctx)
{
WOLFSSL_DTLS_CTX* dtlsCtx = (WOLFSSL_DTLS_CTX*)ctx;
int recvd;
int err;
int sd = dtlsCtx->rfd;
WOLFSSL_ENTER("EmbedReceiveFromMcast()");
recvd = (int)RECVFROM_FUNCTION(sd, buf, sz, ssl->rflags, NULL, NULL);
recvd = TranslateReturnCode(recvd, sd);
if (recvd < 0) {
err = LastError();
WOLFSSL_MSG("Embed Receive From error");
if (err == SOCKET_EWOULDBLOCK || err == SOCKET_EAGAIN) {
if (wolfSSL_get_using_nonblock(ssl)) {
WOLFSSL_MSG("\tWould block");
return WOLFSSL_CBIO_ERR_WANT_READ;
}
else {
WOLFSSL_MSG("\tSocket timeout");
return WOLFSSL_CBIO_ERR_TIMEOUT;
}
}
else if (err == SOCKET_ECONNRESET) {
WOLFSSL_MSG("\tConnection reset");
return WOLFSSL_CBIO_ERR_CONN_RST;
}
else if (err == SOCKET_EINTR) {
WOLFSSL_MSG("\tSocket interrupted");
return WOLFSSL_CBIO_ERR_ISR;
}
else if (err == SOCKET_ECONNREFUSED) {
WOLFSSL_MSG("\tConnection refused");
return WOLFSSL_CBIO_ERR_WANT_READ;
}
else {
WOLFSSL_MSG("\tGeneral error");
return WOLFSSL_CBIO_ERR_GENERAL;
}
}
return recvd;
}
#endif /* WOLFSSL_MULTICAST */
/* The DTLS Generate Cookie callback
* return : number of bytes copied into buf, or error
*/
@@ -362,7 +417,7 @@ int EmbedGenerateCookie(WOLFSSL* ssl, byte *buf, int sz, void *ctx)
int sd = ssl->wfd;
SOCKADDR_S peer;
XSOCKLENT peerSz = sizeof(peer);
byte digest[SHA_DIGEST_SIZE];
byte digest[SHA256_DIGEST_SIZE];
int ret = 0;
(void)ctx;
@@ -373,12 +428,12 @@ int EmbedGenerateCookie(WOLFSSL* ssl, byte *buf, int sz, void *ctx)
return GEN_COOKIE_E;
}
ret = wc_ShaHash((byte*)&peer, peerSz, digest);
ret = wc_Sha256Hash((byte*)&peer, peerSz, digest);
if (ret != 0)
return ret;
if (sz > SHA_DIGEST_SIZE)
sz = SHA_DIGEST_SIZE;
if (sz > SHA256_DIGEST_SIZE)
sz = SHA256_DIGEST_SIZE;
XMEMCPY(buf, digest, sz);
return sz;
@@ -1168,7 +1223,7 @@ int EmbedOcspLookup(void* ctx, const char* url, int urlSz,
httpBuf, httpBufSz);
ret = wolfIO_TcpConnect(&sfd, domainName, port, io_timeout_sec);
if ((ret != 0) || (sfd <= 0)) {
if ((ret != 0) || (sfd < 0)) {
WOLFSSL_MSG("OCSP Responder connection failed");
}
else if (wolfIO_Send(sfd, (char*)httpBuf, httpBufSz, 0) !=
@@ -1226,7 +1281,7 @@ int wolfIO_HttpProcessResponseCrl(WOLFSSL_CRL* crl, int sfd, byte* httpBuf,
result = wolfIO_HttpProcessResponse(sfd, "application/pkix-crl",
&respBuf, httpBuf, httpBufSz, DYNAMIC_TYPE_CRL, crl->heap);
if (result >= 0) {
result = BufferLoadCRL(crl, respBuf, result, SSL_FILETYPE_ASN1);
result = BufferLoadCRL(crl, respBuf, result, SSL_FILETYPE_ASN1, 0);
}
XFREE(respBuf, crl->heap, DYNAMIC_TYPE_CRL);
@@ -1267,7 +1322,7 @@ int EmbedCrlLookup(WOLFSSL_CRL* crl, const char* url, int urlSz)
httpBuf, httpBufSz);
ret = wolfIO_TcpConnect(&sfd, domainName, port, io_timeout_sec);
if ((ret != 0) || (sfd <= 0)) {
if ((ret != 0) || (sfd < 0)) {
WOLFSSL_MSG("CRL connection failed");
}
else if (wolfIO_Send(sfd, (char*)httpBuf, httpBufSz, 0)
@@ -1402,6 +1457,8 @@ int NetX_Receive(WOLFSSL *ssl, char *buf, int sz, void *ctx)
ULONG copied = 0;
UINT status;
(void)ssl;
if (nxCtx == NULL || nxCtx->nxSocket == NULL) {
WOLFSSL_MSG("NetX Recv NULL parameters");
return WOLFSSL_CBIO_ERR_GENERAL;
@@ -1455,6 +1512,8 @@ int NetX_Send(WOLFSSL* ssl, char *buf, int sz, void *ctx)
NX_PACKET_POOL* pool; /* shorthand */
UINT status;
(void)ssl;
if (nxCtx == NULL || nxCtx->nxSocket == NULL) {
WOLFSSL_MSG("NetX Send NULL parameters");
return WOLFSSL_CBIO_ERR_GENERAL;

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