Compare commits
561 Commits
v3.11.0-st
...
v3.12.0-st
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d195009dcb | ||
|
|
6717035563 | ||
|
|
d949832059 | ||
|
|
e9c6fa5f22 | ||
|
|
1dc2889388 | ||
|
|
b55f981d5b | ||
|
|
df4387cff4 | ||
|
|
3be4e0823e | ||
|
|
4d6cb66bc1 | ||
|
|
3f2de7154f | ||
|
|
977e909f60 | ||
|
|
4a5ecb8a15 | ||
|
|
089a050d7a | ||
|
|
b0eeed364b | ||
|
|
80bc089cb5 | ||
|
|
31854c1566 | ||
|
|
108f6a4958 | ||
|
|
635bacef28 | ||
|
|
433ca50292 | ||
|
|
e77e93ef2e | ||
|
|
edce23b563 | ||
|
|
43b04af388 | ||
|
|
062f3efa6d | ||
|
|
65b8389af0 | ||
|
|
9f1b17effc | ||
|
|
2d94a3954a | ||
|
|
bd20729fba | ||
|
|
c93d348ecd | ||
|
|
be432d8d3a | ||
|
|
4e735631e7 | ||
|
|
af0514704f | ||
|
|
c20859e67d | ||
|
|
b553d36548 | ||
|
|
24e9f7c43d | ||
|
|
7cee1c5e8a | ||
|
|
2296f4806c | ||
|
|
0c753718bd | ||
|
|
a27738b5f9 | ||
|
|
a55e42c14f | ||
|
|
01099fd97e | ||
|
|
08da8df455 | ||
|
|
66852a9252 | ||
|
|
2051a05139 | ||
|
|
8a11b78960 | ||
|
|
36a539760a | ||
|
|
fb53fac1c1 | ||
|
|
62ce8c8b81 | ||
|
|
87611fdb5d | ||
|
|
5564be6113 | ||
|
|
3387b12a9a | ||
|
|
e1ccc5acad | ||
|
|
d452f97e99 | ||
|
|
bc72d0c2d5 | ||
|
|
d5cf5f9887 | ||
|
|
0978dd4285 | ||
|
|
dc7acc0400 | ||
|
|
637ca44e6a | ||
|
|
05ed5cafc2 | ||
|
|
41e2b236aa | ||
|
|
fbf4e94bcf | ||
|
|
038d16212f | ||
|
|
59450e83fa | ||
|
|
e1830772de | ||
|
|
55b07019a0 | ||
|
|
c03487d463 | ||
|
|
4fead493e7 | ||
|
|
4438b8e92d | ||
|
|
5b0022fba0 | ||
|
|
1b80e5a75f | ||
|
|
ef98e96767 | ||
|
|
a076a2f0d8 | ||
|
|
69d4bcbfd5 | ||
|
|
f9dee9adcc | ||
|
|
4939c3eeef | ||
|
|
874144be73 | ||
|
|
f8e2f596d6 | ||
|
|
e9f87b9f33 | ||
|
|
e8e1504d9f | ||
|
|
08488b52b7 | ||
|
|
33e214ffc1 | ||
|
|
5180cf4cce | ||
|
|
f147b01674 | ||
|
|
b23f983604 | ||
|
|
2329e37d97 | ||
|
|
8e38dcc347 | ||
|
|
bde6a35ac4 | ||
|
|
36c2ee92dc | ||
|
|
1040bbde16 | ||
|
|
be61d7fca3 | ||
|
|
6df9bc07a4 | ||
|
|
e68ceb3d2c | ||
|
|
95664fdd05 | ||
|
|
9d919ca947 | ||
|
|
0fed9c1dc5 | ||
|
|
59a46d08d9 | ||
|
|
26ac5e1ab7 | ||
|
|
b7dac4911b | ||
|
|
9e3497b3d5 | ||
|
|
f0d6299581 | ||
|
|
173283208b | ||
|
|
bd6633a31c | ||
|
|
e3ffd7d539 | ||
|
|
7a972d9611 | ||
|
|
cf9dfac877 | ||
|
|
d6190507ac | ||
|
|
8bfbabd147 | ||
|
|
0a63221220 | ||
|
|
7d82d7235a | ||
|
|
0fee243b75 | ||
|
|
935bf9028d | ||
|
|
3329aa7bef | ||
|
|
6223f4cd8e | ||
|
|
43f3e304e6 | ||
|
|
1d32409651 | ||
|
|
3b5e537f08 | ||
|
|
4c5ddc8482 | ||
|
|
6509faa78d | ||
|
|
1d5c6cce00 | ||
|
|
fbd7f7972b | ||
|
|
b40aad3f9e | ||
|
|
6097d29045 | ||
|
|
af1a9ca908 | ||
|
|
1657569605 | ||
|
|
96c25b2caa | ||
|
|
3f330a2b21 | ||
|
|
60c6c32ad3 | ||
|
|
fa4a8fee8c | ||
|
|
0457df83d4 | ||
|
|
30a54a4860 | ||
|
|
41638b437b | ||
|
|
dd9800856d | ||
|
|
431a0cbea9 | ||
|
|
f83a593f27 | ||
|
|
b616b8df02 | ||
|
|
0838a3828b | ||
|
|
5154584576 | ||
|
|
b3a20470fd | ||
|
|
5c19b7bfe0 | ||
|
|
667b8431cc | ||
|
|
81f09e575e | ||
|
|
d2245b9614 | ||
|
|
5f17598d47 | ||
|
|
0e6b0a6156 | ||
|
|
e68f1b2cec | ||
|
|
c93a903cae | ||
|
|
47fd21dc63 | ||
|
|
5671a4cb49 | ||
|
|
808f4692c7 | ||
|
|
fdb371e82e | ||
|
|
c4f0bd6172 | ||
|
|
cc4ca6a44a | ||
|
|
a7390e32ec | ||
|
|
e51225aca6 | ||
|
|
8acf709b59 | ||
|
|
f7cd8a0f15 | ||
|
|
12795e9a40 | ||
|
|
9e9dbc5e97 | ||
|
|
8612d52844 | ||
|
|
8b55122ba0 | ||
|
|
a0e918c350 | ||
|
|
ba48221c41 | ||
|
|
af8b96e277 | ||
|
|
4491102eed | ||
|
|
d559eb0f4f | ||
|
|
43260f02f4 | ||
|
|
b12e3c6579 | ||
|
|
c4fe67b633 | ||
|
|
b4f9c46069 | ||
|
|
19787e6d4f | ||
|
|
c777097e54 | ||
|
|
b02c995fff | ||
|
|
5bb8de627e | ||
|
|
43ad30d364 | ||
|
|
dc5e6f789d | ||
|
|
9d7e8a83c9 | ||
|
|
7853440d89 | ||
|
|
3ff088b92f | ||
|
|
00724c95a9 | ||
|
|
f8c0a52170 | ||
|
|
69e9aa29f2 | ||
|
|
a5cdbb18cb | ||
|
|
792fcefbb7 | ||
|
|
171796e8e2 | ||
|
|
cebcee34dd | ||
|
|
f9c949e7e5 | ||
|
|
58c05123da | ||
|
|
205da48416 | ||
|
|
b6854d620f | ||
|
|
626eeaa63d | ||
|
|
ced45ced41 | ||
|
|
31ac379c4f | ||
|
|
4b9069f786 | ||
|
|
e767d40656 | ||
|
|
df119692d1 | ||
|
|
5bddb2e4ef | ||
|
|
2939fbe242 | ||
|
|
1729e0205f | ||
|
|
54177c14b4 | ||
|
|
bba3fcf772 | ||
|
|
c9a2c4ef02 | ||
|
|
6a695b76cb | ||
|
|
a025417877 | ||
|
|
a3375ef961 | ||
|
|
d956181911 | ||
|
|
baf6bdd6e1 | ||
|
|
31e1d469c0 | ||
|
|
bba914f92e | ||
|
|
d2ce95955d | ||
|
|
c099137450 | ||
|
|
15a1c9d48e | ||
|
|
a89e50b7b7 | ||
|
|
c748d9dae9 | ||
|
|
b29cd414ef | ||
|
|
47cc3ffdbc | ||
|
|
7aee92110b | ||
|
|
9ca1903ac5 | ||
|
|
d4e104231c | ||
|
|
a3b21f0394 | ||
|
|
8bd6a1e727 | ||
|
|
3bdf8b3cfd | ||
|
|
fbc4123ec0 | ||
|
|
8ef556c2a0 | ||
|
|
b0f87fdcf7 | ||
|
|
72da8a9a07 | ||
|
|
d017274bff | ||
|
|
3a4edf75bd | ||
|
|
06fa3de31c | ||
|
|
ccb8e8c976 | ||
|
|
207b275d24 | ||
|
|
08a0b98f52 | ||
|
|
a37808b32c | ||
|
|
1aee054902 | ||
|
|
a3578c6643 | ||
|
|
7a3769f435 | ||
|
|
4bb17205fe | ||
|
|
a9d5dcae58 | ||
|
|
42a2f5858e | ||
|
|
9ead657723 | ||
|
|
cd570a01f2 | ||
|
|
247388903b | ||
|
|
fec75e445e | ||
|
|
64873489ef | ||
|
|
d75a9f2436 | ||
|
|
2f9f746053 | ||
|
|
0fa99fcc2e | ||
|
|
3e06beac19 | ||
|
|
c183e03802 | ||
|
|
decdf7ae8b | ||
|
|
1549a60aa5 | ||
|
|
350ce5fcef | ||
|
|
97906bfdb2 | ||
|
|
8b637cbd1b | ||
|
|
a555b5e54a | ||
|
|
c14e2d5888 | ||
|
|
6e6b341b46 | ||
|
|
d5b1698c43 | ||
|
|
4950c644cd | ||
|
|
7fdb7037d8 | ||
|
|
2a688bf905 | ||
|
|
c118146803 | ||
|
|
ee83710a0a | ||
|
|
6a2824f199 | ||
|
|
e0e8d14630 | ||
|
|
816b0b058c | ||
|
|
43d6b7a145 | ||
|
|
17936d65e0 | ||
|
|
2f36b24796 | ||
|
|
4389d271cc | ||
|
|
3c173ba366 | ||
|
|
e6f0ee84ec | ||
|
|
bb6582896d | ||
|
|
d5a43af751 | ||
|
|
1d303f5f61 | ||
|
|
25ce52cd0c | ||
|
|
2b085351b6 | ||
|
|
55d421d8b6 | ||
|
|
e1fef39aa2 | ||
|
|
f008350afd | ||
|
|
73567853d3 | ||
|
|
68439d4317 | ||
|
|
88afc7a92f | ||
|
|
40d94724eb | ||
|
|
131ccf289f | ||
|
|
a77f9fe3e6 | ||
|
|
b778ddfea2 | ||
|
|
c283d4aece | ||
|
|
70eddc4336 | ||
|
|
ff48d19727 | ||
|
|
89e6ac91bf | ||
|
|
6d5c257010 | ||
|
|
ea9e4887e9 | ||
|
|
1e94868432 | ||
|
|
13c4fe6cc4 | ||
|
|
62ae1d3023 | ||
|
|
19f22edd9a | ||
|
|
1ddd6fd3fe | ||
|
|
189d579bec | ||
|
|
76aa1f855f | ||
|
|
0ef1129f18 | ||
|
|
042ee817f3 | ||
|
|
048b074894 | ||
|
|
adf819458c | ||
|
|
a18e9a220f | ||
|
|
af2cbcdbab | ||
|
|
ce231e0cbc | ||
|
|
1d2b4226a4 | ||
|
|
894f4f6fa5 | ||
|
|
0fcd1617eb | ||
|
|
7cc455259e | ||
|
|
267753acdd | ||
|
|
8dbd9a88ee | ||
|
|
044417ba01 | ||
|
|
fdcf25b6d1 | ||
|
|
c70fa33094 | ||
|
|
86809cca74 | ||
|
|
90287c8857 | ||
|
|
a00165768c | ||
|
|
3429b5a3b5 | ||
|
|
1db52f0c04 | ||
|
|
a30e8eb4ad | ||
|
|
1bc862ae24 | ||
|
|
613d30bcae | ||
|
|
4beda52dcd | ||
|
|
1be0b2aa30 | ||
|
|
2c84eee2df | ||
|
|
5d5ff56336 | ||
|
|
26f106c42b | ||
|
|
63c85f72d2 | ||
|
|
af03b7a4ff | ||
|
|
026a95ff10 | ||
|
|
642795db1b | ||
|
|
c55575665f | ||
|
|
c3d29ddfe3 | ||
|
|
b3a85bc2c7 | ||
|
|
3df565475a | ||
|
|
0b32d0368f | ||
|
|
6b34a94589 | ||
|
|
7a52b5b394 | ||
|
|
38c6d2e3eb | ||
|
|
320ad56139 | ||
|
|
c0408aebb4 | ||
|
|
e345471b21 | ||
|
|
a0345f6ba9 | ||
|
|
53021a5df7 | ||
|
|
1c0006882a | ||
|
|
a44df73151 | ||
|
|
7ef5aeaf13 | ||
|
|
4134073c8d | ||
|
|
0e22752af4 | ||
|
|
47b0a62c88 | ||
|
|
edddd05226 | ||
|
|
4d458831b7 | ||
|
|
b47fca5760 | ||
|
|
60c51db831 | ||
|
|
c1664bd1a0 | ||
|
|
64de29f277 | ||
|
|
77dbf539c8 | ||
|
|
720f3fdad2 | ||
|
|
d2b6ab0796 | ||
|
|
6b09a7c6e1 | ||
|
|
1880677232 | ||
|
|
fc5a37ac02 | ||
|
|
9f5f1dd00f | ||
|
|
19edd47018 | ||
|
|
47d04ebaff | ||
|
|
c85d07a49d | ||
|
|
a8f08d1d70 | ||
|
|
0e860b0d55 | ||
|
|
15a2323c09 | ||
|
|
6c6069bed8 | ||
|
|
8920cd89e4 | ||
|
|
570c3f02b8 | ||
|
|
398c27d848 | ||
|
|
b6c2e2acf9 | ||
|
|
184e9c4090 | ||
|
|
a616513860 | ||
|
|
0a28b76e8b | ||
|
|
1cf3530124 | ||
|
|
bdaa827114 | ||
|
|
7f01aa917a | ||
|
|
4390f4c711 | ||
|
|
5ef977aa3d | ||
|
|
7f350a726b | ||
|
|
452e057dbf | ||
|
|
c3a7497562 | ||
|
|
4737b97503 | ||
|
|
cbb2c73828 | ||
|
|
d61e0243a3 | ||
|
|
36e1fb5e5b | ||
|
|
09ca962d66 | ||
|
|
2086394a35 | ||
|
|
77ac61c0f4 | ||
|
|
30db8e95a7 | ||
|
|
48895cf03b | ||
|
|
7bd1e0b80a | ||
|
|
c5cc9f5392 | ||
|
|
4370a01778 | ||
|
|
b5e74878b3 | ||
|
|
4edcbc79c1 | ||
|
|
548c01ce54 | ||
|
|
9fb6373cfb | ||
|
|
c1f82ece7a | ||
|
|
2f15d57a6f | ||
|
|
63a6618feb | ||
|
|
4c451a6c61 | ||
|
|
5621fad02b | ||
|
|
cb3b10054d | ||
|
|
270d6cbae3 | ||
|
|
6acd5dafa7 | ||
|
|
81b6894f6f | ||
|
|
289f60e2c9 | ||
|
|
79b0311952 | ||
|
|
c960faffeb | ||
|
|
e5fe1a3750 | ||
|
|
da15b54529 | ||
|
|
bb60f7a4a4 | ||
|
|
d53a77a589 | ||
|
|
1a08143946 | ||
|
|
1e2a6412d7 | ||
|
|
ff4fcf21d6 | ||
|
|
c6ce1fe330 | ||
|
|
c7e57e9c6c | ||
|
|
c8e6c64e51 | ||
|
|
4723b8470a | ||
|
|
4d77e80d04 | ||
|
|
224c1b2645 | ||
|
|
f8023b808f | ||
|
|
3297280e62 | ||
|
|
dcd3a6a478 | ||
|
|
66e086a0bf | ||
|
|
0374907acc | ||
|
|
d03f97dafc | ||
|
|
606aca9916 | ||
|
|
01a5f901d0 | ||
|
|
53a837b230 | ||
|
|
7c7503449f | ||
|
|
562db08c3d | ||
|
|
c0c98c8f64 | ||
|
|
f1e6f7d01d | ||
|
|
ce42738198 | ||
|
|
5c652e398f | ||
|
|
e12545ac38 | ||
|
|
05d2032661 | ||
|
|
1b21df9b2b | ||
|
|
2efa7d5b8b | ||
|
|
a79f9c93c9 | ||
|
|
7d6597fe55 | ||
|
|
dcc9f9ae63 | ||
|
|
22ce2f183d | ||
|
|
01586b26ae | ||
|
|
ec6d8f48b8 | ||
|
|
df3abee72c | ||
|
|
8d4f8c6d80 | ||
|
|
c47826cc8f | ||
|
|
e8cf4b5ff0 | ||
|
|
dea092fa0a | ||
|
|
46c4adcf4c | ||
|
|
2e016f3b25 | ||
|
|
285a338054 | ||
|
|
7b6e2b1002 | ||
|
|
5726c23d81 | ||
|
|
8cd78edac1 | ||
|
|
011178994b | ||
|
|
6cc3983894 | ||
|
|
17587d38f8 | ||
|
|
d23f1e5637 | ||
|
|
176193a835 | ||
|
|
a4ceeed462 | ||
|
|
fdb46ac24c | ||
|
|
0ca2d7c137 | ||
|
|
af0103bc94 | ||
|
|
758c2a761c | ||
|
|
902f5cf53f | ||
|
|
f0204de881 | ||
|
|
570befb63f | ||
|
|
efb4b3c183 | ||
|
|
253140f37e | ||
|
|
77f9126edf | ||
|
|
2b1e9973ec | ||
|
|
1215203c39 | ||
|
|
4a8259b2ad | ||
|
|
5486a60326 | ||
|
|
f7c58b0643 | ||
|
|
3749988ee2 | ||
|
|
5b5c8f1e95 | ||
|
|
609ca3c823 | ||
|
|
b5d856eada | ||
|
|
00ea508751 | ||
|
|
ac6b840dc5 | ||
|
|
85b78835a6 | ||
|
|
3478c9b937 | ||
|
|
6e16410e25 | ||
|
|
d62d0aaa26 | ||
|
|
706c02deed | ||
|
|
d626c917dd | ||
|
|
5f7e77f131 | ||
|
|
88679a6a0c | ||
|
|
739436d7a8 | ||
|
|
d5d7a4ae7b | ||
|
|
b2fc525a1d | ||
|
|
c467bbd776 | ||
|
|
6ca16b06d2 | ||
|
|
daafb2c5ac | ||
|
|
e33d4c0172 | ||
|
|
00a74d0da4 | ||
|
|
bf12e4ecca | ||
|
|
b11265dbf5 | ||
|
|
de9f05f3c5 | ||
|
|
e4942eaa3d | ||
|
|
74f72b5c6b | ||
|
|
3ca087e850 | ||
|
|
79e8bd2f2b | ||
|
|
be768f5395 | ||
|
|
d3d7446a24 | ||
|
|
3918cdef03 | ||
|
|
a761a7fc64 | ||
|
|
feb6617dc9 | ||
|
|
51bf46288b | ||
|
|
5c8e69eb5e | ||
|
|
c5bd24c1b7 | ||
|
|
bb97e03a44 | ||
|
|
089387906e | ||
|
|
715d6afeda | ||
|
|
0a9f66338c | ||
|
|
2d56f09320 | ||
|
|
56091e267f | ||
|
|
08f188ab44 | ||
|
|
2c87f8d33c | ||
|
|
050ba9d6e0 | ||
|
|
cb0cc92ff2 | ||
|
|
2f3ec778bd | ||
|
|
d3195d0b75 | ||
|
|
53d4c171c8 | ||
|
|
35f03eb00a | ||
|
|
1c9147a41e | ||
|
|
9b58ab0211 | ||
|
|
4b75d11164 | ||
|
|
f3c1522608 | ||
|
|
b9934695fb | ||
|
|
567dfd76b3 | ||
|
|
2cbdd45e8f | ||
|
|
07072ef266 | ||
|
|
baeba53527 | ||
|
|
445e375daa | ||
|
|
52eb0becf0 | ||
|
|
368f2baf88 | ||
|
|
8eec3cb874 | ||
|
|
0ed0672b16 | ||
|
|
c0b59a585b | ||
|
|
015ffecbab | ||
|
|
760ddd14f5 | ||
|
|
7201435f2d | ||
|
|
bd14611879 | ||
|
|
c8ae6abb43 | ||
|
|
e1c01378c7 | ||
|
|
20cfbe399c | ||
|
|
e06b17e170 | ||
|
|
0df897d4b9 | ||
|
|
7b884ad72a | ||
|
|
8b0edafef3 | ||
|
|
f4d6890b51 |
15
.gitignore
vendored
15
.gitignore
vendored
@@ -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
25
IDE/LINUX-SGX/README.md
Normal 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
6
IDE/LINUX-SGX/include.am
Normal 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
|
||||
145
IDE/LINUX-SGX/sgx_t_static.mk
Normal file
145
IDE/LINUX-SGX/sgx_t_static.mk
Normal 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)
|
||||
@@ -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)
|
||||
|
||||
@@ -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
148
IDE/OPENSTM32/.cproject
Normal 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 "${BuildArtifactFileBaseName}.elf" "${BuildArtifactFileBaseName}.bin" && arm-none-eabi-size "${BuildArtifactFileName}"">
|
||||
<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=""${ProjDirPath}/../..""/>
|
||||
</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="__attribute__((weak))""/>
|
||||
<listOptionValue builtIn="false" value="__packed="__attribute__((__packed__))""/>
|
||||
<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
2444
IDE/OPENSTM32/.project
Normal file
File diff suppressed because it is too large
Load Diff
105
IDE/OPENSTM32/Inc/lwipopts.h
Normal file
105
IDE/OPENSTM32/Inc/lwipopts.h
Normal 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 */
|
||||
401
IDE/OPENSTM32/Inc/user_settings.h
Normal file
401
IDE/OPENSTM32/Inc/user_settings.h
Normal 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 */
|
||||
14
IDE/OPENSTM32/Inc/wolfssl_example.h
Normal file
14
IDE/OPENSTM32/Inc/wolfssl_example.h
Normal 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
27
IDE/OPENSTM32/README.md
Normal 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
384
IDE/OPENSTM32/Src/main.c
Normal 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
|
||||
101
IDE/OPENSTM32/Src/wolfssl_example.c
Normal file
101
IDE/OPENSTM32/Src/wolfssl_example.c
Normal 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
15
IDE/OPENSTM32/include.am
Normal 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
|
||||
13
IDE/OPENSTM32/wolfSTM32.cfg
Normal file
13
IDE/OPENSTM32/wolfSTM32.cfg
Normal 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
213
IDE/OPENSTM32/wolfSTM32.ioc
Normal 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
|
||||
9
IDE/OPENSTM32/wolfSTM32.xml
Normal file
9
IDE/OPENSTM32/wolfSTM32.xml
Normal 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>
|
||||
@@ -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();
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
@@ -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_ */
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
73
README
@@ -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)
|
||||
|
||||
74
README.md
74
README.md
@@ -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
80
certs/crl/crl2.pem
Normal 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-----
|
||||
@@ -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
|
||||
|
||||
8
certs/ecc-privOnlyCert.pem
Normal file
8
certs/ecc-privOnlyCert.pem
Normal file
@@ -0,0 +1,8 @@
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIIBJDCByaADAgECAgEAMAwGCCqGSM49BAMCBQAwGjELMAkGA1UEChMCV1IxCzAJBgNVBAYTAkRF
|
||||
MB4XDTE3MDIwNjE0NTY0MVoXDTE4MDIwNjE0NTY0MVowGjELMAkGA1UEChMCV1IxCzAJBgNVBAYT
|
||||
AkRFMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEJcD9Frgr8rgKHt2szmJSfFgKYH1Xddq9EcHV
|
||||
KupUa3bmPTb33VGXa6gm/numvZZVhVCdmn5pAdhDRYnZ/korJjAMBggqhkjOPQQDAgUAA0gAMEUC
|
||||
IDnBQOHgHIudh7nFB0wG/WFMoUutVFN0uQPbVJSWwbQHAiEAmw25n+eEMgMK4Gi7qH1lzxm11WX0
|
||||
jM1gxQSGZTaja8s=
|
||||
-----END CERTIFICATE-----
|
||||
4
certs/ecc-privOnlyKey.pem
Normal file
4
certs/ecc-privOnlyKey.pem
Normal file
@@ -0,0 +1,4 @@
|
||||
-----BEGIN PRIVATE KEY-----
|
||||
MEECAQAwEwYHKoZIzj0CAQYIKoZIzj0DAQcEJzAlAgEBBCBmlE/nixmHCpmplUopbqNEo+jJE40p
|
||||
wfkxzH01tAWqcQ==
|
||||
-----END PRIVATE KEY-----
|
||||
4
certs/ecc-privkey.pem
Normal file
4
certs/ecc-privkey.pem
Normal file
@@ -0,0 +1,4 @@
|
||||
-----BEGIN EC PRIVATE KEY-----
|
||||
MDECAQEEIEW2aQJznGyFoThbcujox6zEA41TNQT6bCjcNI3hqAmMoAoGCCqGSM49
|
||||
AwEH
|
||||
-----END EC PRIVATE KEY-----
|
||||
BIN
certs/ed25519/ca-ed25519-key.der
Normal file
BIN
certs/ed25519/ca-ed25519-key.der
Normal file
Binary file not shown.
4
certs/ed25519/ca-ed25519-key.pem
Normal file
4
certs/ed25519/ca-ed25519-key.pem
Normal file
@@ -0,0 +1,4 @@
|
||||
-----BEGIN EDDSA PRIVATE KEY-----
|
||||
MFICAQAwBQYDK2VwBCIEIE3EyZVR/gbofvUgIsCeuA3yZ9E7DbTQxW7HMDYQhbxl
|
||||
oSIEIEEH7HUMaHISPASCB24Wb0BBbaSPCPLinadDwiQomH6s
|
||||
-----END EDDSA PRIVATE KEY-----
|
||||
BIN
certs/ed25519/ca-ed25519.der
Normal file
BIN
certs/ed25519/ca-ed25519.der
Normal file
Binary file not shown.
15
certs/ed25519/ca-ed25519.pem
Normal file
15
certs/ed25519/ca-ed25519.pem
Normal 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-----
|
||||
BIN
certs/ed25519/client-ed25519-key.der
Normal file
BIN
certs/ed25519/client-ed25519-key.der
Normal file
Binary file not shown.
4
certs/ed25519/client-ed25519-key.pem
Normal file
4
certs/ed25519/client-ed25519-key.pem
Normal file
@@ -0,0 +1,4 @@
|
||||
-----BEGIN EDDSA PRIVATE KEY-----
|
||||
MFICAQAwBQYDK2VwBCIEIBGdNYxa3ommO8aYO1oGaGSRQBqDYB0sKOdR3bqejqIQ
|
||||
oSIEIDY9UZ60w5FgsDoJuIdapQUPW1PlZBc+cLkNZhKk5fFR
|
||||
-----END EDDSA PRIVATE KEY-----
|
||||
BIN
certs/ed25519/client-ed25519.der
Normal file
BIN
certs/ed25519/client-ed25519.der
Normal file
Binary file not shown.
15
certs/ed25519/client-ed25519.pem
Normal file
15
certs/ed25519/client-ed25519.pem
Normal 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-----
|
||||
BIN
certs/ed25519/root-ed25519-key.der
Normal file
BIN
certs/ed25519/root-ed25519-key.der
Normal file
Binary file not shown.
4
certs/ed25519/root-ed25519-key.pem
Normal file
4
certs/ed25519/root-ed25519-key.pem
Normal file
@@ -0,0 +1,4 @@
|
||||
-----BEGIN EDDSA PRIVATE KEY-----
|
||||
MFICAQAwBQYDK2VwBCIEIFwOftlJ9QL4yEBIBh9UmTRwCu+A6puPK9OFmVk0A19P
|
||||
oSIEIKZgKbt92EfL1B7QbQ9XANgqH1BqQrxd5bgZZbLfJK9Q
|
||||
-----END EDDSA PRIVATE KEY-----
|
||||
BIN
certs/ed25519/root-ed25519.der
Normal file
BIN
certs/ed25519/root-ed25519.der
Normal file
Binary file not shown.
15
certs/ed25519/root-ed25519.pem
Normal file
15
certs/ed25519/root-ed25519.pem
Normal 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-----
|
||||
BIN
certs/ed25519/server-ed25519-key.der
Normal file
BIN
certs/ed25519/server-ed25519-key.der
Normal file
Binary file not shown.
4
certs/ed25519/server-ed25519-key.pem
Normal file
4
certs/ed25519/server-ed25519-key.pem
Normal file
@@ -0,0 +1,4 @@
|
||||
-----BEGIN EDDSA PRIVATE KEY-----
|
||||
MFICAQAwBQYDK2VwBCIEINjpdrI/H/eIdfXd+HrGSTBu6Z/LnR4rwBjvu3WJ5ndn
|
||||
oSIEIBowiBhHL5faBPSk471sDBa5SMHRQteOkoSgdCpDng4p
|
||||
-----END EDDSA PRIVATE KEY-----
|
||||
BIN
certs/ed25519/server-ed25519.der
Normal file
BIN
certs/ed25519/server-ed25519.der
Normal file
Binary file not shown.
30
certs/ed25519/server-ed25519.pem
Normal file
30
certs/ed25519/server-ed25519.pem
Normal 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
23
certs/external/ca-digicert-ev.pem
vendored
Normal 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-----
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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 \
|
||||
|
||||
8
certs/ocsp/ocspd-intermediate1-ca-issued-certs-with-ca-as-responder.sh
Executable file
8
certs/ocsp/ocspd-intermediate1-ca-issued-certs-with-ca-as-responder.sh
Executable 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 \
|
||||
$@
|
||||
8
certs/ocsp/ocspd-intermediate1-ca-issued-certs.sh
Executable file
8
certs/ocsp/ocspd-intermediate1-ca-issued-certs.sh
Executable 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 \
|
||||
$@
|
||||
8
certs/ocsp/ocspd-intermediate2-ca-issued-certs.sh
Executable file
8
certs/ocsp/ocspd-intermediate2-ca-issued-certs.sh
Executable 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 \
|
||||
$@
|
||||
8
certs/ocsp/ocspd-intermediate3-ca-issued-certs.sh
Executable file
8
certs/ocsp/ocspd-intermediate3-ca-issued-certs.sh
Executable 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 \
|
||||
$@
|
||||
8
certs/ocsp/ocspd-root-ca-and-intermediate-cas.sh
Executable file
8
certs/ocsp/ocspd-root-ca-and-intermediate-cas.sh
Executable 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 \
|
||||
$@
|
||||
@@ -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 \
|
||||
$@
|
||||
@@ -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 \
|
||||
$@
|
||||
@@ -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 \
|
||||
$@
|
||||
@@ -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 \
|
||||
$@
|
||||
487
configure.ac
487
configure.ac
File diff suppressed because it is too large
Load Diff
@@ -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
|
||||
|
||||
@@ -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 */
|
||||
|
||||
|
||||
|
||||
@@ -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 */
|
||||
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
125
mcapi/crypto.c
125
mcapi/crypto.c
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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 */
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
386
mcapi/user_settings.h
Normal 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 */
|
||||
@@ -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"/>
|
||||
|
||||
@@ -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"/>
|
||||
|
||||
@@ -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"/>
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
386
mplabx/user_settings.h
Normal 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 */
|
||||
@@ -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"/>
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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"/>
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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"/>
|
||||
|
||||
@@ -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/>
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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
|
||||
|
||||
39
scripts/ocsp-stapling-with-ca-as-responder.test
Executable file
39
scripts/ocsp-stapling-with-ca-as-responder.test
Executable 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
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
440
scripts/tls13.test
Executable 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
|
||||
|
||||
@@ -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
152
src/crl.c
@@ -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) {
|
||||
|
||||
@@ -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
|
||||
|
||||
4440
src/internal.c
4440
src/internal.c
File diff suppressed because it is too large
Load Diff
75
src/io.c
75
src/io.c
@@ -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
Reference in New Issue
Block a user