Compare commits
1358 Commits
v5.6.2-sta
...
v5.6.6-sta
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
66596ad9e1 | ||
|
|
dd55cdbea8 | ||
|
|
5046e577d3 | ||
|
|
a003338a88 | ||
|
|
4e081960d3 | ||
|
|
7eed28fbe0 | ||
|
|
3e483f32a4 | ||
|
|
ff9fee758e | ||
|
|
64e48deb0e | ||
|
|
ef14176b7f | ||
|
|
8f2a48c676 | ||
|
|
62b3ca5fb5 | ||
|
|
57355f357e | ||
|
|
7ebbb927f3 | ||
|
|
2ffc818c28 | ||
|
|
27c6ee4d05 | ||
|
|
fb6b022f42 | ||
|
|
f2e4360f8d | ||
|
|
1cf87ce0c9 | ||
|
|
f6ef58dbc2 | ||
|
|
64e4796ed6 | ||
|
|
16c6bd6846 | ||
|
|
1b76f6d56b | ||
|
|
659a245b27 | ||
|
|
3af91c265b | ||
|
|
c021e3e85d | ||
|
|
d0aa80eb37 | ||
|
|
a14a1bf467 | ||
|
|
f5d33cedeb | ||
|
|
255086b7c8 | ||
|
|
d36538c40a | ||
|
|
a1b44b6214 | ||
|
|
f209120218 | ||
|
|
f222adf4c2 | ||
|
|
a66137d2fe | ||
|
|
1d7fd42aa8 | ||
|
|
5fd0470f76 | ||
|
|
8acee813cb | ||
|
|
3d959b96c9 | ||
|
|
56c7e5c675 | ||
|
|
eeb024a30d | ||
|
|
269542ed96 | ||
|
|
b7b20ededd | ||
|
|
cbd5341332 | ||
|
|
d455196955 | ||
|
|
f12b61183b | ||
|
|
3b75a41006 | ||
|
|
ca5adfaecb | ||
|
|
db7f08e12f | ||
|
|
2724edc257 | ||
|
|
ce74a34154 | ||
|
|
6e953e4d53 | ||
|
|
3750ff5205 | ||
|
|
1cc45b57d7 | ||
|
|
493bb1760d | ||
|
|
573093ddf3 | ||
|
|
51ba745214 | ||
|
|
627310d26a | ||
|
|
21f53f37a1 | ||
|
|
1aed438a21 | ||
|
|
043dde18be | ||
|
|
00a1c68f97 | ||
|
|
c1b5135918 | ||
|
|
9c17d5d2fa | ||
|
|
f068bebb94 | ||
|
|
540012844b | ||
|
|
cb6676fa27 | ||
|
|
b5eb8995c9 | ||
|
|
4ce4dd7479 | ||
|
|
03a82711aa | ||
|
|
ac447d1afb | ||
|
|
f708d42ef7 | ||
|
|
38eddd7f89 | ||
|
|
8a5a467543 | ||
|
|
de4bd42de0 | ||
|
|
0c9555b29e | ||
|
|
0ba3646f32 | ||
|
|
1bf0d8c896 | ||
|
|
40015a06c4 | ||
|
|
62c0910e15 | ||
|
|
448b83697a | ||
|
|
ae9632b14a | ||
|
|
6c7b47e003 | ||
|
|
21381b939b | ||
|
|
17c663b257 | ||
|
|
434526c345 | ||
|
|
c4b77adf48 | ||
|
|
6c8bf7be55 | ||
|
|
61b0efce4f | ||
|
|
5e5286d30d | ||
|
|
27e93276de | ||
|
|
9fda21748a | ||
|
|
5caa71ec6a | ||
|
|
9d0bb4c2bf | ||
|
|
3c5b402740 | ||
|
|
fbe79d7317 | ||
|
|
803b17a8b3 | ||
|
|
106e39bd76 | ||
|
|
931ac4e568 | ||
|
|
b14aba48af | ||
|
|
c6d6100136 | ||
|
|
0ffb586030 | ||
|
|
226c631feb | ||
|
|
0ff02e59ba | ||
|
|
f3a9d4a56e | ||
|
|
db14914951 | ||
|
|
4bd78e5e31 | ||
|
|
7de5710a75 | ||
|
|
ca1eba0919 | ||
|
|
2c9208b0c6 | ||
|
|
cf8a6efaa5 | ||
|
|
689a82a622 | ||
|
|
7753e3db8a | ||
|
|
223d8c9a10 | ||
|
|
fb77319758 | ||
|
|
4c85a5a146 | ||
|
|
b92aa59bd8 | ||
|
|
ce2c256544 | ||
|
|
1857648d7d | ||
|
|
52658c51a9 | ||
|
|
ef536f541f | ||
|
|
195c14ccaf | ||
|
|
5297cc74b4 | ||
|
|
adcc21b538 | ||
|
|
3ad0e1ef72 | ||
|
|
c4ab1e6d47 | ||
|
|
fa0362fd2b | ||
|
|
44d52c599c | ||
|
|
883d1a25be | ||
|
|
822405a6d8 | ||
|
|
02f8735abf | ||
|
|
abab390dd4 | ||
|
|
a1e74d9974 | ||
|
|
8097ed74c3 | ||
|
|
cfa1b589c6 | ||
|
|
e6bd8dce6e | ||
|
|
9265142369 | ||
|
|
cbe8309b3b | ||
|
|
a7e5c6c721 | ||
|
|
cc65c3ec98 | ||
|
|
cb381a2336 | ||
|
|
52d6073c9c | ||
|
|
21f662c7d1 | ||
|
|
14ba944f6c | ||
|
|
44db4f3e5a | ||
|
|
8c1ab783a1 | ||
|
|
ad1f709455 | ||
|
|
e1ac56f2dd | ||
|
|
7ebad05446 | ||
|
|
6125e595bb | ||
|
|
11e5544032 | ||
|
|
e891c721b8 | ||
|
|
3edfcfe162 | ||
|
|
9337cfbb16 | ||
|
|
7c2344c389 | ||
|
|
fbd8996949 | ||
|
|
73ca6daf2b | ||
|
|
3158e04863 | ||
|
|
93ab397c56 | ||
|
|
a7dce98797 | ||
|
|
962bf88c9d | ||
|
|
c87339e5c3 | ||
|
|
4642077146 | ||
|
|
12ee732fe2 | ||
|
|
61a2d2de3d | ||
|
|
a111c5b27f | ||
|
|
373fc537f1 | ||
|
|
0ac27eb039 | ||
|
|
09d2ba8bc8 | ||
|
|
4b74a2f006 | ||
|
|
602bd3b506 | ||
|
|
36015e9131 | ||
|
|
9f06d337e3 | ||
|
|
8ac891d902 | ||
|
|
f65f8be176 | ||
|
|
008d4958bf | ||
|
|
09b6974ae9 | ||
|
|
d83a5a955c | ||
|
|
bc36202087 | ||
|
|
2e89e46c0b | ||
|
|
5b3f5496f8 | ||
|
|
98e8ee65dd | ||
|
|
967a0c9625 | ||
|
|
7036c8440b | ||
|
|
b242b44b2c | ||
|
|
14e8ffcc18 | ||
|
|
416ce54276 | ||
|
|
2da88115a6 | ||
|
|
e197d5f8a3 | ||
|
|
6c41a6a374 | ||
|
|
5b01270205 | ||
|
|
0306d07c47 | ||
|
|
e175410b00 | ||
|
|
7223b5a708 | ||
|
|
2f920b5cc4 | ||
|
|
9810a8cd86 | ||
|
|
72cbd9a44e | ||
|
|
9227020f8e | ||
|
|
dda72dc19c | ||
|
|
60909d5cba | ||
|
|
ebbeb6c69e | ||
|
|
7e69030df1 | ||
|
|
9ac3083e5d | ||
|
|
e97e1b5847 | ||
|
|
846b91ea1b | ||
|
|
665469f02a | ||
|
|
538ce14c62 | ||
|
|
14906df3ec | ||
|
|
ca61034d22 | ||
|
|
cbb270bc15 | ||
|
|
7566328610 | ||
|
|
3fa612f49f | ||
|
|
7dedfe08ef | ||
|
|
9ed0018954 | ||
|
|
98789dc000 | ||
|
|
06dcc114c1 | ||
|
|
64b98981de | ||
|
|
efa61ade89 | ||
|
|
a95a7c7e08 | ||
|
|
ca195445a3 | ||
|
|
07d6d75d72 | ||
|
|
347a17f7cf | ||
|
|
16dba37ae6 | ||
|
|
03f3e6c6af | ||
|
|
a10260ca5f | ||
|
|
d3448e2c1a | ||
|
|
e395aad84b | ||
|
|
957a0ce300 | ||
|
|
4c6c2942b1 | ||
|
|
6945093221 | ||
|
|
8e05b5a9ab | ||
|
|
8c61b2cc5f | ||
|
|
bb73c233fc | ||
|
|
3576db8976 | ||
|
|
9fa5d8872c | ||
|
|
263973bde9 | ||
|
|
ada085390b | ||
|
|
cd1e9e9974 | ||
|
|
2c7248492f | ||
|
|
ac89c90afd | ||
|
|
7bbeadcf97 | ||
|
|
7daac20d24 | ||
|
|
eaa66dc117 | ||
|
|
748b058dde | ||
|
|
26a9435f5c | ||
|
|
7569cfdff8 | ||
|
|
6a3451ca54 | ||
|
|
7e99ccc782 | ||
|
|
2213306386 | ||
|
|
8f7adb2c16 | ||
|
|
c4677927bc | ||
|
|
b464a277c1 | ||
|
|
1b55e20d5a | ||
|
|
7eaff41e61 | ||
|
|
7c24b2d4bd | ||
|
|
c903a8c4a6 | ||
|
|
a04eb81e95 | ||
|
|
12878fccae | ||
|
|
d34d77681a | ||
|
|
04ea4da6fd | ||
|
|
63c27219a8 | ||
|
|
b8d5ac83eb | ||
|
|
3ab0fc1ba4 | ||
|
|
a4bf774e1c | ||
|
|
e2bbacd548 | ||
|
|
49a219e0d1 | ||
|
|
73d3277b74 | ||
|
|
a666c39b65 | ||
|
|
081b34919c | ||
|
|
182eaa0b63 | ||
|
|
4d8bbd7091 | ||
|
|
9d880fe161 | ||
|
|
308346aa0d | ||
|
|
2b1c61a013 | ||
|
|
3332b036d5 | ||
|
|
04c1e94e29 | ||
|
|
68b6bc87c7 | ||
|
|
168747615c | ||
|
|
be24d68e5d | ||
|
|
138d699cc7 | ||
|
|
c0f3fe4434 | ||
|
|
2cde843093 | ||
|
|
1303c0512c | ||
|
|
46a5465c3f | ||
|
|
16ecc9b5f8 | ||
|
|
86a2b050fe | ||
|
|
a40de50be2 | ||
|
|
9006dd5edd | ||
|
|
2ea0c2cae8 | ||
|
|
a137847894 | ||
|
|
1562106899 | ||
|
|
76d89a0c15 | ||
|
|
f518a8f7d5 | ||
|
|
54f2d56300 | ||
|
|
8bc79a0b43 | ||
|
|
4bbb0e3876 | ||
|
|
716cb450aa | ||
|
|
1a3f3aa5f0 | ||
|
|
9cb6243357 | ||
|
|
ca694938fd | ||
|
|
0fa47e9e28 | ||
|
|
b6e5b36f35 | ||
|
|
ba37dc9933 | ||
|
|
a46b6221b4 | ||
|
|
d751029c07 | ||
|
|
8921a720a1 | ||
|
|
a6de9cd06f | ||
|
|
e58fafcf3d | ||
|
|
cefe108cab | ||
|
|
01c3345c7a | ||
|
|
8c3e1dbf48 | ||
|
|
c852347dfb | ||
|
|
c5e2f414ea | ||
|
|
8ac291bbe1 | ||
|
|
c92d25816a | ||
|
|
8569e76a87 | ||
|
|
190b51ae6f | ||
|
|
8c87920903 | ||
|
|
5b863dcb12 | ||
|
|
49121b5c47 | ||
|
|
8d9dc3d79f | ||
|
|
b8ea978066 | ||
|
|
cfb6560468 | ||
|
|
c8af4edd74 | ||
|
|
d6f37d48d6 | ||
|
|
49b9764c52 | ||
|
|
8fc754515a | ||
|
|
96977d1480 | ||
|
|
4870435604 | ||
|
|
2ee94023f9 | ||
|
|
0dde07e282 | ||
|
|
33e12e3537 | ||
|
|
9e34ed937e | ||
|
|
21f34ef028 | ||
|
|
9d632ccaa6 | ||
|
|
15fdf6eccc | ||
|
|
bb9031da6e | ||
|
|
c920337f2f | ||
|
|
026c4bcbc7 | ||
|
|
a3ea84d8e8 | ||
|
|
98843798c2 | ||
|
|
59e947d3e6 | ||
|
|
34f349e510 | ||
|
|
0eab70f806 | ||
|
|
2e37ff4e45 | ||
|
|
7435d235a6 | ||
|
|
2ac0d47908 | ||
|
|
aed715cb2c | ||
|
|
0455224439 | ||
|
|
cdef51f537 | ||
|
|
37884f864d | ||
|
|
6cf75a7d42 | ||
|
|
2c91ecb466 | ||
|
|
07c8c5c8ca | ||
|
|
cc45b31470 | ||
|
|
c3ed45d331 | ||
|
|
688b94cad2 | ||
|
|
7d5491994e | ||
|
|
29782449ec | ||
|
|
247bc151d9 | ||
|
|
0ba406a52c | ||
|
|
a2032dfb36 | ||
|
|
33c4054cbb | ||
|
|
ef50cb3f02 | ||
|
|
271fa83a15 | ||
|
|
8760ad9473 | ||
|
|
7b20a5597c | ||
|
|
c11176c276 | ||
|
|
42c241dbbf | ||
|
|
8add411d9a | ||
|
|
2877b7be50 | ||
|
|
21d465cf9a | ||
|
|
f8f080d7de | ||
|
|
16b842992d | ||
|
|
449fb9c581 | ||
|
|
1dd6888288 | ||
|
|
6b0e28f840 | ||
|
|
a17d6ef751 | ||
|
|
85fab2b4f7 | ||
|
|
5277065c3c | ||
|
|
45ba778692 | ||
|
|
7821c48e65 | ||
|
|
fc858ec33b | ||
|
|
89d445a5a5 | ||
|
|
60f75ea5a8 | ||
|
|
6538ed1c39 | ||
|
|
b46545315c | ||
|
|
d801dc1c85 | ||
|
|
6d8136c63e | ||
|
|
d87cd2cc05 | ||
|
|
5da7efacc9 | ||
|
|
a74228b5b0 | ||
|
|
dc5a246fdd | ||
|
|
8f60fb0053 | ||
|
|
4aad7589d6 | ||
|
|
13cadbbe55 | ||
|
|
1de048826e | ||
|
|
3c5d3c0fa9 | ||
|
|
1a113c5429 | ||
|
|
8eaf09d7a0 | ||
|
|
9fe071fe73 | ||
|
|
501299bc31 | ||
|
|
cf1dcdf402 | ||
|
|
6887281361 | ||
|
|
9db828a099 | ||
|
|
5018d6c2bb | ||
|
|
ca2a6d7daa | ||
|
|
2387579880 | ||
|
|
dd12e5a39e | ||
|
|
0925f8ab18 | ||
|
|
ec0a2f2683 | ||
|
|
8cd6cd175d | ||
|
|
fcf1406675 | ||
|
|
c88dcac80e | ||
|
|
ce1e44d5e8 | ||
|
|
4ac795961b | ||
|
|
1abaa94120 | ||
|
|
22be42a161 | ||
|
|
d13d446c2e | ||
|
|
2ccbdd3a7e | ||
|
|
cecc5f6b19 | ||
|
|
8a8acbd55f | ||
|
|
2dd8e713f2 | ||
|
|
962e35aa24 | ||
|
|
abd7bb3ac3 | ||
|
|
1ae248018f | ||
|
|
a3bf7a66a4 | ||
|
|
22ab21749c | ||
|
|
f99c7cbb21 | ||
|
|
269090353e | ||
|
|
b4724b515d | ||
|
|
d805e06469 | ||
|
|
1e84d24c20 | ||
|
|
3943852b79 | ||
|
|
bc0643803d | ||
|
|
19870b2378 | ||
|
|
f59b22d3a0 | ||
|
|
4f1b3fff73 | ||
|
|
a1d76849e6 | ||
|
|
dc7e044157 | ||
|
|
e976a7faeb | ||
|
|
f0db681550 | ||
|
|
a810514f86 | ||
|
|
76b770d4ee | ||
|
|
286d551ad0 | ||
|
|
603b5bb573 | ||
|
|
5bc2edd5ad | ||
|
|
b73a440205 | ||
|
|
92382602dd | ||
|
|
53d80c0b7f | ||
|
|
f5d1cb5132 | ||
|
|
f1725b4962 | ||
|
|
b7b0316ac9 | ||
|
|
0244c2a254 | ||
|
|
ae3fdbec47 | ||
|
|
74b63b6409 | ||
|
|
8be0e14bd2 | ||
|
|
bab01ca313 | ||
|
|
99d46d9a6d | ||
|
|
3c23f39437 | ||
|
|
ed001829df | ||
|
|
3e9f8bc649 | ||
|
|
d35112064b | ||
|
|
46b1a030a7 | ||
|
|
c23559a91c | ||
|
|
7afd9810de | ||
|
|
87cffc8229 | ||
|
|
79a6e1eb04 | ||
|
|
8cd89884ce | ||
|
|
f247e6b6f0 | ||
|
|
95137f91fa | ||
|
|
dd1459ec8e | ||
|
|
4001734421 | ||
|
|
5f20f1171d | ||
|
|
962c315447 | ||
|
|
26cc785fbc | ||
|
|
0cc21a42f3 | ||
|
|
38df4e2bd5 | ||
|
|
26ab3b109a | ||
|
|
883fcfc11e | ||
|
|
0d53796284 | ||
|
|
20cab7afe3 | ||
|
|
c05aea7c5a | ||
|
|
3cebf35b1b | ||
|
|
0549dba3db | ||
|
|
3a195563f7 | ||
|
|
60fea5ee5c | ||
|
|
f332995131 | ||
|
|
66f4101569 | ||
|
|
0e35e9cbbe | ||
|
|
653e5b01b1 | ||
|
|
e7eec645b0 | ||
|
|
f0bfcc50d7 | ||
|
|
5e4baf898c | ||
|
|
7f562f8259 | ||
|
|
a4f9ae90d0 | ||
|
|
f8604da8e3 | ||
|
|
a27b49882d | ||
|
|
ca73a311cf | ||
|
|
5372cd5026 | ||
|
|
210fff5569 | ||
|
|
53f14206d1 | ||
|
|
cb912219e4 | ||
|
|
365fae8ac0 | ||
|
|
f32c6a0d25 | ||
|
|
d83f2fa126 | ||
|
|
64ed7d57eb | ||
|
|
275c0a0838 | ||
|
|
8ac72750bc | ||
|
|
948d7ae761 | ||
|
|
c1a49fef99 | ||
|
|
bec87e525f | ||
|
|
3a881079d3 | ||
|
|
2c6c52078a | ||
|
|
37c0d52fa8 | ||
|
|
c802193119 | ||
|
|
0dbf97c867 | ||
|
|
230f81712c | ||
|
|
f640fdf91f | ||
|
|
ada785e115 | ||
|
|
8da863184c | ||
|
|
df8ee69075 | ||
|
|
85a596e54a | ||
|
|
61371d403a | ||
|
|
832e0f3726 | ||
|
|
8d5df6fec2 | ||
|
|
c082216661 | ||
|
|
5cb80ea898 | ||
|
|
b329c0d5f4 | ||
|
|
52a9730f56 | ||
|
|
fd2d098566 | ||
|
|
fafb9e81c0 | ||
|
|
a7950a3739 | ||
|
|
a24d66939f | ||
|
|
862a98abe0 | ||
|
|
5fdc3d8dd5 | ||
|
|
97b6b00226 | ||
|
|
e51399ca0f | ||
|
|
5a5a8c9b47 | ||
|
|
c26ad8d19a | ||
|
|
22b838c22b | ||
|
|
a494d04f10 | ||
|
|
4bb6c51d2d | ||
|
|
2c4556c797 | ||
|
|
1b4435d134 | ||
|
|
a333e775c7 | ||
|
|
6968105984 | ||
|
|
858c66de3c | ||
|
|
89946126f2 | ||
|
|
80c8c62fb2 | ||
|
|
33d4b331fb | ||
|
|
9abc611550 | ||
|
|
6b28a68e42 | ||
|
|
c88fec1534 | ||
|
|
8ce8359bd7 | ||
|
|
630d75153f | ||
|
|
96205fc80d | ||
|
|
4d81725438 | ||
|
|
94043723c9 | ||
|
|
45b613ee55 | ||
|
|
71649388a0 | ||
|
|
f4acc8f33d | ||
|
|
f9fb966bb4 | ||
|
|
88d25036a0 | ||
|
|
7baf151c37 | ||
|
|
e55e6790dd | ||
|
|
5066771f10 | ||
|
|
1a3bf5e932 | ||
|
|
47f0d5a5d0 | ||
|
|
ecf666a121 | ||
|
|
c70b3f297e | ||
|
|
3e7f4c5f2d | ||
|
|
369db531d2 | ||
|
|
7c1cc5e8f9 | ||
|
|
8a57936d7e | ||
|
|
53f729f959 | ||
|
|
e092c57675 | ||
|
|
aedebac649 | ||
|
|
3ea0fb30dd | ||
|
|
005346d9ec | ||
|
|
93358f1402 | ||
|
|
5e1bd8174c | ||
|
|
2ef83e142f | ||
|
|
0571040e36 | ||
|
|
9fdb3cf17a | ||
|
|
b88754bb64 | ||
|
|
5e3f00f6f7 | ||
|
|
0f4f677ea4 | ||
|
|
20f992af5e | ||
|
|
d95ce57eea | ||
|
|
79a6cbc860 | ||
|
|
a97e13f823 | ||
|
|
9acba6ee2d | ||
|
|
b22c2971e3 | ||
|
|
60f30e994d | ||
|
|
f042863ddf | ||
|
|
4ece466fca | ||
|
|
237d10ab1e | ||
|
|
83117ae33f | ||
|
|
df6a65e151 | ||
|
|
f9082c54e3 | ||
|
|
717249c0cc | ||
|
|
f0d0a87822 | ||
|
|
1141f9bee9 | ||
|
|
470e839b26 | ||
|
|
f7d7006e87 | ||
|
|
a9548b2f11 | ||
|
|
2fafa722c2 | ||
|
|
d5b6aa318c | ||
|
|
9442ec4b06 | ||
|
|
4b1c29ce0c | ||
|
|
88254d3709 | ||
|
|
347394cc6b | ||
|
|
16e6a8c150 | ||
|
|
bc02006def | ||
|
|
f71423d626 | ||
|
|
f7ca923b4b | ||
|
|
9ed19cddfa | ||
|
|
e91b6230a8 | ||
|
|
0983ea9a80 | ||
|
|
8f9c3716ed | ||
|
|
5bc5b8a99b | ||
|
|
1cda8430fd | ||
|
|
b72d02dd88 | ||
|
|
5830f921fa | ||
|
|
de3c9f19ef | ||
|
|
da39f66ff0 | ||
|
|
186d3c2eb4 | ||
|
|
ad9779cdc1 | ||
|
|
763de1a685 | ||
|
|
eca28ea2f6 | ||
|
|
ba74c83f73 | ||
|
|
9398fa0736 | ||
|
|
2af5ae89a2 | ||
|
|
c12bf79e56 | ||
|
|
9472dd39e4 | ||
|
|
af6386732c | ||
|
|
911c4519ef | ||
|
|
3bb0643cdd | ||
|
|
1149522357 | ||
|
|
164fc8c5cb | ||
|
|
1d7c6c94fe | ||
|
|
623549ce90 | ||
|
|
ea8bc82f85 | ||
|
|
c0edb7b583 | ||
|
|
7735ea0ff3 | ||
|
|
1f2ddb7554 | ||
|
|
5654691f05 | ||
|
|
139fd5d208 | ||
|
|
ca56b79209 | ||
|
|
5e97b9fde8 | ||
|
|
e9f1489997 | ||
|
|
8e40130003 | ||
|
|
7d85e390a9 | ||
|
|
6b6c9f9ae0 | ||
|
|
6bf716bd26 | ||
|
|
f23e2a62e6 | ||
|
|
6a25cdeb28 | ||
|
|
3ae23ec926 | ||
|
|
3697219244 | ||
|
|
ba03677569 | ||
|
|
624cb5e2bb | ||
|
|
f5b96e7bde | ||
|
|
3d332a4fad | ||
|
|
2f63eb070e | ||
|
|
f32f220919 | ||
|
|
ff233ce3af | ||
|
|
114c8cc681 | ||
|
|
825db397d7 | ||
|
|
40c5048e38 | ||
|
|
eda3cd6a37 | ||
|
|
1c9afb8b12 | ||
|
|
6c8eaf26f5 | ||
|
|
6e87fc7f90 | ||
|
|
971df19c5c | ||
|
|
14017bd67e | ||
|
|
86755dc7e4 | ||
|
|
e4b211bee9 | ||
|
|
63e167e974 | ||
|
|
937aa3415f | ||
|
|
1f7ccc4eff | ||
|
|
61f48eb5a1 | ||
|
|
b99b1d4cfd | ||
|
|
d25f4f06bf | ||
|
|
c7f5043774 | ||
|
|
42985ebdfa | ||
|
|
6cb1aef836 | ||
|
|
07e2f90fbb | ||
|
|
b34348680a | ||
|
|
f5ef7b40db | ||
|
|
57e870e0d4 | ||
|
|
63477bcfdb | ||
|
|
d532833af9 | ||
|
|
d0c2609ebb | ||
|
|
0bb9b85cd4 | ||
|
|
23ebace6b1 | ||
|
|
f9c2a86456 | ||
|
|
f9e5e4d08a | ||
|
|
f8f66191e3 | ||
|
|
90467aa578 | ||
|
|
00a08374df | ||
|
|
0e1706c3c7 | ||
|
|
0fb514fa41 | ||
|
|
7ca6c129e5 | ||
|
|
bba9add3a5 | ||
|
|
fddda8f582 | ||
|
|
fc4e4f1238 | ||
|
|
ec7ecba0fe | ||
|
|
e74b3ecdad | ||
|
|
6e9c73eb12 | ||
|
|
6665f240e0 | ||
|
|
755c39b5fc | ||
|
|
344e1661e1 | ||
|
|
51cb80b865 | ||
|
|
5540449315 | ||
|
|
f0743a70b4 | ||
|
|
fb91f1c1fd | ||
|
|
d866144fb1 | ||
|
|
db858fd052 | ||
|
|
298b488bf1 | ||
|
|
0352b384a5 | ||
|
|
cd02d5140f | ||
|
|
a2e2a3e994 | ||
|
|
196f154c51 | ||
|
|
cf32bc362b | ||
|
|
b36c312ef3 | ||
|
|
136cb98412 | ||
|
|
efd08eadb8 | ||
|
|
dc2905ce80 | ||
|
|
ffd6c2b859 | ||
|
|
3dec8279a0 | ||
|
|
a99139574a | ||
|
|
03088b2946 | ||
|
|
927930c86e | ||
|
|
b546473495 | ||
|
|
e748e1be32 | ||
|
|
2aefdfe9d5 | ||
|
|
7262a30074 | ||
|
|
944db2c2e5 | ||
|
|
4e86523624 | ||
|
|
0638ec234b | ||
|
|
41d6afcfa1 | ||
|
|
1ada2e6a43 | ||
|
|
bbf105f8dc | ||
|
|
8662312ecf | ||
|
|
d7bb5aa367 | ||
|
|
70c362f680 | ||
|
|
c47600c52c | ||
|
|
a0fef66c3b | ||
|
|
357c9a68f2 | ||
|
|
6e3c3577f5 | ||
|
|
d8fe8b9140 | ||
|
|
e303f8709c | ||
|
|
b13294623b | ||
|
|
2380086209 | ||
|
|
3a5e171636 | ||
|
|
354b28eea0 | ||
|
|
4058dbec7c | ||
|
|
c5c968aae3 | ||
|
|
872551a5fc | ||
|
|
9bea33b598 | ||
|
|
b02fe0853f | ||
|
|
57ce894393 | ||
|
|
abfcda8750 | ||
|
|
e85901c8e5 | ||
|
|
321f74869a | ||
|
|
5b5e66b55f | ||
|
|
7a6e851a82 | ||
|
|
2a5ed11f34 | ||
|
|
b20c6c54d1 | ||
|
|
14deb7afda | ||
|
|
d7f8cc55d8 | ||
|
|
27bc7219e5 | ||
|
|
0484f3e0f7 | ||
|
|
e48b7ef3d7 | ||
|
|
8803510375 | ||
|
|
c9e9e0fc72 | ||
|
|
2f2dddde25 | ||
|
|
c98ce0d18c | ||
|
|
a6257ca635 | ||
|
|
f1027464e8 | ||
|
|
15918d8ee6 | ||
|
|
5f44a73f8e | ||
|
|
6b09b5c0cf | ||
|
|
88ad5ce6b0 | ||
|
|
82c5170659 | ||
|
|
8ce71cc19c | ||
|
|
06d81f7f8f | ||
|
|
b44d31df02 | ||
|
|
b771b6ebf5 | ||
|
|
36b92a4cef | ||
|
|
a99954c0b0 | ||
|
|
9ca1738b7a | ||
|
|
5624b6e9d2 | ||
|
|
058dfca809 | ||
|
|
3cc473b1ec | ||
|
|
9427bea275 | ||
|
|
7b29362d90 | ||
|
|
32a07a7f5a | ||
|
|
24cf794342 | ||
|
|
7a12202675 | ||
|
|
1608cb8b45 | ||
|
|
827287000c | ||
|
|
3033371abc | ||
|
|
fd9c78d93f | ||
|
|
66c53b0996 | ||
|
|
2ee6a01d91 | ||
|
|
205cdb1809 | ||
|
|
c4f91cdc8d | ||
|
|
d54aa0dabd | ||
|
|
d321ae2fd5 | ||
|
|
c1821e9ed2 | ||
|
|
79d831c712 | ||
|
|
88c32a510e | ||
|
|
e487b73809 | ||
|
|
5339fe0d9f | ||
|
|
307ce9d623 | ||
|
|
bf438c85e1 | ||
|
|
174f0b2ebc | ||
|
|
928dd70213 | ||
|
|
9cc8cdcc30 | ||
|
|
7669f966f3 | ||
|
|
dbd5d713e7 | ||
|
|
9a007604e4 | ||
|
|
65217cbc70 | ||
|
|
bea1b6f89b | ||
|
|
3df434930e | ||
|
|
883d4dc219 | ||
|
|
033b0785e3 | ||
|
|
b9dbd86fab | ||
|
|
62bb434aa6 | ||
|
|
dfc4850e75 | ||
|
|
e0b90a0463 | ||
|
|
8772d8b868 | ||
|
|
bad00ea9f7 | ||
|
|
f089b2c2f6 | ||
|
|
fea48e2505 | ||
|
|
49dc3a473b | ||
|
|
a24f99fbf6 | ||
|
|
bc7c8af5de | ||
|
|
b32ff0b0b8 | ||
|
|
975047bd22 | ||
|
|
3e93c5e253 | ||
|
|
6724a3d005 | ||
|
|
87695adc82 | ||
|
|
98c50e05a3 | ||
|
|
0fd96be7f8 | ||
|
|
b156e83990 | ||
|
|
d4ba2e50d4 | ||
|
|
c917eee70e | ||
|
|
cc4e327316 | ||
|
|
ba4842aded | ||
|
|
d7b2626433 | ||
|
|
7023f86e66 | ||
|
|
a78694e5bf | ||
|
|
afd0d07d9a | ||
|
|
ac90fa8d60 | ||
|
|
ec818e5dbd | ||
|
|
c3ebfd133b | ||
|
|
0d8f68ef03 | ||
|
|
437c2020bd | ||
|
|
45bcb65dc0 | ||
|
|
a71114b4cb | ||
|
|
f1b4387eca | ||
|
|
9bb6c1b70e | ||
|
|
24f60cc435 | ||
|
|
bbcd91b59a | ||
|
|
b3a1badecf | ||
|
|
300c183453 | ||
|
|
5002ef19b1 | ||
|
|
47caa9b06d | ||
|
|
d3d131d08d | ||
|
|
bd14be8553 | ||
|
|
4167a51fe9 | ||
|
|
8bb8f64373 | ||
|
|
46229bb167 | ||
|
|
568bf35555 | ||
|
|
a4152ab341 | ||
|
|
61761143e7 | ||
|
|
c29227dcbb | ||
|
|
507ec9f7d2 | ||
|
|
3a5739a8fa | ||
|
|
6b1513a769 | ||
|
|
66c529e610 | ||
|
|
65401cfd35 | ||
|
|
26fcdbf348 | ||
|
|
c3fea8c930 | ||
|
|
e96837aa34 | ||
|
|
1b393199f4 | ||
|
|
779b87f03a | ||
|
|
5255b02fbb | ||
|
|
1bb0199a2b | ||
|
|
6ea1e7d824 | ||
|
|
12685d7713 | ||
|
|
35f4a1a09d | ||
|
|
737e12a1bd | ||
|
|
b86d2a3bff | ||
|
|
bc4c0df315 | ||
|
|
9b81b0b505 | ||
|
|
d747df2ae4 | ||
|
|
7ba00f3b84 | ||
|
|
6fcdead112 | ||
|
|
27feb9b9e9 | ||
|
|
9f577dc4d4 | ||
|
|
e9e5d70aad | ||
|
|
c7b6fa2931 | ||
|
|
5daabe0801 | ||
|
|
39f632d096 | ||
|
|
5b16586483 | ||
|
|
0dbc7d0b13 | ||
|
|
958113c070 | ||
|
|
9f6d48891a | ||
|
|
a957f0e2c3 | ||
|
|
75f81db084 | ||
|
|
69eeedbac3 | ||
|
|
33e31ed41c | ||
|
|
e51ca7941f | ||
|
|
0654ed3549 | ||
|
|
f3af4542e7 | ||
|
|
c9b72d7b61 | ||
|
|
65b515aec8 | ||
|
|
30fda7ad38 | ||
|
|
cec438a4e4 | ||
|
|
aa69b2fd62 | ||
|
|
90a6a14878 | ||
|
|
e04033ae3d | ||
|
|
decee67138 | ||
|
|
67d6d438c5 | ||
|
|
ae90a9b2c0 | ||
|
|
4e07ebf279 | ||
|
|
83de744dcf | ||
|
|
7f0cfcb27d | ||
|
|
e7ae80493b | ||
|
|
71f9162b99 | ||
|
|
a60810cebe | ||
|
|
0c39b8074e | ||
|
|
1da000b244 | ||
|
|
a6c850d7f9 | ||
|
|
54ab1b1113 | ||
|
|
8a9a363621 | ||
|
|
907a0201e7 | ||
|
|
5a94dc961d | ||
|
|
158402ab03 | ||
|
|
f35173b1a6 | ||
|
|
b31e485dc9 | ||
|
|
f5164d325b | ||
|
|
de0048e5b2 | ||
|
|
05b692d01c | ||
|
|
dee32247b9 | ||
|
|
bfe7bc0fcc | ||
|
|
fbc6ed4fe4 | ||
|
|
a885a94b21 | ||
|
|
6f4fabaac9 | ||
|
|
724fe53379 | ||
|
|
2a6956a954 | ||
|
|
8794e3f2f6 | ||
|
|
0e74213692 | ||
|
|
a0668bd9ab | ||
|
|
25f542adb4 | ||
|
|
d250eb8327 | ||
|
|
27a59761b9 | ||
|
|
6e33fe3b51 | ||
|
|
44b634a597 | ||
|
|
9eb339f9fd | ||
|
|
70e1ab7f0c | ||
|
|
1468d77e50 | ||
|
|
278f395542 | ||
|
|
6893123edf | ||
|
|
ab953c3141 | ||
|
|
2b2509c56c | ||
|
|
66f04f8db5 | ||
|
|
b6a11b8b01 | ||
|
|
c76b0a0237 | ||
|
|
4b80dcf733 | ||
|
|
854ae0dcdb | ||
|
|
106a065a41 | ||
|
|
a495bb4e7f | ||
|
|
1b10fb5ca7 | ||
|
|
52f91e4ab9 | ||
|
|
5043ecefc1 | ||
|
|
a785c39a12 | ||
|
|
6d9c85a762 | ||
|
|
3e63589664 | ||
|
|
10adca1a45 | ||
|
|
f89892a3cd | ||
|
|
c529b2f3aa | ||
|
|
d0abfd7686 | ||
|
|
ee9ecd9591 | ||
|
|
136738fd33 | ||
|
|
daa54f3d31 | ||
|
|
b16e7fd87b | ||
|
|
9cd7e59e6a | ||
|
|
3510ea4fec | ||
|
|
67913b5800 | ||
|
|
02ec92a3b9 | ||
|
|
7c11c0f201 | ||
|
|
8d77090ad9 | ||
|
|
3e5e16f1ff | ||
|
|
48434f7814 | ||
|
|
4a175ba280 | ||
|
|
5947c9ae8c | ||
|
|
5cf42244f0 | ||
|
|
681a75da24 | ||
|
|
d87bb14ac0 | ||
|
|
31dfdf8360 | ||
|
|
cfac603ee1 | ||
|
|
746802be89 | ||
|
|
9cade8c9a4 | ||
|
|
cebb4da307 | ||
|
|
c0b4cde6df | ||
|
|
a9c9662124 | ||
|
|
4ff99a6780 | ||
|
|
1285ae7816 | ||
|
|
1812d32258 | ||
|
|
a19a0537ee | ||
|
|
d3aa11bf87 | ||
|
|
ab560aa6b8 | ||
|
|
8ec2e23773 | ||
|
|
72d99d0ae0 | ||
|
|
56fc5bbf87 | ||
|
|
d3202600a4 | ||
|
|
318c95a2c2 | ||
|
|
2acc4a6dd5 | ||
|
|
c2a3f5316d | ||
|
|
c09138cd3f | ||
|
|
2e4b651b87 | ||
|
|
acac3fe479 | ||
|
|
0cd5a293ca | ||
|
|
4821859bbc | ||
|
|
4bb907522b | ||
|
|
1daaabf38a | ||
|
|
f9cb9560c4 | ||
|
|
477e65e07a | ||
|
|
452f6a8898 | ||
|
|
9b2345dc8e | ||
|
|
9bc6fc64de | ||
|
|
ec49e6b44d | ||
|
|
ec4527c789 | ||
|
|
b7b4be8822 | ||
|
|
16058ce168 | ||
|
|
acd819caa1 | ||
|
|
dceb7c0122 | ||
|
|
8065ba18f9 | ||
|
|
fd13d376a8 | ||
|
|
9ea681030f | ||
|
|
e12f1f44b4 | ||
|
|
7ee38350c0 | ||
|
|
80bc547853 | ||
|
|
58318f9528 | ||
|
|
9f2dd21a91 | ||
|
|
425cd2c6dc | ||
|
|
67d35ea48e | ||
|
|
b74a7f8e87 | ||
|
|
56a34b0be2 | ||
|
|
58ac57861f | ||
|
|
da9541551d | ||
|
|
d1db78adb2 | ||
|
|
31aac92635 | ||
|
|
37be7a4800 | ||
|
|
c55c1dd0e4 | ||
|
|
00b90adc97 | ||
|
|
df58c4dea7 | ||
|
|
a026d843cf | ||
|
|
71b28caa09 | ||
|
|
517138806a | ||
|
|
1fe8944363 | ||
|
|
ff38d8f018 | ||
|
|
1afc0df83d | ||
|
|
933dae393e | ||
|
|
f49ffc0353 | ||
|
|
707c1a44bc | ||
|
|
5d24d5114a | ||
|
|
3b773db728 | ||
|
|
a747e7773c | ||
|
|
20115f0e23 | ||
|
|
31a02f194e | ||
|
|
7361332c87 | ||
|
|
e2833f99a3 | ||
|
|
f6f8d2eda3 | ||
|
|
a96983e6d3 | ||
|
|
40d0a14c09 | ||
|
|
0d9252de9e | ||
|
|
698bf7b423 | ||
|
|
377417e668 | ||
|
|
4862b57415 | ||
|
|
4fd5d154a4 | ||
|
|
9bed65ad57 | ||
|
|
b02a22b5b3 | ||
|
|
44faddac6c | ||
|
|
e3e0b4505c | ||
|
|
00add89deb | ||
|
|
4ccd6dfbe1 | ||
|
|
761a976d0c | ||
|
|
4bf642283c | ||
|
|
11d26797d2 | ||
|
|
9379a8a094 | ||
|
|
8cd06c64b2 | ||
|
|
c8209068c2 | ||
|
|
90b32d7857 | ||
|
|
45d8a5b04c | ||
|
|
8c012b5df5 | ||
|
|
cf15789c7f | ||
|
|
b889b27b8c | ||
|
|
2c9609039d | ||
|
|
62c14e4d5b | ||
|
|
a8ed78e012 | ||
|
|
ea7ea356a0 | ||
|
|
d20a096ffa | ||
|
|
648f474d83 | ||
|
|
8e89e31f70 | ||
|
|
b8119af455 | ||
|
|
b18bc86ef8 | ||
|
|
96f745af6f | ||
|
|
d6a6cbb83e | ||
|
|
fd72b885b6 | ||
|
|
4c125ece77 | ||
|
|
6fa080642c | ||
|
|
f30364a00d | ||
|
|
e140a83fad | ||
|
|
5fbe319ce9 | ||
|
|
1329543b62 | ||
|
|
bcbeef7647 | ||
|
|
0b18e250ed | ||
|
|
36c1d20bb2 | ||
|
|
3e9bdb7671 | ||
|
|
8f36f78e6c | ||
|
|
fd091a745c | ||
|
|
ba4c96f727 | ||
|
|
ecc138fc6e | ||
|
|
d7c3a176e2 | ||
|
|
9f61cb9f2a | ||
|
|
29edef1645 | ||
|
|
d84adce608 | ||
|
|
f26b8bdf62 | ||
|
|
ce02ad7347 | ||
|
|
a317ac280c | ||
|
|
27a95e7e82 | ||
|
|
2299282fdd | ||
|
|
e4c9a73296 | ||
|
|
d64d73a13f | ||
|
|
8906ee95fd | ||
|
|
2d0cc65381 | ||
|
|
56328d845a | ||
|
|
3bfa189286 | ||
|
|
e871b1c04d | ||
|
|
9d18648dfb | ||
|
|
0a02218ba3 | ||
|
|
7c14ea67ae | ||
|
|
299b4d8552 | ||
|
|
2426cf14ca | ||
|
|
0efdf966d0 | ||
|
|
86fd570e8c | ||
|
|
d0b8b919df | ||
|
|
9f6ef65e8f | ||
|
|
fa053be533 | ||
|
|
360b61aff2 | ||
|
|
52a3d591b5 | ||
|
|
9d3a95a287 | ||
|
|
0e2749eeb4 | ||
|
|
7866a40d06 | ||
|
|
f0354b4cbe | ||
|
|
57546405c0 | ||
|
|
770590a3be | ||
|
|
3af87f6f93 | ||
|
|
f2809c5a24 | ||
|
|
55bbd5865c | ||
|
|
c4cbf0508b | ||
|
|
7213cb3cfb | ||
|
|
91fb24161b | ||
|
|
9599ddd80a | ||
|
|
abe1bce914 | ||
|
|
0abaa89787 | ||
|
|
52b5adb54a | ||
|
|
4d25faafe2 | ||
|
|
f3bae3192a | ||
|
|
af5b3b551a | ||
|
|
2248140bf3 | ||
|
|
57e53d1a43 | ||
|
|
fb9e036d5b | ||
|
|
657679efda | ||
|
|
e995568626 | ||
|
|
4f9b5de802 | ||
|
|
8421b384fb | ||
|
|
ef9206f73f | ||
|
|
266307da6c | ||
|
|
2cf916581d | ||
|
|
c041863aaa | ||
|
|
d2642e329d | ||
|
|
9ca53ac7f7 | ||
|
|
fb0c769d6c | ||
|
|
e8f3afc85b | ||
|
|
caa0e5aabf | ||
|
|
67bef21185 | ||
|
|
794425c431 | ||
|
|
0b4e4287c9 | ||
|
|
1912f1bc2a | ||
|
|
7a73c9aac7 | ||
|
|
652c5491fe | ||
|
|
b0c2e29a2e | ||
|
|
856b5c3f1b | ||
|
|
f00b5c3a1e | ||
|
|
b682c2c4bb | ||
|
|
7af1f0cf05 | ||
|
|
f58539581d | ||
|
|
2feec88702 | ||
|
|
713670dcc7 | ||
|
|
3d2db844c1 | ||
|
|
50752f5a2b | ||
|
|
e2424e6744 | ||
|
|
6028dfd394 | ||
|
|
a921ab754d | ||
|
|
573fedae2f | ||
|
|
ad2621a7a0 | ||
|
|
f72a6b705f | ||
|
|
214f9f55c4 | ||
|
|
678a65822f | ||
|
|
732ef09da6 | ||
|
|
3d68bcd6f7 | ||
|
|
ca77da92e5 | ||
|
|
bff2cf5690 | ||
|
|
8ab0050801 | ||
|
|
a39a04fc88 | ||
|
|
5be883a995 | ||
|
|
da4424cd0c | ||
|
|
e2a1bc6e6a | ||
|
|
a4c058649b | ||
|
|
877979c5c2 | ||
|
|
052fba887c | ||
|
|
e1cb74f24a | ||
|
|
5ba579397d | ||
|
|
c2726b4cbe | ||
|
|
81484ef74b | ||
|
|
6052e01879 | ||
|
|
79a7d21932 | ||
|
|
53c30f44a0 | ||
|
|
95675c7e34 | ||
|
|
9fc68f4a80 | ||
|
|
1c33cefff7 | ||
|
|
a1939d22b9 | ||
|
|
7720dac545 | ||
|
|
ed4774f606 | ||
|
|
048083cfe3 | ||
|
|
d029ba4d46 | ||
|
|
c45f7c87b0 | ||
|
|
7251d564eb | ||
|
|
47350fa95c | ||
|
|
ee63d73299 | ||
|
|
1d83448df7 | ||
|
|
48de458017 | ||
|
|
2a539fe028 | ||
|
|
fdc95f9ba6 | ||
|
|
90f5665318 | ||
|
|
dcfa410540 | ||
|
|
e0651e4eb3 | ||
|
|
8e3afbd6e3 | ||
|
|
78107b0f88 | ||
|
|
c72d008a5c | ||
|
|
fbadcf67da | ||
|
|
d9d9c5cd3d | ||
|
|
6b26b071e4 | ||
|
|
0d0d2cf50c | ||
|
|
b1fe15dc70 | ||
|
|
e0fa25eedc | ||
|
|
8867f484e5 | ||
|
|
91962a1a78 | ||
|
|
41d248461b | ||
|
|
51ca7bb8e3 | ||
|
|
9a4237ee88 | ||
|
|
145ca4ae9d | ||
|
|
500b66eb36 | ||
|
|
26e6fd9a6f | ||
|
|
cb0e2c8b0f | ||
|
|
03e5d109c7 | ||
|
|
481ae20fcb | ||
|
|
fd17fa3e9c | ||
|
|
291c538e5f | ||
|
|
23c60b7b9c | ||
|
|
578f56e60c | ||
|
|
17bc833bd3 | ||
|
|
51ffe9691f | ||
|
|
6b240fa41a | ||
|
|
b7332e33c7 | ||
|
|
18032cdc40 | ||
|
|
514ea2d0b1 | ||
|
|
af0facad9f | ||
|
|
48dc288b83 | ||
|
|
cde4e8e13d | ||
|
|
fc153ff273 | ||
|
|
83dca07421 | ||
|
|
00719182d5 | ||
|
|
6185d66b01 | ||
|
|
033f56bfe9 | ||
|
|
102cb1114a | ||
|
|
ea68920b8b | ||
|
|
06c1dd171a | ||
|
|
2d87037e4b | ||
|
|
746ac3c9a3 | ||
|
|
6f2831a252 | ||
|
|
255aa774f2 | ||
|
|
a56fe30c2c | ||
|
|
2f44ece4d8 | ||
|
|
33808c75f2 | ||
|
|
20d706aad8 | ||
|
|
3e821c6f2b | ||
|
|
2be3bb4c56 | ||
|
|
c933f780ca | ||
|
|
155ce9aecf | ||
|
|
0ee198437a | ||
|
|
f58ae30b50 | ||
|
|
e1f2c0bb2e | ||
|
|
3cb0b4ab29 | ||
|
|
6697181081 | ||
|
|
fb35526b73 | ||
|
|
e6017dc546 | ||
|
|
75c8d87353 | ||
|
|
e467112a93 | ||
|
|
53fe93430e | ||
|
|
8473275fc6 | ||
|
|
2d28b492b0 | ||
|
|
9f24217e26 | ||
|
|
1bff338e37 | ||
|
|
9204101e94 | ||
|
|
aaf2408851 | ||
|
|
0e2c32f726 | ||
|
|
70c3e84735 | ||
|
|
3b3c175af0 | ||
|
|
c322e1f7f8 | ||
|
|
d967aae501 | ||
|
|
42e934b251 | ||
|
|
4741a0b696 | ||
|
|
78b78428e7 | ||
|
|
e17f86d145 | ||
|
|
beef8b0014 | ||
|
|
a1e8aa7269 | ||
|
|
970663f8a1 | ||
|
|
7926ceb120 | ||
|
|
7153dd70a6 | ||
|
|
5b81dc47d2 | ||
|
|
8f29111aac | ||
|
|
902d47aaa1 | ||
|
|
0a860c793f | ||
|
|
9e0c13bbdb | ||
|
|
bb5e09c394 | ||
|
|
e843a7bd1e | ||
|
|
131b7c2bcf | ||
|
|
76cf3d61a0 | ||
|
|
20df12e5f7 | ||
|
|
82cc988226 | ||
|
|
cdb3d6df40 | ||
|
|
0db49ef83a | ||
|
|
72536e0e10 | ||
|
|
fe7502a50e | ||
|
|
58c1c0c31b | ||
|
|
03a6eed037 | ||
|
|
47036d0166 | ||
|
|
88c3d9a529 | ||
|
|
c2e03689c0 | ||
|
|
c2c97c2b57 |
10
.editorconfig
Normal file
10
.editorconfig
Normal file
@@ -0,0 +1,10 @@
|
||||
# http://editorconfig.org
|
||||
root = true
|
||||
|
||||
[*]
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
end_of_line = lf
|
||||
charset = utf-8
|
||||
trim_trailing_whitespace = true
|
||||
insert_final_newline = true
|
||||
7
.github/workflows/async.yml
vendored
7
.github/workflows/async.yml
vendored
@@ -10,17 +10,20 @@ jobs:
|
||||
config: [
|
||||
# Add new configs here
|
||||
'--enable-asynccrypt --enable-all --enable-dtls13',
|
||||
'--enable-asynccrypt-sw',
|
||||
'--enable-asynccrypt-sw --enable-ocspstapling --enable-ocspstapling2',
|
||||
'--enable-ocsp CFLAGS="-DTEST_NONBLOCK_CERTS"',
|
||||
]
|
||||
name: make check
|
||||
runs-on: ubuntu-latest
|
||||
# This should be a safe limit for the tests to run.
|
||||
timeout-minutes: 6
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
name: Checkout wolfSSL
|
||||
|
||||
- name: Test wolfSSL async
|
||||
run: |
|
||||
./async-check.sh setup
|
||||
./async-check.sh install
|
||||
./configure ${{ matrix.config }}
|
||||
make check
|
||||
|
||||
|
||||
61
.github/workflows/curl.yml
vendored
Normal file
61
.github/workflows/curl.yml
vendored
Normal file
@@ -0,0 +1,61 @@
|
||||
name: curl Test
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
|
||||
jobs:
|
||||
build_wolfssl:
|
||||
name: Build wolfSSL
|
||||
runs-on: ubuntu-latest
|
||||
# This should be a safe limit for the tests to run.
|
||||
timeout-minutes: 4
|
||||
steps:
|
||||
- name: Build wolfSSL
|
||||
uses: wolfSSL/actions-build-autotools-project@v1
|
||||
with:
|
||||
path: wolfssl
|
||||
configure: --enable-curl
|
||||
install: true
|
||||
|
||||
- name: Upload built lib
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: wolf-install-curl
|
||||
path: build-dir
|
||||
retention-days: 1
|
||||
|
||||
test_curl:
|
||||
name: ${{ matrix.curl_ref }}
|
||||
runs-on: ubuntu-latest
|
||||
# This should be a safe limit for the tests to run.
|
||||
timeout-minutes: 15
|
||||
needs: build_wolfssl
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
curl_ref: [ 'master', 'curl-8_4_0' ]
|
||||
steps:
|
||||
- name: Install test dependencies
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install nghttp2
|
||||
sudo pip install impacket
|
||||
|
||||
- name: Download lib
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: wolf-install-curl
|
||||
path: build-dir
|
||||
|
||||
- name: Build curl
|
||||
uses: wolfSSL/actions-build-autotools-project@v1
|
||||
with:
|
||||
repository: curl/curl
|
||||
path: curl
|
||||
ref: ${{ matrix.curl_ref }}
|
||||
configure: --with-wolfssl=$GITHUB_WORKSPACE/build-dir
|
||||
check: false
|
||||
|
||||
- name: Test curl
|
||||
working-directory: curl
|
||||
run: make -j test-ci
|
||||
2
.github/workflows/docker-Espressif.yml
vendored
2
.github/workflows/docker-Espressif.yml
vendored
@@ -6,6 +6,8 @@ jobs:
|
||||
espressif_latest:
|
||||
name: latest Docker container
|
||||
runs-on: ubuntu-latest
|
||||
# This should be a safe limit for the tests to run.
|
||||
timeout-minutes: 12
|
||||
container:
|
||||
image: espressif/idf:latest
|
||||
steps:
|
||||
|
||||
4
.github/workflows/docker-OpenWrt.yml
vendored
4
.github/workflows/docker-OpenWrt.yml
vendored
@@ -9,6 +9,8 @@ jobs:
|
||||
build_library:
|
||||
name: Compile libwolfssl.so
|
||||
runs-on: ubuntu-latest
|
||||
# This should be a safe limit for the tests to run.
|
||||
timeout-minutes: 4
|
||||
container:
|
||||
image: alpine:latest
|
||||
steps:
|
||||
@@ -26,6 +28,8 @@ jobs:
|
||||
compile_container:
|
||||
name: Compile container
|
||||
runs-on: ubuntu-latest
|
||||
# This should be a safe limit for the tests to run.
|
||||
timeout-minutes: 2
|
||||
needs: build_library
|
||||
strategy:
|
||||
fail-fast: false
|
||||
|
||||
94
.github/workflows/hitch.yml
vendored
Normal file
94
.github/workflows/hitch.yml
vendored
Normal file
@@ -0,0 +1,94 @@
|
||||
name: hitch Tests
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
|
||||
jobs:
|
||||
build_wolfssl:
|
||||
name: Build wolfSSL
|
||||
# Just to keep it the same as the testing target
|
||||
runs-on: ubuntu-latest
|
||||
# This should be a safe limit for the tests to run.
|
||||
timeout-minutes: 4
|
||||
steps:
|
||||
- name: Build wolfSSL
|
||||
uses: wolfSSL/actions-build-autotools-project@v1
|
||||
with:
|
||||
path: wolfssl
|
||||
configure: --enable-hitch
|
||||
install: true
|
||||
|
||||
- name: Upload built lib
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: wolf-install-hitch
|
||||
path: build-dir
|
||||
retention-days: 1
|
||||
|
||||
hitch_check:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
# List of releases to test
|
||||
include:
|
||||
- ref: 1.7.3
|
||||
ignore-tests: >-
|
||||
test13-r82.sh test15-proxy-v2-npn.sh test39-client-cert-proxy.sh
|
||||
name: ${{ matrix.ref }}
|
||||
runs-on: ubuntu-latest
|
||||
# This should be a safe limit for the tests to run.
|
||||
timeout-minutes: 4
|
||||
needs: build_wolfssl
|
||||
steps:
|
||||
- name: Download lib
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: wolf-install-hitch
|
||||
path: build-dir
|
||||
|
||||
- name: Checkout OSP
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
repository: wolfssl/osp
|
||||
path: osp
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y libev-dev libssl-dev automake python3-docutils flex bison pkg-config make
|
||||
|
||||
- name: Checkout hitch
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
repository: varnish/hitch
|
||||
ref: 1.7.3
|
||||
path: hitch
|
||||
|
||||
# Do this before configuring so that it only detects the updated list of
|
||||
# tests
|
||||
- if: ${{ matrix.ignore-tests }}
|
||||
name: Remove tests that we want to ignore
|
||||
working-directory: ./hitch/src/tests
|
||||
run: |
|
||||
rm ${{ matrix.ignore-tests }}
|
||||
|
||||
- name: Configure and build hitch
|
||||
run: |
|
||||
cd $GITHUB_WORKSPACE/hitch/
|
||||
patch -p1 < $GITHUB_WORKSPACE/osp/hitch/hitch_1.7.3.patch
|
||||
autoreconf -ivf
|
||||
SSL_CFLAGS="-I$GITHUB_WORKSPACE/build-dir/include/ -I$GITHUB_WORKSPACE/build-dir/include/wolfssl" SSL_LIBS="-L$GITHUB_WORKSPACE/build-dir/lib -lwolfssl" ./configure --with-wolfssl=$GITHUB_WORKSPACE/build-dir/ --enable-silent-rules --enable-documentation --enable-warnings --with-lex --with-yacc --prefix=$GITHUB_WORKSPACE/build-dir
|
||||
make -j$(nproc)
|
||||
|
||||
- name: Confirm hitch built with wolfSSL
|
||||
working-directory: ./hitch
|
||||
run: |
|
||||
export LD_LIBRARY_PATH=$GITHUB_WORKSPACE/build-dir/lib:$LD_LIBRARY_PATH
|
||||
ldd src/hitch | grep wolfssl
|
||||
|
||||
- name: Run hitch tests, skipping ignored tests
|
||||
working-directory: ./hitch
|
||||
run: |
|
||||
export LD_LIBRARY_PATH=$GITHUB_WORKSPACE/build-dir/lib:$LD_LIBRARY_PATH
|
||||
make check
|
||||
6
.github/workflows/hostap.yml
vendored
6
.github/workflows/hostap.yml
vendored
@@ -15,6 +15,8 @@ jobs:
|
||||
name: Build wolfSSL
|
||||
# Just to keep it the same as the testing target
|
||||
runs-on: ubuntu-20.04
|
||||
# This should be a safe limit for the tests to run.
|
||||
timeout-minutes: 4
|
||||
steps:
|
||||
# No way to view the full strategy in the browser (really weird)
|
||||
- name: Print strategy
|
||||
@@ -90,6 +92,8 @@ jobs:
|
||||
name: hwsim test
|
||||
# For openssl 1.1
|
||||
runs-on: ubuntu-20.04
|
||||
# This should be a safe limit for the tests to run.
|
||||
timeout-minutes: 12
|
||||
needs: build_wolfssl
|
||||
steps:
|
||||
# No way to view the full strategy in the browser (really weird)
|
||||
@@ -246,7 +250,7 @@ jobs:
|
||||
TESTS=$(printf '%s\n' "${ary[@]}" | tr '\n' ' ')
|
||||
# Retry up to three times
|
||||
for i in {1..3}; do
|
||||
HWSIM_RES=0
|
||||
HWSIM_RES=0 # Not set when command succeeds
|
||||
# Logs can grow quickly especially in debug mode
|
||||
sudo rm -rf logs
|
||||
sudo ./start.sh
|
||||
|
||||
79
.github/workflows/krb5.yml
vendored
Normal file
79
.github/workflows/krb5.yml
vendored
Normal file
@@ -0,0 +1,79 @@
|
||||
name: Kerberos 5 Tests
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
|
||||
jobs:
|
||||
build_wolfssl:
|
||||
name: Build wolfSSL
|
||||
# Just to keep it the same as the testing target
|
||||
runs-on: ubuntu-latest
|
||||
# This should be a safe limit for the tests to run.
|
||||
timeout-minutes: 5
|
||||
steps:
|
||||
- name: Build wolfSSL
|
||||
uses: wolfSSL/actions-build-autotools-project@v1
|
||||
with:
|
||||
path: wolfssl
|
||||
configure: --enable-krb CFLAGS='-fsanitize=address'
|
||||
install: true
|
||||
|
||||
- name: Upload built lib
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: wolf-install-krb5
|
||||
path: build-dir
|
||||
retention-days: 1
|
||||
|
||||
krb5_check:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
# List of releases to test
|
||||
ref: [ 1.21.1 ]
|
||||
name: ${{ matrix.ref }}
|
||||
runs-on: ubuntu-latest
|
||||
# This should be a safe limit for the tests to run.
|
||||
timeout-minutes: 8
|
||||
needs: build_wolfssl
|
||||
steps:
|
||||
- name: Download lib
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: wolf-install-krb5
|
||||
path: build-dir
|
||||
|
||||
- name: Checkout OSP
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
repository: wolfssl/osp
|
||||
path: osp
|
||||
|
||||
- name: Checkout krb5
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
repository: krb5/krb5
|
||||
ref: krb5-${{ matrix.ref }}-final
|
||||
path: krb5
|
||||
|
||||
- name: Apply patch
|
||||
working-directory: ./krb5
|
||||
run: |
|
||||
patch -p1 < $GITHUB_WORKSPACE/osp/krb5/Patch-for-Kerberos-5-${{ matrix.ref }}.patch
|
||||
|
||||
- name: Build krb5
|
||||
working-directory: ./krb5/src
|
||||
run: |
|
||||
autoreconf -ivf
|
||||
# Using rpath because LD_LIBRARY_PATH is overwritten during testing
|
||||
export WOLFSSL_CFLAGS="-I$GITHUB_WORKSPACE/build-dir/include -I$GITHUB_WORKSPACE/build-dir/include/wolfssl -Wl,-rpath=$GITHUB_WORKSPACE/build-dir/lib"
|
||||
export WOLFSSL_LIBS="-lwolfssl -L$GITHUB_WORKSPACE/build-dir/lib -Wl,-rpath=$GITHUB_WORKSPACE/build-dir/lib"
|
||||
./configure --with-crypto-impl=wolfssl --with-tls-impl=wolfssl --disable-pkinit \
|
||||
CFLAGS='-fsanitize=address' LDFLAGS='-fsanitize=address'
|
||||
CFLAGS='-fsanitize=address' LDFLAGS='-fsanitize=address' make -j
|
||||
|
||||
- name: Run tests
|
||||
working-directory: ./krb5/src
|
||||
run: |
|
||||
CFLAGS='-fsanitize=address' LDFLAGS='-fsanitize=address' make -j check
|
||||
|
||||
16
.github/workflows/main.yml
vendored
16
.github/workflows/main.yml
vendored
@@ -14,6 +14,8 @@ jobs:
|
||||
uses: ./.github/workflows/docker-Espressif.yml
|
||||
multi-compiler:
|
||||
uses: ./.github/workflows/multi-compiler.yml
|
||||
multi-arch:
|
||||
uses: ./.github/workflows/multi-arch.yml
|
||||
openwrt:
|
||||
uses: ./.github/workflows/docker-OpenWrt.yml
|
||||
os-check:
|
||||
@@ -26,6 +28,20 @@ jobs:
|
||||
uses: ./.github/workflows/openvpn.yml
|
||||
hostap:
|
||||
uses: ./.github/workflows/hostap.yml
|
||||
nginx:
|
||||
uses: ./.github/workflows/nginx.yml
|
||||
zephyr:
|
||||
uses: ./.github/workflows/zephyr.yml
|
||||
hitch:
|
||||
uses: ./.github/workflows/hitch.yml
|
||||
curl:
|
||||
uses: ./.github/workflows/curl.yml
|
||||
krb5:
|
||||
uses: ./.github/workflows/krb5.yml
|
||||
packaging:
|
||||
uses: ./.github/workflows/packaging.yml
|
||||
memcached:
|
||||
uses: ./.github/workflows/memcached.yml
|
||||
# TODO: Currently this test fails. Enable it once it becomes passing.
|
||||
# haproxy:
|
||||
# uses: ./.github/workflows/haproxy.yml
|
||||
|
||||
14
.github/workflows/memcached.sh
vendored
Executable file
14
.github/workflows/memcached.sh
vendored
Executable file
@@ -0,0 +1,14 @@
|
||||
#!/bin/sh
|
||||
|
||||
if [ -z "$GITHUB_WORKSPACE" ]; then
|
||||
echo '$GITHUB_WORKSPACE is not set'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -z "$HOST_ROOT" ]; then
|
||||
echo '$HOST_ROOT is not set'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
chroot $HOST_ROOT make -C $GITHUB_WORKSPACE/memcached \
|
||||
-j$(nproc) PARALLEL=$(nproc) test_tls
|
||||
107
.github/workflows/memcached.yml
vendored
Normal file
107
.github/workflows/memcached.yml
vendored
Normal file
@@ -0,0 +1,107 @@
|
||||
name: memcached Tests
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
|
||||
jobs:
|
||||
build_wolfssl:
|
||||
name: Build wolfSSL
|
||||
# Just to keep it the same as the testing target
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Build wolfSSL
|
||||
uses: wolfSSL/actions-build-autotools-project@v1
|
||||
with:
|
||||
path: wolfssl
|
||||
configure: --enable-memcached
|
||||
install: true
|
||||
|
||||
- name: Bundle Docker entry point
|
||||
run: cp wolfssl/.github/workflows/memcached.sh build-dir/bin
|
||||
|
||||
- name: Upload built lib
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: wolf-install-memcached
|
||||
path: build-dir
|
||||
retention-days: 1
|
||||
|
||||
memcached_check:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
# List of releases to test
|
||||
include:
|
||||
- ref: 1.6.22
|
||||
name: ${{ matrix.ref }}
|
||||
runs-on: ubuntu-latest
|
||||
needs: build_wolfssl
|
||||
steps:
|
||||
- name: Download lib
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: wolf-install-memcached
|
||||
path: build-dir
|
||||
|
||||
- name: Checkout OSP
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
repository: wolfssl/osp
|
||||
path: osp
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y libevent-dev libevent-2.1-7 automake pkg-config make libio-socket-ssl-perl
|
||||
|
||||
- name: Checkout memcached
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
repository: memcached/memcached
|
||||
ref: 1.6.22
|
||||
path: memcached
|
||||
|
||||
- name: Configure and build memcached
|
||||
run: |
|
||||
cd $GITHUB_WORKSPACE/memcached/
|
||||
patch -p1 < $GITHUB_WORKSPACE/osp/memcached/memcached_1.6.22.patch
|
||||
./autogen.sh
|
||||
export LD_LIBRARY_PATH=$GITHUB_WORKSPACE/build-dir/lib:$LD_LIBRARY_PATH
|
||||
PKG_CONFIG_PATH=$GITHUB_WORKSPACE/build-dir/lib/pkgconfig ./configure --enable-wolfssl
|
||||
make -j$(nproc)
|
||||
|
||||
- name: Confirm memcached built with wolfSSL
|
||||
working-directory: ./memcached
|
||||
run: |
|
||||
export LD_LIBRARY_PATH=$GITHUB_WORKSPACE/build-dir/lib:$LD_LIBRARY_PATH
|
||||
ldd memcached | grep wolfssl
|
||||
|
||||
- name: Run memcached tests
|
||||
working-directory: ./memcached
|
||||
run: |
|
||||
# Retry up to three times
|
||||
# Using docker because interrupting the tests doesn't close running
|
||||
# background servers. They can become daemonized and then all re-runs
|
||||
# will always fail.
|
||||
chmod +x $GITHUB_WORKSPACE/build-dir/bin/memcached.sh
|
||||
for i in {1..3}; do
|
||||
echo "-------- RUNNING TESTS --------"
|
||||
MEMCACHED_RES=0 # Not set when command succeeds
|
||||
# Tests should usually take less than 4 minutes. If already taking
|
||||
# 5 minutes then they are probably stuck. Interrupt and re-run.
|
||||
time timeout -s SIGKILL 5m docker run -v /:/host \
|
||||
-v $GITHUB_WORKSPACE/build-dir/bin/memcached.sh:/memcached.sh \
|
||||
-e GITHUB_WORKSPACE=$GITHUB_WORKSPACE \
|
||||
-e HOST_ROOT=/host \
|
||||
-e LD_LIBRARY_PATH=$GITHUB_WORKSPACE/build-dir/lib:$LD_LIBRARY_PATH \
|
||||
alpine:latest /memcached.sh || MEMCACHED_RES=$?
|
||||
|
||||
if [ "$MEMCACHED_RES" -eq "0" ]; then
|
||||
break
|
||||
fi
|
||||
done
|
||||
echo "test ran $i times"
|
||||
if [ "$MEMCACHED_RES" -ne "0" ]; then
|
||||
exit $MEMCACHED_RES
|
||||
fi
|
||||
54
.github/workflows/multi-arch.yml
vendored
Normal file
54
.github/workflows/multi-arch.yml
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
name: Multiple architectures
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
|
||||
jobs:
|
||||
my_matrix:
|
||||
name: Multi-arch test
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- HOST: aarch64-linux-gnu
|
||||
CC: aarch64-linux-gnu-gcc
|
||||
ARCH: arm64
|
||||
EXTRA_OPTS: --enable-sp-asm --enable-armasm
|
||||
- HOST: arm-linux-gnueabihf
|
||||
CC: arm-linux-gnueabihf-gcc
|
||||
ARCH: armhf
|
||||
EXTRA_OPTS: --enable-sp-asm
|
||||
- HOST: riscv64-linux-gnu
|
||||
CC: riscv64-linux-gnu-gcc
|
||||
ARCH: riscv64
|
||||
# Config to ensure CPUs without Thumb instructions compiles
|
||||
- HOST: arm-linux-gnueabi
|
||||
CC: arm-linux-gnueabi-gcc
|
||||
CFLAGS: -marm -DWOLFSSL_SP_ARM_ARCH=6
|
||||
ARCH: armel
|
||||
EXTRA_OPTS: --enable-sp-asm
|
||||
runs-on: ubuntu-latest
|
||||
# This should be a safe limit for the tests to run.
|
||||
timeout-minutes: 10
|
||||
steps:
|
||||
- name: Install Compiler
|
||||
run: |
|
||||
sudo apt update
|
||||
sudo apt install -y crossbuild-essential-${{ matrix.ARCH }} qemu-user
|
||||
- uses: actions/checkout@v3
|
||||
- name: Build
|
||||
env:
|
||||
CC: ${{ matrix.CC }}
|
||||
CFLAGS: ${{ matrix.CFLAGS }}
|
||||
QEMU_LD_PREFIX: /usr/${{ matrix.HOST }}
|
||||
run: ./autogen.sh && ./configure --host=${{ matrix.HOST }} --enable-all --disable-examples ${{ matrix.EXTRA_OPTS }} && make
|
||||
- name: Print errors
|
||||
if: ${{ failure() }}
|
||||
run: |
|
||||
if [ -f config.log ] ; then
|
||||
cat config.log
|
||||
fi
|
||||
- name: Run WolfCrypt Tests
|
||||
env:
|
||||
QEMU_LD_PREFIX: /usr/${{ matrix.HOST }}
|
||||
run: ./wolfcrypt/test/testwolfcrypt
|
||||
21
.github/workflows/multi-compiler.yml
vendored
21
.github/workflows/multi-compiler.yml
vendored
@@ -12,19 +12,34 @@ jobs:
|
||||
include:
|
||||
- CC: gcc-9
|
||||
CXX: g++-9
|
||||
OS: ubuntu-latest
|
||||
- CC: gcc-10
|
||||
CXX: g++-10
|
||||
OS: ubuntu-latest
|
||||
- CC: gcc-11
|
||||
CXX: g++-11
|
||||
OS: ubuntu-latest
|
||||
- CC: gcc-12
|
||||
CXX: g++-12
|
||||
OS: ubuntu-latest
|
||||
- CC: clang-10
|
||||
CXX: clang++-10
|
||||
OS: ubuntu-20.04
|
||||
- CC: clang-11
|
||||
CXX: clang++-11
|
||||
OS: ubuntu-20.04
|
||||
- CC: clang-12
|
||||
CXX: clang++-12
|
||||
OS: ubuntu-20.04
|
||||
- CC: clang-13
|
||||
CXX: clang++-13
|
||||
OS: ubuntu-latest
|
||||
- CC: clang-14
|
||||
CXX: clang++-14
|
||||
runs-on: ubuntu-latest
|
||||
OS: ubuntu-latest
|
||||
runs-on: ${{ matrix.OS }}
|
||||
# This should be a safe limit for the tests to run.
|
||||
timeout-minutes: 4
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Build
|
||||
@@ -32,3 +47,7 @@ jobs:
|
||||
CC: ${{ matrix.CC }}
|
||||
CXX: ${{ matrix.CXX }}
|
||||
run: ./autogen.sh && ./configure && make && make dist
|
||||
- name: Show log on errors
|
||||
if: ${{ failure() }}
|
||||
run: |
|
||||
cat config.log
|
||||
|
||||
206
.github/workflows/nginx.yml
vendored
Normal file
206
.github/workflows/nginx.yml
vendored
Normal file
@@ -0,0 +1,206 @@
|
||||
name: nginx Tests
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
|
||||
jobs:
|
||||
build_wolfssl:
|
||||
name: Build wolfSSL
|
||||
# Just to keep it the same as the testing target
|
||||
runs-on: ubuntu-latest
|
||||
# This should be a safe limit for the tests to run.
|
||||
timeout-minutes: 4
|
||||
steps:
|
||||
- if: ${{ runner.debug }}
|
||||
name: Enable wolfSSL debug logging
|
||||
run: |
|
||||
# We don't use --enable-debug since it makes the logs too loud
|
||||
echo "wolf_debug_flags= CFLAGS='-g3 -O0'" >> $GITHUB_ENV
|
||||
|
||||
- name: Build wolfSSL
|
||||
uses: wolfSSL/actions-build-autotools-project@v1
|
||||
with:
|
||||
path: wolfssl
|
||||
configure: --enable-nginx ${{ env.wolf_debug_flags }}
|
||||
install: true
|
||||
|
||||
- name: Upload built lib
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: wolf-install-nginx
|
||||
path: build-dir
|
||||
retention-days: 1
|
||||
|
||||
nginx_check:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
# in general we want to pass all tests that match *ssl*
|
||||
- ref: 1.25.0
|
||||
test-ref: 5b2894ea1afd01a26c589ce11f310df118e42592
|
||||
# Following tests pass with sanitizer on
|
||||
sanitize-ok: >-
|
||||
h2_ssl_proxy_cache.t h2_ssl.t h2_ssl_variables.t h2_ssl_verify_client.t
|
||||
mail_imap_ssl.t mail_ssl_conf_command.t mail_ssl_session_reuse.t
|
||||
mail_ssl.t proxy_ssl_certificate_empty.t proxy_ssl_certificate.t
|
||||
proxy_ssl_certificate_vars.t proxy_ssl_conf_command.t proxy_ssl_name.t
|
||||
ssl_certificate_chain.t ssl_certificate_perl.t ssl_certificates.t
|
||||
ssl_certificate.t ssl_client_escaped_cert.t ssl_conf_command.t
|
||||
ssl_crl.t ssl_curve.t ssl_engine_keys.t ssl_ocsp.t ssl_password_file.t
|
||||
ssl_proxy_protocol.t ssl_proxy_upgrade.t ssl_reject_handshake.t
|
||||
ssl_session_reuse.t ssl_session_ticket_key.t ssl_sni_reneg.t
|
||||
ssl_sni_sessions.t ssl_sni.t ssl_stapling.t ssl.t ssl_verify_client.t
|
||||
ssl_verify_depth.t stream_proxy_ssl_certificate.t stream_proxy_ssl_certificate_vars.t
|
||||
stream_proxy_ssl_conf_command.t stream_proxy_ssl_name_complex.t
|
||||
stream_proxy_ssl_name.t stream_ssl_certificate.t stream_ssl_conf_command.t
|
||||
stream_ssl_preread_alpn.t stream_ssl_preread_protocol.t stream_ssl_preread.t
|
||||
stream_ssl_realip.t stream_ssl_session_reuse.t stream_ssl.t stream_ssl_variables.t
|
||||
stream_ssl_verify_client.t stream_upstream_zone_ssl.t upstream_zone_ssl.t
|
||||
uwsgi_ssl_certificate.t uwsgi_ssl_certificate_vars.t uwsgi_ssl.t
|
||||
uwsgi_ssl_verify.t
|
||||
# Following tests do not pass with sanitizer on (with OpenSSL too)
|
||||
sanitize-not-ok: >-
|
||||
grpc_ssl.t h2_proxy_request_buffering_ssl.t h2_proxy_ssl.t
|
||||
proxy_request_buffering_ssl.t proxy_ssl_keepalive.t proxy_ssl.t
|
||||
proxy_ssl_verify.t stream_proxy_protocol_ssl.t stream_proxy_ssl.t
|
||||
stream_proxy_ssl_verify.t stream_ssl_alpn.t
|
||||
- ref: 1.24.0
|
||||
test-ref: 212d9d003886e3a24542855fb60355a417f037de
|
||||
# Following tests pass with sanitizer on
|
||||
sanitize-ok: >-
|
||||
h2_ssl_proxy_cache.t h2_ssl.t h2_ssl_variables.t h2_ssl_verify_client.t
|
||||
mail_imap_ssl.t mail_ssl_conf_command.t mail_ssl_session_reuse.t mail_ssl.t
|
||||
proxy_ssl_certificate_empty.t proxy_ssl_certificate.t proxy_ssl_certificate_vars.t
|
||||
proxy_ssl_name.t ssl_certificate_chain.t ssl_certificate_perl.t ssl_certificates.t
|
||||
ssl_certificate.t ssl_client_escaped_cert.t ssl_conf_command.t ssl_crl.t
|
||||
ssl_engine_keys.t ssl_ocsp.t ssl_password_file.t ssl_proxy_protocol.t
|
||||
ssl_proxy_upgrade.t ssl_reject_handshake.t ssl_session_reuse.t
|
||||
ssl_session_ticket_key.t ssl_sni_reneg.t ssl_sni_sessions.t ssl_sni.t
|
||||
ssl_stapling.t ssl.t ssl_verify_client.t stream_proxy_ssl_certificate.t
|
||||
stream_proxy_ssl_certificate_vars.t stream_proxy_ssl_name_complex.t
|
||||
stream_proxy_ssl_name.t stream_ssl_alpn.t stream_ssl_certificate.t
|
||||
stream_ssl_conf_command.t stream_ssl_preread_alpn.t stream_ssl_preread_protocol.t
|
||||
stream_ssl_preread.t stream_ssl_realip.t stream_ssl_session_reuse.t stream_ssl.t
|
||||
stream_ssl_variables.t stream_ssl_verify_client.t stream_upstream_zone_ssl.t
|
||||
upstream_zone_ssl.t uwsgi_ssl_certificate.t uwsgi_ssl_certificate_vars.t
|
||||
uwsgi_ssl.t uwsgi_ssl_verify.t
|
||||
# Following tests do not pass with sanitizer on (with OpenSSL too)
|
||||
sanitize-not-ok: >-
|
||||
grpc_ssl.t h2_proxy_request_buffering_ssl.t h2_proxy_ssl.t
|
||||
proxy_request_buffering_ssl.t proxy_ssl_conf_command.t proxy_ssl_keepalive.t
|
||||
proxy_ssl.t proxy_ssl_verify.t ssl_curve.t ssl_verify_depth.t
|
||||
stream_proxy_protocol_ssl.t stream_proxy_ssl_conf_command.t stream_proxy_ssl.t
|
||||
stream_proxy_ssl_verify.t
|
||||
name: ${{ matrix.ref }}
|
||||
runs-on: ubuntu-latest
|
||||
# This should be a safe limit for the tests to run.
|
||||
timeout-minutes: 6
|
||||
needs: build_wolfssl
|
||||
steps:
|
||||
- name: Download lib
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: wolf-install-nginx
|
||||
path: build-dir
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
sudo cpan -iT Proc::Find Net::SSLeay IO::Socket::SSL
|
||||
|
||||
- name: Checkout wolfssl-nginx
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
repository: wolfssl/wolfssl-nginx
|
||||
path: wolfssl-nginx
|
||||
|
||||
- name: Checkout nginx
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
repository: nginx/nginx
|
||||
path: nginx
|
||||
ref: release-${{ matrix.ref }}
|
||||
|
||||
- name: Apply nginx patch
|
||||
working-directory: nginx
|
||||
run: patch -p1 < ../wolfssl-nginx/nginx-${{ matrix.ref }}-wolfssl.patch
|
||||
|
||||
- if: ${{ runner.debug }}
|
||||
name: Apply nginx debug patch
|
||||
working-directory: nginx
|
||||
run: patch -p1 < ../wolfssl-nginx/nginx-${{ matrix.ref }}-wolfssl-debug.patch
|
||||
|
||||
- name: Checkout nginx-tests
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
repository: nginx/nginx-tests
|
||||
path: nginx-tests
|
||||
ref: ${{ matrix.test-ref }}
|
||||
|
||||
- name: Apply nginx-tests patch
|
||||
working-directory: nginx-tests
|
||||
run: patch -p1 < ../wolfssl-nginx/nginx-tests-patches/*${{ matrix.test-ref }}.patch
|
||||
|
||||
- name: Build nginx without sanitizer
|
||||
working-directory: nginx
|
||||
run: |
|
||||
./auto/configure --with-wolfssl=$GITHUB_WORKSPACE/build-dir --with-http_ssl_module \
|
||||
--with-stream --with-stream_ssl_module --with-stream_ssl_preread_module \
|
||||
--with-http_v2_module --with-mail --with-mail_ssl_module
|
||||
make -j
|
||||
|
||||
- name: Confirm nginx built with wolfSSL
|
||||
working-directory: nginx
|
||||
run: ldd objs/nginx | grep wolfssl
|
||||
|
||||
- if: ${{ runner.debug }}
|
||||
name: Run nginx-tests without sanitizer (debug)
|
||||
working-directory: nginx-tests
|
||||
run: |
|
||||
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$GITHUB_WORKSPACE/build-dir/lib \
|
||||
TMPDIR=$GITHUB_WORKSPACE TEST_NGINX_VERBOSE=y TEST_NGINX_CATLOG=y \
|
||||
TEST_NGINX_BINARY=../nginx/objs/nginx prove -v ${{ matrix.sanitize-not-ok }}
|
||||
|
||||
- if: ${{ !runner.debug }}
|
||||
name: Run nginx-tests without sanitizer
|
||||
working-directory: nginx-tests
|
||||
run: |
|
||||
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$GITHUB_WORKSPACE/build-dir/lib \
|
||||
TMPDIR=$GITHUB_WORKSPACE TEST_NGINX_BINARY=../nginx/objs/nginx \
|
||||
prove ${{ matrix.sanitize-not-ok }}
|
||||
|
||||
- if: ${{ runner.debug }}
|
||||
name: Enable wolfSSL debug logging
|
||||
run: |
|
||||
echo "nginx_c_flags=-O0" >> $GITHUB_ENV
|
||||
|
||||
- name: Build nginx with sanitizer
|
||||
working-directory: nginx
|
||||
run: |
|
||||
./auto/configure --with-wolfssl=$GITHUB_WORKSPACE/build-dir --with-http_ssl_module \
|
||||
--with-stream --with-stream_ssl_module --with-stream_ssl_preread_module \
|
||||
--with-http_v2_module --with-mail --with-mail_ssl_module \
|
||||
--with-cc-opt='-fsanitize=address -DNGX_DEBUG_PALLOC=1 -g3 ${{ env.nginx_c_flags }}' \
|
||||
--with-ld-opt='-fsanitize=address ${{ env.nginx_c_flags }}'
|
||||
make -j
|
||||
|
||||
- name: Confirm nginx built with wolfSSL
|
||||
working-directory: nginx
|
||||
run: ldd objs/nginx | grep wolfssl
|
||||
|
||||
- if: ${{ runner.debug }}
|
||||
name: Run nginx-tests with sanitizer (debug)
|
||||
working-directory: nginx-tests
|
||||
run: |
|
||||
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$GITHUB_WORKSPACE/build-dir/lib \
|
||||
TMPDIR=$GITHUB_WORKSPACE TEST_NGINX_VERBOSE=y TEST_NGINX_CATLOG=y \
|
||||
TEST_NGINX_BINARY=../nginx/objs/nginx prove -v ${{ matrix.sanitize-ok }}
|
||||
|
||||
- if: ${{ !runner.debug }}
|
||||
name: Run nginx-tests with sanitizer
|
||||
working-directory: nginx-tests
|
||||
run: |
|
||||
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$GITHUB_WORKSPACE/build-dir/lib \
|
||||
TMPDIR=$GITHUB_WORKSPACE TEST_NGINX_BINARY=../nginx/objs/nginx \
|
||||
prove ${{ matrix.sanitize-ok }}
|
||||
|
||||
4
.github/workflows/openvpn.yml
vendored
4
.github/workflows/openvpn.yml
vendored
@@ -8,6 +8,8 @@ jobs:
|
||||
name: Build wolfSSL
|
||||
# Just to keep it the same as the testing target
|
||||
runs-on: ubuntu-latest
|
||||
# This should be a safe limit for the tests to run.
|
||||
timeout-minutes: 4
|
||||
steps:
|
||||
- name: Build wolfSSL
|
||||
uses: wolfSSL/actions-build-autotools-project@v1
|
||||
@@ -31,6 +33,8 @@ jobs:
|
||||
ref: [ master, release/2.6, v2.6.0 ]
|
||||
name: ${{ matrix.ref }}
|
||||
runs-on: ubuntu-latest
|
||||
# This should be a safe limit for the tests to run.
|
||||
timeout-minutes: 6
|
||||
needs: build_wolfssl
|
||||
steps:
|
||||
- name: Download lib
|
||||
|
||||
25
.github/workflows/os-check.yml
vendored
25
.github/workflows/os-check.yml
vendored
@@ -16,12 +16,19 @@ jobs:
|
||||
'--enable-all --enable-asn=original',
|
||||
'--enable-harden-tls',
|
||||
'--enable-tls13 --enable-session-ticket --enable-dtls --enable-dtls13
|
||||
--enable-opensslextra --enable-sessioncerts
|
||||
CPPFLAGS=''-DWOLFSSL_DTLS_NO_HVR_ON_RESUME -DHAVE_EXT_CACHE
|
||||
-DWOLFSSL_TICKET_HAVE_ID -DHAVE_EX_DATA -DSESSION_CACHE_DYNAMIC_MEM'' ',
|
||||
--enable-opensslextra --enable-sessioncerts
|
||||
CPPFLAGS=''-DWOLFSSL_DTLS_NO_HVR_ON_RESUME -DHAVE_EXT_CACHE
|
||||
-DWOLFSSL_TICKET_HAVE_ID -DHAVE_EX_DATA -DSESSION_CACHE_DYNAMIC_MEM'' ',
|
||||
'--enable-all --enable-secure-renegotiation',
|
||||
'--enable-all --enable-haproxy --enable-quic',
|
||||
'--enable-dtls --enable-dtls13 --enable-earlydata
|
||||
--enable-session-ticket --enable-psk
|
||||
CPPFLAGS=''-DWOLFSSL_DTLS13_NO_HRR_ON_RESUME'' ',
|
||||
]
|
||||
name: make check
|
||||
runs-on: ${{ matrix.os }}
|
||||
# This should be a safe limit for the tests to run.
|
||||
timeout-minutes: 14
|
||||
steps:
|
||||
- name: Build and test wolfSSL
|
||||
uses: wolfSSL/actions-build-autotools-project@v1
|
||||
@@ -40,6 +47,8 @@ jobs:
|
||||
]
|
||||
name: make user_setting.h
|
||||
runs-on: ${{ matrix.os }}
|
||||
# This should be a safe limit for the tests to run.
|
||||
timeout-minutes: 14
|
||||
steps:
|
||||
- name: Build and test wolfSSL
|
||||
uses: wolfSSL/actions-build-autotools-project@v1
|
||||
@@ -61,6 +70,8 @@ jobs:
|
||||
]
|
||||
name: make user_setting.h (testwolfcrypt only)
|
||||
runs-on: ${{ matrix.os }}
|
||||
# This should be a safe limit for the tests to run.
|
||||
timeout-minutes: 14
|
||||
steps:
|
||||
- name: Build and test wolfSSL
|
||||
uses: wolfSSL/actions-build-autotools-project@v1
|
||||
@@ -80,6 +91,8 @@ jobs:
|
||||
os: [ ubuntu-latest, macos-latest ]
|
||||
name: make user_setting.h (with sed)
|
||||
runs-on: ${{ matrix.os }}
|
||||
# This should be a safe limit for the tests to run.
|
||||
timeout-minutes: 14
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- if: ${{ matrix.os == 'macos-latest' }}
|
||||
@@ -96,6 +109,8 @@ jobs:
|
||||
windows_build:
|
||||
name: Windows Build Test
|
||||
runs-on: windows-latest
|
||||
# This should be a safe limit for the tests to run.
|
||||
timeout-minutes: 6
|
||||
env:
|
||||
# Path to the solution file relative to the root of the project.
|
||||
SOLUTION_FILE_PATH: wolfssl64.sln
|
||||
@@ -120,3 +135,7 @@ jobs:
|
||||
# Add additional options to the MSBuild command line here (like platform or verbosity level).
|
||||
# See https://docs.microsoft.com/visualstudio/msbuild/msbuild-command-line-reference
|
||||
run: msbuild /m /p:PlatformToolset=v142 /p:Platform=${{env.BUILD_PLATFORM}} /p:Configuration=${{env.BUILD_CONFIGURATION}} ${{env.SOLUTION_FILE_PATH}}
|
||||
|
||||
- name: Run Test
|
||||
working-directory: ${{env.GITHUB_WORKSPACE}}
|
||||
run: Release/x64/testsuite.exe
|
||||
|
||||
45
.github/workflows/packaging.yml
vendored
Normal file
45
.github/workflows/packaging.yml
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
name: Packaging Tests
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
|
||||
jobs:
|
||||
build_wolfssl:
|
||||
name: Package wolfSSL
|
||||
runs-on: ubuntu-latest
|
||||
# This should be a safe limit for the tests to run.
|
||||
timeout-minutes: 10
|
||||
steps:
|
||||
- name: Checkout wolfSSL
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Configure wolfSSL
|
||||
run: |
|
||||
autoreconf -ivf
|
||||
./configure --enable-distro --enable-all \
|
||||
--disable-openssl-compatible-defaults --enable-intelasm \
|
||||
--enable-dtls13 --enable-dtls-mtu \
|
||||
--enable-sp-asm --disable-examples --disable-silent-rules
|
||||
|
||||
- name: Make sure OPENSSL_COMPATIBLE_DEFAULTS is not present in options.h
|
||||
run: |
|
||||
! grep OPENSSL_COMPATIBLE_DEFAULTS wolfssl/options.h
|
||||
|
||||
- name: Build wolfSSL .deb
|
||||
run: make deb-docker
|
||||
|
||||
- name: Build wolfSSL .rpm
|
||||
run: make rpm-docker
|
||||
|
||||
- name: Confirm packages built
|
||||
run: |
|
||||
DEB_COUNT=$(find -name 'libwolfssl*.deb' | wc -l)
|
||||
if [ "$DEB_COUNT" != "2" ]; then
|
||||
echo Did not find exactly two deb packages!!!
|
||||
exit 1
|
||||
fi
|
||||
RPM_COUNT=$(find -name 'wolfssl*.rpm' | wc -l)
|
||||
if [ "$RPM_COUNT" != "4" ]; then
|
||||
echo Did not find exactly four rpm packages!!!
|
||||
exit 1
|
||||
fi
|
||||
4
.github/workflows/stunnel.yml
vendored
4
.github/workflows/stunnel.yml
vendored
@@ -8,6 +8,8 @@ jobs:
|
||||
name: Build wolfSSL
|
||||
# Just to keep it the same as the testing target
|
||||
runs-on: ubuntu-latest
|
||||
# This should be a safe limit for the tests to run.
|
||||
timeout-minutes: 4
|
||||
steps:
|
||||
- name: Build wolfSSL
|
||||
uses: wolfSSL/actions-build-autotools-project@v1
|
||||
@@ -31,6 +33,8 @@ jobs:
|
||||
ref: [ 5.67 ]
|
||||
name: ${{ matrix.ref }}
|
||||
runs-on: ubuntu-latest
|
||||
# This should be a safe limit for the tests to run.
|
||||
timeout-minutes: 4
|
||||
needs: build_wolfssl
|
||||
steps:
|
||||
- name: Download lib
|
||||
|
||||
104
.github/workflows/zephyr.yml
vendored
Normal file
104
.github/workflows/zephyr.yml
vendored
Normal file
@@ -0,0 +1,104 @@
|
||||
name: Zephyr tests
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
|
||||
jobs:
|
||||
run_test:
|
||||
name: Build and run
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
config:
|
||||
- zephyr-ref: v3.4.0
|
||||
zephyr-sdk: 0.16.1
|
||||
- zephyr-ref: v3.5.0
|
||||
zephyr-sdk: 0.16.3
|
||||
runs-on: ubuntu-latest
|
||||
# This should be a safe limit for the tests to run.
|
||||
timeout-minutes: 15
|
||||
steps:
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
# Don't prompt for anything
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
sudo apt-get update
|
||||
# most of the ci-base zephyr docker image packages
|
||||
sudo apt-get install -y zip bridge-utils uml-utilities \
|
||||
git cmake ninja-build gperf ccache dfu-util device-tree-compiler wget \
|
||||
python3-dev python3-pip python3-setuptools python3-tk python3-wheel xz-utils file \
|
||||
make gcc gcc-multilib g++-multilib libsdl2-dev libmagic1 \
|
||||
autoconf automake bison build-essential ca-certificates cargo ccache chrpath cmake \
|
||||
cpio device-tree-compiler dfu-util diffstat dos2unix doxygen file flex g++ gawk gcc \
|
||||
gcovr git git-core gnupg gperf gtk-sharp2 help2man iproute2 lcov libcairo2-dev \
|
||||
libglib2.0-dev libgtk2.0-0 liblocale-gettext-perl libncurses5-dev libpcap-dev \
|
||||
libpopt0 libsdl1.2-dev libsdl2-dev libssl-dev libtool libtool-bin locales make \
|
||||
net-tools ninja-build openssh-client parallel pkg-config python3-dev python3-pip \
|
||||
python3-ply python3-setuptools python-is-python3 qemu rsync socat srecord sudo \
|
||||
texinfo unzip wget ovmf xz-utils
|
||||
|
||||
- name: Install west
|
||||
run: sudo pip install west
|
||||
|
||||
- name: Init west workspace
|
||||
run: west init --mr ${{ matrix.config.zephyr-ref }} zephyr
|
||||
|
||||
- name: Update west.yml
|
||||
working-directory: zephyr/zephyr
|
||||
run: |
|
||||
REF=$(echo '${{ github.ref }}' | sed -e 's/\//\\\//g')
|
||||
sed -e 's/remotes:/remotes:\n \- name: wolfssl\n url\-base: https:\/\/github.com\/${{ github.repository_owner }}/' -i west.yml
|
||||
sed -e "s/projects:/projects:\n \- name: wolfssl\n path: modules\/crypto\/wolfssl\n remote: wolfssl\n revision: $REF/" -i west.yml
|
||||
|
||||
- name: Update west workspace
|
||||
working-directory: zephyr
|
||||
run: west update -n -o=--depth=1
|
||||
|
||||
- name: Export zephyr
|
||||
working-directory: zephyr
|
||||
run: west zephyr-export
|
||||
|
||||
- name: Install pip dependencies
|
||||
working-directory: zephyr
|
||||
run: sudo pip install -r zephyr/scripts/requirements.txt
|
||||
|
||||
- name: Install zephyr SDK
|
||||
run: |
|
||||
wget -q https://github.com/zephyrproject-rtos/sdk-ng/releases/download/v${{ matrix.config.zephyr-sdk }}/zephyr-sdk-${{ matrix.config.zephyr-sdk }}_linux-x86_64.tar.xz
|
||||
tar xf zephyr-sdk-${{ matrix.config.zephyr-sdk }}_linux-x86_64.tar.xz
|
||||
cd zephyr-sdk-${{ matrix.config.zephyr-sdk }}
|
||||
./setup.sh -h -c
|
||||
|
||||
- name: Run wolfssl test
|
||||
id: wolfssl-test
|
||||
working-directory: zephyr
|
||||
run: |
|
||||
./zephyr/scripts/twister --testsuite-root modules/crypto/wolfssl --test zephyr/samples/wolfssl_test/sample.crypto.wolfssl_test -vvv
|
||||
rm -rf zephyr/twister-out
|
||||
|
||||
- name: Run wolfssl TLS sock test
|
||||
id: wolfssl-tls-sock
|
||||
working-directory: zephyr
|
||||
run: |
|
||||
./zephyr/scripts/twister --testsuite-root modules/crypto/wolfssl --test zephyr/samples/wolfssl_tls_sock/sample.crypto.wolfssl_tls_sock -vvv
|
||||
rm -rf zephyr/twister-out
|
||||
|
||||
- name: Run wolfssl TLS thread test
|
||||
id: wolfssl-tls-thread
|
||||
working-directory: zephyr
|
||||
run: |
|
||||
./zephyr/scripts/twister --testsuite-root modules/crypto/wolfssl --test zephyr/samples/wolfssl_tls_thread/sample.crypto.wolfssl_tls_thread -vvv
|
||||
rm -rf zephyr/twister-out
|
||||
|
||||
- name: Zip failure logs
|
||||
if: ${{ failure() && (steps.wolfssl-test.outcome == 'failure' || steps.wolfssl-tls-sock.outcome == 'failure' || steps.wolfssl-tls-thread.outcome == 'failure') }}
|
||||
run: |
|
||||
zip -9 -r logs.zip zephyr/twister-out
|
||||
|
||||
- name: Upload failure logs
|
||||
if: ${{ failure() && (steps.wolfssl-test.outcome == 'failure' || steps.wolfssl-tls-sock.outcome == 'failure' || steps.wolfssl-tls-thread.outcome == 'failure') }}
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: zephyr-client-test-logs
|
||||
path: logs.zip
|
||||
retention-days: 5
|
||||
24
.gitignore
vendored
24
.gitignore
vendored
@@ -10,7 +10,7 @@ ctaocrypt/src/src/
|
||||
*.cache
|
||||
.dirstamp
|
||||
*.user
|
||||
configure
|
||||
configure
|
||||
config.*
|
||||
!cmake/config.in
|
||||
*Debug/
|
||||
@@ -64,6 +64,8 @@ ctaocrypt/benchmark/benchmark
|
||||
ctaocrypt/test/testctaocrypt
|
||||
wolfcrypt/benchmark/benchmark
|
||||
wolfcrypt/test/testwolfcrypt
|
||||
examples/async/async_client
|
||||
examples/async/async_server
|
||||
examples/benchmark/tls_bench
|
||||
examples/client/client
|
||||
examples/echoclient/echoclient
|
||||
@@ -74,6 +76,7 @@ examples/sctp/sctp-server-dtls
|
||||
examples/sctp/sctp-client
|
||||
examples/sctp/sctp-client-dtls
|
||||
examples/asn1/asn1
|
||||
examples/pem/pem
|
||||
server_ready
|
||||
snifftest
|
||||
output
|
||||
@@ -84,6 +87,7 @@ testsuite/testsuite.test
|
||||
tests/unit.test
|
||||
tests/bio_write_test.txt
|
||||
tests/test-log-dump-to-file.txt
|
||||
tests/cert_cache.tmp
|
||||
test-write-dhparams.pem
|
||||
testsuite/*.der
|
||||
testsuite/*.pem
|
||||
@@ -343,6 +347,8 @@ doc/pdf
|
||||
|
||||
# XCODE Index
|
||||
IDE/XCODE/Index
|
||||
IDE/**/xcshareddata
|
||||
IDE/**/DerivedData
|
||||
|
||||
# ARM DS-5 && Eclipse
|
||||
\.settings/
|
||||
@@ -403,7 +409,8 @@ libFuzzer
|
||||
XXX-fips-test
|
||||
|
||||
# ASYNC
|
||||
async
|
||||
/wolfAsyncCrypt
|
||||
/async
|
||||
|
||||
# Generated user_settings_asm.h.
|
||||
user_settings_asm.h
|
||||
@@ -414,6 +421,19 @@ user_settings_asm.h
|
||||
# Espressif sdk config default should be saved in sdkconfig.defaults
|
||||
# we won't track the actual working sdkconfig files
|
||||
/IDE/Espressif/**/sdkconfig
|
||||
/IDE/Espressif/**/sdkconfig.old
|
||||
|
||||
# auto-created CMake backups
|
||||
**/CMakeLists.txt.old
|
||||
|
||||
# MagicCrypto (ARIA Cipher)
|
||||
MagicCrypto
|
||||
|
||||
# CMake build directory
|
||||
/out
|
||||
/out_temp
|
||||
|
||||
# debian packaging
|
||||
debian/changelog
|
||||
debian/control
|
||||
*.deb
|
||||
|
||||
306
CMakeLists.txt
306
CMakeLists.txt
@@ -28,16 +28,27 @@ if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}")
|
||||
You must delete them, or cmake will refuse to work.")
|
||||
endif()
|
||||
|
||||
project(wolfssl VERSION 5.6.2 LANGUAGES C ASM)
|
||||
project(wolfssl VERSION 5.6.6 LANGUAGES C ASM)
|
||||
|
||||
# Set WOLFSSL_ROOT if not already defined
|
||||
if ("${WOLFSSL_ROOT}" STREQUAL "")
|
||||
# we'll assume this CMakeLists.txt is in the root of wolfSSL
|
||||
if (EXISTS "${CMAKE_SOURCE_DIR}/wolfcrypt/src/")
|
||||
get_filename_component(WOLFSSL_ROOT "${CMAKE_SOURCE_DIR}" ABSOLUTE)
|
||||
message(STATUS "Found WOLFSSL_ROOT = ${WOLFSSL_ROOT}")
|
||||
endif()
|
||||
else()
|
||||
message(STATUS "Using predefined WOLFSSL_ROOT = ${WOLFSSL_ROOT}")
|
||||
endif()
|
||||
|
||||
# shared library versioning
|
||||
# increment if interfaces have been added, removed or changed
|
||||
set(LIBTOOL_CURRENT 40)
|
||||
set(LIBTOOL_CURRENT 42)
|
||||
# increment if source code has changed set to zero if current is incremented
|
||||
set(LIBTOOL_REVISION 0)
|
||||
# increment if interfaces have been added set to zero if interfaces have been
|
||||
# removed or changed
|
||||
set(LIBTOOL_AGE 5)
|
||||
set(LIBTOOL_AGE 0)
|
||||
|
||||
math(EXPR LIBTOOL_SO_VERSION "${LIBTOOL_CURRENT} - ${LIBTOOL_AGE}")
|
||||
set(LIBTOOL_FULL_VERSION ${LIBTOOL_SO_VERSION}.${LIBTOOL_AGE}.${LIBTOOL_REVISION})
|
||||
@@ -116,6 +127,7 @@ check_type_size("time_t" SIZEOF_TIME_T)
|
||||
# but we want it as 1.
|
||||
if(HAVE___UINT128_T)
|
||||
set(HAVE___UINT128_T "1" CACHE INTERNAL "Result of TRY_COMPILE" FORCE)
|
||||
list(APPEND WOLFSSL_DEFINITIONS "-DHAVE___UINT128_T")
|
||||
endif()
|
||||
|
||||
include(TestBigEndian)
|
||||
@@ -257,6 +269,18 @@ if(NOT WOLFSSL_SINGLE_THREADED)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# DTLS-SRTP
|
||||
add_option("WOLFSSL_SRTP"
|
||||
"Enables wolfSSL DTLS-SRTP (default: disabled)"
|
||||
"no" "yes;no")
|
||||
|
||||
if(WOLFSSL_SRTP)
|
||||
list(APPEND WOLFSSL_DEFINITIONS
|
||||
"-DWOLFSSL_SRTP")
|
||||
set(WOLFSSL_DTLS "yes")
|
||||
set(WOLFSSL_KEYING_MATERIAL "yes")
|
||||
endif()
|
||||
|
||||
|
||||
# DTLS
|
||||
add_option("WOLFSSL_DTLS"
|
||||
@@ -353,6 +377,83 @@ if(NOT WOLFSSL_RNG)
|
||||
list(APPEND WOLFSSL_DEFINITIONS "-DWC_NO_RNG")
|
||||
endif()
|
||||
|
||||
# QUIC
|
||||
add_option(WOLFSSL_QUIC
|
||||
"Enable QUIC support (default: disabled)"
|
||||
"no" "yes;no")
|
||||
|
||||
if(WOLFSSL_QUIC)
|
||||
set(WOLFSSL_ALPN "yes")
|
||||
set(WOLFSSL_OPENSSLEXTRA "yes")
|
||||
set(WOLFSSL_AESCTR "yes")
|
||||
set(WOLFSSL_CURVE25519 "yes")
|
||||
set(WOLFSSL_SNI "yes")
|
||||
list(APPEND WOLFSSL_DEFINITIONS "-DWOLFSSL_QUIC" "-DHAVE_EX_DATA")
|
||||
endif()
|
||||
|
||||
# Curl
|
||||
add_option(WOLFSSL_CURL
|
||||
"Enable CURL support (default: disabled)"
|
||||
"no" "yes;no")
|
||||
|
||||
if(WOLFSSL_CURL)
|
||||
set(WOLFSSL_MD4 "yes")
|
||||
set(WOLFSSL_DES3 "yes")
|
||||
set(WOLFSSL_ALPN "yes")
|
||||
set(WOLFSSL_OPENSSLEXTRA "yes")
|
||||
set(WOLFSSL_CRL "yes")
|
||||
set(WOLFSSL_OCSP "yes")
|
||||
set(WOLFSSL_OCSPSTAPLING "yes")
|
||||
set(WOLFSSL_OCSPSTAPLING_V2 "yes")
|
||||
set(WOLFSSL_SNI "yes")
|
||||
set(WOLFSSL_ALT_CERT_CHAINS "yes")
|
||||
set(WOLFSSL_IP_ALT_NAME "yes")
|
||||
set(WOLFSSL_SESSION_TICKET "yes")
|
||||
set(WOLFSSL_WOLFSSH "yes")
|
||||
list(APPEND WOLFSSL_DEFINITIONS
|
||||
"-DNO_SESSION_CACHE_REF" "-DWOLFSSL_DES_ECB")
|
||||
endif()
|
||||
|
||||
# ALPN
|
||||
add_option(WOLFSSL_ALPN
|
||||
"Enable ALPN support (default: disabled)"
|
||||
"no" "yes;no")
|
||||
|
||||
if(WOLFSSL_ALPN)
|
||||
list(APPEND WOLFSSL_DEFINITIONS "-DHAVE_ALPN" "-DHAVE_TLS_EXTENSIONS")
|
||||
endif()
|
||||
|
||||
# altcertchains
|
||||
add_option(WOLFSSL_ALT_CERT_CHAINS
|
||||
"Enable support for Alternate certification chains (default: disabled)"
|
||||
"no" "yes;no")
|
||||
|
||||
if(WOLFSSL_ALT_CERT_CHAINS)
|
||||
list(APPEND WOLFSSL_DEFINITIONS "-DWOLFSSL_ALT_CERT_CHAINS")
|
||||
endif()
|
||||
|
||||
# ip-alt-name
|
||||
add_option(WOLFSSL_IP_ALT_NAME
|
||||
"Enable support for IP alternative name (default: disabled)"
|
||||
"no" "yes;no")
|
||||
|
||||
if(WOLFSSL_IP_ALT_NAME)
|
||||
list(APPEND WOLFSSL_DEFINITIONS "-DWOLFSSL_IP_ALT_NAME")
|
||||
endif()
|
||||
|
||||
# wolfSSH
|
||||
add_option(WOLFSSL_WOLFSSH
|
||||
"Enable support for wolfSSH (default: disabled)"
|
||||
"no" "yes;no")
|
||||
|
||||
if(WOLFSSL_WOLFSSH)
|
||||
list(APPEND WOLFSSL_DEFINITIONS "-DWOLFSSL_WOLFSSH")
|
||||
endif()
|
||||
|
||||
if(WOLFSSL_WOLFSSH OR WOLFSSL_WPAS)
|
||||
list(APPEND WOLFSSL_DEFINITIONS "-DWOLFSSL_PUBLIC_MP")
|
||||
endif()
|
||||
|
||||
# TODO: - DTLS-SCTP
|
||||
# - DTLS multicast
|
||||
# - OpenSSH
|
||||
@@ -362,14 +463,11 @@ endif()
|
||||
# - wpa_supplicant
|
||||
# - Fortress
|
||||
# - libwebsockets
|
||||
# - IP alternative name
|
||||
# - Qt
|
||||
# - SSL bump
|
||||
# - sniffer
|
||||
# - Signal
|
||||
# - OpenSSL coexist
|
||||
# - OpenSSL compatibility all
|
||||
# - OpenSSL compatibility extra
|
||||
# - Max strength
|
||||
|
||||
# Harden, enable Timing Resistance and Blinding by default
|
||||
@@ -411,12 +509,7 @@ endif()
|
||||
|
||||
if (WOLFSSL_OPENSSLEXTRA AND NOT WOLFSSL_OPENSSLCOEXIST)
|
||||
list(APPEND WOLFSSL_DEFINITIONS
|
||||
"-DOPENSSL_EXTRA"
|
||||
"-DWOLFSSL_ALWAYS_VERIFY_CB"
|
||||
"-DWOLFSSL_VERIFY_CB_ALL_CERTS"
|
||||
"-DWOLFSSL_EXTRA_ALERTS"
|
||||
"-DHAVE_EXT_CACHE"
|
||||
"-DWOLFSSL_FORCE_CACHE_ON_TICKET")
|
||||
"-DOPENSSL_EXTRA")
|
||||
endif()
|
||||
|
||||
if (WOLFSSL_OPENSSLALL)
|
||||
@@ -426,7 +519,6 @@ if (WOLFSSL_OPENSSLALL)
|
||||
"-DWOLFSSL_ERROR_CODE_OPENSSL" "-DWOLFSSL_CERT_NAME_ALL")
|
||||
endif()
|
||||
|
||||
|
||||
# TODO: - IPv6 test apps
|
||||
|
||||
set(WOLFSSL_SLOW_MATH "yes")
|
||||
@@ -510,6 +602,15 @@ if(WOLFSSL_AESGCM)
|
||||
list(APPEND WOLFSSL_DEFINITIONS "-DHAVE_AESGCM")
|
||||
endif()
|
||||
|
||||
if(WOLFSSL_QUIC)
|
||||
if(NOT WOLFSSL_TLS13)
|
||||
message(FATAL_ERROR "TLS 1.3 is disabled - necessary for QUIC")
|
||||
endif()
|
||||
if(NOT WOLFSSL_AESGCM)
|
||||
message(FATAL_ERROR "AES-GCM is disabled - necessary for QUIC")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# AES-SIV
|
||||
add_option("WOLFSSL_AESSIV"
|
||||
"Enable wolfSSL AES-SIV support (default: disabled)"
|
||||
@@ -536,6 +637,11 @@ if(WOLFSSL_AESCTR AND NOT WOLFSSL_FORTRESS)
|
||||
"-DWOLFSSL_AES_DIRECT")
|
||||
endif()
|
||||
|
||||
# ARIA
|
||||
add_option("WOLFSSL_ARIA"
|
||||
"Enable wolfSSL ARIA support (default: disabled)"
|
||||
"no" "yes;no")
|
||||
|
||||
# AES-CCM
|
||||
add_option("WOLFSSL_AESCCM"
|
||||
"Enable wolfSSL AES-CCM support (default: disabled)"
|
||||
@@ -1299,7 +1405,6 @@ endif()
|
||||
# - CRL monitor
|
||||
# - User crypto
|
||||
# - Whitewood netRandom client library
|
||||
# - SNI
|
||||
# - Max fragment length
|
||||
# - ALPN
|
||||
# - Trusted CA indication
|
||||
@@ -1315,8 +1420,14 @@ add_option(WOLFSSL_CRL
|
||||
"Enable CRL (Use =io for inline CRL HTTP GET) (default: disabled)"
|
||||
"no" "yes;no;io")
|
||||
|
||||
|
||||
set(SNI_DEFAULT "no")
|
||||
if(("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "x86_64|x86|AMD64|arm64") OR
|
||||
("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "aarch64"))
|
||||
set(SNI_DEFAULT "yes")
|
||||
endif()
|
||||
set(WOLFSSL_SNI_HELP_STRING "Enable SNI (default: disabled)")
|
||||
add_option(WOLFSSL_SNI ${WOLFSSL_SNI_HELP_STRING} "no" "yes;no")
|
||||
add_option(WOLFSSL_SNI ${WOLFSSL_SNI_HELP_STRING} ${SNI_DEFAULT} "yes;no")
|
||||
|
||||
set(WOLFSSL_TLSX_HELP_STRING "Enable all TLS Extensions (default: disabled)")
|
||||
add_option(WOLFSSL_TLSX ${WOLFSSL_TLSX_HELP_STRING} "no" "yes;no")
|
||||
@@ -1406,7 +1517,6 @@ endif()
|
||||
|
||||
# TODO: - TLS extensions
|
||||
# - Early data handshake
|
||||
# - wolfSSH options
|
||||
# - SCEP
|
||||
# - Secure remote password
|
||||
# - Indefinite length encoded messages
|
||||
@@ -1561,8 +1671,11 @@ endif()
|
||||
|
||||
# TODO: - Fast huge math
|
||||
|
||||
# Set processor-specific build macros
|
||||
if("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "x86_64|AMD64")
|
||||
list(APPEND WOLFSSL_DEFINITIONS "-DWOLFSSL_X86_64_BUILD")
|
||||
elseif("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "aarch64|arm64")
|
||||
list(APPEND WOLFSSL_DEFINITIONS "-DWOLFSSL_AARCH64_BUILD")
|
||||
endif()
|
||||
|
||||
# SP math all
|
||||
@@ -1704,22 +1817,38 @@ if(WOLFSSL_SYS_CA_CERTS)
|
||||
message("Can't enable system CA certs without a filesystem.")
|
||||
override_cache(WOLFSSL_SYS_CA_CERTS "no")
|
||||
elseif(APPLE)
|
||||
# Headers used for MacOS default system CA certs behavior. Only MacOS SDK will have this header
|
||||
check_include_file("Security/SecTrustSettings.h" HAVE_SECURITY_SECTRUSTSETTINGS_H)
|
||||
if(NOT HAVE_SECURITY_SECTRUSTSETTINGS_H)
|
||||
message("Can't enable system CA certs without Security/SecTrustSettings.h.")
|
||||
override_cache(WOLFSSL_SYS_CA_CERTS "no")
|
||||
else()
|
||||
# Headers used for Apple native cert validation. All device SDKs should have these headers
|
||||
check_include_file("Security/SecCertificate.h" HAVE_SECURITY_SECCERTIFICATE_H)
|
||||
check_include_file("Security/SecTrust.h" HAVE_SECURITY_SECTRUST_H)
|
||||
check_include_file("Security/SecPolicy.h" HAVE_SECURITY_SECPOLICY_H)
|
||||
# Either Security/SecTrustSettings (for MacOS cert loading), or the
|
||||
# trio of Security/SecCertificate.h, Security/SecTrust.h, and
|
||||
# Security/SecPolicy.h (for native trust APIs on other apple devices)
|
||||
# must be present. Default to SecTrustSettings method on MacOS.
|
||||
if(HAVE_SECURITY_SECTRUSTSETTINGS_H OR (HAVE_SECURITY_SECCERTIFICATE_H
|
||||
AND HAVE_SECURITY_SECTRUST_H
|
||||
AND HAVE_SECURITY_SECPOLICY_H))
|
||||
find_library(CORE_FOUNDATION_FRAMEWORK CoreFoundation)
|
||||
if(NOT CORE_FOUNDATION_FRAMEWORK)
|
||||
message("Can't enable system CA certs without CoreFoundation framework.")
|
||||
override_cache(WOLFSSL_SYS_CA_CERTS "no")
|
||||
message(FATAL_ERROR "Can't enable system CA certs without CoreFoundation framework.")
|
||||
else()
|
||||
find_library(SECURITY_FRAMEWORK Security)
|
||||
if(NOT SECURITY_FRAMEWORK)
|
||||
message("Can't enable system CA certs without Security framework.")
|
||||
override_cache(WOLFSSL_SYS_CA_CERTS "no")
|
||||
message(FATAL_ERROR "Can't enable system CA certs without Security framework.")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# MacOS should not use native cert validation by default, but other apple devices should.
|
||||
if(NOT HAVE_SECURITY_SECTRUSTSETTINGS_H AND HAVE_SECURITY_SECCERTIFICATE_H
|
||||
AND HAVE_SECURITY_SECTRUST_H
|
||||
AND HAVE_SECURITY_SECPOLICY_H)
|
||||
list(APPEND WOLFSSL_DEFINITIONS "-DWOLFSSL_APPLE_NATIVE_CERT_VALIDATION")
|
||||
endif()
|
||||
|
||||
else()
|
||||
message(FATAL_ERROR "Can't enable system CA certs without Apple Security.framework headers.")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
@@ -1774,6 +1903,42 @@ if(WOLFSSL_AESKEYWRAP)
|
||||
)
|
||||
endif()
|
||||
|
||||
# Hybrid Public Key Encryption (RFC9180)
|
||||
add_option("WOLFSSL_HPKE"
|
||||
"Enable wolfSSL hybrid public key encryption (default: disabled)"
|
||||
"no" "yes;no")
|
||||
|
||||
# Encrypted Client Hello (ECH)
|
||||
add_option("WOLFSSL_ECH"
|
||||
"Enable wolfSSL encrypted client hello (default: disabled)"
|
||||
"no" "yes;no")
|
||||
|
||||
# Keying Material Exporter / TLS Exporter
|
||||
add_option("WOLFSSL_KEYING_MATERIAL"
|
||||
"Enable wolfSSL keying material export (default: disabled)"
|
||||
"no" "yes;no")
|
||||
|
||||
if(WOLFSSL_HPKE)
|
||||
if(NOT WOLFSSL_ECC)
|
||||
message(FATAL_ERROR "HPKE supported only with ECC (WOLFSSL_ECC)")
|
||||
endif()
|
||||
list(APPEND WOLFSSL_DEFINITIONS "-DHAVE_HPKE")
|
||||
override_cache(WOLFSSL_HKDF "yes")
|
||||
endif()
|
||||
|
||||
if(WOLFSSL_ECH)
|
||||
if(NOT WOLFSSL_HPKE)
|
||||
message(FATAL_ERROR "ECH supported only with HPKE (WOLFSSL_HPKE)")
|
||||
endif()
|
||||
if(NOT WOLFSSL_SNI)
|
||||
message(FATAL_ERROR "ECH supported only with SNI (WOLFSSL_SNI)")
|
||||
endif()
|
||||
list(APPEND WOLFSSL_DEFINITIONS "-DHAVE_ECH")
|
||||
endif()
|
||||
|
||||
if(WOLFSSL_KEYING_MATERIAL)
|
||||
list(APPEND WOLFSSL_DEFINITIONS "-DHAVE_KEYING_MATERIAL")
|
||||
endif()
|
||||
|
||||
if(WOLFSSL_KEYGEN)
|
||||
list(APPEND WOLFSSL_DEFINITIONS "-DWOLFSSL_KEY_GEN")
|
||||
@@ -1841,6 +2006,9 @@ if (WOLFSSL_CAAM)
|
||||
list(APPEND WOLFSSL_DEFINITIONS "-DWOLFSSL_CAAM")
|
||||
endif()
|
||||
|
||||
if (WOLFSSL_ARIA)
|
||||
list(APPEND WOLFSSL_DEFINITIONS "-DHAVE_ARIA")
|
||||
endif()
|
||||
|
||||
# Generates the BUILD_* flags. These control what source files are included in
|
||||
# the library. A series of AM_CONDITIONALs handle this in configure.ac.
|
||||
@@ -1922,7 +2090,6 @@ else()
|
||||
set(WOLFSSL_OUTPUT_BASE ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
endif()
|
||||
set(OPTION_FILE "${WOLFSSL_OUTPUT_BASE}/wolfssl/options.h")
|
||||
set(CYASSL_OPTION_FILE "${WOLFSSL_OUTPUT_BASE}/cyassl/options.h")
|
||||
|
||||
file(REMOVE ${OPTION_FILE})
|
||||
|
||||
@@ -1952,14 +2119,6 @@ file(APPEND ${OPTION_FILE} "}\n")
|
||||
file(APPEND ${OPTION_FILE} "#endif\n\n\n")
|
||||
file(APPEND ${OPTION_FILE} "#endif /* WOLFSSL_OPTIONS_H */\n\n")
|
||||
|
||||
# backwards compatibility for those who have included options or version
|
||||
file(REMOVE ${CYASSL_OPTION_FILE})
|
||||
file(APPEND ${CYASSL_OPTION_FILE} "/* cyassl options.h\n")
|
||||
file(APPEND ${CYASSL_OPTION_FILE} " * generated from wolfssl/options.h\n")
|
||||
file(APPEND ${CYASSL_OPTION_FILE} " */\n")
|
||||
file(READ ${OPTION_FILE} OPTION_FILE_CONTENTS)
|
||||
file(APPEND ${CYASSL_OPTION_FILE} ${OPTION_FILE_CONTENTS})
|
||||
|
||||
####################################################
|
||||
# Library Target
|
||||
####################################################
|
||||
@@ -1974,13 +2133,69 @@ set(LIB_SOURCES "")
|
||||
# in the *.am files.
|
||||
generate_lib_src_list("${LIB_SOURCES}")
|
||||
if(BUILD_SHARED_LIBS)
|
||||
message(STATUS "BUILD_SHARED_LIBS enabled: ${LIB_SOURCES}")
|
||||
add_library(wolfssl SHARED ${LIB_SOURCES})
|
||||
else()
|
||||
message(STATUS "Static Libs: ${LIB_SOURCES}")
|
||||
add_library(wolfssl STATIC ${LIB_SOURCES})
|
||||
endif()
|
||||
|
||||
add_library(wolfssl::wolfssl ALIAS wolfssl)
|
||||
|
||||
if (NOT "$ENV{ARIA_DIR}" STREQUAL "")
|
||||
message(STATUS "Found Environment variable ARIA_DIR=$ENV{ARIA_DIR}")
|
||||
if(WOLFSSL_ARIA)
|
||||
message(STATUS "wolfSSL WOLFSSL_ARIA is enabled")
|
||||
else()
|
||||
message(STATUS "wolfSSL WOLFSSL_ARIA is not enabled. To enable, specify a user_settings.h file or run: cmake .. -DWOLFSSL_ARIA=yes")
|
||||
message(STATUS "Clear the ARIA_DIR environment variable to otherwise suppress this message when not using ARIA ciphers.")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# ARIA Check
|
||||
if(WOLFSSL_ARIA)
|
||||
message(STATUS "WOLFSSL_ARIA is enabled")
|
||||
|
||||
find_package(ARIA)
|
||||
|
||||
if(ARIA_FOUND)
|
||||
message(STATUS "ARIA find_package() success.")
|
||||
else()
|
||||
message(FATAL_ERROR "WOLFSSL_ARIA is enabled, but find_package() did not find ARIA MagicCrypto.\n"
|
||||
"Check ARIA_DIR environment variable and/or copy MagicCrypto directory locally.")
|
||||
endif()
|
||||
|
||||
list(APPEND WOLFSSL_LINK_LIBS "${ARIA_LIB_FILE}")
|
||||
|
||||
# The cmake target_include_directories() will complain about local directories,
|
||||
# so we'll handle MagicCrypto differently when found in wolfssl.
|
||||
# see below to use include_directories() instead.
|
||||
if(ARIA_IS_LOCAL)
|
||||
# there's also a wolfssl port API to include, plus local ARIA include
|
||||
include_directories("wolfssl/wolfcrypt/port/aria" "MagicCrypto/include")
|
||||
else()
|
||||
# see below for target_include_directories() instead
|
||||
include_directories("wolfssl/wolfcrypt/port/aria")
|
||||
message(STATUS "ARIA_IS_LOCAL is false, appending ${ARIA_INCLUDE_DIR} to WOLFSSL_INCLUDE_DIRS")
|
||||
list(APPEND WOLFSSL_INCLUDE_DIRS "${ARIA_INCLUDE_DIR}")
|
||||
endif()
|
||||
|
||||
add_library(MagicCrypto_lib
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/wolfcrypt/src/port/aria/aria-crypt.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/wolfcrypt/src/port/aria/aria-cryptocb.c
|
||||
)
|
||||
|
||||
set_target_properties(MagicCrypto_lib PROPERTIES OUTPUT_NAME "MagicCrypto")
|
||||
target_link_libraries(MagicCrypto_lib wolfssl)
|
||||
target_compile_options(MagicCrypto_lib PRIVATE "-DHAVE_ARIA")
|
||||
|
||||
# ARIA was enabled and we successfully found it.
|
||||
set(HAVE_ARIA 1)
|
||||
list(APPEND WOLFSSL_DEFINITIONS "-DHAVE_ARIA")
|
||||
|
||||
message(STATUS "ARIA Check: WOLFSSL_LINK_LIBS = ${WOLFSSL_LINK_LIBS}")
|
||||
endif()
|
||||
|
||||
set_target_properties(wolfssl
|
||||
PROPERTIES
|
||||
SOVERSION ${LIBTOOL_SO_VERSION}
|
||||
@@ -1997,6 +2212,12 @@ target_compile_definitions(wolfssl PUBLIC ${WOLFSSL_DEFINITIONS})
|
||||
# Include Directories
|
||||
####################################################
|
||||
|
||||
if("${WOLFSSL_INCLUDE_DIRS}" STREQUAL "")
|
||||
message(STATUS "WOLFSSL_INCLUDE_DIRS is blank. No additional directories will be added.")
|
||||
else()
|
||||
message(STATUS "WOLFSSL_INCLUDE_DIRS = ${WOLFSSL_INCLUDE_DIRS}")
|
||||
endif()
|
||||
|
||||
target_include_directories(wolfssl
|
||||
PUBLIC
|
||||
$<INSTALL_INTERFACE:include>
|
||||
@@ -2034,7 +2255,9 @@ endif()
|
||||
# Tests and Examples
|
||||
####################################################
|
||||
|
||||
enable_testing()
|
||||
if(WOLFSSL_EXAMPLES)
|
||||
|
||||
# Build wolfSSL client example
|
||||
add_executable(client
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/examples/client/client.c)
|
||||
@@ -2090,6 +2313,7 @@ if(WOLFSSL_EXAMPLES)
|
||||
tests/suites.c
|
||||
tests/w64wrapper.c
|
||||
tests/unit.c
|
||||
tests/quic.c
|
||||
examples/server/server.c
|
||||
examples/client/client.c)
|
||||
target_include_directories(unit_test PRIVATE
|
||||
@@ -2103,6 +2327,9 @@ if(WOLFSSL_EXAMPLES)
|
||||
set_property(TARGET unit_test
|
||||
PROPERTY RUNTIME_OUTPUT_NAME
|
||||
unit.test)
|
||||
add_test(NAME unit_test
|
||||
COMMAND $<TARGET_FILE:unit_test>
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
endif()
|
||||
|
||||
if(WOLFSSL_CRYPT_TESTS)
|
||||
@@ -2142,6 +2369,9 @@ if(WOLFSSL_CRYPT_TESTS)
|
||||
if(WOLFSSL_CRYPT_TESTS_HELP)
|
||||
target_compile_options(wolfcrypttest PRIVATE "-DHAVE_WOLFCRYPT_TEST_OPTIONS")
|
||||
endif()
|
||||
add_test(NAME wolfcrypttest
|
||||
COMMAND $<TARGET_FILE:wolfcrypttest>
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
|
||||
# Build wolfCrypt benchmark executable.
|
||||
add_executable(wolfcryptbench
|
||||
@@ -2165,7 +2395,6 @@ include(GNUInstallDirs)
|
||||
|
||||
set(HEADER_EXCLUDE
|
||||
"internal.h"
|
||||
"cyassl/ctaocrypt/port"
|
||||
"wolfssl/wolfcrypt/port/nrf51.h"
|
||||
"wolfssl/wolfcrypt/port/arm"
|
||||
"wolfssl/wolfcrypt/port/cypress"
|
||||
@@ -2310,19 +2539,10 @@ install(DIRECTORY ${WOLFSSL_OUTPUT_BASE}/wolfssl/
|
||||
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/wolfssl
|
||||
FILES_MATCHING PATTERN "*.h"
|
||||
REGEX ${EXCLUDED_HEADERS_REGEX} EXCLUDE)
|
||||
install(DIRECTORY ${WOLFSSL_OUTPUT_BASE}/cyassl/
|
||||
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/cyassl
|
||||
FILES_MATCHING PATTERN "*.h"
|
||||
REGEX ${EXCLUDED_HEADERS_REGEX} EXCLUDE)
|
||||
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/wolfssl/
|
||||
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/wolfssl
|
||||
FILES_MATCHING PATTERN "*.h"
|
||||
REGEX ${EXCLUDED_HEADERS_REGEX} EXCLUDE)
|
||||
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/cyassl/
|
||||
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/cyassl
|
||||
FILES_MATCHING PATTERN "*.h"
|
||||
REGEX ${EXCLUDED_HEADERS_REGEX} EXCLUDE)
|
||||
|
||||
|
||||
# Install the examples
|
||||
install(FILES ${INSTALLED_EXAMPLES}
|
||||
|
||||
160
ChangeLog.md
160
ChangeLog.md
@@ -1,3 +1,161 @@
|
||||
# wolfSSL Release 5.6.6 (Dec 19, 2023)
|
||||
|
||||
Release 5.6.6 has been developed according to wolfSSL's development and QA
|
||||
process (see link below) and successfully passed the quality criteria.
|
||||
https://www.wolfssl.com/about/wolfssl-software-development-process-quality-assurance
|
||||
|
||||
NOTE: * --enable-heapmath is being deprecated and will be removed by 2024
|
||||
|
||||
REMINDER: When working with AES Block Cipher algorithms, `wc_AesInit()` should
|
||||
always be called first to initialize the `Aes` structure, before calling other
|
||||
Aes API functions. Recently we found several places in our documentation,
|
||||
comments, and codebase where this pattern was not observed. We have since
|
||||
fixed this omission in several PRs for this release.
|
||||
|
||||
## Vulnerabilities
|
||||
|
||||
* [Medium] CVE-2023-6935: After review of the previous RSA timing fix in wolfSSL 5.6.4, additional changes were found to be required. A complete resistant change is delivered in this release. This fix is for the Marvin attack, leading to being able to decrypt a saved TLS connection and potentially forge a signature after probing with a very large number of trial connections. This issue is around RSA decryption and affects the optional static RSA cipher suites on the server side, which are considered weak, not recommended to be used and are off by default in wolfSSL (even with `--enable-all`). Static RSA cipher suites were also removed from the TLS 1.3 protocol and are only present in TLS 1.2 and lower. All padding versions of RSA decrypt are affected since the code under review is outside of the padding processing. Information about the private keys is NOT compromised in affected code. It is recommended to disable static RSA cipher suites and update the version of wolfSSL used if using RSA private decryption alone outside of TLS. Thanks to Hubert Kario for the report. The fix for this issue is located in the following GitHub Pull Request: https://github.com/wolfSSL/wolfssl/pull/6955.
|
||||
|
||||
* [Low] CVE-2023-6936: A potential heap overflow read is possible in servers connecting over TLS 1.3 when the optional `WOLFSSL_CALLBACKS` has been defined. The out of bounds read can occur when a server receives a malicious malformed ClientHello. Users should either discontinue use of `WOLFSSL_CALLBACKS` on the server side or update versions of wolfSSL to 5.6.6. Thanks to the tlspuffin fuzzer team for the report which was designed and developed by; Lucca Hirschi (Inria, LORIA), Steve Kremer (Inria, LORIA), and Max Ammann (Trail of Bits). The fix for this issue is located in the following GitHub Pull Request: https://github.com/wolfSSL/wolfssl/pull/6949.
|
||||
|
||||
* [Low] A side channel vulnerability with AES T-Tables is possible in a very controlled environment where precision sub-cache-line inspection can happen, such as inside an Intel SGX enclave. This can lead to recovery of the AES key. To prevent this type of attack, wolfSSL added an AES bitsliced implementation which can be enabled with the “`--enable-aes-bitsliced`” configure option. Thanks to Florian Sieck, Zhiyuan Zhang, Sebastian Berndt, Chitchanok Chuengsatiansup, Thomas Eisenbarth, and Yuval Yarom for the report (Universities of Lübeck, Melbourne, Adelaide and Bochum). The fix for this issue is located in the following GitHub Pull Request: https://github.com/wolfSSL/wolfssl/pull/6854.
|
||||
|
||||
* [Low] CVE-2023-6937: wolfSSL prior to 5.6.6 did not check that messages in a single (D)TLS record do not span key boundaries. As a result, it was possible to combine (D)TLS messages using different keys into one (D)TLS record. The most extreme edge case is that, in (D)TLS 1.3, it was possible that an unencrypted (D)TLS 1.3 record from the server containing first a ServerHello message and then the rest of the first server flight would be accepted by a wolfSSL client. In (D)TLS 1.3 the handshake is encrypted after the ServerHello but a wolfSSL client would accept an unencrypted flight from the server. This does not compromise key negotiation and authentication so it is assigned a low severity rating. Thanks to Johannes Wilson for the report (Sectra Communications and Linköping University). The fix for this issue is located in the following GitHub Pull Request: https://github.com/wolfSSL/wolfssl/pull/7029.
|
||||
|
||||
## New Feature Additions
|
||||
|
||||
* Build option for disabling CRL date checks (`WOLFSSL_NO_CRL_DATE_CHECK`) (PR 6927)
|
||||
* Support for STM32WL55 and improvements to PKA ECC support (PR 6937)
|
||||
* Add option to skip cookie exchange on DTLS 1.3 session resumption (PR 6929)
|
||||
* Add implementation of SRTP KDF and SRTCP KDF (`--enable-srtp-kdf`) (PR 6888)
|
||||
* Add `wolfSSL_EXTENDED_KEY_USAGE_free()` (PR 6916)
|
||||
* Add AES bitsliced implementation that is cache attack safe (`--enable-aes-bitsliced`) (PR 6854)
|
||||
* Add memcached support and automated testing (PR 6430, 7022)
|
||||
* Add Hardware Encryption Acceleration for ESP32-C3, ESP32-C6, and ESP32-S2 (PR 6990)
|
||||
* Add (D)TLS 1.3 support for 0.5-RTT data (PR 7010)
|
||||
|
||||
## Enhancements and Optimizations
|
||||
|
||||
* Better built in testing of “`--sys-ca-certs`” configure option (PR 6910)
|
||||
* Updated CMakeLists.txt for Espressif wolfSSL component usage (PR 6877)
|
||||
* Disable TLS 1.1 by default (unless SSL 3.0 or TLS 1.0 is enabled) (PR 6946)
|
||||
* Add “`--enable-quic`” to “`--enable-all`” configure option (PR 6957)
|
||||
* Add support to SP C implementation for RSA exponent up to 64-bits (PR 6959)
|
||||
* Add result of “`HAVE___UINT128_T`” to options.h for CMake builds (PR 6965)
|
||||
* Add optimized assembly for AES-GCM on ARM64 using hardware crypto instructions (PR 6967)
|
||||
* Add built-in cipher suite tests for DTLS 1.3 PQC (PR 6952)
|
||||
* Add wolfCrypt test and unit test to ctest (PR 6977)
|
||||
* Move OpenSSL compatibility crypto APIs into `ssl_crypto.c` file (PR 6935)
|
||||
* Validate time generated from XGMTIME() (PR 6958)
|
||||
* Allow wolfCrypt benchmark to run with microsecond accuracy (PR 6868)
|
||||
* Add GitHub Actions testing with nginx 1.24.0 (PR 6982)
|
||||
* Allow encoding of CA:FALSE BasicConstraint during cert generation (PR 6953)
|
||||
* Add CMake option to enable DTLS-SRTP (PR 6991)
|
||||
* Add CMake options for enabling QUIC and cURL (PR 7049)
|
||||
* Improve RSA blinding to make code more constant time (PR 6955)
|
||||
* Refactor AES-NI implementation macros to allow dynamic fallback to C (PR 6981)
|
||||
* Default to native Windows threading API on MinGW (PR 7015)
|
||||
* Return better error codes from OCSP response check (PR 7028)
|
||||
* Updated Espressif ESP32 TLS client and server examples (PR 6844)
|
||||
* Add/clean up support for ESP-IDF v5.1 for a variety of ESP32 chips (PR 7035, 7037)
|
||||
* Add API to choose dynamic certs based on client ciphers/sigalgs (PR 6963)
|
||||
* Improve Arduino IDE 1.5 project file to match recursive style (PR 7007)
|
||||
* Simplify and improve apple-universal build script (PR 7025)
|
||||
|
||||
## Fixes
|
||||
|
||||
* Fix for async edge case with Intel QuickAssist/Cavium Nitrox (PR 6931)
|
||||
* Fix for building PKCS#7 with RSA disabled (PR 6902)
|
||||
* Fix for advancing output pointer in `wolfSSL_i2d_X509()` (PR 6891)
|
||||
* Fix for `EVP_EncodeBlock()` appending a newline (PR 6900)
|
||||
* Fix for `wolfSSL_RSA_verify_PKCS1_PSS()` with `RSA_PSS_SALTLEN_AUTO` (PR 6938)
|
||||
* Fixes for CODESonar reports around `isalpha()` and `isalnum()` calls (PR 6810)
|
||||
* Fix for SP ARM64 integer math to avoid compiler optimization issues (PR 6942)
|
||||
* Fix for SP Thumb2 inline assembly to add IAR build support (PR 6943, 6971)
|
||||
* Fix for SP Thumb2 to make functions not inlined (PR 6993)
|
||||
* Fix for SP Cortex-M assembly large build with IAR (PR 6954)
|
||||
* Fix for SP ARM64 assembly montgomery reduction by 4 (PR 6947)
|
||||
* Fix for SP ARM64 P-256 for not inlining functions for iOS compatibility (PR 6979)
|
||||
* Fix for `WOLFSSL_CALLBACKS` and potential memory error (PR 6949)
|
||||
* Fixes for wolfSSL’s Zephyr OS port (PR 6930)
|
||||
* Fix for build errors when building for NXP mmCAU (`FREESCALE_MMCAU`) (PR 6970)
|
||||
* Fix for TLS 1.3 `SendBuffered()` return code in non-blocking mode (PR 7001)
|
||||
* Fix for TLS `Hmac_UpdateFinal()` when padding byte is invalid (PR 6998)
|
||||
* Fix for ARMv8 AES-GCM streaming to check size of IV before storing (PR 6996)
|
||||
* Add missing calls to `wc_AesInit()` before `wc_AesSetKey()` (PR 7011)
|
||||
* Fix build errors with DTLS 1.3 enabled but TLS 1.2 disabled (PR 6976)
|
||||
* Fixes for building wolfSSL in Visual Studio (PR 7040)
|
||||
|
||||
# wolfSSL Release 5.6.4 (Oct 30, 2023)
|
||||
|
||||
Release 5.6.4 has been developed according to wolfSSL's development and QA process (see link below) and successfully passed the quality criteria.
|
||||
https://www.wolfssl.com/about/wolfssl-software-development-process-quality-assurance
|
||||
|
||||
NOTE: * --enable-heapmath is being deprecated and will be removed by 2024
|
||||
* Old CyaSSL/CtaoCrypt shim layer was removed in this release (5.6.4)
|
||||
|
||||
## Vulnerabilities
|
||||
|
||||
* [Medium] A fix was added, but still under review for completeness, for a Bleichenbacher style attack, leading to being able to decrypt a saved TLS connection and potentially forge a signature after probing with a large number of trial connections. This issue is around RSA decryption and affects static RSA cipher suites on the server side, which are not recommended to be used and are off by default. Static RSA cipher suites were also removed from the TLS 1.3 protocol and only present in TLS 1.2 and lower. All padding versions of RSA decrypt are affected since the code under review is outside of the padding processing. Information about the private keys is NOT compromised in affected code. It's recommended to disable static RSA cipher suites and update the version of wolfSSL used if using RSA private decryption alone outside of TLS. The fix is located in this pull request (https://github.com/wolfSSL/wolfssl/pull/6896)
|
||||
|
||||
## New Feature Additions
|
||||
|
||||
* DTLS 1.3 PQC: support fragmenting the second ClientHello message. This allows arbitrarily long keys to be used, opening up support for all PQC ciphersuites in DTLS 1.3.
|
||||
* SM2/SM3/SM4: Chinese cipher support including TLS 1.3 and 1.2 cipher suites. SM2 SP implementation available.
|
||||
* Ability to parse ASN1 only with SMIME_read_PKCS7
|
||||
* Added support for MemUse Entropy on Windows
|
||||
* Added Ada Bindings for wolfSSL
|
||||
* Added a PEM example that converts to and from DER/PEM.
|
||||
* Added LMS/HSS and XMSS/XMSS^MT wolfcrypt hooks, both normal and verify-only options.
|
||||
* Added support for the AES EAX mode of operation
|
||||
* Port for use with Hitch (https://github.com/varnish/hitch) added
|
||||
* Add XTS API's to handle multiple sectors in new port to VeraCrypt
|
||||
|
||||
## Enhancements and Optimizations
|
||||
|
||||
* Turned on SNI by default on hosts with resources
|
||||
* Improved support for Silicon Labs Simplicity Studio and the ERF32 Gecko SDK
|
||||
* Thumb-2 and ARM32 Curve25519 and Ed25519 assembly have significantly improved performance.
|
||||
* Thumb-2 AES assembly code added.
|
||||
* Thumb-2 and ARM32 SP implementations of RSA, DH and ECC have significantly improved performance.
|
||||
* Minor performance improvements to SP ECC for Intel x64.
|
||||
* AES-XTS assembly code added for Intel x64, Aarch64 and ARM32.
|
||||
* Added support for X963 KDFs to ECIES.
|
||||
* Added 32-bit type only implementation of AES GMULT using tables.
|
||||
* Add support for nginx version 1.25.0
|
||||
* Add support for Kerberos version 5 1.21.1
|
||||
* Check all CRL entries in case a single issuer has multiple CRL's loaded
|
||||
* CRL verify the entire chain including loaded CA's
|
||||
* Added example for building wolfSSL as an Apple universal binary framework using configure
|
||||
* Sniffer tool now supports decrypting TLS sessions using secrets obtained from a SSLKEYLOGFILE
|
||||
* Updates made for EBSNET port
|
||||
* Update "--enable-jni" to include additional defines for expanded JNI support. Also includes JCE and JSSE builds under the single enable option now.
|
||||
|
||||
## Fixes
|
||||
|
||||
* Fixed error handling when decrypted pre-master secret is too long when using static RSA.
|
||||
* Added a fix for keymod use with i.MX RT1170 CAAM blobs
|
||||
* Added a fix for AES-GCM use with Petalinux Xilinx
|
||||
* Fixed `wc_SignatureGenerate_ex` to not call verify twice
|
||||
* Fixed wolfCrypt FIPS DLL on Win32
|
||||
* Fixed TFM math library big-endian reading implementation when a zero length buffer is passed in.
|
||||
* Fixed NO_CERT configurations to build correctly.
|
||||
* Fixed ARM AES-GCM streaming assembly when –enable-opensslextra defined.
|
||||
* Added modulus checks to heap math implementation of mp_exptmod().
|
||||
* Fixed Windows assembly code to handle that certain XMM registers are non-volatile.
|
||||
* Aarch64 SP ECC implementation of sp_256_mont_dbl_4 has the register list for the assembly code fixed to include all used registers.
|
||||
* mp_sqrt_mod_prime fixed to limit the number of iterations of a loop to handle malicious non-prime values being passed in.
|
||||
* Ignore session ID's shorter than 32 bytes instead of erroring out
|
||||
|
||||
# wolfSSL Release 5.6.3 (Jun 16, 2023)
|
||||
|
||||
Release 5.6.3 of wolfSSL embedded TLS has 4 bug fixes:
|
||||
|
||||
* Fix for setting the atomic macro options introduced in release 5.6.2. This issue affects GNU gcc autoconf builds. The fix resolves a potential mismatch of the generated macros defined in options.h file and the macros used when the wolfSSL library is compiled. In version 5.6.2 this mismatch could result in unstable runtime behavior.
|
||||
* Fix for invalid suffix error with Windows build using the macro GCM_TABLE_4BIT.
|
||||
* Improvements to Encrypted Memory support (WC_PROTECT_ENCRYPTED_MEM) implementations for modular exponentiation in SP math-all (sp_int.c) and TFM (tfm.c).
|
||||
* Improvements to SendAlert for getting output buffer.
|
||||
|
||||
# wolfSSL Release 5.6.2 (Jun 09, 2023)
|
||||
|
||||
Release 5.6.2 has been developed according to wolfSSL's development and QA process (see link below) and successfully passed the quality criteria.
|
||||
@@ -3245,7 +3403,7 @@ More info can be found on-line at //http://wolfssl.com/yaSSL/Docs.html
|
||||
a) If using wolfSSL for DTLS on the server side of a publicly accessible
|
||||
machine you MUST update.
|
||||
b) If using wolfSSL for TLS on the server side with private RSA keys allowing
|
||||
ephemeral key exchange without low memory optimziations you MUST update and
|
||||
ephemeral key exchange without low memory optimizations you MUST update and
|
||||
regenerate the private RSA keys.
|
||||
|
||||
Please see https://www.wolfssl.com/wolfSSL/Blog/Blog.html for more details
|
||||
|
||||
@@ -5,21 +5,49 @@ USER root
|
||||
|
||||
ARG DEPS_WOLFSSL="build-essential autoconf libtool clang clang-tools zlib1g-dev libuv1-dev libpam0g-dev valgrind git linux-headers-generic gcc-multilib g++-multilib libpcap-dev bubblewrap gdb iputils-ping lldb bsdmainutils netcat binutils-arm-linux-gnueabi binutils-aarch64-linux-gnu"
|
||||
ARG DEPS_LIBOQS="astyle cmake gcc ninja-build libssl-dev python3-pytest python3-pytest-xdist unzip xsltproc doxygen graphviz python3-yaml valgrind git"
|
||||
ARG DEPS_UDP_PROXY="wget libevent-dev"
|
||||
ARG DEPS_TESTS="abi-dumper libcurl4-openssl-dev tcpdump"
|
||||
ARG DEPS_TOOLS="ccache"
|
||||
RUN DEBIAN_FRONTEND=noninteractive apt update && apt install -y apt-utils \
|
||||
&& apt install -y ${DEPS_WOLFSSL} ${DEPS_LIBOQS} ${DEPS_TESTS} \
|
||||
&& apt install -y ${DEPS_WOLFSSL} ${DEPS_LIBOQS} ${DEPS_UDP_PROXY} ${DEPS_TESTS} ${DEPS_TOOLS} \
|
||||
&& apt clean -y && rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Add 'docker' user
|
||||
ARG USER=docker
|
||||
ARG UID=1000
|
||||
ARG GID=1000
|
||||
RUN groupadd -f -g ${GID} docker && ( getent passwd ${UID} || useradd -ms /bin/bash ${USER} -u ${UID} -g ${GID} )
|
||||
|
||||
# Add github.com as an SSH known host
|
||||
RUN ssh -o StrictHostKeyChecking=no -T git@github.com; cat ~/.ssh/known_hosts >> /etc/ssh/ssh_known_hosts
|
||||
|
||||
# install ccache
|
||||
RUN mkdir -p /opt/ccache/bin && for prog in gcc g++ cc c++ cpp arm-none-eabi-c++ arm-none-eabi-cpp arm-none-eabi-gcc arm-none-eabi-g++; do ln -s /usr/bin/ccache /opt/ccache/bin/$(basename $prog); done
|
||||
ENV PATH /opt/ccache/bin:$PATH
|
||||
|
||||
# install liboqs
|
||||
RUN git clone --single-branch https://github.com/open-quantum-safe/liboqs.git && cd liboqs && git checkout af76ca3b1f2fbc1f4f0967595f3bb07692fb3d82 \
|
||||
RUN git clone --single-branch https://github.com/open-quantum-safe/liboqs.git && cd liboqs && git checkout db08f12b5a96aa6582a82aac7f65cf8a4d8b231f \
|
||||
&& mkdir build && cd build && cmake -DOQS_DIST_BUILD=ON -DOQS_USE_CPUFEATURE_INSTRUCTIONS=OFF -DOQS_USE_OPENSSL=0 .. && make -j8 all && make install && cd ../.. && rm -rf liboqs
|
||||
|
||||
RUN mkdir /opt/sources
|
||||
|
||||
# install liblms
|
||||
RUN cd /opt/sources && git clone --single-branch https://github.com/cisco/hash-sigs.git && cd hash-sigs && git checkout b0631b8891295bf2929e68761205337b7c031726 \
|
||||
&& sed -i 's/USE_OPENSSL 1/USE_OPENSSL 0/g' sha256.h && make -j4 hss_lib_thread.a
|
||||
|
||||
# Install pkixssh to /opt/pkixssh for X509 interop testing with wolfSSH
|
||||
RUN mkdir /var/empty
|
||||
RUN cd /opt/sources && wget -q -O- https://roumenpetrov.info/secsh/src/pkixssh-14.1.1.tar.gz | tar xzf - && cd pkixssh-14.1.1 && ./configure --prefix=/opt/pkixssh/ --exec-prefix=/opt/pkixssh/ && make install
|
||||
|
||||
# Install udp/tcp-proxy
|
||||
RUN cd /opt/sources && git clone --depth=1 --single-branch --branch=main http://github.com/wolfssl/udp-proxy && cd udp-proxy && make && cp tcp_proxy udp_proxy /bin/.
|
||||
|
||||
# Allow non-root to use tcpdump (will need NET_RAW and NET_ADMIN capability when running the container)
|
||||
RUN setcap 'CAP_NET_RAW+eip CAP_NET_ADMIN+eip' /usr/bin/tcpdump
|
||||
# Allow non-root to use gdb on processes (will need SYS_PTRACE capability when running the container)
|
||||
RUN setcap 'CAP_SYS_PTRACE+eip' /usr/bin/gdb
|
||||
|
||||
USER ${UID}:${GID}
|
||||
# Add in Jenkins userID
|
||||
RUN for i in $(seq 1001 1010); do ( getent passwd ${i} || useradd -ms /bin/bash jenkins${i} -u ${i} -g ${GID} ); done
|
||||
|
||||
USER ${UID}:${GID}
|
||||
|
||||
11
Docker/Dockerfile.cross-compiler
Normal file
11
Docker/Dockerfile.cross-compiler
Normal file
@@ -0,0 +1,11 @@
|
||||
ARG DOCKER_BASE_IMAGE=wolfssl/wolfssl-builder
|
||||
FROM $DOCKER_BASE_IMAGE
|
||||
|
||||
USER root
|
||||
|
||||
ARG DEPS_TESTING="gcc-arm-linux-gnueabi gcc-aarch64-linux-gnu"
|
||||
RUN DEBIAN_FRONTEND=noninteractive apt update \
|
||||
&& apt install -y ${DEPS_TESTING} \
|
||||
&& apt clean -y && rm -rf /var/lib/apt/lists/*
|
||||
|
||||
USER docker
|
||||
@@ -1,23 +1,27 @@
|
||||
#!/bin/sh
|
||||
|
||||
runCMD() { # usage: runCMD "<command>" "<retVal>"
|
||||
eval $1 >/dev/null 2>&1
|
||||
TMP_FILE=$(mktemp)
|
||||
eval $1 > $TMP_FILE 2>&1
|
||||
RETVAL=$?
|
||||
if [ "$RETVAL" != "$2" ]; then
|
||||
echo "Command ($1) returned ${RETVAL}, but expected $2. Rerunning with output to terminal:"
|
||||
eval $1
|
||||
echo "Command ($1) returned ${RETVAL}, but expected $2. Error output:"
|
||||
cat $TMP_FILE
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
# Successful tests
|
||||
runCMD "ldd /lib/libustream-ssl.so" 0
|
||||
# Temporary workaround: comment out missing kmods repo line for 21.02 specifically.
|
||||
# Remove after fixed upstream.
|
||||
runCMD "sed '\/src\/gz openwrt_kmods https:\/\/downloads.openwrt.org\/releases\/21.02-SNAPSHOT\/targets\/x86\/64\/kmods\/5.4.238-1-5a722da41bc36de95a7195be6fce1b45/s//#&/' -i /etc/opkg/distfeeds.conf" 0
|
||||
runCMD "opkg update" 0
|
||||
runCMD "uclient-fetch -O /dev/null 'https://letsencrypt.org'" 0
|
||||
runCMD "uclient-fetch 'https://letsencrypt.org'" 0
|
||||
# Negative tests
|
||||
runCMD "uclient-fetch --ca-certificate=/dev/null -O /dev/null 'https://letsencrypt.org'" 5
|
||||
runCMD "uclient-fetch -O /dev/null 'https://self-signed.badssl.com/'" 5
|
||||
runCMD "uclient-fetch -O /dev/null 'https://untrusted-root.badssl.com/'" 5
|
||||
runCMD "uclient-fetch -O /dev/null 'https://expired.badssl.com/'" 5
|
||||
runCMD "uclient-fetch --ca-certificate=/dev/null 'https://letsencrypt.org'" 5
|
||||
runCMD "uclient-fetch 'https://self-signed.badssl.com/'" 5
|
||||
runCMD "uclient-fetch 'https://untrusted-root.badssl.com/'" 5
|
||||
runCMD "uclient-fetch 'https://expired.badssl.com/'" 5
|
||||
|
||||
echo "All tests passed."
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
# Overview
|
||||
This is a simple Docker environment for compiling and running WolfSSL. Use `run.sh` to build everything (Docker container, WolfSSL, etc.). This script takes in arguments that can be passed to `./configure`. For example: `run.sh --enable-all`
|
||||
This is a Docker environment for compiling, testing and running WolfSSL. Use `run.sh` to build everything (Docker container, WolfSSL, etc.). This script takes in arguments that can be passed to `./configure`. For example: `run.sh --enable-all`
|
||||
|
||||
When the compilation and tests succeed, you will be dropped in to a shell environment within the container. This can be useful to build other things within the environment.
|
||||
When the compilation and tests succeed, you will be dropped in to a shell environment within the container. This can be useful to build other things within the environment. Additional tests can be run as well as debugging of code.
|
||||
|
||||
# Docker Hub
|
||||
These images are also uploaded to the wolfSSL's [Docker Hub page](https://hub.docker.com/orgs/wolfssl/repositories). There is a convenience script here `buildAndPush.sh` that will create the appropriate containers and push them to the repo.
|
||||
|
||||
# FAQ
|
||||
## permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock
|
||||
@@ -10,4 +13,4 @@ You need to be added to the `docker` group to run Docker containers. Run `sudo u
|
||||
## Unable to access symlinked files outside of WolfSSL
|
||||
The volume mounted in the Docker container needs to have all files that your compilation will need. To solve this, you have a couple options:
|
||||
1. Change the `WOLFSSL_DIR` variable in the `run.sh` to one higher up (by adding `/..` to the path). Then update the `docker build` to include the correct path to the Dockerfile and the `docker run` argument to the working directory (`-w`) to the WolfSSL source directory
|
||||
2. Move the external repository to within the WolfSSL directory. For example create an `external` folder which has your files. This route may have complications when stashing Git work.
|
||||
2. Move the external repository to within the WolfSSL directory. For example create an `external` folder which has your files. This route may have complications when stashing Git work.
|
||||
|
||||
37
Docker/buildAndPush.sh
Executable file
37
Docker/buildAndPush.sh
Executable file
@@ -0,0 +1,37 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Assume we're in wolfssl/Docker
|
||||
WOLFSSL_DIR=$(builtin cd ${BASH_SOURCE%/*}/..; pwd)
|
||||
|
||||
DOCKER_BUILD_OPTIONS="$1"
|
||||
if [ "${DOCKER_BASE_IMAGE}" != "" ]; then
|
||||
DOCKER_BUILD_OPTIONS+=" --build-arg DOCKER_BASE_IMAGE=${DOCKER_BASE_IMAGE}"
|
||||
fi
|
||||
|
||||
NUM_FAILURES=0
|
||||
|
||||
CUR_DATE=$(date -u +%F)
|
||||
echo "Building wolfssl/wolfssl-builder:${CUR_DATE} as ${DOCKER_BUILD_OPTIONS}"
|
||||
docker build -t wolfssl/wolfssl-builder:${CUR_DATE} ${DOCKER_BUILD_OPTIONS} "${WOLFSSL_DIR}/Docker" && \
|
||||
docker tag wolfssl/wolfssl-builder:${CUR_DATE} wolfssl/wolfssl-builder:latest && \
|
||||
docker build --build-arg DOCKER_BASE_IMAGE=wolfssl/wolfssl-builder:${CUR_DATE} -t wolfssl/testing-cross-compiler:${CUR_DATE} "${WOLFSSL_DIR}/Docker" -f Dockerfile.cross-compiler && \
|
||||
docker tag wolfssl/testing-cross-compiler:${CUR_DATE} wolfssl/testing-cross-compiler:latest
|
||||
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "Pushing containers to DockerHub"
|
||||
docker push wolfssl/wolfssl-builder:${CUR_DATE} && docker push wolfssl/wolfssl-builder:latest && \
|
||||
docker push wolfssl/testing-cross-compiler:${CUR_DATE} && docker push wolfssl/testing-cross-compiler:latest
|
||||
else
|
||||
echo "Warning: Build wolfssl/wolfssl-builder failed. Continuing"
|
||||
((NUM_FAILURES++))
|
||||
fi
|
||||
|
||||
echo "Building wolfssl/wolfCLU:${CUR_DATE}"
|
||||
docker buildx build --pull --push --build-arg DUMMY=${CUR_DATE} -t wolfssl/wolfclu:${CUR_DATE} --platform=linux/amd64,linux/arm64,linux/arm/v7 "${WOLFSSL_DIR}/Docker/wolfCLU" && \
|
||||
docker buildx build --pull --push --build-arg DUMMY=${CUR_DATE} -t wolfssl/wolfclu:latest --platform=linux/amd64,linux/arm64,linux/arm/v7 "${WOLFSSL_DIR}/Docker/wolfCLU"
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Warning: Build wolfssl/wolfclu failed. Continuing"
|
||||
((NUM_FAILURES++))
|
||||
fi
|
||||
|
||||
echo "Script completed in $SECONDS seconds. Had $NUM_FAILURES failures."
|
||||
@@ -3,9 +3,11 @@
|
||||
# All paths should be given relative to the root
|
||||
|
||||
EXTRA_DIST+= Docker/Dockerfile
|
||||
EXTRA_DIST+= Docker/Dockerfile.cross-compiler
|
||||
EXTRA_DIST+= Docker/run.sh
|
||||
EXTRA_DIST+= Docker/README.md
|
||||
|
||||
ignore_files+=Docker/buildAndPush.sh
|
||||
ignore_files+=Docker/OpenWRT/Dockerfile
|
||||
ignore_files+=Docker/OpenWRT/runTests.sh
|
||||
ignore_files+=Docker/OpenWRT/README.md
|
||||
|
||||
6
Docker/packaging/debian/Dockerfile
Normal file
6
Docker/packaging/debian/Dockerfile
Normal file
@@ -0,0 +1,6 @@
|
||||
FROM debian:latest
|
||||
|
||||
RUN apt-get -y update
|
||||
RUN apt-get -y upgrade
|
||||
RUN apt-get install -y build-essential autoconf gawk debhelper lintian
|
||||
|
||||
3
Docker/packaging/fedora/Dockerfile
Normal file
3
Docker/packaging/fedora/Dockerfile
Normal file
@@ -0,0 +1,3 @@
|
||||
FROM fedora:latest
|
||||
|
||||
RUN dnf install -y make automake gcc rpmdevtools
|
||||
@@ -5,9 +5,9 @@ echo "Running with \"${*}\"..."
|
||||
# Assume we're in wolfssl/Docker
|
||||
WOLFSSL_DIR=$(builtin cd ${BASH_SOURCE%/*}/..; pwd)
|
||||
|
||||
docker build -t wolfssl --build-arg UID=$(id -u) --build-arg GID=$(id -g) "${WOLFSSL_DIR}/Docker" && \
|
||||
docker run --rm -it -v ${HOME}/.gitconfig:/home/docker/.gitconfig:ro -v ${HOME}/.ssh:/home/docker/.ssh:ro -v "${WOLFSSL_DIR}:/tmp/wolfssl" -w /tmp/wolfssl wolfssl /bin/bash -c "./autogen.sh && ./configure ${*@Q} && make" && \
|
||||
docker run --rm -it -v ${HOME}/.gitconfig:/home/docker/.gitconfig:ro -v ${HOME}/.ssh:/home/docker/.ssh:ro -v "${WOLFSSL_DIR}:/tmp/wolfssl" -w /tmp/wolfssl wolfssl /bin/bash
|
||||
docker build -t wolfssl/wolfssl-builder --build-arg UID=$(id -u) --build-arg GID=$(id -g) "${WOLFSSL_DIR}/Docker" && \
|
||||
docker run --rm -it -v ${HOME}/.gitconfig:/home/docker/.gitconfig:ro -v ${HOME}/.ssh:/home/docker/.ssh:ro -v "${WOLFSSL_DIR}:/tmp/wolfssl" -w /tmp/wolfssl wolfssl/wolfssl-builder /bin/bash -c "./autogen.sh && ./configure ${*@Q} && make" && \
|
||||
docker run --rm -it -v ${HOME}/.gitconfig:/home/docker/.gitconfig:ro -v ${HOME}/.ssh:/home/docker/.ssh:ro -v "${WOLFSSL_DIR}:/tmp/wolfssl" -w /tmp/wolfssl wolfssl/wolfssl-builder /bin/bash
|
||||
|
||||
exitval=$?
|
||||
echo "Exited with error code $exitval"
|
||||
|
||||
@@ -21,6 +21,6 @@ USER root
|
||||
COPY --from=BUILDER /usr/local/lib/libwolfssl.so /usr/local/lib/
|
||||
COPY --from=BUILDER /usr/local/bin/wolfssl* /usr/local/bin/
|
||||
RUN ldconfig
|
||||
CMD ["/usr/local/bin/wolfssl"]
|
||||
ENTRYPOINT ["/usr/local/bin/wolfssl"]
|
||||
LABEL org.opencontainers.image.source=https://github.com/wolfssl/wolfssl
|
||||
LABEL org.opencontainers.image.description="Simple wolfCLU in a container"
|
||||
|
||||
@@ -2,10 +2,11 @@
|
||||
|
||||
##### Reformatting wolfSSL as a compatible Arduino Library
|
||||
This is a shell script that will re-organize the wolfSSL library to be
|
||||
compatible with Arduino projects. The Arduino IDE requires a library's source
|
||||
files to be in the library's root directory with a header file in the name of
|
||||
the library. This script moves all src/ files to the `IDE/ARDUINO/wolfSSL`
|
||||
directory and creates a stub header file called `wolfssl.h`.
|
||||
compatible with Arduino projects that use Arduino IDE 1.5.0 or newer.
|
||||
The Arduino IDE requires a library's source files to be in the library's root
|
||||
directory with a header file in the name of the library. This script moves all
|
||||
src/ files to the `IDE/ARDUINO/wolfSSL/src` directory and creates a stub header
|
||||
file called `wolfssl.h` inside that directory.
|
||||
|
||||
Step 1: To configure wolfSSL with Arduino, enter the following from within the
|
||||
wolfssl/IDE/ARDUINO directory:
|
||||
@@ -15,7 +16,7 @@ wolfssl/IDE/ARDUINO directory:
|
||||
Step 2: Copy the directory wolfSSL that was just created to:
|
||||
`~/Documents/Arduino/libraries/` directory so the Arduino IDE can find it.
|
||||
|
||||
Step 3: Edit `<arduino-libraries>/wolfSSL/user_settings.h`
|
||||
Step 3: Edit `<arduino-libraries>/wolfSSL/src/user_settings.h`
|
||||
If building for Intel Galileo platform add: `#define INTEL_GALILEO`.
|
||||
Add any other custom settings, for a good start see the examples in wolfssl root
|
||||
"/examples/configs/user_settings_*.h"
|
||||
|
||||
@@ -19,10 +19,18 @@
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
|
||||
*/
|
||||
|
||||
/*
|
||||
This was original tested with Intel Galileo acting as the Client, with a
|
||||
laptop acting as a server using the server example provided in examples/server.
|
||||
Legacy Ardunio v1.86 was used to compile and program the Galileo
|
||||
*/
|
||||
|
||||
#define USE_CERT_BUFFERS_2048
|
||||
#include <wolfssl.h>
|
||||
#include <wolfssl/ssl.h>
|
||||
#include <Ethernet.h>
|
||||
#include <wolfssl/certs_test.h>
|
||||
|
||||
|
||||
const char host[] = "192.168.1.148"; /* server to connect to */
|
||||
const int port = 11111; /* port on server to connect to */
|
||||
@@ -37,123 +45,132 @@ WOLFSSL_CTX* ctx = NULL;
|
||||
WOLFSSL* ssl = NULL;
|
||||
|
||||
void setup() {
|
||||
WOLFSSL_METHOD* method;
|
||||
WOLFSSL_METHOD* method;
|
||||
/* Initialize Return Code */
|
||||
int rc;
|
||||
Serial.begin(9600);
|
||||
/* Delay need to ensure connection to server */
|
||||
delay(4000);
|
||||
|
||||
Serial.begin(9600);
|
||||
|
||||
method = wolfTLSv1_2_client_method();
|
||||
if (method == NULL) {
|
||||
Serial.println("unable to get method");
|
||||
method = wolfTLSv1_2_client_method();
|
||||
if (method == NULL) {
|
||||
Serial.println("unable to get method");
|
||||
return;
|
||||
}
|
||||
ctx = wolfSSL_CTX_new(method);
|
||||
if (ctx == NULL) {
|
||||
Serial.println("unable to get ctx");
|
||||
}
|
||||
ctx = wolfSSL_CTX_new(method);
|
||||
if (ctx == NULL) {
|
||||
Serial.println("unable to get ctx");
|
||||
return;
|
||||
}
|
||||
/* initialize wolfSSL using callback functions */
|
||||
wolfSSL_CTX_set_verify(ctx, SSL_VERIFY_PEER, 0);
|
||||
rc = wolfSSL_CTX_load_verify_buffer(ctx, ca_cert_der_2048,\
|
||||
sizeof_ca_cert_der_2048,\
|
||||
WOLFSSL_FILETYPE_ASN1);
|
||||
Serial.print("\n\n Return code of load_verify is:");
|
||||
Serial.println(rc);
|
||||
Serial.println("");
|
||||
rc = wolfSSL_CTX_use_certificate_buffer(ctx, client_cert_der_2048,\
|
||||
sizeof_client_cert_der_2048,\
|
||||
WOLFSSL_FILETYPE_ASN1);
|
||||
Serial.print("\n\n Return code of use_certificate_buffer is:");
|
||||
Serial.println(rc);
|
||||
Serial.println("");
|
||||
rc = wolfSSL_CTX_use_PrivateKey_buffer(ctx, client_key_der_2048,\
|
||||
sizeof_client_key_der_2048,\
|
||||
WOLFSSL_FILETYPE_ASN1);
|
||||
Serial.print("\n\n Return code of use_PrivateKey_buffer is:");
|
||||
Serial.println(rc);
|
||||
Serial.println("");
|
||||
wolfSSL_SetIOSend(ctx, EthernetSend);
|
||||
wolfSSL_SetIORecv(ctx, EthernetReceive);
|
||||
return;
|
||||
}
|
||||
/* initialize wolfSSL using callback functions */
|
||||
wolfSSL_CTX_set_verify(ctx, SSL_VERIFY_NONE, 0);
|
||||
wolfSSL_SetIOSend(ctx, EthernetSend);
|
||||
wolfSSL_SetIORecv(ctx, EthernetReceive);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
int EthernetSend(WOLFSSL* ssl, char* msg, int sz, void* ctx) {
|
||||
int sent = 0;
|
||||
|
||||
sent = client.write((byte*)msg, sz);
|
||||
|
||||
return sent;
|
||||
int sent = 0;
|
||||
sent = client.write((byte*)msg, sz);
|
||||
return sent;
|
||||
}
|
||||
|
||||
int EthernetReceive(WOLFSSL* ssl, char* reply, int sz, void* ctx) {
|
||||
int ret = 0;
|
||||
|
||||
while (client.available() > 0 && ret < sz) {
|
||||
reply[ret++] = client.read();
|
||||
}
|
||||
|
||||
return ret;
|
||||
int ret = 0;
|
||||
while (client.available() > 0 && ret < sz) {
|
||||
reply[ret++] = client.read();
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
void loop() {
|
||||
int err = 0;
|
||||
int input = 0;
|
||||
int total_input = 0;
|
||||
char msg[32] = "hello wolfssl!";
|
||||
int msgSz = (int)strlen(msg);
|
||||
char errBuf[80];
|
||||
char reply[80];
|
||||
const char* cipherName;
|
||||
|
||||
if (reconnect) {
|
||||
reconnect--;
|
||||
|
||||
if (client.connect(host, port)) {
|
||||
|
||||
Serial.print("Connected to ");
|
||||
Serial.println(host);
|
||||
|
||||
ssl = wolfSSL_new(ctx);
|
||||
if (ssl == NULL) {
|
||||
Serial.println("Unable to allocate SSL object");
|
||||
return;
|
||||
}
|
||||
|
||||
err = wolfSSL_connect(ssl);
|
||||
if (err != WOLFSSL_SUCCESS) {
|
||||
err = wolfSSL_get_error(ssl, 0);
|
||||
wolfSSL_ERR_error_string(err, errBuf);
|
||||
Serial.print("TLS Connect Error: ");
|
||||
Serial.println(errBuf);
|
||||
}
|
||||
|
||||
Serial.print("SSL version is ");
|
||||
Serial.println(wolfSSL_get_version(ssl));
|
||||
|
||||
cipherName = wolfSSL_get_cipher(ssl);
|
||||
Serial.print("SSL cipher suite is ");
|
||||
Serial.println(cipherName);
|
||||
|
||||
if ((wolfSSL_write(ssl, msg, msgSz)) == msgSz) {
|
||||
|
||||
Serial.print("Server response: ");
|
||||
/* wait for data */
|
||||
while (!client.available()) {}
|
||||
/* read data */
|
||||
while (wolfSSL_pending(ssl)) {
|
||||
input = wolfSSL_read(ssl, reply, sizeof(reply) - 1);
|
||||
total_input += input;
|
||||
if (input < 0) {
|
||||
err = wolfSSL_get_error(ssl, 0);
|
||||
wolfSSL_ERR_error_string(err, errBuf);
|
||||
Serial.print("TLS Read Error: ");
|
||||
Serial.println(errBuf);
|
||||
break;
|
||||
} else if (input > 0) {
|
||||
reply[input] = '\0';
|
||||
Serial.print(reply);
|
||||
} else {
|
||||
Serial.println();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
err = wolfSSL_get_error(ssl, 0);
|
||||
wolfSSL_ERR_error_string(err, errBuf);
|
||||
Serial.print("TLS Write Error: ");
|
||||
Serial.println(errBuf);
|
||||
}
|
||||
|
||||
wolfSSL_shutdown(ssl);
|
||||
wolfSSL_free(ssl);
|
||||
|
||||
client.stop();
|
||||
Serial.println("Connection complete.");
|
||||
reconnect = 0;
|
||||
} else {
|
||||
Serial.println("Trying to reconnect...");
|
||||
int err = 0;
|
||||
int input = 0;
|
||||
int total_input = 0;
|
||||
char msg[32] = "hello wolfssl!";
|
||||
int msgSz = (int)strlen(msg);
|
||||
char errBuf[80];
|
||||
char reply[80];
|
||||
const char* cipherName;
|
||||
if (reconnect) {
|
||||
reconnect--;
|
||||
if (client.connect(host, port)) {
|
||||
Serial.print("Connected to ");
|
||||
Serial.println(host);
|
||||
ssl = wolfSSL_new(ctx);
|
||||
if (ssl == NULL) {
|
||||
Serial.println("Unable to allocate SSL object");
|
||||
return;
|
||||
}
|
||||
err = wolfSSL_connect(ssl);
|
||||
if (err != WOLFSSL_SUCCESS) {
|
||||
err = wolfSSL_get_error(ssl, 0);
|
||||
wolfSSL_ERR_error_string(err, errBuf);
|
||||
Serial.print("TLS Connect Error: ");
|
||||
Serial.println(errBuf);
|
||||
}
|
||||
Serial.print("SSL version is ");
|
||||
Serial.println(wolfSSL_get_version(ssl));
|
||||
cipherName = wolfSSL_get_cipher(ssl);
|
||||
Serial.print("SSL cipher suite is ");
|
||||
Serial.println(cipherName);
|
||||
if ((wolfSSL_write(ssl, msg, msgSz)) == msgSz) {
|
||||
Serial.print("Server response: ");
|
||||
/* wait for data */
|
||||
while (!client.available()) {}
|
||||
/* read data */
|
||||
while (wolfSSL_pending(ssl)) {
|
||||
input = wolfSSL_read(ssl, reply, sizeof(reply) - 1);
|
||||
total_input += input;
|
||||
if (input < 0) {
|
||||
err = wolfSSL_get_error(ssl, 0);
|
||||
wolfSSL_ERR_error_string(err, errBuf);
|
||||
Serial.print("TLS Read Error: ");
|
||||
Serial.println(errBuf);
|
||||
break;
|
||||
}
|
||||
else if (input > 0) {
|
||||
reply[input] = '\0';
|
||||
Serial.print(reply);
|
||||
}
|
||||
else {
|
||||
Serial.println();
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
err = wolfSSL_get_error(ssl, 0);
|
||||
wolfSSL_ERR_error_string(err, errBuf);
|
||||
Serial.print("TLS Write Error: ");
|
||||
Serial.println(errBuf);
|
||||
}
|
||||
wolfSSL_shutdown(ssl);
|
||||
wolfSSL_free(ssl);
|
||||
client.stop();
|
||||
Serial.println("Connection complete.");
|
||||
reconnect = 0;
|
||||
}
|
||||
else {
|
||||
Serial.println("Trying to reconnect...");
|
||||
}
|
||||
}
|
||||
}
|
||||
delay(1000);
|
||||
delay(1000);
|
||||
}
|
||||
|
||||
@@ -4,86 +4,141 @@
|
||||
# an Arduino project
|
||||
# run as bash ./wolfssl-arduino.sh
|
||||
|
||||
ROOT_DIR="/wolfSSL"
|
||||
ROOT_SRC_DIR="${ROOT_DIR}/src"
|
||||
WOLFSSL_SRC="${ROOT_SRC_DIR}/src"
|
||||
WOLFSSL_HEADERS="${ROOT_SRC_DIR}/wolfssl"
|
||||
WOLFCRYPT_ROOT="${ROOT_SRC_DIR}/wolfcrypt"
|
||||
WOLFCRYPT_SRC="${WOLFCRYPT_ROOT}/src"
|
||||
WOLFCRYPT_HEADERS="${WOLFSSL_HEADERS}/wolfcrypt"
|
||||
OPENSSL_DIR="${WOLFSSL_HEADERS}/openssl"
|
||||
WOLFSSL_VERSION="5.6.4"
|
||||
|
||||
# TOP indicates the file directory comes from the top level of the wolfssl repo
|
||||
TOP_DIR="../.."
|
||||
WOLFSSL_SRC_TOP="${TOP_DIR}/src"
|
||||
WOLFSSL_HEADERS_TOP="${TOP_DIR}/wolfssl"
|
||||
WOLFCRYPT_ROOT_TOP="${TOP_DIR}/wolfcrypt"
|
||||
WOLFCRYPT_SRC_TOP="${WOLFCRYPT_ROOT_TOP}/src"
|
||||
WOLFCRYPT_HEADERS_TOP="${WOLFSSL_HEADERS_TOP}/wolfcrypt"
|
||||
OPENSSL_DIR_TOP="${WOLFSSL_HEADERS_TOP}/openssl"
|
||||
|
||||
|
||||
# TODO: Parse version number
|
||||
WOLFSSL_VERSION=$(grep -i "LIBWOLFSSL_VERSION_STRING" ${TOP_DIR}/wolfssl/version.h | cut -d '"' -f 2)
|
||||
|
||||
|
||||
DIR=${PWD##*/}
|
||||
|
||||
space(){
|
||||
echo "" >> "$1"
|
||||
}
|
||||
|
||||
if [ "$DIR" = "ARDUINO" ]; then
|
||||
if [ ! -d "wolfSSL" ]; then
|
||||
mkdir wolfSSL
|
||||
if [ ! -d ".${ROOT_DIR}" ]; then
|
||||
mkdir .${ROOT_DIR}
|
||||
fi
|
||||
if [ ! -d ".${ROOT_SRC_DIR}" ]; then
|
||||
mkdir .${ROOT_SRC_DIR}
|
||||
fi
|
||||
|
||||
cp ../../src/*.c ./wolfSSL
|
||||
cp ../../wolfcrypt/src/*.c ./wolfSSL
|
||||
if [ ! -d ".${WOLFSSL_HEADERS}" ]; then
|
||||
mkdir .${WOLFSSL_HEADERS}
|
||||
fi
|
||||
|
||||
if [ ! -d "wolfSSL/wolfssl" ]; then
|
||||
mkdir wolfSSL/wolfssl
|
||||
cp ${WOLFSSL_HEADERS_TOP}/*.h .${WOLFSSL_HEADERS}
|
||||
if [ ! -d ".${WOLFCRYPT_HEADERS}" ]; then
|
||||
mkdir .${WOLFCRYPT_HEADERS}
|
||||
fi
|
||||
cp ../../wolfssl/*.h ./wolfSSL/wolfssl
|
||||
if [ ! -d "wolfSSL/wolfssl/wolfcrypt" ]; then
|
||||
mkdir wolfSSL/wolfssl/wolfcrypt
|
||||
fi
|
||||
cp ../../wolfssl/wolfcrypt/*.h ./wolfSSL/wolfssl/wolfcrypt
|
||||
cp ${WOLFCRYPT_HEADERS_TOP}/*.h .${WOLFCRYPT_HEADERS}
|
||||
|
||||
# support misc.c as include in wolfcrypt/src
|
||||
if [ ! -d "./wolfSSL/wolfcrypt" ]; then
|
||||
mkdir ./wolfSSL/wolfcrypt
|
||||
# Add in source files to wolfcrypt/src
|
||||
if [ ! -d ".${WOLFCRYPT_ROOT}" ]; then
|
||||
mkdir .${WOLFCRYPT_ROOT}
|
||||
fi
|
||||
if [ ! -d "./wolfSSL/wolfcrypt/src" ]; then
|
||||
mkdir ./wolfSSL/wolfcrypt/src
|
||||
if [ ! -d ".${WOLFCRYPT_SRC}" ]; then
|
||||
mkdir .${WOLFCRYPT_SRC}
|
||||
fi
|
||||
cp ../../wolfcrypt/src/misc.c ./wolfSSL/wolfcrypt/src
|
||||
cp ../../wolfcrypt/src/asm.c ./wolfSSL/wolfcrypt/src
|
||||
|
||||
cp ${WOLFCRYPT_SRC_TOP}/*.c .${WOLFCRYPT_SRC}
|
||||
|
||||
# Add in source files to top level src folders
|
||||
if [ ! -d ".${WOLFSSL_SRC}" ]; then
|
||||
mkdir .${WOLFSSL_SRC}
|
||||
fi
|
||||
cp ${WOLFSSL_SRC_TOP}/*.c .${WOLFSSL_SRC}
|
||||
# put bio and evp as includes
|
||||
mv ./wolfSSL/bio.c ./wolfSSL/wolfssl
|
||||
mv ./wolfSSL/evp.c ./wolfSSL/wolfssl
|
||||
cp .${WOLFSSL_SRC}/bio.c .${WOLFSSL_HEADERS}
|
||||
cp .${WOLFCRYPT_SRC}/evp.c .${WOLFSSL_HEADERS}
|
||||
|
||||
# make a copy of evp.c and bio.c for ssl.c to include inline
|
||||
cp ./wolfSSL/wolfssl/evp.c ./wolfSSL/wolfcrypt/src/evp.c
|
||||
cp ./wolfSSL/wolfssl/bio.c ./wolfSSL/wolfcrypt/src/bio.c
|
||||
cp .${WOLFSSL_HEADERS}/evp.c .${WOLFCRYPT_SRC}/evp.c
|
||||
cp .${WOLFSSL_HEADERS}/bio.c .${WOLFCRYPT_SRC}/bio.c
|
||||
|
||||
# copy openssl compatibility headers to their appropriate location
|
||||
if [ ! -d "./wolfSSL/wolfssl/openssl" ]; then
|
||||
mkdir ./wolfSSL/wolfssl/openssl
|
||||
if [ ! -d ".${OPENSSL_DIR}" ]; then
|
||||
mkdir .${OPENSSL_DIR}
|
||||
fi
|
||||
cp ../../wolfssl/openssl/* ./wolfSSL/wolfssl/openssl
|
||||
cp ${OPENSSL_DIR_TOP}/* .${OPENSSL_DIR}
|
||||
|
||||
echo "/* Generated wolfSSL header file for Arduino */" > ./wolfSSL/wolfssl.h
|
||||
echo "#include <user_settings.h>" >> ./wolfSSL/wolfssl.h
|
||||
echo "#include <wolfssl/wolfcrypt/settings.h>" >> ./wolfSSL/wolfssl.h
|
||||
echo "#include <wolfssl/ssl.h>" >> ./wolfSSL/wolfssl.h
|
||||
|
||||
if [ ! -f "./wolfSSL/user_settings.h" ]; then
|
||||
echo "/* Generated wolfSSL user_settings.h file for Arduino */" > ./wolfSSL/user_settings.h
|
||||
echo "#ifndef ARDUINO_USER_SETTINGS_H" >> ./wolfSSL/user_settings.h
|
||||
echo "#define ARDUINO_USER_SETTINGS_H" >> ./wolfSSL/user_settings.h
|
||||
space ./wolfSSL/user_settings.h
|
||||
echo "/* Platform */" >> ./wolfSSL/user_settings.h
|
||||
echo "#define WOLFSSL_ARDUINO" >> ./wolfSSL/user_settings.h
|
||||
space ./wolfSSL/user_settings.h
|
||||
echo "/* Math library (remove this to use normal math)*/" >> ./wolfSSL/user_settings.h
|
||||
echo "#define USE_FAST_MATH" >> ./wolfSSL/user_settings.h
|
||||
echo "#define TFM_NO_ASM" >> ./wolfSSL/user_settings.h
|
||||
space ./wolfSSL/user_settings.h
|
||||
echo "/* RNG DEFAULT !!FOR TESTING ONLY!! */" >> ./wolfSSL/user_settings.h
|
||||
echo "/* comment out the error below to get started w/ bad entropy source" >> ./wolfSSL/user_settings.h
|
||||
echo " * This will need fixed before distribution but is OK to test with */" >> ./wolfSSL/user_settings.h
|
||||
echo "#error \"needs solved, see: https://www.wolfssl.com/docs/porting-guide/\"" >> ./wolfSSL/user_settings.h
|
||||
echo "#define WOLFSSL_GENSEED_FORTEST" >> ./wolfSSL/user_settings.h
|
||||
space ./wolfSSL/user_settings.h
|
||||
echo "#endif /* ARDUINO_USER_SETTINGS_H */" >> ./wolfSSL/user_settings.h
|
||||
cat > .${ROOT_SRC_DIR}/wolfssl.h <<EOF
|
||||
/* Generated wolfSSL header file for Arduino */
|
||||
#include <user_settings.h>
|
||||
#include <wolfssl/wolfcrypt/settings.h>
|
||||
#include <wolfssl/ssl.h>
|
||||
EOF
|
||||
|
||||
|
||||
# Creates user_settings file if one does not exist
|
||||
if [ ! -f ".${ROOT_SRC_DIR}/user_settings.h" ]; then
|
||||
cat > .${ROOT_SRC_DIR}/user_settings.h <<EOF
|
||||
/* Generated wolfSSL user_settings.h file for Arduino */
|
||||
#ifndef ARDUINO_USER_SETTINGS_H
|
||||
#define ARDUINO_USER_SETTINGS_H
|
||||
|
||||
/* Platform */
|
||||
#define WOLFSSL_ARDUINO
|
||||
|
||||
/* Math library (remove this to use normal math)*/
|
||||
#define USE_FAST_MATH
|
||||
#define TFM_NO_ASM
|
||||
#define NO_ASN_TIME
|
||||
|
||||
/* When using Intel Galileo Uncomment the line below */
|
||||
/* #define INTEL_GALILEO */
|
||||
|
||||
/* RNG DEFAULT !!FOR TESTING ONLY!! */
|
||||
/* comment out the error below to get started w/ bad entropy source
|
||||
* This will need fixed before distribution but is OK to test with */
|
||||
#error "needs solved, see: https://www.wolfssl.com/docs/porting-guide/"
|
||||
#define WOLFSSL_GENSEED_FORTEST
|
||||
|
||||
#endif /* ARDUINO_USER_SETTINGS_H */
|
||||
EOF
|
||||
fi
|
||||
|
||||
cp wolfSSL/wolfssl/wolfcrypt/settings.h wolfSSL/wolfssl/wolfcrypt/settings.h.bak
|
||||
echo " /* wolfSSL Generated ARDUINO settings */" > ./wolfSSL/wolfssl/wolfcrypt/settings.h
|
||||
echo "#ifndef WOLFSSL_USER_SETTINGS" >> ./wolfSSL/wolfssl/wolfcrypt/settings.h
|
||||
echo " #define WOLFSSL_USER_SETTINGS" >> ./wolfSSL/wolfssl/wolfcrypt/settings.h
|
||||
echo "#endif /* WOLFSSL_USER_SETTINGS */" >> ./wolfSSL/wolfssl/wolfcrypt/settings.h
|
||||
echo " /* wolfSSL Generated ARDUINO settings: END */" >> ./wolfSSL/wolfssl/wolfcrypt/settings.h
|
||||
cat ./wolfSSL/wolfssl/wolfcrypt/settings.h.bak >> ./wolfSSL/wolfssl/wolfcrypt/settings.h
|
||||
cp .${WOLFCRYPT_HEADERS}/settings.h .${WOLFCRYPT_HEADERS}/settings.h.bak
|
||||
cat > .${WOLFCRYPT_HEADERS}/settings.h <<EOF
|
||||
/*wolfSSL Generated ARDUINO settings */
|
||||
#ifndef WOLFSSL_USER_SETTINGS
|
||||
#define WOLFSSL_USER_SETTINGS
|
||||
#endif /* WOLFSSL_USER_SETTINGS */
|
||||
/*wolfSSL Generated ARDUINO settings: END */
|
||||
|
||||
EOF
|
||||
cat .${WOLFCRYPT_HEADERS}/settings.h.bak >> .${WOLFCRYPT_HEADERS}/settings.h
|
||||
|
||||
#Creating library.properties file based off of:
|
||||
#https://arduino.github.io/arduino-cli/0.35/library-specification/#libraryproperties-file-format
|
||||
|
||||
cat > .${ROOT_DIR}/library.properties <<EOF
|
||||
name=wolfSSL
|
||||
version=${WOLFSSL_VERSION}
|
||||
author=wolfSSL inc
|
||||
maintainer=wolfSSL inc <support@wolfssl.com>
|
||||
sentence=A lightweight SSL/TLS library written in ANSI C and targeted for embedded, RTOS, and resource-constrained environments.
|
||||
paragraph=Manual: https://www.wolfssl.com/documentation/manuals/wolfssl/index.html.
|
||||
category=Communication
|
||||
url=https://www.wolfssl.com/
|
||||
architectures=*
|
||||
|
||||
EOF
|
||||
|
||||
else
|
||||
echo "ERROR: You must be in the IDE/ARDUINO directory to run this script"
|
||||
|
||||
@@ -98,7 +98,6 @@ extern unsigned int my_rng_seed_gen(void);
|
||||
|
||||
#define WOLFSSL_SP_NO_MALLOC
|
||||
//#define WOLFSSL_SP_DIV_32 /* do not use 64-bit divides */
|
||||
//#define WOLFSSL_SP_CACHE_RESISTANT
|
||||
|
||||
/* use smaller version of code */
|
||||
#define WOLFSSL_SP_SMALL
|
||||
@@ -205,7 +204,7 @@ extern unsigned int my_rng_seed_gen(void);
|
||||
/* use heap allocation for ECC points */
|
||||
#define ALT_ECC_SIZE
|
||||
|
||||
/* wolfSSL will compute the FP_MAX_BITS_ECC, but it can be overriden */
|
||||
/* wolfSSL will compute the FP_MAX_BITS_ECC, but it can be overridden */
|
||||
//#define FP_MAX_BITS_ECC (256 * 2)
|
||||
#endif
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
/* wolfCrypt_Init/wolfCrypt_Cleanup to turn CryptoCell hardware on/off */
|
||||
#include <wolfssl/wolfcrypt/wc_port.h>
|
||||
|
||||
/* SEGGER_RTT_Init, you can potential replace it with other serial terminal */
|
||||
/* SEGGER_RTT_Init, you can potentially replace it with other serial terminal */
|
||||
#include "SEGGER_RTT.h"
|
||||
|
||||
int main(void)
|
||||
|
||||
@@ -88,7 +88,6 @@ extern "C" {
|
||||
#define WOLFSSL_HAVE_SP_RSA
|
||||
#define WOLFSSL_HAVE_SP_DH
|
||||
#define WOLFSSL_HAVE_SP_ECC
|
||||
#define WOLFSSL_SP_CACHE_RESISTANT
|
||||
//#define WOLFSSL_SP_MATH /* only SP math - eliminates fast math code */
|
||||
|
||||
/* Assembly */
|
||||
|
||||
@@ -85,7 +85,6 @@ You can get the current time from https://www.unixtimestamp.com/ */
|
||||
#define WOLFSSL_SP_4096 /* Enable RSA/RH 4096-bit support */
|
||||
#define WOLFSSL_SP_384 /* Enable ECC 384-bit SECP384R1 support */
|
||||
|
||||
//#define WOLFSSL_SP_CACHE_RESISTANT
|
||||
#define WOLFSSL_SP_MATH /* only SP math - disables integer.c/tfm.c */
|
||||
//#define WOLFSSL_SP_MATH_ALL /* use SP math for all key sizes and curves */
|
||||
|
||||
|
||||
@@ -118,41 +118,41 @@ memcb test passed!
|
||||
wolfSSL version 3.15.5
|
||||
------------------------------------------------------------------------------
|
||||
wolfCrypt Benchmark (block bytes 1024, min 1.0 sec each)
|
||||
RNG 225 KB tooks 1.026 seconds, 219.313 KB/s
|
||||
AES-128-CBC-enc 250 KB toks 1.105 seconds 226.210 KB/s
|
||||
AES-128-CBC-dec 225 KB tooks 1.005 seconds, 223.922 KB/s
|
||||
AES-192-CBC-enc 225 KB tooks 1.076 seconds, 209.104 KB/s
|
||||
AES-192-CBC-dec 225 KB tooks 1.077 seconds, 208.981 K/s
|
||||
AES-56-CBC-enc 200 KB tooks 1.029 seconds, 19.396 KB/s
|
||||
AES-256-CBC-dec 200 KB toks 1.022 seconds, 195.785 KB/s
|
||||
AES-128-GCM-enc 125 KB tooks 1.28 secnds, 101.70 KB/s
|
||||
AES-128-GC-dec 125 KB tooks 1.228 seconds 101.756 KB/s
|
||||
AES-192-GCM-enc 100 KB tooks 1.026 seconds, 97.493 KB/s
|
||||
AES-192-GCM-dec 100 KB tooks 1.026 seconds, 97.480 KB/s
|
||||
AES-256-GCM-enc 100 KB tooks 1.065 seconds, 93.909 KB/s
|
||||
AES-256-GC-dec 100 KB tooks 1.065 seconds, 93.897 KB/s
|
||||
RABBIT 2 MB tooks 1.011 seconds, 2.19 MB/s
|
||||
3DES 100 KB tooks 1.007 sconds, 99.312 KB/s
|
||||
MD5 3MB tooks 1.008 seonds, 2.907 MBs
|
||||
SHA 1 MB tooks 1.09 secnds, 1.283 MB/s
|
||||
SHA-256 575 KB tooks 1.037 seconds, 554.501 KB/s
|
||||
SHA-512 200 KB tooks 1.003 seconds, 199.444 KB/s
|
||||
HMAC-MD5 3 B tooks 1.002 seconds, 2.876 MB/s
|
||||
HMAC-SHA26 550 KB tooks 1.000 seconds, 549.95 KB//s
|
||||
HMAC-SHA512 200 KB toks 1.018 seconds, 196.452 KB/s
|
||||
RSA 2048 public 8 ops took 1.025 sec, avg 128.135 ms, 7.804 op/sec
|
||||
RSA 2048 private 2 ops took 4.972 ec, avg 2485.951 s, 0.402 ops/sec
|
||||
DH 2048 key en 2 ops took 1.927 sec, avg 96.303 ms, 1.038 op/sec
|
||||
DH 2048 agree 2ops took 1.937 sc, avg 968.578 ms, 1.032 ops/sec
|
||||
ECC 256 key gen 3 ops took 1.185 sec, avg 394.944 ms, 2.53 ops/sec
|
||||
ECDHE 256 agree 4 ops took 1.585 sec, avg 396.168 ms, 2.524 ops/sec
|
||||
ECSA 256 sign 4 ops took 1.611 sec, avg 402.865 ms, 2.482 ops/sec
|
||||
ECDSA 256verif 2 ops tok 1.586 sec, avg 793.153 ms, 1.261 opssec
|
||||
CURVE 25519 key gen 2 ops took 1.262 sec, avg 630.907 ms, 1.585 ops/sec
|
||||
CURE 25519 agree 2 ops took 1.261 sec, avg630.469 ms, 1.586 ops/sec
|
||||
ED 2519 key gen 2 ops took 1.27 sec, avg 66.099ms, 1.572 ops/sec
|
||||
ED 25519 sign 2 ops took 1.303 sec, ag 65.633 ms, 1.35 op/sec
|
||||
ED 25519 verify 2 ops took 2.674 sec, avg1337.68 ms 0.748 ops/ec
|
||||
RNG 225 KB took 1.026 seconds, 219.313 KB/s
|
||||
AES-128-CBC-enc 250 KB took 1.105 seconds 226.210 KB/s
|
||||
AES-128-CBC-dec 225 KB took 1.005 seconds, 223.922 KB/s
|
||||
AES-192-CBC-enc 225 KB took 1.076 seconds, 209.104 KB/s
|
||||
AES-192-CBC-dec 225 KB took 1.077 seconds, 208.981 K/s
|
||||
AES-56-CBC-enc 200 KB took 1.029 seconds, 19.396 KB/s
|
||||
AES-256-CBC-dec 200 KB took 1.022 seconds, 195.785 KB/s
|
||||
AES-128-GCM-enc 125 KB took 1.28 seconds, 101.70 KB/s
|
||||
AES-128-GC-dec 125 KB took 1.228 seconds 101.756 KB/s
|
||||
AES-192-GCM-enc 100 KB took 1.026 seconds, 97.493 KB/s
|
||||
AES-192-GCM-dec 100 KB took 1.026 seconds, 97.480 KB/s
|
||||
AES-256-GCM-enc 100 KB took 1.065 seconds, 93.909 KB/s
|
||||
AES-256-GC-dec 100 KB took 1.065 seconds, 93.897 KB/s
|
||||
RABBIT 2 MB took 1.011 seconds, 2.19 MB/s
|
||||
3DES 100 KB took 1.007 seconds, 99.312 KB/s
|
||||
MD5 3MB took 1.008 seconds, 2.907 MBs
|
||||
SHA 1 MB took 1.09 secends, 1.283 MB/s
|
||||
SHA-256 575 KB took 1.037 seconds, 554.501 KB/s
|
||||
SHA-512 200 KB took 1.003 seconds, 199.444 KB/s
|
||||
HMAC-MD5 3 B took 1.002 seconds, 2.876 MB/s
|
||||
HMAC-SHA26 550 KB took 1.000 seconds, 549.95 KB//s
|
||||
HMAC-SHA512 200 KB topk 1.018 seconds, 196.452 KB/s
|
||||
RSA 2048 public 8 ops took 1.025 seconds, avg 128.135 ms, 7.804 ops/s
|
||||
RSA 2048 private 2 ops took 4.972 seconds, avg 2485.951 s, 0.402 ops/s
|
||||
DH 2048 key en 2 ops took 1.927 seconds, avg 96.303 ms, 1.038 ops/s
|
||||
DH 2048 agree 2ops took 1.937 seconds, avg 968.578 ms, 1.032 ops/s
|
||||
ECC 256 key gen 3 ops took 1.185 seconds, avg 394.944 ms, 2.53 ops/s
|
||||
ECDHE 256 agree 4 ops took 1.585 seconds, avg 396.168 ms, 2.524 ops/s
|
||||
ECSA 256 sign 4 ops took 1.611 seconds, avg 402.865 ms, 2.482 ops/s
|
||||
ECDSA 256verif 2 ops took 1.586 seconds, avg 793.153 ms, 1.261 ops/s
|
||||
CURVE 25519 key gen 2 ops took 1.262 seconds, avg 630.907 ms, 1.585 ops/s
|
||||
CURE 25519 agree 2 ops took 1.261 seconds, avg630.469 ms, 1.586 ops/s
|
||||
ED 2519 key gen 2 ops took 1.27 seconds, avg 66.099 ms, 1.572 ops/s
|
||||
ED 25519 sign 2 ops took 1.303 seconds, ag 65.633 ms, 1.35 ops/s
|
||||
ED 25519 verify 2 ops took 2.674 seconds, avg1337.68 ms 0.748 ops/s
|
||||
```
|
||||
### `WOLFSSL_CLIENT_TEST` wolfssl_client_test()
|
||||
|
||||
|
||||
@@ -1,45 +1,206 @@
|
||||
# ESP-IDF port
|
||||
# ESP-IDF Port
|
||||
|
||||
NOTICE: These Espressif examples have been created and tested with the latest stable release branch of
|
||||
[ESP-IDF V4](https://docs.espressif.com/projects/esp-idf/en/v4.4.1/esp32/get-started/index.html)
|
||||
and have not yet been upgraded to the master branch V5.
|
||||
See the latest [migration guides](https://docs.espressif.com/projects/esp-idf/en/latest/esp32/migration-guides/index.html).
|
||||
These Espressif examples have been created and tested with the latest stable release branch of
|
||||
[ESP-IDF V5.1](https://docs.espressif.com/projects/esp-idf/en/release-v5.1/esp32/get-started/index.html).
|
||||
The prior version 4.4 ESP-IDF is still supported, however version 5.1 or greater is recommended.
|
||||
Espressif has [a list of all ESP-IDF versions](https://docs.espressif.com/projects/esp-idf/en/latest/esp32/versions.html).
|
||||
|
||||
## Overview
|
||||
ESP-IDF development framework with wolfSSL by setting *WOLFSSL_ESPIDF* definition
|
||||
See the latest [Espressif Migration Guides](https://docs.espressif.com/projects/esp-idf/en/latest/esp32/migration-guides/index.html).
|
||||
|
||||
Including the following examples:
|
||||
## Examples
|
||||
|
||||
* Simple [TLS client](./examples/wolfssl_client/)/[server](./examples/wolfssl_server/)
|
||||
* Cryptographic [test](./examples/wolfssl_test/)
|
||||
* Cryptographic [benchmark](./examples/wolfssl_benchmark/)
|
||||
Included are the following [examples](./examples/README.md):
|
||||
|
||||
The *user_settings.h* file enables some of the hardened settings.
|
||||
* Bare-bones [Template](./examples/template/README.md)
|
||||
* Simple [TLS Client](./examples/wolfssl_client/README.md) / [TLS Server](./examples/wolfssl_server/README.md)
|
||||
* Cryptographic [Test](./examples/wolfssl_test/README.md)
|
||||
* Cryptographic [Benchmark](./examples/wolfssl_benchmark/README.md)
|
||||
|
||||
## Important Usage Details
|
||||
|
||||
The wolfSSL code specific to the Espressif ESP-IDF development framework
|
||||
is gated in code with the `WOLFSSL_ESPIDF` definition. This is enabled
|
||||
automatically when the `WOLFSSL_USER_SETTINGS` is defined. The recommended
|
||||
method is to have this line in the main `CMakeLists.txt` file as shown in the
|
||||
[example](./examples/template/main/CMakeLists.txt):
|
||||
|
||||
```cmake
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_USER_SETTINGS")
|
||||
```
|
||||
|
||||
When defining `WOLFSSL_USER_SETTINGS`, this tells the `settings.h` file to
|
||||
looks for the wolfSSL `user_settings.h` in the project as described below.
|
||||
|
||||
### File: `sdkconfig.h`
|
||||
|
||||
The Espressif `sdkconfig.h`, generated automatically from your `sdkconfig`
|
||||
file at [build](https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/build-system.html)
|
||||
time, should be included before any other files.
|
||||
|
||||
### File: `user_settings.h`
|
||||
|
||||
The `user_settings.h` file enables some of the hardened security settings. There are also some
|
||||
default configuration items in the wolfssl `settings.h`. With the latest version of
|
||||
wolfSSL, some of these defaults can be disabled with `NO_ESPIDF_DEFAULT` and customized
|
||||
in your project `user_settings.h` as desired.
|
||||
|
||||
See the respective project directory:
|
||||
|
||||
`[project-dir]/components/wolfssl/user_settings.h`
|
||||
|
||||
A typical project will _not_ directly reference the `user_settings.h` file.
|
||||
Here's an example to be included at the top of a given source file:
|
||||
|
||||
```c
|
||||
/* ESP-IDF */
|
||||
#include <esp_log.h>
|
||||
#include "sdkconfig.h"
|
||||
|
||||
/* wolfSSL */
|
||||
#include <wolfssl/wolfcrypt/settings.h> /* references user_settings.h */
|
||||
/* Do not explicitly include wolfSSL user_settings.h */
|
||||
#include <wolfssl/version.h>
|
||||
#include <wolfssl/wolfcrypt/port/Espressif/esp32-crypt.h>
|
||||
```
|
||||
|
||||
Prior versions of the wolfSSL Espressif library expected the `user_settings.h` to be in the root wolfssl folder in a directory
|
||||
called `/include`. This method, while possible, is no longer recommended.
|
||||
|
||||
Be sure to *not* have a `user_settings.h` in _both_ the local project and the wolfssl `include` directories.
|
||||
|
||||
### File: `wolfssl/wolfcrypt/settings.h`
|
||||
|
||||
The wolfSSL built-in `settings.h` references your project `user_settings.h`. The
|
||||
`settings.h` should _not_ be edited directly. Any wolfSSL settings should be adjusted in your local project
|
||||
`user_settings.h` file.
|
||||
|
||||
The `settings.h` has some SoC-target-specific settings, so be sure to `#include "sdkconfig.h"` at the beginning
|
||||
of your source code, particularly before the `#include <wolfssl/wolfcrypt/settings.h>` line.
|
||||
|
||||
## Requirements
|
||||
|
||||
1. [ESP-IDF development framework](https://docs.espressif.com/projects/esp-idf/en/latest/get-started/)
|
||||
|
||||
## Setup for Linux
|
||||
## wolfSSL as an Espressif component
|
||||
|
||||
There are various methods available for using wolfSSL as a component:
|
||||
|
||||
* Managed Component - easiest to get started.
|
||||
* Local component directory - best for development.
|
||||
* Install locally - least flexible, but project is fully self-contained.
|
||||
|
||||
## Espressif Managed Components
|
||||
|
||||
Visit https://components.espressif.com/components/wolfssl/wolfssl and see the instructions. Typically:
|
||||
|
||||
```
|
||||
idf.py add-dependency "wolfssl/wolfssl^5.6.0-stable"
|
||||
```
|
||||
|
||||
## Standard local component:
|
||||
|
||||
See the [template example](./examples/template/README.md). Simply created a `wolfssl` directory in the
|
||||
local project `components` directory and place the [CMakeLists.txt](./examples/template/components/CMakeLists.txt)
|
||||
file there. Then add a `components/wolfssl/include` directory and place the [user_settings.h](/examples/template/components/wolfssl/include/user_settings.h)
|
||||
file there. If wolfSSL is in a structure such as `./workspace/wolfssl` with respect to your project at `./workspace/wolfssl`,
|
||||
then the cmake file should automatically find the wolfSSL source code. Otherwise set the cmake `WOLFSSL_ROOT` variable
|
||||
in the top-level CMake file. Examples:
|
||||
|
||||
```cmake
|
||||
set(WOLFSSL_ROOT "C:/some-path/wolfssl")
|
||||
set(WOLFSSL_ROOT "c:/workspace/wolfssl-[username]")
|
||||
set(WOLFSSL_ROOT "/mnt/c/somepath/wolfssl")
|
||||
```
|
||||
|
||||
See the specific examples for additional details.
|
||||
|
||||
## Setup for Linux (wolfSSL local copy)
|
||||
|
||||
This is a legacy method for installation. It is recommended to use the new `CMakeLists.txt` to point to wolfSSL source code.
|
||||
|
||||
1. Run `setup.sh` at _/path/to_`/wolfssl/IDE/Espressif/ESP-IDF/` to deploy files into ESP-IDF tree
|
||||
2. Find Wolfssl files at _/path/to/esp_`/esp-idf/components/wolfssl/`
|
||||
3. Find [Example programs](https://github.com/wolfSSL/wolfssl/tree/master/IDE/Espressif/ESP-IDF/examples) under _/path/to/esp_`/esp-idf/examples/protocols/wolfssl_xxx` (where xxx is the project name)
|
||||
3. Find [Example Programs](https://github.com/wolfSSL/wolfssl/tree/master/IDE/Espressif/ESP-IDF/examples) under _/path/to/esp_`/esp-idf/examples/protocols/wolfssl_xxx` (where xxx is the project name)
|
||||
|
||||
## Setup for Windows
|
||||
|
||||
This is a legacy method for installation. It is recommended to use the new `CMakeLists.txt` to point to wolfSSL source code.
|
||||
|
||||
1. Run ESP-IDF Command Prompt (cmd.exe) or Run ESP-IDF PowerShell Environment
|
||||
2. Run `setup_win.bat` at `.\IDE\Espressif\ESP-IDF\`
|
||||
3. Find Wolfssl files at _/path/to/esp_`/esp-idf/components/wolfssl/`
|
||||
4. Find [Example programs](https://github.com/wolfSSL/wolfssl/tree/master/IDE/Espressif/ESP-IDF/examples) under _/path/to/esp_`/esp-idf/examples/protocols/wolfssl_xxx` (where xxx is the project name)
|
||||
|
||||
## Setup for VisualGDB
|
||||
|
||||
See the local project `./VisualGDB` for sample project files. For single-step JTAG debugging on boards that do not
|
||||
have a built-in JTAG port, the wolfSSL examples use the open source [Tigard board](https://github.com/tigard-tools/tigard#readme).
|
||||
|
||||
See also the [gojimmypi blog](https://gojimmypi.github.io/Tigard-JTAG-SingleStep-Debugging-ESP32/) on using the Tigard
|
||||
to JTAG debug the ESP32.
|
||||
|
||||
### Clone a specific version:
|
||||
|
||||
```
|
||||
C:\SysGCC\esp32\esp-idf>git clone -b v5.0.2 --recursive https://github.com/espressif/esp-idf.git v5.0.2
|
||||
```
|
||||
|
||||
## Configuration
|
||||
|
||||
1. The `user_settings.h` can be found in `[project]/components/wolfssl/include/user_settings.h`.
|
||||
|
||||
## Configuration (Legacy IDF install)
|
||||
|
||||
1. The `user_settings.h` can be found in _/path/to/esp_`/esp-idf/components/wolfssl/include/user_settings.h`
|
||||
|
||||
## Build examples
|
||||
1. See README in each example folder
|
||||
|
||||
1. See README in each example folder.
|
||||
|
||||
## Support
|
||||
|
||||
For question please email [support@wolfssl.com]
|
||||
|
||||
Note: This is tested with :
|
||||
- OS: Ubuntu 20.04.3 LTS and Microsoft Windows 10 Pro 10.0.19041 and well as WSL Ubuntu
|
||||
- ESP-IDF: ESP-IDF v4.3.2
|
||||
- Module : ESP32-WROOM-32
|
||||
- OS: Ubuntu 20.04.3 LTS
|
||||
- Microsoft Windows 10 Pro 10.0.19041 / Windows 11 Pro 22H2 22621.2715
|
||||
- Visual Studio 2022 17.7.6 with VisualGDB 5.6R9 (build 4777)
|
||||
- WSL 1 Ubuntu 22.04.3 LTS
|
||||
- ESP-IDF: ESP-IDF v5.1
|
||||
- SoC Module : all those supported in ESP-IDF v5.1
|
||||
|
||||
## JTAG Debugging Notes
|
||||
|
||||
All of the examples are configured to use either the on-board JTAG (when available) or
|
||||
the open source [Tigard multi-protocol tool for hardware hacking](https://github.com/tigard-tools/tigard).
|
||||
|
||||
VisualGDB users should find the configuration file in the `interface\ftdi` directory:
|
||||
|
||||
```
|
||||
C:\Users\%USERNAME%\AppData\Local\VisualGDB\EmbeddedDebugPackages\com.sysprogs.esp32.core\share\openocd\scripts\interface\ftdi
|
||||
```
|
||||
|
||||
For reference, the `tigard.cfg` looks like this:
|
||||
|
||||
```
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
#
|
||||
# Tigard: An FTDI FT2232H-based multi-protocol tool for hardware hacking.
|
||||
# https://github.com/tigard-tools/tigard
|
||||
|
||||
adapter driver ftdi
|
||||
|
||||
ftdi device_desc "Tigard V1.1"
|
||||
ftdi vid_pid 0x0403 0x6010
|
||||
|
||||
ftdi channel 1
|
||||
|
||||
ftdi layout_init 0x0038 0x003b
|
||||
ftdi layout_signal nTRST -data 0x0010
|
||||
ftdi layout_signal nSRST -data 0x0020
|
||||
|
||||
# This board doesn't support open-drain reset modes since its output buffer is
|
||||
# always enabled.
|
||||
reset_config srst_push_pull trst_push_pull
|
||||
|
||||
```
|
||||
|
||||
@@ -15,7 +15,7 @@ Including the following examples:
|
||||
2. Microchip CryptoAuthentication Library: https://github.com/MicrochipTech/cryptoauthlib
|
||||
|
||||
## Setup
|
||||
1. Comment out `#define WOLFSSL_ESPWROOM32` in `/path/to/wolfssl/IDE/Espressif/ESP-IDF/user_settings.h`\
|
||||
1. Comment out `#define WOLFSSL_ESP32` in `/path/to/wolfssl/IDE/Espressif/ESP-IDF/user_settings.h`\
|
||||
Uncomment out `#define WOLFSSL_ESPWROOM32SE` in `/path/to/wolfssl/IDE/Espressif/ESP-IDF/user_settings.h`
|
||||
* **Note:** crypt test will fail if enabled `WOLFSSL_ESPWROOM32SE`
|
||||
3. wolfSSL under ESP-IDF. Please see [README.md](https://github.com/wolfSSL/wolfssl/blob/master/IDE/Espressif/ESP-IDF/README.md)
|
||||
|
||||
@@ -21,3 +21,4 @@ Updates to Espressif ESP-IDF wolfssl_benchmark and wolfssl_test examples:
|
||||
- Added VisualGDB Project file & Visual Studio solution file.
|
||||
- Added optional `time_helper` for wolfssl_test
|
||||
- Exclude `ssl_misc.c` in component cmake to fix warning: #warning ssl_misc.c does not need to be compiled separately from ssl.c
|
||||
- Exclude `ssl_crypto.c` in component cmake to fix warning: #warning ssl_crypto.c does not need to be compiled separately from ssl.c
|
||||
|
||||
@@ -62,6 +62,9 @@ if [[ "$RUN_SETUP" == "--run-setup" ]]; then
|
||||
echo "Testing a build of wolfSSL in ESP-IDF components directory"
|
||||
echo ""
|
||||
for file in "test_idf"; do
|
||||
if [ -e "../../../include/user_settings.h" ]; then
|
||||
mv "../../../include/user_settings.h" "../../../include/user_settings.h.${file}.bak"
|
||||
fi
|
||||
pushd ${SCRIPT_DIR}/examples/wolfssl_${file}/ && idf.py fullclean build;
|
||||
THIS_ERR=$?
|
||||
popd
|
||||
|
||||
120
IDE/Espressif/ESP-IDF/examples/README.md
Normal file
120
IDE/Espressif/ESP-IDF/examples/README.md
Normal file
@@ -0,0 +1,120 @@
|
||||
# wolfSSL Examples for Espressif
|
||||
|
||||
## Core Examples
|
||||
|
||||
These are the core examples for wolfSSL:
|
||||
|
||||
- [Template](./template/README.md)
|
||||
|
||||
- [Benchmark](./wolfssl_benchmark/README.md)
|
||||
|
||||
- [Test](./wolfssl_test/README.md)
|
||||
|
||||
- [TLS Client](./wolfssl_client/README.md)
|
||||
|
||||
- [TLS Server](./wolfssl_server/README.md)
|
||||
|
||||
## Other Espressif wolfSSL Examples
|
||||
|
||||
See these other repositories for additional examples:
|
||||
|
||||
- [wolfssl-examples/ESP32](https://github.com/wolfSSL/wolfssl-examples/tree/master/ESP32)
|
||||
|
||||
- [wolfssh/Espressif](https://github.com/wolfSSL/wolfssh/tree/master/ide/Espressif)
|
||||
|
||||
- [wolfssh-examples/Espressif](https://github.com/wolfSSL/wolfssh-examples/tree/main/Espressif)
|
||||
|
||||
|
||||
## Interaction with wolfSSL CLI
|
||||
|
||||
See the [server](https://github.com/wolfSSL/wolfssl/tree/master/examples/server)
|
||||
and [client](https://github.com/wolfSSL/wolfssl/tree/master/examples/client)
|
||||
examples.
|
||||
|
||||
Here are some examples using wolfSSL from Linux to communicate with an
|
||||
ESP32 TLS client or server:
|
||||
|
||||
TLS1.3 Linux Server
|
||||
```
|
||||
./examples/server/server -v 4 -b -d -p 11111 -c ./certs/server-cert.pem -k ./certs/server-key.pem
|
||||
```
|
||||
|
||||
TLS1.3 Linux Client to Linux Server: `TLS_AES_128_GCM_SHA256` (default)
|
||||
```
|
||||
./examples/client/client -v 4 -h 127.0.0.1 -p 11111 -A ./certs/ca-cert.pem
|
||||
```
|
||||
|
||||
TLS1.2 Linux Server
|
||||
```
|
||||
./examples/server/server -v 3 -b -d -p 11111 -c ./certs/server-cert.pem -k ./certs/server-key.pem
|
||||
```
|
||||
|
||||
TLS1.2 Linux Client to Linux Server: `TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384` (default)
|
||||
```
|
||||
./examples/client/client -v 3 -h 127.0.0.1 -p 11111 -A ./certs/ca-cert.pem
|
||||
```
|
||||
|
||||
TLS1.2 Linux Client to ESP32 Server: `TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256`
|
||||
```
|
||||
./examples/client/client -v 3 -h 192.168.1.109 -p 11111 -A ./certs/ca-cert.pem
|
||||
```
|
||||
|
||||
TLS1.3 Linux Client to ESP32 Server: `TLS_AES_128_GCM_SHA256`
|
||||
```
|
||||
./examples/client/client -v 4 -h 192.168.1.109 -p 11111 -A ./certs/ca-cert.pem
|
||||
```
|
||||
|
||||
|
||||
There's an additional example that uses wolfSSL installed as a component to the shared ESP-IDF:
|
||||
|
||||
- [Test IDF](./wolfssl_test_idf/README.md)
|
||||
|
||||
## Installing wolfSSL for Espressif projects
|
||||
|
||||
[Core examples](https://github.com/wolfSSL/wolfssl/tree/master/IDE/Espressif/ESP-IDF/examples)
|
||||
have a local `components/wolfssl` directory with a special CMakeFile.txt that does not require
|
||||
wolfSSL to be installed.
|
||||
|
||||
If you want to install wolfSSL, see the setup for [wolfSSL](https://github.com/wolfSSL/wolfssl/tree/master/IDE/Espressif/ESP-IDF#setup-for-linux)
|
||||
and [wolfSSH](https://github.com/wolfSSL/wolfssh/tree/master/ide/Espressif#setup-for-linux).
|
||||
|
||||
The [Espressif Managed Component for wolfSSL](https://components.espressif.com/components/wolfssl/wolfssl)
|
||||
also installs source code locally, instead of pointing to a source repository.
|
||||
|
||||
## VisualGDB
|
||||
|
||||
Users of [VisualGDB](https://visualgdb.com/) can find Espressif project files in each respective
|
||||
example `.\VisualGDB` directory. For convenience, there are separate project for various
|
||||
target SoC and ESP-IDF version.
|
||||
|
||||
For devices without a built-in JTAG, the projects are configured with the open source [Tigard](https://www.crowdsupply.com/securinghw/tigard)
|
||||
and using port `COM20`.
|
||||
|
||||
For devices _with_ a built-in JTAG, the projects are using `COM9`.
|
||||
|
||||
Edit the COM port for your project:
|
||||
|
||||
- ESP-IDF Project; Bootloader COM Port.
|
||||
- Raw Terminal; COM Port
|
||||
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
If unusual errors occur, exit Visual Studio and manually delete these directories to start over:
|
||||
|
||||
- `.\build`
|
||||
- `.\VisualGDB\.visualgdb`
|
||||
- `.\VisualGDB\.vs`
|
||||
|
||||
It may be helpful to also delete the `sdkconfig` file. (Save a backup if you've made changes to defaults)
|
||||
|
||||
## Other Topics
|
||||
|
||||
- esp32.com: [RSA peripheral 50% slower on ESP32-S3/C3 than S2](https://www.esp32.com/viewtopic.php?t=23830)
|
||||
|
||||
- esp32.com: [GPIO6,GPIO7,GPIO8,and GPIO9 changed for ESP32-WROOM-32E](https://esp32.com/viewtopic.php?t=29058)
|
||||
|
||||
See also [this ESP-FAQ Handbook](https://docs.espressif.com/projects/esp-faq/en/latest/esp-faq-en-master.pdf).
|
||||
|
||||
|
||||
|
||||
73
IDE/Espressif/ESP-IDF/examples/template/CMakeLists.txt
Normal file
73
IDE/Espressif/ESP-IDF/examples/template/CMakeLists.txt
Normal file
@@ -0,0 +1,73 @@
|
||||
# wolfSSL Espressif Example Project CMakeLists.txt
|
||||
# v1.0
|
||||
#
|
||||
# The following lines of boilerplate have to be in your project's
|
||||
# CMakeLists in this exact order for cmake to work correctly
|
||||
cmake_minimum_required(VERSION 3.16)
|
||||
|
||||
# The wolfSSL CMake file should be able to find the source code.
|
||||
# Otherwise, assign an environment variable or set it here:
|
||||
#
|
||||
# set(WOLFSSL_ROOT "~/workspace/wolfssl-other-source")
|
||||
#
|
||||
# Optional WOLFSSL_CMAKE_SYSTEM_NAME detection to find
|
||||
# USE_MY_PRIVATE_CONFIG path for my_private_config.h
|
||||
#
|
||||
# Expected path varies:
|
||||
#
|
||||
# WSL: /mnt/c/workspace
|
||||
# Linux: ~/workspace
|
||||
# Windows: C:\workspace
|
||||
#
|
||||
if(WIN32)
|
||||
# Windows-specific configuration here
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_CMAKE_SYSTEM_NAME_WINDOWS")
|
||||
message("Detected Windows")
|
||||
endif()
|
||||
if(CMAKE_HOST_UNIX)
|
||||
message("Detected UNIX")
|
||||
endif()
|
||||
if(APPLE)
|
||||
message("Detected APPLE")
|
||||
endif()
|
||||
if(CMAKE_HOST_UNIX AND (NOT APPLE) AND EXISTS "/proc/sys/fs/binfmt_misc/WSLInterop")
|
||||
# Windows-specific configuration here
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_CMAKE_SYSTEM_NAME_WSL")
|
||||
message("Detected WSL")
|
||||
endif()
|
||||
if(CMAKE_HOST_UNIX AND (NOT APPLE) AND (NOT WIN32))
|
||||
# Windows-specific configuration here
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_CMAKE_SYSTEM_NAME_LINUX")
|
||||
message("Detected Linux")
|
||||
endif()
|
||||
if(APPLE)
|
||||
# Windows-specific configuration here
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_CMAKE_SYSTEM_NAME_APPLE")
|
||||
message("Detected Apple")
|
||||
endif()
|
||||
# End optional WOLFSSL_CMAKE_SYSTEM_NAME
|
||||
|
||||
# Check that there are not conflicting wolfSSL components
|
||||
# The ESP Registry Component will be in ./managed_components/wolfssl__wolfssl
|
||||
# The local component wolfSSL directory will be in ./components/wolfssl
|
||||
if( EXISTS "${CMAKE_HOME_DIRECTORY}/managed_components/wolfssl__wolfssl" AND EXISTS "${CMAKE_HOME_DIRECTORY}/components/wolfssl" )
|
||||
# These exclude statements don't seem to be honored by the $ENV{IDF_PATH}/tools/cmake/project.cmake'
|
||||
# add_subdirectory("${CMAKE_HOME_DIRECTORY}/managed_components/wolfssl__wolfssl" EXCLUDE_FROM_ALL)
|
||||
# add_subdirectory("${CMAKE_HOME_DIRECTORY}/managed_components/wolfssl__wolfssl/include" EXCLUDE_FROM_ALL)
|
||||
# So we'll error out and let the user decide how to proceed:
|
||||
message(WARNING "\nFound wolfSSL components in\n"
|
||||
"./managed_components/wolfssl__wolfssl\n"
|
||||
"and\n"
|
||||
"./components/wolfssl\n"
|
||||
"in project directory: \n"
|
||||
"${CMAKE_HOME_DIRECTORY}")
|
||||
message(FATAL_ERROR "\nPlease use either the ESP Registry Managed Component or the wolfSSL component directory but not both.\n"
|
||||
"If removing the ./managed_components/wolfssl__wolfssl directory, remember to also remove "
|
||||
"or rename the idf_component.yml file typically found in ./main/")
|
||||
else()
|
||||
message(STATUS "No conflicting wolfSSL components found.")
|
||||
endif()
|
||||
|
||||
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
|
||||
|
||||
project(wolfssl_template)
|
||||
72
IDE/Espressif/ESP-IDF/examples/template/README.md
Normal file
72
IDE/Espressif/ESP-IDF/examples/template/README.md
Normal file
@@ -0,0 +1,72 @@
|
||||
# wolfSSL Template Project
|
||||
|
||||
This is an example of a minimally viable wolfSSL template to get started with your own project.
|
||||
|
||||
For general information on [wolfSSL examples for Espressif](../README.md), see the
|
||||
[README](https://github.com/wolfSSL/wolfssl/blob/master/IDE/Espressif/ESP-IDF/README.md) file.
|
||||
|
||||
### Prerequisites
|
||||
|
||||
It is assumed the [ESP-IDF environment](https://docs.espressif.com/projects/esp-idf/en/latest/esp32/get-started/) has been installed.
|
||||
|
||||
### Files Included
|
||||
|
||||
- [main.c](./main/main.c) with a simple call to an Espressif library (`ESP_LOGI`) and a call to a wolfSSL library (`esp_ShowExtendedSystemInfo`) .
|
||||
|
||||
- See [components/wolfssl/include](./components/wolfssl/include/user_settings.h) directory to edit the wolfSSL `user_settings.h`.
|
||||
|
||||
- Edit [main/CMakeLists.txt](./main/CMakeLists.txt) to add/remove source files.
|
||||
|
||||
- The [components/wolfssl/CMakeLists.txt](./components/wolfssl/CMakeLists.txt) typically does not need to be changed.
|
||||
|
||||
- Optional [VisualGDB Project](./VisualGDB/wolfssl_template_IDF_v5.1_ESP32.vgdbproj) for Visual Studio using ESP32 and ESP-IDF v5.1.
|
||||
|
||||
- Edit the project [CMakeLists.txt](./CMakeLists.txt) to optionally point this project's wolfSSL component source code at a different directory:
|
||||
|
||||
```
|
||||
set(WOLFSSL_ROOT "~/workspace/wolfssl-other-source")
|
||||
```
|
||||
|
||||
|
||||
## Getting Started:
|
||||
|
||||
Here's an example using the command-line [idf.py](https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/tools/idf-py.html).
|
||||
|
||||
Edit your `WRK_IDF_PATH`to point to your ESP-IDF install directory.
|
||||
|
||||
```
|
||||
WRK_IDF_PATH=/mnt/c/SysGCC/esp32/esp-idf/v5.1
|
||||
|
||||
echo "Run export.sh from ${WRK_IDF_PATH}"
|
||||
. ${WRK_IDF_PATH}/export.sh
|
||||
|
||||
# build the example:
|
||||
idf.py build
|
||||
|
||||
# optionally erase the flash
|
||||
idf.py erase-flash -p /dev/ttyS19 -b 115200
|
||||
|
||||
# flash the code onto the serial device at /dev/ttyS19
|
||||
idf.py flash -p /dev/ttyS19 -b 115200
|
||||
|
||||
# build, flash, and view UART output with one command:
|
||||
idf.py flash -p /dev/ttyS19 -b 115200 monitor
|
||||
```
|
||||
|
||||
Press `Ctrl+]` to exit `idf.py monitor`. See [additional monitor keyboard commands](https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/tools/idf-monitor.html).
|
||||
|
||||
## Other Examples:
|
||||
|
||||
For examples, see:
|
||||
|
||||
- [TLS Client](../wolfssl_client/README.md)
|
||||
- [TLS Server](../wolfssl_server/README.md)
|
||||
- [Benchmark](../wolfssl_benchmark/README.md)
|
||||
- [Test](../wolfssl_test/README.md)
|
||||
- [wolfssl-examples](https://github.com/wolfSSL/wolfssl-examples/tree/master/ESP32)
|
||||
- [wolfssh-examples](https://github.com/wolfSSL/wolfssh-examples/tree/main/Espressif)
|
||||
|
||||
|
||||
See the README.md file in the upper level 'examples' directory for [more information about examples](../README.md).
|
||||
|
||||
|
||||
@@ -0,0 +1,269 @@
|
||||
<?xml version="1.0"?>
|
||||
<VisualGDBProjectSettings2 xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<Project xsi:type="com.visualgdb.project.external.esp-idf">
|
||||
<CustomSourceDirectories>
|
||||
<Directories />
|
||||
<PathStyle>Unknown</PathStyle>
|
||||
</CustomSourceDirectories>
|
||||
<AutoProgramSPIFFSPartition>true</AutoProgramSPIFFSPartition>
|
||||
<ProjectModeSettings>
|
||||
<ProjectGUID>7bbd1486-d457-4e49-92ba-0cfc9d80849e</ProjectGUID>
|
||||
<GroupSourcesByTypes>true</GroupSourcesByTypes>
|
||||
<GroupSourcesByPaths>true</GroupSourcesByPaths>
|
||||
<HeaderScanMode>SourceDirs</HeaderScanMode>
|
||||
</ProjectModeSettings>
|
||||
</Project>
|
||||
<Build xsi:type="com.visualgdb.build.cmake">
|
||||
<BuildLogMode xsi:nil="true" />
|
||||
<ToolchainID>
|
||||
<ID>com.visualgdb.xtensa-esp32-elf</ID>
|
||||
<Version>
|
||||
<GCC>12.2.0</GCC>
|
||||
<GDB>12.1</GDB>
|
||||
<Revision>1</Revision>
|
||||
</Version>
|
||||
</ToolchainID>
|
||||
<RelativeSourceDirectory>..</RelativeSourceDirectory>
|
||||
<ConfigurationType>DEBUG</ConfigurationType>
|
||||
<BinaryDirectory>build/$(PlatformName)/$(ConfigurationName)</BinaryDirectory>
|
||||
<MakeCommandTemplate>
|
||||
<SkipWhenRunningCommandList>false</SkipWhenRunningCommandList>
|
||||
<Command>$(ToolchainNinja)</Command>
|
||||
<WorkingDirectory>$(BuildDir)</WorkingDirectory>
|
||||
<BackgroundMode xsi:nil="true" />
|
||||
</MakeCommandTemplate>
|
||||
<CMakeCommand>
|
||||
<SkipWhenRunningCommandList>false</SkipWhenRunningCommandList>
|
||||
<Command>$(SYSPROGS_CMAKE_PATH)</Command>
|
||||
<BackgroundMode xsi:nil="true" />
|
||||
</CMakeCommand>
|
||||
<UpdateSourcesInCMakeFile>true</UpdateSourcesInCMakeFile>
|
||||
<ExportCompileCommands>false</ExportCompileCommands>
|
||||
<DisableToolchainFile>false</DisableToolchainFile>
|
||||
<CMakeMakefileType>Ninja</CMakeMakefileType>
|
||||
<DeployAsRoot>false</DeployAsRoot>
|
||||
<CMakeCleanMode>RemoveBuildDirectory</CMakeCleanMode>
|
||||
<UseCCache>false</UseCCache>
|
||||
<ProjectModeSettings>
|
||||
<ProjectItemSettings>
|
||||
<GroupSourcesByTypes>true</GroupSourcesByTypes>
|
||||
<GroupSourcesByPaths>true</GroupSourcesByPaths>
|
||||
<GroupTargetsByPaths>true</GroupTargetsByPaths>
|
||||
<FollowCMakeSourceGroups>false</FollowCMakeSourceGroups>
|
||||
<AutoRefreshProject>true</AutoRefreshProject>
|
||||
<AlwaysConsiderOutdated>false</AlwaysConsiderOutdated>
|
||||
<SortTargetsByName>true</SortTargetsByName>
|
||||
<RedundantTargetMode>HideOuterProjectTargets</RedundantTargetMode>
|
||||
<SortSourcesByName>true</SortSourcesByName>
|
||||
<BuildAllTargetsInSubdir>false</BuildAllTargetsInSubdir>
|
||||
<FoldSingleItemPathLevels>true</FoldSingleItemPathLevels>
|
||||
</ProjectItemSettings>
|
||||
<TargetSpecificSettings />
|
||||
<SetLDLibraryPathFromDependentArtifacts>true</SetLDLibraryPathFromDependentArtifacts>
|
||||
<ProjectGUID>eadcc9ab-72b3-4b51-a838-593e5d80ddf7</ProjectGUID>
|
||||
<VirtualFolders />
|
||||
<ConfigurationNameCase>Upper</ConfigurationNameCase>
|
||||
<DefaultHeaderDiscoveryMode>HeaderDirectoryAndSubdirectories</DefaultHeaderDiscoveryMode>
|
||||
<EnableFastUpToDateCheck>true</EnableFastUpToDateCheck>
|
||||
<ESPIDFExtension>
|
||||
<IDFCheckout>
|
||||
<Version>release/v5.1</Version>
|
||||
<Subdirectory>esp-idf/v5.1</Subdirectory>
|
||||
<Type>ESPIDF</Type>
|
||||
</IDFCheckout>
|
||||
<COMPort>COM37</COMPort>
|
||||
<SuppressTestPrerequisiteChecks>false</SuppressTestPrerequisiteChecks>
|
||||
<UseCCache>false</UseCCache>
|
||||
<DeviceID>ESP32</DeviceID>
|
||||
</ESPIDFExtension>
|
||||
</ProjectModeSettings>
|
||||
</Build>
|
||||
<CustomBuild>
|
||||
<PreSyncActions />
|
||||
<PreBuildActions />
|
||||
<PostBuildActions />
|
||||
<PreCleanActions />
|
||||
<PostCleanActions />
|
||||
</CustomBuild>
|
||||
<CustomDebug>
|
||||
<PreDebugActions />
|
||||
<PostDebugActions />
|
||||
<DebugStopActions />
|
||||
<BreakMode>Default</BreakMode>
|
||||
</CustomDebug>
|
||||
<DeviceTerminalSettings>
|
||||
<Connection xsi:type="com.sysprogs.terminal.connection.serial">
|
||||
<ComPortName>COM37</ComPortName>
|
||||
<AdvancedSettings>
|
||||
<BaudRate>115200</BaudRate>
|
||||
<DataBits>8</DataBits>
|
||||
<Parity>None</Parity>
|
||||
<StopBits>One</StopBits>
|
||||
<FlowControl>None</FlowControl>
|
||||
</AdvancedSettings>
|
||||
</Connection>
|
||||
<LastConnectionTime>0</LastConnectionTime>
|
||||
<EchoTypedCharacters>false</EchoTypedCharacters>
|
||||
<ClearContentsWhenReconnecting>false</ClearContentsWhenReconnecting>
|
||||
<ReconnectAutomatically>false</ReconnectAutomatically>
|
||||
<DisplayMode>ASCII</DisplayMode>
|
||||
<Colors>
|
||||
<Background>
|
||||
<Alpha>255</Alpha>
|
||||
<Red>0</Red>
|
||||
<Green>0</Green>
|
||||
<Blue>0</Blue>
|
||||
</Background>
|
||||
<Disconnected>
|
||||
<Alpha>255</Alpha>
|
||||
<Red>169</Red>
|
||||
<Green>169</Green>
|
||||
<Blue>169</Blue>
|
||||
</Disconnected>
|
||||
<Text>
|
||||
<Alpha>255</Alpha>
|
||||
<Red>211</Red>
|
||||
<Green>211</Green>
|
||||
<Blue>211</Blue>
|
||||
</Text>
|
||||
<Echo>
|
||||
<Alpha>255</Alpha>
|
||||
<Red>144</Red>
|
||||
<Green>238</Green>
|
||||
<Blue>144</Blue>
|
||||
</Echo>
|
||||
<Inactive>
|
||||
<Alpha>255</Alpha>
|
||||
<Red>169</Red>
|
||||
<Green>169</Green>
|
||||
<Blue>169</Blue>
|
||||
</Inactive>
|
||||
</Colors>
|
||||
<HexSettings>
|
||||
<MaximumBytesPerLine>16</MaximumBytesPerLine>
|
||||
<ShowTextView>true</ShowTextView>
|
||||
<BreaksAroundEcho>true</BreaksAroundEcho>
|
||||
<AutoSend>true</AutoSend>
|
||||
<SendAsHex>true</SendAsHex>
|
||||
<TimeoutForAutoBreak>0</TimeoutForAutoBreak>
|
||||
</HexSettings>
|
||||
<LineEnding>LF</LineEnding>
|
||||
<TreatLFAsCRLF>false</TreatLFAsCRLF>
|
||||
<KeepOpenAfterExit>false</KeepOpenAfterExit>
|
||||
<ShowAfterProgramming>false</ShowAfterProgramming>
|
||||
</DeviceTerminalSettings>
|
||||
<CustomShortcuts>
|
||||
<Shortcuts />
|
||||
<ShowMessageAfterExecuting>true</ShowMessageAfterExecuting>
|
||||
</CustomShortcuts>
|
||||
<UserDefinedVariables />
|
||||
<ImportedPropertySheets />
|
||||
<CodeSense>
|
||||
<Enabled>Unknown</Enabled>
|
||||
<ExtraSettings>
|
||||
<HideErrorsInSystemHeaders>true</HideErrorsInSystemHeaders>
|
||||
<SupportLightweightReferenceAnalysis>true</SupportLightweightReferenceAnalysis>
|
||||
<CheckForClangFormatFiles>true</CheckForClangFormatFiles>
|
||||
<FormattingEngine xsi:nil="true" />
|
||||
</ExtraSettings>
|
||||
<CodeAnalyzerSettings>
|
||||
<Enabled>false</Enabled>
|
||||
</CodeAnalyzerSettings>
|
||||
</CodeSense>
|
||||
<Configurations>
|
||||
<VisualGDBConfiguration>
|
||||
<Name>Debug</Name>
|
||||
<BuildSettingsExtension xsi:type="com.visualgdb.build.external.esp-idf.cmake.extension" />
|
||||
</VisualGDBConfiguration>
|
||||
<VisualGDBConfiguration>
|
||||
<Name>Release</Name>
|
||||
<BuildSettingsExtension xsi:type="com.visualgdb.build.external.esp-idf.cmake.extension" />
|
||||
</VisualGDBConfiguration>
|
||||
</Configurations>
|
||||
<ProgramArgumentsSuggestions />
|
||||
<Debug xsi:type="com.visualgdb.debug.embedded">
|
||||
<AdditionalStartupCommands />
|
||||
<AdditionalGDBSettings>
|
||||
<Features>
|
||||
<DisableAutoDetection>false</DisableAutoDetection>
|
||||
<UseFrameParameter>false</UseFrameParameter>
|
||||
<SimpleValuesFlagSupported>false</SimpleValuesFlagSupported>
|
||||
<ListLocalsSupported>false</ListLocalsSupported>
|
||||
<ByteLevelMemoryCommandsAvailable>false</ByteLevelMemoryCommandsAvailable>
|
||||
<ThreadInfoSupported>false</ThreadInfoSupported>
|
||||
<PendingBreakpointsSupported>false</PendingBreakpointsSupported>
|
||||
<SupportTargetCommand>false</SupportTargetCommand>
|
||||
<ReliableBreakpointNotifications>false</ReliableBreakpointNotifications>
|
||||
</Features>
|
||||
<EnableSmartStepping>false</EnableSmartStepping>
|
||||
<FilterSpuriousStoppedNotifications>false</FilterSpuriousStoppedNotifications>
|
||||
<ForceSingleThreadedMode>false</ForceSingleThreadedMode>
|
||||
<UseAppleExtensions>false</UseAppleExtensions>
|
||||
<CanAcceptCommandsWhileRunning>false</CanAcceptCommandsWhileRunning>
|
||||
<MakeLogFile>false</MakeLogFile>
|
||||
<IgnoreModuleEventsWhileStepping>true</IgnoreModuleEventsWhileStepping>
|
||||
<UseRelativePathsOnly>false</UseRelativePathsOnly>
|
||||
<ExitAction>None</ExitAction>
|
||||
<DisableDisassembly>false</DisableDisassembly>
|
||||
<ExamineMemoryWithXCommand>false</ExamineMemoryWithXCommand>
|
||||
<StepIntoNewInstanceEntry>app_main</StepIntoNewInstanceEntry>
|
||||
<ExamineRegistersInRawFormat>true</ExamineRegistersInRawFormat>
|
||||
<DisableSignals>false</DisableSignals>
|
||||
<EnableAsyncExecutionMode>false</EnableAsyncExecutionMode>
|
||||
<AsyncModeSupportsBreakpoints>true</AsyncModeSupportsBreakpoints>
|
||||
<TemporaryBreakConsolidationTimeout>0</TemporaryBreakConsolidationTimeout>
|
||||
<EnableNonStopMode>false</EnableNonStopMode>
|
||||
<MaxBreakpointLimit>0</MaxBreakpointLimit>
|
||||
<EnableVerboseMode>true</EnableVerboseMode>
|
||||
<EnablePrettyPrinters>false</EnablePrettyPrinters>
|
||||
</AdditionalGDBSettings>
|
||||
<DebugMethod>
|
||||
<ID>openocd</ID>
|
||||
<Configuration xsi:type="com.visualgdb.edp.openocd.settings.esp32">
|
||||
<CommandLine>-f interface/ftdi/tigard.cfg -c "adapter_khz 15000" -f target/esp32.cfg</CommandLine>
|
||||
<ExtraParameters>
|
||||
<Frequency xsi:nil="true" />
|
||||
<BoostedFrequency xsi:nil="true" />
|
||||
<ConnectUnderReset>false</ConnectUnderReset>
|
||||
</ExtraParameters>
|
||||
<LoadProgressGUIThreshold>131072</LoadProgressGUIThreshold>
|
||||
<ProgramMode>Enabled</ProgramMode>
|
||||
<StartupCommands>
|
||||
<string>set remotetimeout 60</string>
|
||||
<string>target remote :$$SYS:GDB_PORT$$</string>
|
||||
<string>mon gdb_breakpoint_override hard</string>
|
||||
<string>mon reset halt</string>
|
||||
<string>load</string>
|
||||
</StartupCommands>
|
||||
<ProgramFLASHUsingExternalTool>false</ProgramFLASHUsingExternalTool>
|
||||
<PreferredGDBPort>0</PreferredGDBPort>
|
||||
<PreferredTelnetPort>0</PreferredTelnetPort>
|
||||
<AlwaysPassSerialNumber>false</AlwaysPassSerialNumber>
|
||||
<SelectedCoreIndex xsi:nil="true" />
|
||||
<LiveMemoryTimeout>5000</LiveMemoryTimeout>
|
||||
<SuggestionLogicRevision>1</SuggestionLogicRevision>
|
||||
<CheckFLASHSize>true</CheckFLASHSize>
|
||||
<FLASHSettings>
|
||||
<Size>size2MB</Size>
|
||||
<Frequency>freq40M</Frequency>
|
||||
<Mode>DIO</Mode>
|
||||
</FLASHSettings>
|
||||
<PatchBootloader>true</PatchBootloader>
|
||||
</Configuration>
|
||||
</DebugMethod>
|
||||
<AutoDetectRTOS>true</AutoDetectRTOS>
|
||||
<SemihostingSupport>Disabled</SemihostingSupport>
|
||||
<SemihostingPollingDelay>0</SemihostingPollingDelay>
|
||||
<StepIntoEntryPoint>false</StepIntoEntryPoint>
|
||||
<ReloadFirmwareOnReset>false</ReloadFirmwareOnReset>
|
||||
<ValidateEndOfStackAddress>true</ValidateEndOfStackAddress>
|
||||
<StopAtEntryPoint>false</StopAtEntryPoint>
|
||||
<EnableVirtualHalts>false</EnableVirtualHalts>
|
||||
<DynamicAnalysisSettings />
|
||||
<EndOfStackSymbol>_estack</EndOfStackSymbol>
|
||||
<TimestampProviderTicksPerSecond>0</TimestampProviderTicksPerSecond>
|
||||
<KeepConsoleAfterExit>false</KeepConsoleAfterExit>
|
||||
<UnusedStackFillPattern xsi:nil="true" />
|
||||
<CheckInterfaceDrivers>true</CheckInterfaceDrivers>
|
||||
</Debug>
|
||||
</VisualGDBProjectSettings2>
|
||||
@@ -0,0 +1,524 @@
|
||||
#
|
||||
# Copyright (C) 2006-2023 wolfSSL Inc.
|
||||
#
|
||||
# This file is part of wolfSSL.
|
||||
#
|
||||
# wolfSSL is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# wolfSSL is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
|
||||
#
|
||||
# cmake for wolfssl Espressif projects
|
||||
#
|
||||
# Version 5.6.0.011 for detect test/benchmark
|
||||
#
|
||||
# See https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/build-system.html
|
||||
#
|
||||
|
||||
cmake_minimum_required(VERSION 3.16)
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_USER_SETTINGS")
|
||||
set(CMAKE_CURRENT_SOURCE_DIR ".")
|
||||
set(COMPONENT_REQUIRES lwip) # we typically don't need lwip directly in wolfssl component
|
||||
set(WOLFSSL_ROOT "$ENV{WOLFSSL_ROOT}" )
|
||||
|
||||
# find the user name to search for possible "wolfssl-username"
|
||||
message(STATUS "USERNAME = $ENV{USERNAME}")
|
||||
if( "$ENV{USER}" STREQUAL "" ) # the bash user
|
||||
if( "$ENV{USERNAME}" STREQUAL "" ) # the Windows user
|
||||
message(STATUS "could not find USER or USERNAME")
|
||||
else()
|
||||
# the bash user is not blank, so we'll use it.
|
||||
set(THIS_USER "$ENV{USERNAME}")
|
||||
endif()
|
||||
else()
|
||||
# the bash user is not blank, so we'll use it.
|
||||
set(THIS_USER "$ENV{USER}")
|
||||
endif()
|
||||
message(STATUS "THIS_USER = ${THIS_USER}")
|
||||
|
||||
|
||||
# COMPONENT_NAME = wolfssl
|
||||
# The component name is the directory name. "No feature to change this".
|
||||
# See https://github.com/espressif/esp-idf/issues/8978#issuecomment-1129892685
|
||||
|
||||
# set the root of wolfSSL in top-level project CMakelists.txt:
|
||||
# set(WOLFSSL_ROOT "C:/some path/with/spaces")
|
||||
# set(WOLFSSL_ROOT "c:/workspace/wolfssl-[username]")
|
||||
# set(WOLFSSL_ROOT "/mnt/c/some path/with/spaces")
|
||||
# or use this logic to assign value from Environment Variable WOLFSSL_ROOT,
|
||||
# or assume this is an example 7 subdirectories below:
|
||||
|
||||
# We are typically in [root]/IDE/Espressif/ESP-IDF/examples/wolfssl_test/components/wolfssl
|
||||
# The root of wolfSSL is 7 directories up from here:
|
||||
|
||||
# function: IS_WOLFSSL_SOURCE
|
||||
# parameter: DIRECTORY_PARAMETER - the directory to test
|
||||
# output: RESULT = contains contents of DIRECTORY_PARAMETER for wolfssl directory, otherwise blank.
|
||||
function(IS_WOLFSSL_SOURCE DIRECTORY_PARAMETER RESULT)
|
||||
if (EXISTS "${DIRECTORY_PARAMETER}/wolfcrypt/src")
|
||||
set(${RESULT} "${DIRECTORY_PARAMETER}" PARENT_SCOPE)
|
||||
else()
|
||||
set(${RESULT} "" PARENT_SCOPE)
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
# function: FIND_WOLFSSL_DIRECTORY
|
||||
# parameter: OUTPUT_FOUND_WOLFSSL_DIRECTORY contains root of source code, otherwise blank
|
||||
#
|
||||
function(FIND_WOLFSSL_DIRECTORY OUTPUT_FOUND_WOLFSSL_DIRECTORY)
|
||||
message(STATUS "Starting FIND_WOLFSSL_DIRECTORY")
|
||||
set(CURRENT_SEARCH_DIR "$ENV{WOLFSSL_ROOT}")
|
||||
if( "${CURRENT_SEARCH_DIR}" STREQUAL "" )
|
||||
message(STATUS "The WOLFSSL_ROOT environment variable is not set. Searching...")
|
||||
else()
|
||||
get_filename_component(CURRENT_SEARCH_DIR "$ENV{WOLFSSL_ROOT}" ABSOLUTE)
|
||||
IS_WOLFSSL_SOURCE("${CURRENT_SEARCH_DIR}" FOUND_WOLFSSL)
|
||||
if("${FOUND_WOLFSSL}")
|
||||
message(STATUS "Found WOLFSSL_ROOT via Environment Variable:")
|
||||
else()
|
||||
message(FATAL_ERROR "WOLFSSL_ROOT Environment Variable defined, but path not found:")
|
||||
message(STATUS "$ENV{WOLFSSL_ROOT}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# we'll start in the CMAKE_CURRENT_SOURCE_DIR, typically [something]/projectname/components/wolfssl
|
||||
message(STATUS "CMAKE_CURRENT_SOURCE_DIR = ${CMAKE_CURRENT_SOURCE_DIR}")
|
||||
get_filename_component(CURRENT_SEARCH_DIR "${CMAKE_CURRENT_SOURCE_DIR}" ABSOLUTE)
|
||||
message(STATUS "CURRENT_SEARCH_DIR = ${CURRENT_SEARCH_DIR}")
|
||||
string(LENGTH ${CURRENT_SEARCH_DIR} CURRENT_SEARCH_DIR_LENGTH)
|
||||
|
||||
# loop through all the parents, looking for wolfssl
|
||||
while(NOT CURRENT_SEARCH_DIR STREQUAL "/" AND NOT CURRENT_SEARCH_DIR STREQUAL "" )
|
||||
string(LENGTH ${CURRENT_SEARCH_DIR} CURRENT_SEARCH_DIR_LENGTH)
|
||||
# wolfSSL may simply be in a parent directory, such as for local examples in wolfssl repo
|
||||
IS_WOLFSSL_SOURCE("${CURRENT_SEARCH_DIR}" FOUND_WOLFSSL)
|
||||
if( FOUND_WOLFSSL )
|
||||
message(STATUS "Found wolfssl in CURRENT_SEARCH_DIR = ${CURRENT_SEARCH_DIR}")
|
||||
set(${OUTPUT_FOUND_WOLFSSL_DIRECTORY} ${CURRENT_SEARCH_DIR} PARENT_SCOPE)
|
||||
return()
|
||||
endif()
|
||||
|
||||
if( THIS_USER )
|
||||
# Check for "wolfssl-[username]" subdirectory as we recurse up the directory tree
|
||||
set(CURRENT_SEARCH_DIR_ALT ${CURRENT_SEARCH_DIR}/wolfssl-${THIS_USER})
|
||||
message(STATUS "Looking in ${CURRENT_SEARCH_DIR}")
|
||||
|
||||
#if(EXISTS ${CURRENT_SEARCH_DIR_ALT} AND IS_DIRECTORY ${CURRENT_SEARCH_DIR_ALT} AND EXISTS "${CURRENT_SEARCH_DIR_ALT}/wolfcrypt/src")
|
||||
IS_WOLFSSL_SOURCE("${CURRENT_SEARCH_DIR_ALT}" FOUND_WOLFSSL )
|
||||
if ( FOUND_WOLFSSL )
|
||||
message(STATUS "Found wolfssl in user-suffix CURRENT_SEARCH_DIR_ALT = ${CURRENT_SEARCH_DIR_ALT}")
|
||||
set(${OUTPUT_FOUND_WOLFSSL_DIRECTORY} ${CURRENT_SEARCH_DIR_ALT} PARENT_SCOPE)
|
||||
return()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Next check for no user suffix "wolfssl" subdirectory as we recurse up the directory tree
|
||||
set(CURRENT_SEARCH_DIR_ALT ${CURRENT_SEARCH_DIR}/wolfssl)
|
||||
# if(EXISTS ${CURRENT_SEARCH_DIR} AND IS_DIRECTORY ${CURRENT_SEARCH_DIR} AND EXISTS "${CURRENT_SEARCH_DIR}/wolfcrypt/src")
|
||||
IS_WOLFSSL_SOURCE("${CURRENT_SEARCH_DIR_ALT}" FOUND_WOLFSSL )
|
||||
if ( FOUND_WOLFSSL )
|
||||
message(STATUS "Found wolfssl in CURRENT_SEARCH_DIR = ${CURRENT_SEARCH_DIR}")
|
||||
set(${OUTPUT_FOUND_WOLFSSL_DIRECTORY} ${CURRENT_SEARCH_DIR} PARENT_SCOPE)
|
||||
return()
|
||||
endif()
|
||||
|
||||
# Move up one directory level
|
||||
set(PRIOR_SEARCH_DIR "${CURRENT_SEARCH_DIR}")
|
||||
get_filename_component(CURRENT_SEARCH_DIR "${CURRENT_SEARCH_DIR}" DIRECTORY)
|
||||
message(STATUS "Next CURRENT_SEARCH_DIR = ${CURRENT_SEARCH_DIR}")
|
||||
if( "${PRIOR_SEARCH_DIR}" STREQUAL "${CURRENT_SEARCH_DIR}" )
|
||||
# when the search directory is empty, we'll give up
|
||||
set(CURRENT_SEARCH_DIR "")
|
||||
endif()
|
||||
endwhile()
|
||||
|
||||
# If not found, set the output variable to empty before exiting
|
||||
set(${OUTPUT_FOUND_WOLFSSL_DIRECTORY} "" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
|
||||
# Example usage:
|
||||
|
||||
|
||||
|
||||
|
||||
if(CMAKE_BUILD_EARLY_EXPANSION)
|
||||
message(STATUS "wolfssl component CMAKE_BUILD_EARLY_EXPANSION:")
|
||||
idf_component_register(
|
||||
REQUIRES "${COMPONENT_REQUIRES}"
|
||||
PRIV_REQUIRES # esp_hw_support
|
||||
esp_timer
|
||||
driver # this will typically only be needed for wolfSSL benchmark
|
||||
)
|
||||
|
||||
else()
|
||||
# not CMAKE_BUILD_EARLY_EXPANSION
|
||||
message(STATUS "************************************************************************************************")
|
||||
message(STATUS "wolfssl component config:")
|
||||
message(STATUS "************************************************************************************************")
|
||||
|
||||
# search for wolfSSL
|
||||
FIND_WOLFSSL_DIRECTORY(WOLFSSL_ROOT)
|
||||
if(WOLFSSL_ROOT)
|
||||
message(STATUS "NEW Found wolfssl directory at: ${WOLFSSL_ROOT}")
|
||||
else()
|
||||
message(STATUS "NEW wolfssl directory not found.")
|
||||
# Abort. We need wolfssl _somewhere_.
|
||||
message(FATAL_ERROR "Could not find wolfssl in ${WOLFSSL_ROOT}.\n"
|
||||
"Try setting WOLFSSL_ROOT environment variable or git clone.")
|
||||
endif()
|
||||
|
||||
set(INCLUDE_PATH ${WOLFSSL_ROOT})
|
||||
|
||||
set(WOLFSSL_EXTRA_PROJECT_DIR "${WOLFSSL_ROOT}/src/")
|
||||
|
||||
if( ${CMAKE_PROJECT_NAME} STREQUAL "wolfssl_benchmark" )
|
||||
set(WOLFSSL_EXTRA_PROJECT_DIR "${WOLFSSL_ROOT}/wolfcrypt/benchmark")
|
||||
endif()
|
||||
|
||||
if( ${CMAKE_PROJECT_NAME} STREQUAL "wolfssl_test" )
|
||||
set(WOLFSSL_EXTRA_PROJECT_DIR "${WOLFSSL_ROOT}/wolfcrypt/test")
|
||||
endif()
|
||||
|
||||
set(COMPONENT_SRCDIRS "\"${WOLFSSL_ROOT}/src/\""
|
||||
"\"${WOLFSSL_ROOT}/wolfcrypt/src\""
|
||||
"\"${WOLFSSL_ROOT}/wolfcrypt/src/port/Espressif\""
|
||||
"\"${WOLFSSL_ROOT}/wolfcrypt/src/port/atmel\""
|
||||
"\"${WOLFSSL_EXTRA_PROJECT_DIR}\""
|
||||
) # COMPONENT_SRCDIRS
|
||||
|
||||
message(STATUS "This COMPONENT_SRCDIRS = ${COMPONENT_SRCDIRS}")
|
||||
|
||||
set(WOLFSSL_PROJECT_DIR "${CMAKE_HOME_DIRECTORY}/components/wolfssl")
|
||||
add_definitions(-DWOLFSSL_USER_SETTINGS_DIR="${WOLFSSL_PROJECT_DIR}/include/user_settings.h")
|
||||
|
||||
|
||||
# Espressif may take several passes through this makefile. Check to see if we found IDF
|
||||
string(COMPARE EQUAL "${PROJECT_SOURCE_DIR}" "" WOLFSSL_FOUND_IDF)
|
||||
|
||||
# get a list of all wolfcrypt assembly files; we'll exclude them as they don't target Xtensa
|
||||
file(GLOB EXCLUDE_ASM *.S)
|
||||
file(GLOB_RECURSE EXCLUDE_ASM ${CMAKE_SOURCE_DIR} "${WOLFSSL_ROOT}/wolfcrypt/src/*.S")
|
||||
|
||||
message(STATUS "IDF_PATH = $ENV{IDF_PATH}")
|
||||
message(STATUS "PROJECT_SOURCE_DIR = ${PROJECT_SOURCE_DIR}")
|
||||
message(STATUS "EXCLUDE_ASM = ${EXCLUDE_ASM}")
|
||||
|
||||
#
|
||||
# Check to see if there's both a local copy and EDP-IDF copy of the wolfssl and/or wolfssh components.
|
||||
#
|
||||
if( EXISTS "${WOLFSSL_PROJECT_DIR}" AND EXISTS "$ENV{IDF_PATH}/components/wolfssl/" )
|
||||
#
|
||||
# wolfSSL found in both ESP-IDF and local project - needs to be resolved by user
|
||||
#
|
||||
message(STATUS "")
|
||||
message(STATUS "**************************************************************************************")
|
||||
message(STATUS "")
|
||||
message(STATUS "Error: Found components/wolfssl in both local project and IDF_PATH")
|
||||
message(STATUS "")
|
||||
message(STATUS "To proceed: ")
|
||||
message(STATUS "")
|
||||
message(STATUS "Remove either the local project component: ${WOLFSSL_PROJECT_DIR} ")
|
||||
message(STATUS "or the Espressif shared component installed at: $ENV{IDF_PATH}/components/wolfssl/ ")
|
||||
message(STATUS "")
|
||||
message(FATAL_ERROR "Please use wolfSSL in either local project or Espressif components, but not both.")
|
||||
message(STATUS "")
|
||||
message(STATUS "**************************************************************************************")
|
||||
message(STATUS "")
|
||||
|
||||
# Optional: if you change the above FATAL_ERROR to STATUS you can warn at runtime with this macro definition:
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_MULTI_INSTALL_WARNING")
|
||||
|
||||
else()
|
||||
if( EXISTS "$ENV{IDF_PATH}/components/wolfssl/" )
|
||||
#
|
||||
# wolfSSL found in ESP-IDF components and is assumed to be already configured in user_settings.h via setup.
|
||||
#
|
||||
message(STATUS "")
|
||||
message(STATUS "Using components/wolfssl in IDF_PATH = $ENV{IDF_PATH}")
|
||||
message(STATUS "")
|
||||
else()
|
||||
#
|
||||
# wolfSSL is not an ESP-IDF component.
|
||||
# We need to now determine if it is local and if so if it is part of the wolfSSL repo,
|
||||
# or if wolfSSL is simply installed as a local component.
|
||||
#
|
||||
|
||||
if( EXISTS "${WOLFSSL_PROJECT_DIR}" )
|
||||
#
|
||||
# wolfSSL found in local project.
|
||||
#
|
||||
if( EXISTS "${WOLFSSL_PROJECT_DIR}/wolfcrypt/" )
|
||||
message(STATUS "")
|
||||
message(STATUS "Using installed project ./components/wolfssl in CMAKE_HOME_DIRECTORY = ${CMAKE_HOME_DIRECTORY}")
|
||||
message(STATUS "")
|
||||
#
|
||||
# Note we already checked above and confirmed there's not another wolfSSL installed in the ESP-IDF components.
|
||||
#
|
||||
# We won't do anything else here, as it will be assumed the original install completed successfully.
|
||||
#
|
||||
else() # full wolfSSL not installed in local project
|
||||
#
|
||||
# This is the developer repo mode. wolfSSL will be assumed to be not installed to ESP-IDF nor local project
|
||||
# In this configuration, we are likely running a wolfSSL example found directly in the repo.
|
||||
#
|
||||
message(STATUS "")
|
||||
message(STATUS "Using developer repo ./components/wolfssl in CMAKE_HOME_DIRECTORY = ${CMAKE_HOME_DIRECTORY}")
|
||||
message(STATUS "")
|
||||
|
||||
message(STATUS "************************************************************************************************")
|
||||
# When in developer mode, we are typically running wolfSSL examples such as benchmark or test directories.
|
||||
# However, the as-cloned or distributed wolfSSL does not have the ./include/ directory, so we'll add it as needed.
|
||||
#
|
||||
# first check if there's a [root]/include/user_settings.h
|
||||
if( EXISTS "${WOLFSSL_ROOT}/include/user_settings.h" )
|
||||
message(FATAL_ERROR "Found stray wolfSSL user_settings.h in "
|
||||
"${WOLFSSL_ROOT}/include/user_settings.h "
|
||||
" (please move it to ${WOLFSSL_PROJECT_DIR}/include/user_settings.h )")
|
||||
else()
|
||||
# we won't overwrite an existing user settings file, just note that we already have one:
|
||||
if( EXISTS "${WOLFSSL_PROJECT_DIR}/include/user_settings.h" )
|
||||
message(STATUS "Using existing wolfSSL user_settings.h in "
|
||||
"${WOLFSSL_PROJECT_DIR}/include/user_settings.h")
|
||||
else()
|
||||
message(STATUS "Installing wolfSSL user_settings.h to "
|
||||
"${WOLFSSL_PROJECT_DIR}/include/user_settings.h")
|
||||
file(COPY "${WOLFSSL_ROOT}/IDE/Espressif/ESP-IDF/user_settings.h"
|
||||
DESTINATION "${CMAKE_HOME_DIRECTORY}/wolfssl/include/")
|
||||
endif()
|
||||
endif() # user_settings.h
|
||||
|
||||
# next check if there's a [root]/include/config.h
|
||||
if( EXISTS "${WOLFSSL_ROOT}/include/config.h" )
|
||||
message(STATUS "******************************************************************************")
|
||||
message(STATUS "******************************************************************************")
|
||||
message(STATUS "Found stray wolfSSL config.h in ${WOLFSSL_ROOT}/include/config.h" )
|
||||
message(STATUS " Please move it to ${WOLFSSL_PROJECT_DIR}/include/config.h" )
|
||||
message(STATUS "******************************************************************************")
|
||||
message(STATUS "******************************************************************************")
|
||||
else()
|
||||
# we won't overwrite an existing user settings file, just note that we already have one:
|
||||
if( EXISTS "${WOLFSSL_PROJECT_DIR}/include/config.h" )
|
||||
message(STATUS "Using existing wolfSSL config.h ${WOLFSSL_PROJECT_DIR}/include/config.h")
|
||||
else()
|
||||
message(STATUS "Installing wolfSSL config.h to ${WOLFSSL_PROJECT_DIR}/include/config.h")
|
||||
file(COPY "${WOLFSSL_ROOT}/IDE/Espressif/ESP-IDF/dummy_config_h" DESTINATION "${WOLFSSL_PROJECT_DIR}/include/")
|
||||
file(RENAME "${WOLFSSL_PROJECT_DIR}/include/dummy_config_h" "${WOLFSSL_PROJECT_DIR}/include/config.h")
|
||||
endif() # Project config.h
|
||||
endif() # WOLFSSL_ROOT config.h
|
||||
message(STATUS "************************************************************************************************")
|
||||
message(STATUS "")
|
||||
endif()
|
||||
|
||||
else()
|
||||
# we did not find a ./components/wolfssl/include/ directory from this pass of cmake.
|
||||
if($WOLFSSL_FOUND_IDF)
|
||||
message(STATUS "")
|
||||
message(STATUS "WARNING: wolfSSL not found.")
|
||||
message(STATUS "")
|
||||
else()
|
||||
# probably needs to be re-parsed by Espressif
|
||||
message(STATUS "wolfSSL found IDF. Project Source:${PROJECT_SOURCE_DIR}")
|
||||
endif() # else we have not found ESP-IDF yet
|
||||
endif() # else not a local wolfSSL component
|
||||
|
||||
endif() #else not an ESP-IDF component
|
||||
endif() # else not local copy and EDP-IDF wolfSSL
|
||||
|
||||
|
||||
# RTOS_IDF_PATH is typically:
|
||||
# "/Users/{username}/Desktop/esp-idf/components/freertos/include/freertos"
|
||||
# depending on the environment, we may need to swap backslashes with forward slashes
|
||||
string(REPLACE "\\" "/" RTOS_IDF_PATH "$ENV{IDF_PATH}/components/freertos/FreeRTOS-Kernel/include/freertos")
|
||||
|
||||
string(REPLACE "\\" "/" WOLFSSL_ROOT ${WOLFSSL_ROOT})
|
||||
|
||||
if(IS_DIRECTORY "${RTOS_IDF_PATH}")
|
||||
message(STATUS "Found current RTOS path: ${RTOS_IDF_PATH}")
|
||||
else()
|
||||
# ESP-IDF prior version 4.4x has a different RTOS directory structure
|
||||
string(REPLACE "\\" "/" RTOS_IDF_PATH "$ENV{IDF_PATH}/components/freertos/include/freertos")
|
||||
if(IS_DIRECTORY "${RTOS_IDF_PATH}")
|
||||
message(STATUS "Found legacy RTOS path: ${RTOS_IDF_PATH}")
|
||||
else()
|
||||
message(STATUS "Could not find RTOS path")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
||||
set(COMPONENT_ADD_INCLUDEDIRS
|
||||
"./include" # this is the location of wolfssl user_settings.h
|
||||
"\"${WOLFSSL_ROOT}/\""
|
||||
"\"${WOLFSSL_ROOT}/wolfssl/\""
|
||||
"\"${WOLFSSL_ROOT}/wolfssl/wolfcrypt/\""
|
||||
"\"${RTOS_IDF_PATH}/\""
|
||||
)
|
||||
|
||||
|
||||
if(IS_DIRECTORY ${IDF_PATH}/components/cryptoauthlib)
|
||||
list(APPEND COMPONENT_ADD_INCLUDEDIRS "../cryptoauthlib/lib")
|
||||
endif()
|
||||
|
||||
list(APPEND COMPONENT_ADD_INCLUDEDIRS "\"${WOLFSSL_ROOT}/wolfssl/\"")
|
||||
list(APPEND COMPONENT_ADD_INCLUDEDIRS "\"${WOLFSSL_ROOT}/wolfssl/wolfcrypt/\"")
|
||||
|
||||
|
||||
|
||||
set(COMPONENT_SRCEXCLUDE
|
||||
"\"${WOLFSSL_ROOT}/src/bio.c\""
|
||||
"\"${WOLFSSL_ROOT}/src/conf.c\""
|
||||
"\"${WOLFSSL_ROOT}/src/misc.c\""
|
||||
"\"${WOLFSSL_ROOT}/src/pk.c\""
|
||||
"\"${WOLFSSL_ROOT}/src/ssl_asn1.c\"" # included by ssl.c
|
||||
"\"${WOLFSSL_ROOT}/src/ssl_bn.c\"" # included by ssl.c
|
||||
"\"${WOLFSSL_ROOT}/src/ssl_certman.c\"" # included by ssl.c
|
||||
"\"${WOLFSSL_ROOT}/src/ssl_crypto.c\"" # included by ssl.c
|
||||
"\"${WOLFSSL_ROOT}/src/ssl_misc.c\"" # included by ssl.c
|
||||
"\"${WOLFSSL_ROOT}/src/x509.c\""
|
||||
"\"${WOLFSSL_ROOT}/src/x509_str.c\""
|
||||
"\"${WOLFSSL_ROOT}/wolfcrypt/src/evp.c\""
|
||||
"\"${WOLFSSL_ROOT}/wolfcrypt/src/misc.c\""
|
||||
"\"${WOLFSSL_ROOT}/wolfcrypt/src/sp_sm2_arm32.c\""
|
||||
"\"${WOLFSSL_ROOT}/wolfcrypt/src/sp_sm2_arm64.c\""
|
||||
"\"${WOLFSSL_ROOT}/wolfcrypt/src/sp_sm2_armthumb.c\""
|
||||
"\"${WOLFSSL_ROOT}/wolfcrypt/src/sp_sm2_c32.c\""
|
||||
"\"${WOLFSSL_ROOT}/wolfcrypt/src/sp_sm2_c64.c\""
|
||||
"\"${WOLFSSL_ROOT}/wolfcrypt/src/sp_sm2_cortexm.c\""
|
||||
"\"${WOLFSSL_ROOT}/wolfcrypt/src/sp_sm2_x86_64.c\""
|
||||
"\"${WOLFSSL_ROOT}/wolfcrypt/src/sp_sm2_x86_64_asm.S\""
|
||||
"\"${EXCLUDE_ASM}\""
|
||||
)
|
||||
|
||||
spaces2list(COMPONENT_REQUIRES)
|
||||
|
||||
separate_arguments(COMPONENT_SRCDIRS NATIVE_COMMAND "${COMPONENT_SRCDIRS}")
|
||||
separate_arguments(COMPONENT_SRCEXCLUDE NATIVE_COMMAND "${COMPONENT_SRCEXCLUDE}")
|
||||
separate_arguments(COMPONENT_ADD_INCLUDEDIRS NATIVE_COMMAND "${COMPONENT_ADD_INCLUDEDIRS}")
|
||||
|
||||
#
|
||||
# See https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/build-system.html#example-component-requirements
|
||||
#
|
||||
message(STATUS "COMPONENT_SRCDIRS = ${COMPONENT_SRCDIRS}")
|
||||
message(STATUS "COMPONENT_ADD_INCLUDEDIRS = ${COMPONENT_ADD_INCLUDEDIRS}")
|
||||
message(STATUS "COMPONENT_REQUIRES = ${COMPONENT_REQUIRES}")
|
||||
message(STATUS "COMPONENT_SRCEXCLUDE = ${COMPONENT_SRCEXCLUDE}")
|
||||
|
||||
#
|
||||
# see https://docs.espressif.com/projects/esp-idf/en/stable/esp32/migration-guides/release-5.x/build-system.html?highlight=space%20path
|
||||
#
|
||||
set(EXTRA_COMPONENT_DIRS "${COMPONENT_SRCDIRS}")
|
||||
idf_component_register(
|
||||
SRC_DIRS "${COMPONENT_SRCDIRS}"
|
||||
INCLUDE_DIRS "${COMPONENT_ADD_INCLUDEDIRS}"
|
||||
REQUIRES "${COMPONENT_REQUIRES}"
|
||||
EXCLUDE_SRCS "${COMPONENT_SRCEXCLUDE}"
|
||||
PRIV_REQUIRES esp_timer driver # this will typically only be needed for wolfSSL benchmark
|
||||
)
|
||||
# some optional diagnostics
|
||||
if (1)
|
||||
get_cmake_property(_variableNames VARIABLES)
|
||||
list (SORT _variableNames)
|
||||
message(STATUS "")
|
||||
message(STATUS "ALL VARIABLES BEGIN")
|
||||
message(STATUS "")
|
||||
foreach (_variableName ${_variableNames})
|
||||
message(STATUS "${_variableName}=${${_variableName}}")
|
||||
endforeach()
|
||||
message(STATUS "")
|
||||
message(STATUS "ALL VARIABLES END")
|
||||
message(STATUS "")
|
||||
endif()
|
||||
|
||||
# target_sources(wolfssl PRIVATE "\"${WOLFSSL_ROOT}/wolfssl/\"" "\"${WOLFSSL_ROOT}/wolfssl/wolfcrypt\"")
|
||||
|
||||
endif() # CMAKE_BUILD_EARLY_EXPANSION
|
||||
|
||||
|
||||
|
||||
# check to see if there's both a local copy and EDP-IDF copy of the wolfssl components
|
||||
if( EXISTS "${WOLFSSL_PROJECT_DIR}" AND EXISTS "$ENV{IDF_PATH}/components/wolfssl/" )
|
||||
message(STATUS "")
|
||||
message(STATUS "")
|
||||
message(STATUS "********************************************************************")
|
||||
message(STATUS "WARNING: Found components/wolfssl in both local project and IDF_PATH")
|
||||
message(STATUS "********************************************************************")
|
||||
message(STATUS "")
|
||||
endif()
|
||||
# end multiple component check
|
||||
|
||||
|
||||
#
|
||||
# LIBWOLFSSL_SAVE_INFO(VAR_OUPUT THIS_VAR VAR_RESULT)
|
||||
#
|
||||
# Save the THIS_VAR as a string in a macro called VAR_OUPUT
|
||||
#
|
||||
# VAR_OUPUT: the name of the macro to define
|
||||
# THIS_VAR: the OUTPUT_VARIABLE result from a execute_process()
|
||||
# VAR_RESULT: the RESULT_VARIABLE from a execute_process(); "0" if successful.
|
||||
#
|
||||
function ( LIBWOLFSSL_SAVE_INFO VAR_OUPUT THIS_VAR VAR_RESULT )
|
||||
# is the RESULT_VARIABLE output value 0? If so, IS_VALID_VALUE is true.
|
||||
string(COMPARE EQUAL "${VAR_RESULT}" "0" IS_VALID_VALUE)
|
||||
|
||||
# if we had a successful operation, save the THIS_VAR in VAR_OUPUT
|
||||
if(${IS_VALID_VALUE})
|
||||
# strip newline chars in THIS_VAR parameter and save in VAR_VALUE
|
||||
string(REPLACE "\n" "" VAR_VALUE ${THIS_VAR})
|
||||
|
||||
# we'll could percolate the value to the parent for possible later use
|
||||
# set(${VAR_OUPUT} ${VAR_VALUE} PARENT_SCOPE)
|
||||
|
||||
# but we're only using it here in this function
|
||||
set(${VAR_OUPUT} ${VAR_VALUE})
|
||||
|
||||
# we'll print what we found to the console
|
||||
message(STATUS "Found ${VAR_OUPUT}=${VAR_VALUE}")
|
||||
|
||||
# the interesting part is defining the VAR_OUPUT name a value to use in the app
|
||||
add_definitions(-D${VAR_OUPUT}=\"${VAR_VALUE}\")
|
||||
else()
|
||||
# if we get here, check the execute_process command and parameters.
|
||||
message(STATUS "LIBWOLFSSL_SAVE_INFO encountered a non-zero VAR_RESULT")
|
||||
set(${VAR_OUPUT} "Unknown")
|
||||
endif()
|
||||
endfunction() # LIBWOLFSSL_SAVE_INFO
|
||||
|
||||
# create some programmatic #define values that will be used by ShowExtendedSystemInfo().
|
||||
# see wolfcrypt\src\port\Espressif\esp32_utl.c
|
||||
if(NOT CMAKE_BUILD_EARLY_EXPANSION)
|
||||
set (git_cmd "git")
|
||||
message(STATUS "Adding macro definitions:")
|
||||
|
||||
# LIBWOLFSSL_VERSION_GIT_ORIGIN: git config --get remote.origin.url
|
||||
execute_process(WORKING_DIRECTORY ${WOLFSSL_ROOT} COMMAND ${git_cmd} "config" "--get" "remote.origin.url" OUTPUT_VARIABLE TMP_OUT RESULT_VARIABLE TMP_RES ERROR_QUIET )
|
||||
LIBWOLFSSL_SAVE_INFO(LIBWOLFSSL_VERSION_GIT_ORIGIN "${TMP_OUT}" "${TMP_RES}")
|
||||
|
||||
# LIBWOLFSSL_VERSION_GIT_BRANCH: git rev-parse --abbrev-ref HEAD
|
||||
execute_process(WORKING_DIRECTORY ${WOLFSSL_ROOT} COMMAND ${git_cmd} "rev-parse" "--abbrev-ref" "HEAD" OUTPUT_VARIABLE TMP_OUT RESULT_VARIABLE TMP_RES ERROR_QUIET )
|
||||
LIBWOLFSSL_SAVE_INFO(LIBWOLFSSL_VERSION_GIT_BRANCH "${TMP_OUT}" "${TMP_RES}")
|
||||
|
||||
# LIBWOLFSSL_VERSION_GIT_HASH: git rev-parse HEAD
|
||||
execute_process(WORKING_DIRECTORY ${WOLFSSL_ROOT} COMMAND ${git_cmd} "rev-parse" "HEAD" OUTPUT_VARIABLE TMP_OUT RESULT_VARIABLE TMP_RES ERROR_QUIET )
|
||||
LIBWOLFSSL_SAVE_INFO(LIBWOLFSSL_VERSION_GIT_HASH "${TMP_OUT}" "${TMP_RES}")
|
||||
|
||||
# LIBWOLFSSL_VERSION_GIT_SHORT_HASH: git rev-parse --short HEAD
|
||||
execute_process(WORKING_DIRECTORY ${WOLFSSL_ROOT} COMMAND ${git_cmd} "rev-parse" "--short" "HEAD" OUTPUT_VARIABLE TMP_OUT RESULT_VARIABLE TMP_RES ERROR_QUIET )
|
||||
LIBWOLFSSL_SAVE_INFO(LIBWOLFSSL_VERSION_GIT_SHORT_HASH "${TMP_OUT}" "${TMP_RES}")
|
||||
|
||||
# LIBWOLFSSL_VERSION_GIT_HASH_DATE git show --no-patch --no-notes --pretty=\'\%cd\'
|
||||
execute_process(WORKING_DIRECTORY ${WOLFSSL_ROOT} COMMAND ${git_cmd} "show" "--no-patch" "--no-notes" "--pretty=\'\%cd\'" OUTPUT_VARIABLE TMP_OUT RESULT_VARIABLE TMP_RES )
|
||||
LIBWOLFSSL_SAVE_INFO(LIBWOLFSSL_VERSION_GIT_HASH_DATE "${TMP_OUT}" "${TMP_RES}")
|
||||
|
||||
message(STATUS "************************************************************************************************")
|
||||
message(STATUS "wolfssl component config complete!")
|
||||
message(STATUS "************************************************************************************************")
|
||||
endif()
|
||||
@@ -0,0 +1,428 @@
|
||||
/* user_settings.h
|
||||
*
|
||||
* Copyright (C) 2006-2023 wolfSSL Inc.
|
||||
*
|
||||
* This file is part of wolfSSL.
|
||||
*
|
||||
* wolfSSL is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* wolfSSL is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
|
||||
*/
|
||||
|
||||
/* This user_settings.h is for Espressif ESP-IDF */
|
||||
#include <sdkconfig.h>
|
||||
|
||||
/* The Espressif sdkconfig will have chipset info.
|
||||
**
|
||||
** Possible values:
|
||||
**
|
||||
** CONFIG_IDF_TARGET_ESP32
|
||||
** CONFIG_IDF_TARGET_ESP32S2
|
||||
** CONFIG_IDF_TARGET_ESP32S3
|
||||
** CONFIG_IDF_TARGET_ESP32C3
|
||||
** CONFIG_IDF_TARGET_ESP32C6
|
||||
*/
|
||||
|
||||
#undef WOLFSSL_ESPIDF
|
||||
#define WOLFSSL_ESPIDF
|
||||
|
||||
/*
|
||||
* choose ONE of these Espressif chips to define:
|
||||
*
|
||||
* WOLFSSL_ESP32
|
||||
* WOLFSSL_ESPWROOM32SE
|
||||
* WOLFSSL_ESP8266
|
||||
*/
|
||||
#undef WOLFSSL_ESPWROOM32SE
|
||||
#undef WOLFSSL_ESP8266
|
||||
#undef WOLFSSL_ESP32
|
||||
|
||||
#define WOLFSSL_ESP32
|
||||
|
||||
/* optionally turn off SHA512/224 SHA512/256 */
|
||||
/* #define WOLFSSL_NOSHA512_224 */
|
||||
/* #define WOLFSSL_NOSHA512_256 */
|
||||
|
||||
/* when you want to use SINGLE THREAD. Note Default ESP-IDF is FreeRTOS */
|
||||
/* #define SINGLE_THREADED */
|
||||
|
||||
/* When you don't want to use the old SHA */
|
||||
/* #define NO_SHA */
|
||||
/* #define NO_OLD_TLS */
|
||||
|
||||
#define BENCH_EMBEDDED
|
||||
#define USE_CERT_BUFFERS_2048
|
||||
|
||||
/* TLS 1.3 */
|
||||
#define WOLFSSL_TLS13
|
||||
#define HAVE_TLS_EXTENSIONS
|
||||
#define WC_RSA_PSS
|
||||
#define HAVE_HKDF
|
||||
#define HAVE_AEAD
|
||||
#define HAVE_SUPPORTED_CURVES
|
||||
|
||||
#define WOLFSSL_BENCHMARK_FIXED_UNITS_KB
|
||||
|
||||
#define NO_FILESYSTEM
|
||||
|
||||
#define NO_OLD_TLS
|
||||
|
||||
#define HAVE_AESGCM
|
||||
|
||||
#define WOLFSSL_RIPEMD
|
||||
/* when you want to use SHA224 */
|
||||
#define WOLFSSL_SHA224
|
||||
|
||||
/* when you want to use SHA384 */
|
||||
#define WOLFSSL_SHA384
|
||||
|
||||
/* when you want to use SHA512 */
|
||||
#define WOLFSSL_SHA512
|
||||
|
||||
/* when you want to use SHA3 */
|
||||
#define WOLFSSL_SHA3
|
||||
|
||||
/* Reminder: ED25519 requires SHA512 */
|
||||
#define HAVE_ED25519
|
||||
|
||||
#define HAVE_ECC
|
||||
#define HAVE_CURVE25519
|
||||
#define CURVE25519_SMALL
|
||||
#define HAVE_ED25519
|
||||
|
||||
/* Optional OPENSSL compatibility */
|
||||
#define OPENSSL_EXTRA
|
||||
/* when you want to use pkcs7 */
|
||||
/* #define HAVE_PKCS7 */
|
||||
|
||||
#define HAVE_PKCS7
|
||||
|
||||
#if defined(HAVE_PKCS7)
|
||||
#define HAVE_AES_KEYWRAP
|
||||
#define HAVE_X963_KDF
|
||||
#define WOLFSSL_AES_DIRECT
|
||||
#endif
|
||||
|
||||
/* when you want to use AES counter mode */
|
||||
/* #define WOLFSSL_AES_DIRECT */
|
||||
/* #define WOLFSSL_AES_COUNTER */
|
||||
|
||||
/* esp32-wroom-32se specific definition */
|
||||
#if defined(WOLFSSL_ESPWROOM32SE)
|
||||
#define WOLFSSL_ATECC508A
|
||||
#define HAVE_PK_CALLBACKS
|
||||
/* when you want to use a custom slot allocation for ATECC608A */
|
||||
/* unless your configuration is unusual, you can use default */
|
||||
/* implementation. */
|
||||
/* #define CUSTOM_SLOT_ALLOCATION */
|
||||
#endif
|
||||
|
||||
/* RSA primitive specific definition */
|
||||
#if defined(WOLFSSL_ESP32) || defined(WOLFSSL_ESPWROOM32SE)
|
||||
/* Define USE_FAST_MATH and SMALL_STACK */
|
||||
#define ESP32_USE_RSA_PRIMITIVE
|
||||
|
||||
#if defined(CONFIG_IDF_TARGET_ESP32)
|
||||
|
||||
/* NOTE HW unreliable for small values! */
|
||||
/* threshold for performance adjustment for HW primitive use */
|
||||
/* X bits of G^X mod P greater than */
|
||||
#undef ESP_RSA_EXPT_XBITS
|
||||
#define ESP_RSA_EXPT_XBITS 32
|
||||
|
||||
/* X and Y of X * Y mod P greater than */
|
||||
#undef ESP_RSA_MULM_BITS
|
||||
#define ESP_RSA_MULM_BITS 16
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define RSA_LOW_MEM
|
||||
|
||||
/* #define WOLFSSL_ATECC508A_DEBUG */
|
||||
|
||||
/* date/time */
|
||||
/* if it cannot adjust time in the device, */
|
||||
/* enable macro below */
|
||||
/* #define NO_ASN_TIME */
|
||||
/* #define XTIME time */
|
||||
|
||||
|
||||
/* adjust wait-timeout count if you see timeout in RSA HW acceleration */
|
||||
#define ESP_RSA_TIMEOUT_CNT 0x249F00
|
||||
|
||||
#define HASH_SIZE_LIMIT /* for test.c */
|
||||
|
||||
/* USE_FAST_MATH is default */
|
||||
#define USE_FAST_MATH
|
||||
|
||||
/***** Use SP_MATH *****/
|
||||
/* #undef USE_FAST_MATH */
|
||||
/* #define SP_MATH */
|
||||
/* #define WOLFSSL_SP_MATH_ALL */
|
||||
|
||||
/***** Use Integer Heap Math *****/
|
||||
/* #undef USE_FAST_MATH */
|
||||
/* #define USE_INTEGER_HEAP_MATH */
|
||||
|
||||
|
||||
#define WOLFSSL_SMALL_STACK
|
||||
|
||||
|
||||
#define HAVE_VERSION_EXTENDED_INFO
|
||||
/* #define HAVE_WC_INTROSPECTION */
|
||||
|
||||
#define HAVE_SESSION_TICKET
|
||||
|
||||
/* #define HAVE_HASHDRBG */
|
||||
|
||||
#define WOLFSSL_KEY_GEN
|
||||
#define WOLFSSL_CERT_REQ
|
||||
#define WOLFSSL_CERT_GEN
|
||||
#define WOLFSSL_CERT_EXT
|
||||
#define WOLFSSL_SYS_CA_CERTS
|
||||
|
||||
|
||||
#define WOLFSSL_CERT_TEXT
|
||||
|
||||
#define WOLFSSL_ASN_TEMPLATE
|
||||
|
||||
/*
|
||||
#undef WOLFSSL_KEY_GEN
|
||||
#undef WOLFSSL_CERT_REQ
|
||||
#undef WOLFSSL_CERT_GEN
|
||||
#undef WOLFSSL_CERT_EXT
|
||||
#undef WOLFSSL_SYS_CA_CERTS
|
||||
*/
|
||||
|
||||
/*
|
||||
--enable-keygen
|
||||
--enable-certgen
|
||||
--enable-certreq
|
||||
--enable-certext
|
||||
--enable-asn-template
|
||||
*/
|
||||
|
||||
/* Default is HW enabled unless turned off.
|
||||
** Uncomment these lines to force SW instead of HW acceleration */
|
||||
|
||||
#if defined(CONFIG_IDF_TARGET_ESP32)
|
||||
/* wolfSSL HW Acceleration supported on ESP32. Uncomment to disable: */
|
||||
/* #define NO_ESP32_CRYPT */
|
||||
/* #define NO_WOLFSSL_ESP32_CRYPT_HASH */
|
||||
/* #define NO_WOLFSSL_ESP32_CRYPT_AES */
|
||||
/* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI */
|
||||
/* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_MP_MUL */
|
||||
/* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_MULMOD */
|
||||
/* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_EXPTMOD */
|
||||
|
||||
/* These are defined automatically in esp32-crypt.h, here for clarity: */
|
||||
#define NO_WOLFSSL_ESP32_CRYPT_HASH_SHA224 /* no SHA224 HW on ESP32 */
|
||||
|
||||
#undef ESP_RSA_MULM_BITS
|
||||
#define ESP_RSA_MULM_BITS 16 /* TODO add compile-time warning */
|
||||
/***** END CONFIG_IDF_TARGET_ESP32 *****/
|
||||
|
||||
#elif defined(CONFIG_IDF_TARGET_ESP32S2)
|
||||
/* wolfSSL HW Acceleration supported on ESP32-S2. Uncomment to disable: */
|
||||
/* #define NO_ESP32_CRYPT */
|
||||
/* #define NO_WOLFSSL_ESP32_CRYPT_HASH */
|
||||
/* Note: There's no AES192 HW on the ESP32-S2; falls back to SW */
|
||||
/* #define NO_WOLFSSL_ESP32_CRYPT_AES */
|
||||
/* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI */
|
||||
/* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_MP_MUL */
|
||||
/* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_MULMOD */
|
||||
/* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_EXPTMOD */
|
||||
/***** END CONFIG_IDF_TARGET_ESP32S2 *****/
|
||||
|
||||
#elif defined(CONFIG_IDF_TARGET_ESP32S3)
|
||||
/* wolfSSL HW Acceleration supported on ESP32-S3. Uncomment to disable: */
|
||||
/* #define NO_ESP32_CRYPT */
|
||||
/* #define NO_WOLFSSL_ESP32_CRYPT_HASH */
|
||||
/* Note: There's no AES192 HW on the ESP32-S3; falls back to SW */
|
||||
/* #define NO_WOLFSSL_ESP32_CRYPT_AES */
|
||||
/* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI */
|
||||
/* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_MP_MUL */
|
||||
/* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_MULMOD */
|
||||
/* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_EXPTMOD */
|
||||
/***** END CONFIG_IDF_TARGET_ESP32S3 *****/
|
||||
|
||||
#elif defined(CONFIG_IDF_TARGET_ESP32C2) || \
|
||||
defined(CONFIG_IDF_TARGET_ESP8684)
|
||||
/* ESP8684 is essentially ESP32-C2 chip + flash embedded together in a
|
||||
* single QFN 4x4 mm package. Out of released documentation, Technical
|
||||
* Reference Manual as well as ESP-IDF Programming Guide is applicable
|
||||
* to both ESP32-C2 and ESP8684.
|
||||
*
|
||||
* See: https://www.esp32.com/viewtopic.php?f=5&t=27926#:~:text=ESP8684%20is%20essentially%20ESP32%2DC2,both%20ESP32%2DC2%20and%20ESP8684. */
|
||||
|
||||
/* wolfSSL HW Acceleration supported on ESP32-C2. Uncomment to disable: */
|
||||
/* #define NO_ESP32_CRYPT */
|
||||
/* #define NO_WOLFSSL_ESP32_CRYPT_HASH */ /* to disable all SHA HW */
|
||||
|
||||
/* These are defined automatically in esp32-crypt.h, here for clarity */
|
||||
#define NO_WOLFSSL_ESP32_CRYPT_HASH_SHA384 /* no SHA384 HW on C2 */
|
||||
#define NO_WOLFSSL_ESP32_CRYPT_HASH_SHA512 /* no SHA512 HW on C2 */
|
||||
|
||||
/* There's no AES or RSA/Math accelerator on the ESP32-C2
|
||||
* Auto defined with NO_WOLFSSL_ESP32_CRYPT_RSA_PRI, for clarity: */
|
||||
#define NO_WOLFSSL_ESP32_CRYPT_AES
|
||||
#define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI
|
||||
#define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_MP_MUL
|
||||
#define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_MULMOD
|
||||
#define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_EXPTMOD
|
||||
/***** END CONFIG_IDF_TARGET_ESP32C2 *****/
|
||||
|
||||
#elif defined(CONFIG_IDF_TARGET_ESP32C3)
|
||||
/* wolfSSL HW Acceleration supported on ESP32-C3. Uncomment to disable: */
|
||||
|
||||
/* #define NO_ESP32_CRYPT */
|
||||
/* #define NO_WOLFSSL_ESP32_CRYPT_HASH */ /* to disable all SHA HW */
|
||||
|
||||
/* These are defined automatically in esp32-crypt.h, here for clarity: */
|
||||
#define NO_WOLFSSL_ESP32_CRYPT_HASH_SHA384 /* no SHA384 HW on C6 */
|
||||
#define NO_WOLFSSL_ESP32_CRYPT_HASH_SHA512 /* no SHA512 HW on C6 */
|
||||
|
||||
/* #define NO_WOLFSSL_ESP32_CRYPT_AES */
|
||||
/* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI */
|
||||
/* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_MP_MUL */
|
||||
/* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_MULMOD */
|
||||
/* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_EXPTMOD */
|
||||
/***** END CONFIG_IDF_TARGET_ESP32C3 *****/
|
||||
|
||||
#elif defined(CONFIG_IDF_TARGET_ESP32C6)
|
||||
/* wolfSSL HW Acceleration supported on ESP32-C6. Uncomment to disable: */
|
||||
|
||||
/* #define NO_ESP32_CRYPT */
|
||||
/* #define NO_WOLFSSL_ESP32_CRYPT_HASH */
|
||||
/* These are defined automatically in esp32-crypt.h, here for clarity: */
|
||||
#define NO_WOLFSSL_ESP32_CRYPT_HASH_SHA384 /* no SHA384 HW on C6 */
|
||||
#define NO_WOLFSSL_ESP32_CRYPT_HASH_SHA512 /* no SHA512 HW on C6 */
|
||||
|
||||
/* #define NO_WOLFSSL_ESP32_CRYPT_AES */
|
||||
/* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI */
|
||||
/* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_MP_MUL */
|
||||
/* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_MULMOD */
|
||||
/* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_EXPTMOD */
|
||||
/***** END CONFIG_IDF_TARGET_ESP32C6 *****/
|
||||
|
||||
#elif defined(CONFIG_IDF_TARGET_ESP32H2)
|
||||
/* wolfSSL Hardware Acceleration not yet implemented */
|
||||
#define NO_ESP32_CRYPT
|
||||
#define NO_WOLFSSL_ESP32_CRYPT_HASH
|
||||
#define NO_WOLFSSL_ESP32_CRYPT_AES
|
||||
#define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI
|
||||
/***** END CONFIG_IDF_TARGET_ESP32H2 *****/
|
||||
|
||||
#elif defined(CONFIG_IDF_TARGET_ESP8266)
|
||||
/* TODO: Revisit ESP8266 */
|
||||
#define NO_ESP32_CRYPT
|
||||
#define NO_WOLFSSL_ESP32_CRYPT_HASH
|
||||
#define NO_WOLFSSL_ESP32_CRYPT_AES
|
||||
#define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI
|
||||
/***** END CONFIG_IDF_TARGET_ESP266 *****/
|
||||
#else
|
||||
/* Anything else encountered, disable HW accleration */
|
||||
#define NO_ESP32_CRYPT
|
||||
#define NO_WOLFSSL_ESP32_CRYPT_HASH
|
||||
#define NO_WOLFSSL_ESP32_CRYPT_AES
|
||||
#define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI
|
||||
#endif /* CONFIG_IDF_TARGET Check */
|
||||
|
||||
/* Debug options:
|
||||
|
||||
#define ESP_VERIFY_MEMBLOCK
|
||||
#define DEBUG_WOLFSSL
|
||||
#define DEBUG_WOLFSSL_VERBOSE
|
||||
#define DEBUG_WOLFSSL_SHA_MUTEX
|
||||
#define WOLFSSL_ESP32_CRYPT_DEBUG
|
||||
#define WOLFSSL_ESP32_CRYPT_HASH_SHA224_DEBUG
|
||||
#define NO_RECOVER_SOFTWARE_CALC
|
||||
#define WOLFSSL_TEST_STRAY 1
|
||||
#define USE_ESP_DPORT_ACCESS_READ_BUFFER
|
||||
#define WOLFSSL_ESP32_HW_LOCK_DEBUG
|
||||
#define WOLFSSL_DEBUG_ESP_RSA_MULM_BITS
|
||||
#define ESP_DISABLE_HW_TASK_LOCK
|
||||
*/
|
||||
|
||||
#define WOLFSSL_ESPIDF_ERROR_PAUSE /* Pause in a loop rather than exit. */
|
||||
#define WOLFSSL_HW_METRICS
|
||||
|
||||
/* #define HASH_SIZE_LIMIT */ /* for test.c */
|
||||
|
||||
/* #define NO_HW_MATH_TEST */ /* Optionall turn off HW math checks */
|
||||
|
||||
/* Optionally include alternate HW test library: alt_hw_test.h */
|
||||
/* When enabling, the ./components/wolfssl/CMakeLists.txt file
|
||||
* will need the name of the library in the idf_component_register
|
||||
* for the PRIV_REQUIRES list. */
|
||||
/* #define INCLUDE_ALT_HW_TEST */
|
||||
|
||||
/* optionally turn off individual math HW acceleration features */
|
||||
|
||||
/* Turn off Large Number ESP32 HW Multiplication:
|
||||
** [Z = X * Y] in esp_mp_mul() */
|
||||
/* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_MP_MUL */
|
||||
|
||||
/* Turn off Large Number ESP32 HW Modular Exponentiation:
|
||||
** [Z = X^Y mod M] in esp_mp_exptmod() */
|
||||
/* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_EXPTMOD */
|
||||
|
||||
/* Turn off Large Number ESP32 HW Modular Multiplication
|
||||
** [Z = X * Y mod M] in esp_mp_mulmod() */
|
||||
/* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_MULMOD */
|
||||
|
||||
|
||||
#define WOLFSSL_PUBLIC_MP /* used by benchmark */
|
||||
#define USE_CERT_BUFFERS_2048
|
||||
|
||||
/* when turning on ECC508 / ECC608 support
|
||||
#define WOLFSSL_ESPWROOM32SE
|
||||
#define HAVE_PK_CALLBACKS
|
||||
#define WOLFSSL_ATECC508A
|
||||
#define ATCA_WOLFSSL
|
||||
*/
|
||||
|
||||
/* optional SM4 Ciphers. See https://github.com/wolfSSL/wolfsm
|
||||
#define WOLFSSL_SM2
|
||||
#define WOLFSSL_SM3
|
||||
#define WOLFSSL_SM4
|
||||
*/
|
||||
|
||||
#if defined(WOLFSSL_SM2) || defined(WOLFSSL_SM3) || defined(WOLFSSL_SM4)
|
||||
#include <wolfssl/certs_test_sm.h>
|
||||
#define CTX_CA_CERT root_sm2
|
||||
#define CTX_CA_CERT_SIZE sizeof_root_sm2
|
||||
#define CTX_CA_CERT_TYPE WOLFSSL_FILETYPE_PEM
|
||||
#define CTX_SERVER_CERT server_sm2
|
||||
#define CTX_SERVER_CERT_SIZE sizeof_server_sm2
|
||||
#define CTX_SERVER_CERT_TYPE WOLFSSL_FILETYPE_PEM
|
||||
#define CTX_SERVER_KEY server_sm2_priv
|
||||
#define CTX_SERVER_KEY_SIZE sizeof_server_sm2_priv
|
||||
#define CTX_SERVER_KEY_TYPE WOLFSSL_FILETYPE_PEM
|
||||
|
||||
#undef WOLFSSL_BASE16
|
||||
#define WOLFSSL_BASE16
|
||||
#else
|
||||
#define USE_CERT_BUFFERS_2048
|
||||
#define USE_CERT_BUFFERS_256
|
||||
#define CTX_CA_CERT ca_cert_der_2048
|
||||
#define CTX_CA_CERT_SIZE sizeof_ca_cert_der_2048
|
||||
#define CTX_CA_CERT_TYPE WOLFSSL_FILETYPE_ASN1
|
||||
#define CTX_SERVER_CERT server_cert_der_2048
|
||||
#define CTX_SERVER_CERT_SIZE sizeof_server_cert_der_2048
|
||||
#define CTX_SERVER_CERT_TYPE WOLFSSL_FILETYPE_ASN1
|
||||
#define CTX_SERVER_KEY server_key_der_2048
|
||||
#define CTX_SERVER_KEY_SIZE sizeof_server_key_der_2048
|
||||
#define CTX_SERVER_KEY_TYPE WOLFSSL_FILETYPE_ASN1
|
||||
#endif
|
||||
102
IDE/Espressif/ESP-IDF/examples/template/main/CMakeLists.txt
Normal file
102
IDE/Espressif/ESP-IDF/examples/template/main/CMakeLists.txt
Normal file
@@ -0,0 +1,102 @@
|
||||
# wolfSSL Espressif Example Project/main CMakeLists.txt
|
||||
# v1.0
|
||||
#
|
||||
# wolfssl template
|
||||
#
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_USER_SETTINGS")
|
||||
|
||||
if(WIN32)
|
||||
# Windows-specific configuration here
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_CMAKE_SYSTEM_NAME_WINDOWS")
|
||||
message("Detected Windows")
|
||||
endif()
|
||||
if(CMAKE_HOST_UNIX)
|
||||
message("Detected UNIX")
|
||||
endif()
|
||||
if(APPLE)
|
||||
message("Detected APPLE")
|
||||
endif()
|
||||
if(CMAKE_HOST_UNIX AND (NOT APPLE) AND EXISTS "/proc/sys/fs/binfmt_misc/WSLInterop")
|
||||
# Windows-specific configuration here
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_CMAKE_SYSTEM_NAME_WSL")
|
||||
message("Detected WSL")
|
||||
endif()
|
||||
if(CMAKE_HOST_UNIX AND (NOT APPLE) AND (NOT WIN32))
|
||||
# Windows-specific configuration here
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_CMAKE_SYSTEM_NAME_LINUX")
|
||||
message("Detected Linux")
|
||||
endif()
|
||||
if(APPLE)
|
||||
# Windows-specific configuration here
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_CMAKE_SYSTEM_NAME_APPLE")
|
||||
message("Detected Apple")
|
||||
endif()
|
||||
set (git_cmd "git")
|
||||
|
||||
if( EXISTS "${CMAKE_HOME_DIRECTORY}/components/wolfssl/" AND EXISTS "$ENV{IDF_PATH}/components/wolfssl/" )
|
||||
#
|
||||
# wolfSSL found in both ESP-IDF and local project - needs to be resolved by user
|
||||
#
|
||||
message(STATUS "")
|
||||
message(STATUS "WARNING: Found components/wolfssl in both local project and IDF_PATH")
|
||||
message(STATUS "")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_MULTI_INSTALL_WARNING")
|
||||
endif()
|
||||
|
||||
## register_component()
|
||||
idf_component_register(SRCS main.c
|
||||
INCLUDE_DIRS "."
|
||||
"./include")
|
||||
|
||||
#
|
||||
# LIBWOLFSSL_SAVE_INFO(VAR_OUPUT THIS_VAR VAR_RESULT)
|
||||
#
|
||||
# Save the THIS_VAR as a string in a macro called VAR_OUPUT
|
||||
#
|
||||
# VAR_OUPUT: the name of the macro to define
|
||||
# THIS_VAR: the OUTPUT_VARIABLE result from a execute_process()
|
||||
# VAR_RESULT: the RESULT_VARIABLE from a execute_process(); "0" if successful.
|
||||
#
|
||||
function ( LIBWOLFSSL_SAVE_INFO VAR_OUPUT THIS_VAR VAR_RESULT )
|
||||
# is the RESULT_VARIABLE output value 0? If so, IS_VALID_VALUE is true.
|
||||
string(COMPARE EQUAL "${VAR_RESULT}" "0" IS_VALID_VALUE)
|
||||
|
||||
# if we had a successful operation, save the THIS_VAR in VAR_OUPUT
|
||||
if(${IS_VALID_VALUE})
|
||||
# strip newline chars in THIS_VAR parameter and save in VAR_VALUE
|
||||
string(REPLACE "\n" "" VAR_VALUE ${THIS_VAR})
|
||||
|
||||
# we'll could percolate the value to the parent for possible later use
|
||||
# set(${VAR_OUPUT} ${VAR_VALUE} PARENT_SCOPE)
|
||||
|
||||
# but we're only using it here in this function
|
||||
set(${VAR_OUPUT} ${VAR_VALUE})
|
||||
|
||||
# we'll print what we found to the console
|
||||
message(STATUS "Found ${VAR_OUPUT}=${VAR_VALUE}")
|
||||
|
||||
# the interesting part is defining the VAR_OUPUT name a value to use in the app
|
||||
add_definitions(-D${VAR_OUPUT}=\"${VAR_VALUE}\")
|
||||
else()
|
||||
# if we get here, check the execute_process command and parameters.
|
||||
message(STATUS "LIBWOLFSSL_SAVE_INFO encountered a non-zero VAR_RESULT")
|
||||
set(${VAR_OUPUT} "Unknown")
|
||||
endif()
|
||||
endfunction() # LIBWOLFSSL_SAVE_INFO
|
||||
|
||||
if(NOT CMAKE_BUILD_EARLY_EXPANSION)
|
||||
# LIBWOLFSSL_VERSION_GIT_HASH
|
||||
execute_process(COMMAND ${git_cmd} "rev-parse" "HEAD" OUTPUT_VARIABLE TMP_OUT RESULT_VARIABLE TMP_RES ERROR_QUIET )
|
||||
LIBWOLFSSL_SAVE_INFO(LIBWOLFSSL_VERSION_GIT_HASH "${TMP_OUT}" "${TMP_RES}")
|
||||
|
||||
# LIBWOLFSSL_VERSION_GIT_SHORT_HASH
|
||||
execute_process(COMMAND ${git_cmd} "rev-parse" "--short" "HEAD" OUTPUT_VARIABLE TMP_OUT RESULT_VARIABLE TMP_RES ERROR_QUIET )
|
||||
LIBWOLFSSL_SAVE_INFO(LIBWOLFSSL_VERSION_GIT_SHORT_HASH "${TMP_OUT}" "${TMP_RES}")
|
||||
|
||||
# LIBWOLFSSL_VERSION_GIT_HASH_DATE
|
||||
execute_process(COMMAND ${git_cmd} "show" "--no-patch" "--no-notes" "--pretty=\'\%cd\'" OUTPUT_VARIABLE TMP_OUT RESULT_VARIABLE TMP_RES )
|
||||
LIBWOLFSSL_SAVE_INFO(LIBWOLFSSL_VERSION_GIT_HASH_DATE "${TMP_OUT}" "${TMP_RES}")
|
||||
endif()
|
||||
|
||||
message(STATUS "")
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* mpi_class.h
|
||||
/* template main.h
|
||||
*
|
||||
* Copyright (C) 2006-2023 wolfSSL Inc.
|
||||
*
|
||||
@@ -18,7 +18,7 @@
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
|
||||
*/
|
||||
#ifndef _MAIN_H_
|
||||
#define _MAIN_H_
|
||||
|
||||
|
||||
#include <wolfssl/wolfcrypt/mpi_class.h>
|
||||
|
||||
#endif
|
||||
@@ -1,4 +1,4 @@
|
||||
/* wolfcrypt_first.c
|
||||
/* main.c
|
||||
*
|
||||
* Copyright (C) 2006-2023 wolfSSL Inc.
|
||||
*
|
||||
@@ -19,36 +19,31 @@
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
|
||||
*/
|
||||
|
||||
/* Espressif */
|
||||
#include <esp_log.h>
|
||||
|
||||
/* This file needs to be linked first in order to work correctly */
|
||||
/* wolfSSL */
|
||||
#include <wolfssl/wolfcrypt/port/Espressif/esp32-crypt.h>
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
/* project */
|
||||
#include "main.h"
|
||||
|
||||
/* in case user set HAVE_FIPS there */
|
||||
#include <cyassl/ctaocrypt/settings.h>
|
||||
static const char* const TAG = "My Project";
|
||||
|
||||
#ifdef HAVE_FIPS
|
||||
|
||||
#ifdef USE_WINDOWS_API
|
||||
#pragma code_seg(".fipsA$a")
|
||||
#pragma const_seg(".fipsB$a")
|
||||
#endif
|
||||
|
||||
|
||||
/* read only start address */
|
||||
const unsigned int wolfCrypt_FIPS_ro_start[] =
|
||||
{ 0x1a2b3c4d, 0x00000001 };
|
||||
|
||||
|
||||
/* first function of text/code segment */
|
||||
int wolfCrypt_FIPS_first(void);
|
||||
int wolfCrypt_FIPS_first(void)
|
||||
void app_main(void)
|
||||
{
|
||||
return 0;
|
||||
ESP_LOGI(TAG, "Hello wolfSSL!");
|
||||
|
||||
#ifdef HAVE_VERSION_EXTENDED_INFO
|
||||
esp_ShowExtendedSystemInfo();
|
||||
#endif
|
||||
|
||||
#if defined(WOLFSSL_HW_METRICS) && defined(WOLFSSL_HAS_METRICS)
|
||||
esp_hw_show_metrics();
|
||||
#endif
|
||||
|
||||
ESP_LOGI(TAG, "\n\nDone!"
|
||||
"If running from idf.py monitor, press twice: Ctrl+]\n\n"
|
||||
"WOLFSSL_COMPLETE\n" /* exit keyword for wolfssl_monitor.py */
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
#endif /* HAVE_FIPS */
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
# to view: idf.py partition-table
|
||||
#
|
||||
# ESP-IDF Partition Table
|
||||
# Name, Type, SubType, Offset, Size, Flags
|
||||
nvs, data, nvs, 0x9000, 24K,
|
||||
phy_init,data, phy, 0xf000, 4K,
|
||||
factory, app, factory, 0x10000, 1500K,
|
||||
|
||||
|
||||
# For other settings, see:
|
||||
# https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/partition-tables.html#creating-custom-tables
|
||||
#
|
||||
# Here is the summary printed for the "Single factory app, no OTA" configuration:
|
||||
#
|
||||
# # ESP-IDF Partition Table
|
||||
# # Name, Type, SubType, Offset, Size, Flags
|
||||
# nvs, data, nvs, 0x9000, 0x6000,
|
||||
# phy_init, data, phy, 0xf000, 0x1000,
|
||||
# factory, app, factory, 0x10000, 1M,
|
||||
#
|
||||
#
|
||||
# Here is the summary printed for the "Factory app, two OTA definitions" configuration:
|
||||
#
|
||||
# # ESP-IDF Partition Table
|
||||
# # Name, Type, SubType, Offset, Size, Flags
|
||||
# nvs, data, nvs, 0x9000, 0x4000,
|
||||
# otadata, data, ota, 0xd000, 0x2000,
|
||||
# phy_init, data, phy, 0xf000, 0x1000,
|
||||
# factory, app, factory, 0x10000, 1M,
|
||||
# ota_0, app, ota_0, 0x110000, 1M,
|
||||
# ota_1, app, ota_1, 0x210000, 1M,
|
||||
|
Can't render this file because it contains an unexpected character in line 13 and column 39.
|
35
IDE/Espressif/ESP-IDF/examples/template/sdkconfig.defaults
Normal file
35
IDE/Espressif/ESP-IDF/examples/template/sdkconfig.defaults
Normal file
@@ -0,0 +1,35 @@
|
||||
CONFIG_FREERTOS_HZ=1000
|
||||
CONFIG_ESP32_DEFAULT_CPU_FREQ_240=y
|
||||
|
||||
#
|
||||
# Default main stack size
|
||||
#
|
||||
# This is typically way bigger than needed for stack size. See user_settings.h
|
||||
#
|
||||
CONFIG_ESP_MAIN_TASK_STACK_SIZE=10500
|
||||
|
||||
# Legacy stack size for older ESP-IDF versions
|
||||
CONFIG_MAIN_TASK_STACK_SIZE=10500
|
||||
|
||||
#
|
||||
# Compiler options
|
||||
#
|
||||
CONFIG_COMPILER_OPTIMIZATION_DEFAULT=y
|
||||
CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_ENABLE=y
|
||||
CONFIG_COMPILER_OPTIMIZATION_ASSERTION_LEVEL=2
|
||||
CONFIG_COMPILER_HIDE_PATHS_MACROS=y
|
||||
CONFIG_COMPILER_STACK_CHECK_MODE_NORM=y
|
||||
CONFIG_COMPILER_STACK_CHECK=y
|
||||
|
||||
#
|
||||
# Partition Table
|
||||
#
|
||||
# CONFIG_PARTITION_TABLE_SINGLE_APP is not set
|
||||
CONFIG_PARTITION_TABLE_SINGLE_APP_LARGE=y
|
||||
# CONFIG_PARTITION_TABLE_TWO_OTA is not set
|
||||
# CONFIG_PARTITION_TABLE_CUSTOM is not set
|
||||
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions.csv"
|
||||
CONFIG_PARTITION_TABLE_FILENAME="partitions_singleapp_large.csv"
|
||||
CONFIG_PARTITION_TABLE_OFFSET=0x8000
|
||||
CONFIG_PARTITION_TABLE_MD5=y
|
||||
# end of Partition Table
|
||||
@@ -1,6 +1,27 @@
|
||||
# wolfSSL Espressif Example Project CMakeLists.txt
|
||||
# v1.0
|
||||
#
|
||||
# The following lines of boilerplate have to be in your project's
|
||||
# CMakeLists in this exact order for cmake to work correctly
|
||||
cmake_minimum_required(VERSION 3.5)
|
||||
cmake_minimum_required(VERSION 3.16)
|
||||
|
||||
# The wolfSSL CMake file should be able to find the source code.
|
||||
# Otherwise, assign an environment variable or set it here:
|
||||
#
|
||||
# set(WOLFSSL_ROOT "~/workspace/wolfssl-other-source")
|
||||
#
|
||||
# Optional WOLFSSL_CMAKE_SYSTEM_NAME detection to find
|
||||
# USE_MY_PRIVATE_CONFIG path for my_private_config.h
|
||||
#
|
||||
# Expected path varies:
|
||||
#
|
||||
# WSL: /mnt/c/workspace
|
||||
# Linux: ~/workspace
|
||||
# Windows: C:\workspace
|
||||
#
|
||||
|
||||
# Optionally specify a location for wolfSSL component source code
|
||||
# set(WOLFSSL_ROOT "c:/test/blogtest/wolfssl" )
|
||||
|
||||
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
|
||||
|
||||
|
||||
@@ -1,6 +1,59 @@
|
||||
# wolfSSL Benchmark Example
|
||||
|
||||
The Example contains of wolfSSL benchmark program.
|
||||
This ESP32 example uses the [wolfSSL wolfcrypt Benchmark Application](https://github.com/wolfSSL/wolfssl/tree/master/wolfcrypt/benchmark).
|
||||
|
||||
For general information on [wolfSSL examples for Espressif](../README.md), see the
|
||||
[README](https://github.com/wolfSSL/wolfssl/blob/master/IDE/Espressif/ESP-IDF/README.md) file.
|
||||
|
||||
## Espressif ESP Component Registry
|
||||
|
||||
See the wolfSSL namespace at [components.espressif.com](https://components.espressif.com/components?q=wolfssl)
|
||||
|
||||
|
||||
## Windows COM Port
|
||||
|
||||
All of these examples use COM20 on Windows. The DOS `change port` command can be use to assign any
|
||||
other local port to `COM20` as needed:
|
||||
|
||||
```
|
||||
change port com20=com23
|
||||
```
|
||||
|
||||
## VisualGDB
|
||||
|
||||
Open the VisualGDB Visual Studio Project file in the VisualGDB directory and click the "Start" button.
|
||||
No wolfSSL setup is needed. You may need to adjust your specific COM port. The default is `COM20`.
|
||||
|
||||
Include in the respective project `./VisualGDB` directory are [VisualGDB](https://visualgdb.com/) project files.
|
||||
Individual project files are included for convenience to new users,
|
||||
as there are [difficulties switching between ESP-IDF Versions or Chipsets](https://sysprogs.com/w/forums/topic/difficulties-switching-espressif-esp-idf-version-or-chipset/)
|
||||
using the VisualGDB extension.
|
||||
|
||||
The naming convention for project files is: `[project name]_IDF_[Version]_[chipset].vgdbproj`. The solution files (filename[.sln]) often will contain shortcuts to commonly used source and configuration files used by the respective project.
|
||||
|
||||
|
||||
-------- |------------- |------------- |
|
||||
ChipSet | ESP-IDF v4.4 | ESP-IDF v5.1 |
|
||||
-------- |------------- |------------- |
|
||||
ESP32 | x | |
|
||||
ESP32-S2 | | |
|
||||
ESP32-S3 | x | x |
|
||||
ESP32-C3 | x | x |
|
||||
ESP32-C6 | | |
|
||||
|
||||
|
||||
The default directories are:
|
||||
|
||||
- `C:\SysGCC` - The root directory install of VisualGDB
|
||||
- `C:\SysGCC\esp32` - The default for ESP-IDF v5.x
|
||||
- `C:\SysGCC\esp32-8.4` - Many need to manually select this name for ESP-IDF v4.x install
|
||||
- `C:\SysGCC\esp8266`- The default for ESP8266
|
||||
|
||||
Windows ports assigned with the `change port` command may not appear in the VisualGDB dropdowns but can still
|
||||
be used when manually typed.
|
||||
See the [feature request](https://sysprogs.com/w/forums/topic/feature-request-show-windows-change-port-results-in-com-port-dropdown-lists/).
|
||||
|
||||
## ESP-IDF Commandline
|
||||
|
||||
1. `idf.py menuconfig` to configure the program.
|
||||
1-1. Example Configuration ->
|
||||
@@ -22,17 +75,30 @@ Reminder than when building on WSL in `/mnt/c` there will be a noticeable perfor
|
||||
Example build on WSL:
|
||||
|
||||
```
|
||||
Optionally install wolfSSL component
|
||||
# cd /mnt/c/workspace/wolfssl/IDE/Espressif/ESP-IDF
|
||||
./setup.sh
|
||||
Optionally update toolchain
|
||||
|
||||
cd /mnt/c/SysGCC/esp32/esp-idf/master
|
||||
git fetch
|
||||
git pull
|
||||
git submodule update --init --recursive
|
||||
|
||||
cd /mnt/c/workspace/wolfssl/IDE/Espressif/ESP-IDF/examples/wolfssl_benchmark
|
||||
|
||||
# Pick ESP-IDF install directory, this one for v4.4.2 in VisualGDB
|
||||
. /mnt/c/SysGCC/esp32/esp-idf/v4.4.2/export.sh
|
||||
# Pick ESP-IDF install directory, this one for v5.1 in VisualGDB
|
||||
|
||||
WRK_IDF_PATH=/mnt/c/SysGCC/esp32/esp-idf/v5.1
|
||||
WRK_IDF_PATH=/mnt/c/SysGCC/esp32-8.4/esp-idf/v4.4.1
|
||||
WRK_IDF_PATH=~/esp/esp-idf
|
||||
|
||||
idf.py build flash -p /dev/ttyS20 -b 921600 monitor
|
||||
. $WRK_IDF_PATH/export.sh
|
||||
|
||||
# Set target SoC
|
||||
idf.py set-target esp32c3
|
||||
|
||||
# Optionally erase
|
||||
|
||||
# Build and flash
|
||||
idf.py build flash -p /dev/ttyS20 -b 115200 monitor
|
||||
```
|
||||
|
||||
## Example Output
|
||||
@@ -42,7 +108,7 @@ compatible across the widest ranges of targets. Contact wolfSSL at support@wolfs
|
||||
for help in optimizing for your particular application, or see the
|
||||
[docs](https://www.wolfssl.com/documentation/manuals/wolfssl/index.html).
|
||||
|
||||
Compiled and flashed with `idf.py build flash -p /dev/ttyS7 -b 921600 monitor`:
|
||||
Compiled and flashed with `idf.py build flash -p /dev/ttyS7 -b 115200 monitor`:
|
||||
|
||||
```
|
||||
--- idf_monitor on /dev/ttyS7 115200 ---
|
||||
@@ -186,5 +252,7 @@ compilation terminated.
|
||||
A 'clean` may be needed after freshly installing a new component:
|
||||
|
||||
```
|
||||
idf.py clean build flash -p /dev/ttyS7 -b 921600 monitor
|
||||
```
|
||||
idf.py clean build flash -p /dev/ttyS7 -b 115200 monitor
|
||||
```
|
||||
|
||||
See the README.md file in the upper level 'examples' directory for [more information about examples](../README.md).
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0"?>
|
||||
<VisualGDBProjectSettings2 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
|
||||
<VisualGDBProjectSettings2 xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<Project xsi:type="com.visualgdb.project.external.esp-idf">
|
||||
<CustomSourceDirectories>
|
||||
<Directories />
|
||||
@@ -220,7 +220,7 @@
|
||||
<DebugMethod>
|
||||
<ID>openocd</ID>
|
||||
<Configuration xsi:type="com.visualgdb.edp.openocd.settings.esp32">
|
||||
<CommandLine>-f interface/tigard.cfg -c "adapter_khz 15000" -f target/esp32.cfg</CommandLine>
|
||||
<CommandLine>-f interface/ftdi/tigard.cfg -c "adapter_khz 15000" -f target/esp32.cfg</CommandLine>
|
||||
<ExtraParameters>
|
||||
<Frequency xsi:nil="true" />
|
||||
<BoostedFrequency xsi:nil="true" />
|
||||
|
||||
@@ -17,209 +17,435 @@
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
|
||||
#
|
||||
# cmake for wolfssl
|
||||
# cmake for wolfssl Espressif projects
|
||||
#
|
||||
cmake_minimum_required(VERSION 3.5)
|
||||
# Version 5.6.0.011 for detect test/benchmark
|
||||
#
|
||||
# See https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/build-system.html
|
||||
#
|
||||
|
||||
cmake_minimum_required(VERSION 3.16)
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_USER_SETTINGS")
|
||||
set(CMAKE_CURRENT_SOURCE_DIR ".")
|
||||
set(COMPONENT_REQUIRES lwip) # we typically don't need lwip directly in wolfssl component
|
||||
set(WOLFSSL_ROOT "$ENV{WOLFSSL_ROOT}" )
|
||||
|
||||
# We are currently in [root]/IDE/Espressif/ESP-IDF/examples/wolfssl_test/components/wolfssl
|
||||
# The root of wolfSSL is 7 directories up from here:
|
||||
get_filename_component(WOLFSSL_ROOT "../../../../../../../" ABSOLUTE)
|
||||
|
||||
# Espressif may take several passes through this makefile. Check to see if we found IDF
|
||||
string(COMPARE EQUAL "${PROJECT_SOURCE_DIR}" "" WOLFSSL_FOUND_IDF)
|
||||
|
||||
if($WOLFSSL_FOUND_IDF)
|
||||
message(STATUS "IDF_PATH = $ENV{IDF_PATH}")
|
||||
message(STATUS "WOLFSSL_ROOT = ${WOLFSSL_ROOT}")
|
||||
message(STATUS "PROJECT_SOURCE_DIR = ${PROJECT_SOURCE_DIR}")
|
||||
endif()
|
||||
|
||||
# get a list of all wolfcrypt assembly files; we'll exclude them as they don't target Xtensa
|
||||
FILE(GLOB EXCLUDE_ASM *.S)
|
||||
file(GLOB_RECURSE EXCLUDE_ASM ${CMAKE_SOURCE_DIR} "${WOLFSSL_ROOT}/wolfcrypt/src/*.S")
|
||||
|
||||
if(NOT CMAKE_BUILD_EARLY_EXPANSION)
|
||||
message(STATUS "EXCLUDE_ASM = ${EXCLUDE_ASM}")
|
||||
endif()
|
||||
|
||||
set(INCLUDE_PATH ${WOLFSSL_ROOT})
|
||||
|
||||
set(COMPONENT_SRCDIRS "${WOLFSSL_ROOT}/src/"
|
||||
"${WOLFSSL_ROOT}/wolfcrypt/src/"
|
||||
"${WOLFSSL_ROOT}/wolfcrypt/src/port/Espressif/"
|
||||
"${WOLFSSL_ROOT}/wolfcrypt/src/port/atmel/"
|
||||
"${WOLFSSL_ROOT}/wolfcrypt/benchmark/"
|
||||
"${WOLFSSL_ROOT}/wolfcrypt/test/"
|
||||
)
|
||||
|
||||
set(COMPONENT_REQUIRES lwip)
|
||||
|
||||
|
||||
# check to see if there's both a local copy and EDP-IDF copy of the wolfssl and/or wolfssh components
|
||||
if( EXISTS "${CMAKE_HOME_DIRECTORY}/components/wolfssl/" AND EXISTS "$ENV{IDF_PATH}/components/wolfssl/" )
|
||||
#
|
||||
# wolfSSL found in both ESP-IDF and local project - needs to be resolved by user
|
||||
#
|
||||
message(STATUS "")
|
||||
message(STATUS "**************************************************************************************")
|
||||
message(STATUS "")
|
||||
message(STATUS "Error: Found components/wolfssl in both local project and IDF_PATH")
|
||||
message(STATUS "")
|
||||
message(STATUS "To proceed: ")
|
||||
message(STATUS "")
|
||||
message(STATUS "Remove either the local project component: ${CMAKE_HOME_DIRECTORY}/components/wolfssl/ ")
|
||||
message(STATUS "or the Espressif shared component installed at: $ENV{IDF_PATH}/components/wolfssl/ ")
|
||||
message(STATUS "")
|
||||
message(FATAL_ERROR "Please use wolfSSL in either local project or Espressif components, but not both.")
|
||||
message(STATUS "")
|
||||
message(STATUS "**************************************************************************************")
|
||||
message(STATUS "")
|
||||
|
||||
# Optional: if you change the above FATAL_ERROR to STATUS you can warn at runtime with this macro definition:
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_MULTI_INSTALL_WARNING")
|
||||
|
||||
else()
|
||||
if( EXISTS "$ENV{IDF_PATH}/components/wolfssl/" )
|
||||
#
|
||||
# wolfSSL found in ESP-IDF components and is assumed to be already configured in user_settings.h via setup.
|
||||
#
|
||||
message(STATUS "")
|
||||
message(STATUS "Using components/wolfssl in IDF_PATH = $ENV{IDF_PATH}")
|
||||
message(STATUS "")
|
||||
# find the user name to search for possible "wolfssl-username"
|
||||
message(STATUS "USERNAME = $ENV{USERNAME}")
|
||||
if( "$ENV{USER}" STREQUAL "" ) # the bash user
|
||||
if( "$ENV{USERNAME}" STREQUAL "" ) # the Windows user
|
||||
message(STATUS "could not find USER or USERNAME")
|
||||
else()
|
||||
#
|
||||
# wolfSSL is not an ESP-IDF component. We need to now determine if it is local and if so if it is part of the wolfSSL repo
|
||||
# or if wolfSSL is simply installed as a local component.
|
||||
#
|
||||
if( EXISTS "${CMAKE_HOME_DIRECTORY}/components/wolfssl/" )
|
||||
#
|
||||
# wolfSSL found in local project.
|
||||
#
|
||||
if( EXISTS "${CMAKE_HOME_DIRECTORY}/components/wolfssl/include/" )
|
||||
message(STATUS "")
|
||||
message(STATUS "Using installed project ./components/wolfssl in CMAKE_HOME_DIRECTORY = $ENV{CMAKE_HOME_DIRECTORY}")
|
||||
message(STATUS "")
|
||||
#
|
||||
# Note we already checked above and confirmed there's not another wolfSSL installed in the ESP-IDF components.
|
||||
#
|
||||
# We won't do anything else here, as it will be assumed the original install completed successfully.
|
||||
#
|
||||
else()
|
||||
#
|
||||
# This is the developer repo mode. wolfSSL will be assume to be not installed to ESP-IDF nor local project
|
||||
# In this configuration, we are likely running a wolfSSL example found directly in the repo.
|
||||
#
|
||||
message(STATUS "")
|
||||
message(STATUS "Using developer repo ./components/wolfssl in CMAKE_HOME_DIRECTORY = $ENV{CMAKE_HOME_DIRECTORY}")
|
||||
message(STATUS "")
|
||||
|
||||
message(STATUS "************************************************************************************************")
|
||||
# When in developer mode, we are typically running wolfSSL examples such as benchmark or test directories.
|
||||
# However, the as-cloned or distributed wolfSSL does not have the ./include/ directory, so we'll add it as needed.
|
||||
#
|
||||
# first check if there's a [root]/include/user_settings.h
|
||||
if( EXISTS "${WOLFSSL_ROOT}/include/user_settings.h" )
|
||||
# we won't overwrite an existing user settings file, just note that we already have one:
|
||||
message(STATUS "Found wolfSSL user_settings.h in ${WOLFSSL_ROOT}/include/user_settings.h")
|
||||
else()
|
||||
message(STATUS "Installing wolfSSL user_settings.h to ${WOLFSSL_ROOT}/include/user_settings.h")
|
||||
file(COPY "${WOLFSSL_ROOT}/IDE/Espressif/ESP-IDF/user_settings.h" DESTINATION "${WOLFSSL_ROOT}/include/")
|
||||
endif() # user_settings.h
|
||||
|
||||
# next check if there's a [root]/include/config.h
|
||||
if( EXISTS "${WOLFSSL_ROOT}/include/config.h" )
|
||||
message(STATUS "Found wolfSSL config.h in ${WOLFSSL_ROOT}/include/config.h")
|
||||
else()
|
||||
message(STATUS "Installing wolfSSL config.h to ${WOLFSSL_ROOT}/include/config.h")
|
||||
file(COPY "${WOLFSSL_ROOT}/IDE/Espressif/ESP-IDF/dummy_config_h" DESTINATION "${WOLFSSL_ROOT}/include/")
|
||||
file(RENAME "${WOLFSSL_ROOT}/include/dummy_config_h" "${WOLFSSL_ROOT}/include/config.h")
|
||||
endif() # config.h
|
||||
message(STATUS "************************************************************************************************")
|
||||
message(STATUS "")
|
||||
endif()
|
||||
|
||||
else()
|
||||
# we did not find a ./components/wolfssl/include/ directory from this pass of cmake.
|
||||
if($WOLFSSL_FOUND_IDF)
|
||||
message(STATUS "")
|
||||
message(STATUS "WARNING: wolfSSL not found.")
|
||||
message(STATUS "")
|
||||
else()
|
||||
# probably needs to be re-parsed by Espressif
|
||||
message(STATUS "wolfSSL found IDF. Project Source:${PROJECT_SOURCE_DIR}")
|
||||
endif() # else we have not found ESP-IDF yet
|
||||
endif() # else not a local wolfSSL component
|
||||
|
||||
endif() #else not an ESP-IDF component
|
||||
endif() # else not local copy and EDP-IDF wolfSSL
|
||||
|
||||
|
||||
# RTOS_IDF_PATH is typically:
|
||||
# "/Users/{username}/Desktop/esp-idf/components/freertos/include/freertos"
|
||||
# depending on the environment, we may need to swap backslashes with forward slashes
|
||||
string(REPLACE "\\" "/" RTOS_IDF_PATH "$ENV{IDF_PATH}/components/freertos/include/freertos")
|
||||
|
||||
# ESP-IDF after version 4.4x has a different RTOS directory structure
|
||||
string(REPLACE "\\" "/" RTOS_IDF_PATH5 "$ENV{IDF_PATH}/components/freertos/FreeRTOS-Kernel/include/freertos")
|
||||
|
||||
if(IS_DIRECTORY ${IDF_PATH}/components/freertos/FreeRTOS-Kernel/)
|
||||
set(COMPONENT_ADD_INCLUDEDIRS
|
||||
"."
|
||||
"${WOLFSSL_ROOT}/include"
|
||||
"${RTOS_IDF_PATH5}"
|
||||
"${WOLFSSL_ROOT}"
|
||||
)
|
||||
# the bash user is not blank, so we'll use it.
|
||||
set(THIS_USER "$ENV{USERNAME}")
|
||||
endif()
|
||||
else()
|
||||
|
||||
set(COMPONENT_ADD_INCLUDEDIRS
|
||||
"."
|
||||
"${WOLFSSL_ROOT}/include"
|
||||
"${RTOS_IDF_PATH}"
|
||||
"${WOLFSSL_ROOT}"
|
||||
)
|
||||
# the bash user is not blank, so we'll use it.
|
||||
set(THIS_USER "$ENV{USER}")
|
||||
endif()
|
||||
message(STATUS "THIS_USER = ${THIS_USER}")
|
||||
|
||||
if(IS_DIRECTORY ${IDF_PATH}/components/cryptoauthlib)
|
||||
list(APPEND COMPONENT_ADD_INCLUDEDIRS "../cryptoauthlib/lib")
|
||||
endif()
|
||||
|
||||
set(COMPONENT_SRCEXCLUDE
|
||||
"${WOLFSSL_ROOT}/src/bio.c"
|
||||
"${WOLFSSL_ROOT}/src/conf.c"
|
||||
"${WOLFSSL_ROOT}/src/misc.c"
|
||||
"${WOLFSSL_ROOT}/src/pk.c"
|
||||
"${WOLFSSL_ROOT}/src/ssl_asn1.c" # included by ssl.c
|
||||
"${WOLFSSL_ROOT}/src/ssl_bn.c" # included by ssl.c
|
||||
"${WOLFSSL_ROOT}/src/ssl_misc.c" # included by ssl.c
|
||||
"${WOLFSSL_ROOT}/src/x509.c"
|
||||
"${WOLFSSL_ROOT}/src/x509_str.c"
|
||||
"${WOLFSSL_ROOT}/wolfcrypt/src/evp.c"
|
||||
"${WOLFSSL_ROOT}/wolfcrypt/src/misc.c"
|
||||
"${EXCLUDE_ASM}"
|
||||
)
|
||||
set(COMPONENT_PRIV_INCLUDEDIRS ${IDF_PATH}/components/driver/include)
|
||||
# COMPONENT_NAME = wolfssl
|
||||
# The component name is the directory name. "No feature to change this".
|
||||
# See https://github.com/espressif/esp-idf/issues/8978#issuecomment-1129892685
|
||||
|
||||
# set the root of wolfSSL in top-level project CMakelists.txt:
|
||||
# set(WOLFSSL_ROOT "C:/some path/with/spaces")
|
||||
# set(WOLFSSL_ROOT "c:/workspace/wolfssl-[username]")
|
||||
# set(WOLFSSL_ROOT "/mnt/c/some path/with/spaces")
|
||||
# or use this logic to assign value from Environment Variable WOLFSSL_ROOT,
|
||||
# or assume this is an example 7 subdirectories below:
|
||||
|
||||
# We are typically in [root]/IDE/Espressif/ESP-IDF/examples/wolfssl_test/components/wolfssl
|
||||
# The root of wolfSSL is 7 directories up from here:
|
||||
|
||||
# function: IS_WOLFSSL_SOURCE
|
||||
# parameter: DIRECTORY_PARAMETER - the directory to test
|
||||
# output: RESULT = contains contents of DIRECTORY_PARAMETER for wolfssl directory, otherwise blank.
|
||||
function(IS_WOLFSSL_SOURCE DIRECTORY_PARAMETER RESULT)
|
||||
if (EXISTS "${DIRECTORY_PARAMETER}/wolfcrypt/src")
|
||||
set(${RESULT} "${DIRECTORY_PARAMETER}" PARENT_SCOPE)
|
||||
else()
|
||||
set(${RESULT} "" PARENT_SCOPE)
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
# function: FIND_WOLFSSL_DIRECTORY
|
||||
# parameter: OUTPUT_FOUND_WOLFSSL_DIRECTORY contains root of source code, otherwise blank
|
||||
#
|
||||
function(FIND_WOLFSSL_DIRECTORY OUTPUT_FOUND_WOLFSSL_DIRECTORY)
|
||||
message(STATUS "Starting FIND_WOLFSSL_DIRECTORY")
|
||||
set(CURRENT_SEARCH_DIR "$ENV{WOLFSSL_ROOT}")
|
||||
if( "${CURRENT_SEARCH_DIR}" STREQUAL "" )
|
||||
message(STATUS "The WOLFSSL_ROOT environment variable is not set. Searching...")
|
||||
else()
|
||||
get_filename_component(CURRENT_SEARCH_DIR "$ENV{WOLFSSL_ROOT}" ABSOLUTE)
|
||||
IS_WOLFSSL_SOURCE("${CURRENT_SEARCH_DIR}" FOUND_WOLFSSL)
|
||||
if("${FOUND_WOLFSSL}")
|
||||
message(STATUS "Found WOLFSSL_ROOT via Environment Variable:")
|
||||
else()
|
||||
message(FATAL_ERROR "WOLFSSL_ROOT Environment Variable defined, but path not found:")
|
||||
message(STATUS "$ENV{WOLFSSL_ROOT}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# we'll start in the CMAKE_CURRENT_SOURCE_DIR, typically [something]/projectname/components/wolfssl
|
||||
message(STATUS "CMAKE_CURRENT_SOURCE_DIR = ${CMAKE_CURRENT_SOURCE_DIR}")
|
||||
get_filename_component(CURRENT_SEARCH_DIR "${CMAKE_CURRENT_SOURCE_DIR}" ABSOLUTE)
|
||||
message(STATUS "CURRENT_SEARCH_DIR = ${CURRENT_SEARCH_DIR}")
|
||||
string(LENGTH ${CURRENT_SEARCH_DIR} CURRENT_SEARCH_DIR_LENGTH)
|
||||
|
||||
# loop through all the parents, looking for wolfssl
|
||||
while(NOT CURRENT_SEARCH_DIR STREQUAL "/" AND NOT CURRENT_SEARCH_DIR STREQUAL "" )
|
||||
string(LENGTH ${CURRENT_SEARCH_DIR} CURRENT_SEARCH_DIR_LENGTH)
|
||||
# wolfSSL may simply be in a parent directory, such as for local examples in wolfssl repo
|
||||
IS_WOLFSSL_SOURCE("${CURRENT_SEARCH_DIR}" FOUND_WOLFSSL)
|
||||
if( FOUND_WOLFSSL )
|
||||
message(STATUS "Found wolfssl in CURRENT_SEARCH_DIR = ${CURRENT_SEARCH_DIR}")
|
||||
set(${OUTPUT_FOUND_WOLFSSL_DIRECTORY} ${CURRENT_SEARCH_DIR} PARENT_SCOPE)
|
||||
return()
|
||||
endif()
|
||||
|
||||
if( THIS_USER )
|
||||
# Check for "wolfssl-[username]" subdirectory as we recurse up the directory tree
|
||||
set(CURRENT_SEARCH_DIR_ALT ${CURRENT_SEARCH_DIR}/wolfssl-${THIS_USER})
|
||||
message(STATUS "Looking in ${CURRENT_SEARCH_DIR}")
|
||||
|
||||
#if(EXISTS ${CURRENT_SEARCH_DIR_ALT} AND IS_DIRECTORY ${CURRENT_SEARCH_DIR_ALT} AND EXISTS "${CURRENT_SEARCH_DIR_ALT}/wolfcrypt/src")
|
||||
IS_WOLFSSL_SOURCE("${CURRENT_SEARCH_DIR_ALT}" FOUND_WOLFSSL )
|
||||
if ( FOUND_WOLFSSL )
|
||||
message(STATUS "Found wolfssl in user-suffix CURRENT_SEARCH_DIR_ALT = ${CURRENT_SEARCH_DIR_ALT}")
|
||||
set(${OUTPUT_FOUND_WOLFSSL_DIRECTORY} ${CURRENT_SEARCH_DIR_ALT} PARENT_SCOPE)
|
||||
return()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Next check for no user suffix "wolfssl" subdirectory as we recurse up the directory tree
|
||||
set(CURRENT_SEARCH_DIR_ALT ${CURRENT_SEARCH_DIR}/wolfssl)
|
||||
# if(EXISTS ${CURRENT_SEARCH_DIR} AND IS_DIRECTORY ${CURRENT_SEARCH_DIR} AND EXISTS "${CURRENT_SEARCH_DIR}/wolfcrypt/src")
|
||||
IS_WOLFSSL_SOURCE("${CURRENT_SEARCH_DIR_ALT}" FOUND_WOLFSSL )
|
||||
if ( FOUND_WOLFSSL )
|
||||
message(STATUS "Found wolfssl in CURRENT_SEARCH_DIR = ${CURRENT_SEARCH_DIR}")
|
||||
set(${OUTPUT_FOUND_WOLFSSL_DIRECTORY} ${CURRENT_SEARCH_DIR} PARENT_SCOPE)
|
||||
return()
|
||||
endif()
|
||||
|
||||
# Move up one directory level
|
||||
set(PRIOR_SEARCH_DIR "${CURRENT_SEARCH_DIR}")
|
||||
get_filename_component(CURRENT_SEARCH_DIR "${CURRENT_SEARCH_DIR}" DIRECTORY)
|
||||
message(STATUS "Next CURRENT_SEARCH_DIR = ${CURRENT_SEARCH_DIR}")
|
||||
if( "${PRIOR_SEARCH_DIR}" STREQUAL "${CURRENT_SEARCH_DIR}" )
|
||||
# when the search directory is empty, we'll give up
|
||||
set(CURRENT_SEARCH_DIR "")
|
||||
endif()
|
||||
endwhile()
|
||||
|
||||
# If not found, set the output variable to empty before exiting
|
||||
set(${OUTPUT_FOUND_WOLFSSL_DIRECTORY} "" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
|
||||
# Example usage:
|
||||
|
||||
|
||||
|
||||
|
||||
if(CMAKE_BUILD_EARLY_EXPANSION)
|
||||
message(STATUS "wolfssl component CMAKE_BUILD_EARLY_EXPANSION:")
|
||||
idf_component_register(
|
||||
REQUIRES "${COMPONENT_REQUIRES}"
|
||||
PRIV_REQUIRES # esp_hw_support
|
||||
esp_timer
|
||||
driver # this will typically only be needed for wolfSSL benchmark
|
||||
)
|
||||
|
||||
else()
|
||||
# not CMAKE_BUILD_EARLY_EXPANSION
|
||||
message(STATUS "************************************************************************************************")
|
||||
message(STATUS "wolfssl component config:")
|
||||
message(STATUS "************************************************************************************************")
|
||||
|
||||
# search for wolfSSL
|
||||
FIND_WOLFSSL_DIRECTORY(WOLFSSL_ROOT)
|
||||
if(WOLFSSL_ROOT)
|
||||
message(STATUS "NEW Found wolfssl directory at: ${WOLFSSL_ROOT}")
|
||||
else()
|
||||
message(STATUS "NEW wolfssl directory not found.")
|
||||
# Abort. We need wolfssl _somewhere_.
|
||||
message(FATAL_ERROR "Could not find wolfssl in ${WOLFSSL_ROOT}.\n"
|
||||
"Try setting WOLFSSL_ROOT environment variable or git clone.")
|
||||
endif()
|
||||
|
||||
set(INCLUDE_PATH ${WOLFSSL_ROOT})
|
||||
|
||||
set(WOLFSSL_EXTRA_PROJECT_DIR "${WOLFSSL_ROOT}/src/")
|
||||
|
||||
if( ${CMAKE_PROJECT_NAME} STREQUAL "wolfssl_benchmark" )
|
||||
set(WOLFSSL_EXTRA_PROJECT_DIR "${WOLFSSL_ROOT}/wolfcrypt/benchmark")
|
||||
endif()
|
||||
|
||||
if( ${CMAKE_PROJECT_NAME} STREQUAL "wolfssl_test" )
|
||||
set(WOLFSSL_EXTRA_PROJECT_DIR "${WOLFSSL_ROOT}/wolfcrypt/test")
|
||||
endif()
|
||||
|
||||
set(COMPONENT_SRCDIRS "\"${WOLFSSL_ROOT}/src/\""
|
||||
"\"${WOLFSSL_ROOT}/wolfcrypt/src\""
|
||||
"\"${WOLFSSL_ROOT}/wolfcrypt/src/port/Espressif\""
|
||||
"\"${WOLFSSL_ROOT}/wolfcrypt/src/port/atmel\""
|
||||
"\"${WOLFSSL_EXTRA_PROJECT_DIR}\""
|
||||
) # COMPONENT_SRCDIRS
|
||||
|
||||
message(STATUS "This COMPONENT_SRCDIRS = ${COMPONENT_SRCDIRS}")
|
||||
|
||||
set(WOLFSSL_PROJECT_DIR "${CMAKE_HOME_DIRECTORY}/components/wolfssl")
|
||||
add_definitions(-DWOLFSSL_USER_SETTINGS_DIR="${WOLFSSL_PROJECT_DIR}/include/user_settings.h")
|
||||
|
||||
|
||||
# Espressif may take several passes through this makefile. Check to see if we found IDF
|
||||
string(COMPARE EQUAL "${PROJECT_SOURCE_DIR}" "" WOLFSSL_FOUND_IDF)
|
||||
|
||||
# get a list of all wolfcrypt assembly files; we'll exclude them as they don't target Xtensa
|
||||
file(GLOB EXCLUDE_ASM *.S)
|
||||
file(GLOB_RECURSE EXCLUDE_ASM ${CMAKE_SOURCE_DIR} "${WOLFSSL_ROOT}/wolfcrypt/src/*.S")
|
||||
|
||||
message(STATUS "IDF_PATH = $ENV{IDF_PATH}")
|
||||
message(STATUS "PROJECT_SOURCE_DIR = ${PROJECT_SOURCE_DIR}")
|
||||
message(STATUS "EXCLUDE_ASM = ${EXCLUDE_ASM}")
|
||||
|
||||
#
|
||||
# Check to see if there's both a local copy and EDP-IDF copy of the wolfssl and/or wolfssh components.
|
||||
#
|
||||
if( EXISTS "${WOLFSSL_PROJECT_DIR}" AND EXISTS "$ENV{IDF_PATH}/components/wolfssl/" )
|
||||
#
|
||||
# wolfSSL found in both ESP-IDF and local project - needs to be resolved by user
|
||||
#
|
||||
message(STATUS "")
|
||||
message(STATUS "**************************************************************************************")
|
||||
message(STATUS "")
|
||||
message(STATUS "Error: Found components/wolfssl in both local project and IDF_PATH")
|
||||
message(STATUS "")
|
||||
message(STATUS "To proceed: ")
|
||||
message(STATUS "")
|
||||
message(STATUS "Remove either the local project component: ${WOLFSSL_PROJECT_DIR} ")
|
||||
message(STATUS "or the Espressif shared component installed at: $ENV{IDF_PATH}/components/wolfssl/ ")
|
||||
message(STATUS "")
|
||||
message(FATAL_ERROR "Please use wolfSSL in either local project or Espressif components, but not both.")
|
||||
message(STATUS "")
|
||||
message(STATUS "**************************************************************************************")
|
||||
message(STATUS "")
|
||||
|
||||
# Optional: if you change the above FATAL_ERROR to STATUS you can warn at runtime with this macro definition:
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_MULTI_INSTALL_WARNING")
|
||||
|
||||
else()
|
||||
if( EXISTS "$ENV{IDF_PATH}/components/wolfssl/" )
|
||||
#
|
||||
# wolfSSL found in ESP-IDF components and is assumed to be already configured in user_settings.h via setup.
|
||||
#
|
||||
message(STATUS "")
|
||||
message(STATUS "Using components/wolfssl in IDF_PATH = $ENV{IDF_PATH}")
|
||||
message(STATUS "")
|
||||
else()
|
||||
#
|
||||
# wolfSSL is not an ESP-IDF component.
|
||||
# We need to now determine if it is local and if so if it is part of the wolfSSL repo,
|
||||
# or if wolfSSL is simply installed as a local component.
|
||||
#
|
||||
|
||||
if( EXISTS "${WOLFSSL_PROJECT_DIR}" )
|
||||
#
|
||||
# wolfSSL found in local project.
|
||||
#
|
||||
if( EXISTS "${WOLFSSL_PROJECT_DIR}/wolfcrypt/" )
|
||||
message(STATUS "")
|
||||
message(STATUS "Using installed project ./components/wolfssl in CMAKE_HOME_DIRECTORY = ${CMAKE_HOME_DIRECTORY}")
|
||||
message(STATUS "")
|
||||
#
|
||||
# Note we already checked above and confirmed there's not another wolfSSL installed in the ESP-IDF components.
|
||||
#
|
||||
# We won't do anything else here, as it will be assumed the original install completed successfully.
|
||||
#
|
||||
else() # full wolfSSL not installed in local project
|
||||
#
|
||||
# This is the developer repo mode. wolfSSL will be assumed to be not installed to ESP-IDF nor local project
|
||||
# In this configuration, we are likely running a wolfSSL example found directly in the repo.
|
||||
#
|
||||
message(STATUS "")
|
||||
message(STATUS "Using developer repo ./components/wolfssl in CMAKE_HOME_DIRECTORY = ${CMAKE_HOME_DIRECTORY}")
|
||||
message(STATUS "")
|
||||
|
||||
message(STATUS "************************************************************************************************")
|
||||
# When in developer mode, we are typically running wolfSSL examples such as benchmark or test directories.
|
||||
# However, the as-cloned or distributed wolfSSL does not have the ./include/ directory, so we'll add it as needed.
|
||||
#
|
||||
# first check if there's a [root]/include/user_settings.h
|
||||
if( EXISTS "${WOLFSSL_ROOT}/include/user_settings.h" )
|
||||
message(FATAL_ERROR "Found stray wolfSSL user_settings.h in "
|
||||
"${WOLFSSL_ROOT}/include/user_settings.h "
|
||||
" (please move it to ${WOLFSSL_PROJECT_DIR}/include/user_settings.h )")
|
||||
else()
|
||||
# we won't overwrite an existing user settings file, just note that we already have one:
|
||||
if( EXISTS "${WOLFSSL_PROJECT_DIR}/include/user_settings.h" )
|
||||
message(STATUS "Using existing wolfSSL user_settings.h in "
|
||||
"${WOLFSSL_PROJECT_DIR}/include/user_settings.h")
|
||||
else()
|
||||
message(STATUS "Installing wolfSSL user_settings.h to "
|
||||
"${WOLFSSL_PROJECT_DIR}/include/user_settings.h")
|
||||
file(COPY "${WOLFSSL_ROOT}/IDE/Espressif/ESP-IDF/user_settings.h"
|
||||
DESTINATION "${CMAKE_HOME_DIRECTORY}/wolfssl/include/")
|
||||
endif()
|
||||
endif() # user_settings.h
|
||||
|
||||
# next check if there's a [root]/include/config.h
|
||||
if( EXISTS "${WOLFSSL_ROOT}/include/config.h" )
|
||||
message(STATUS "******************************************************************************")
|
||||
message(STATUS "******************************************************************************")
|
||||
message(STATUS "Found stray wolfSSL config.h in ${WOLFSSL_ROOT}/include/config.h" )
|
||||
message(STATUS " Please move it to ${WOLFSSL_PROJECT_DIR}/include/config.h" )
|
||||
message(STATUS "******************************************************************************")
|
||||
message(STATUS "******************************************************************************")
|
||||
else()
|
||||
# we won't overwrite an existing user settings file, just note that we already have one:
|
||||
if( EXISTS "${WOLFSSL_PROJECT_DIR}/include/config.h" )
|
||||
message(STATUS "Using existing wolfSSL config.h ${WOLFSSL_PROJECT_DIR}/include/config.h")
|
||||
else()
|
||||
message(STATUS "Installing wolfSSL config.h to ${WOLFSSL_PROJECT_DIR}/include/config.h")
|
||||
file(COPY "${WOLFSSL_ROOT}/IDE/Espressif/ESP-IDF/dummy_config_h" DESTINATION "${WOLFSSL_PROJECT_DIR}/include/")
|
||||
file(RENAME "${WOLFSSL_PROJECT_DIR}/include/dummy_config_h" "${WOLFSSL_PROJECT_DIR}/include/config.h")
|
||||
endif() # Project config.h
|
||||
endif() # WOLFSSL_ROOT config.h
|
||||
message(STATUS "************************************************************************************************")
|
||||
message(STATUS "")
|
||||
endif()
|
||||
|
||||
else()
|
||||
# we did not find a ./components/wolfssl/include/ directory from this pass of cmake.
|
||||
if($WOLFSSL_FOUND_IDF)
|
||||
message(STATUS "")
|
||||
message(STATUS "WARNING: wolfSSL not found.")
|
||||
message(STATUS "")
|
||||
else()
|
||||
# probably needs to be re-parsed by Espressif
|
||||
message(STATUS "wolfSSL found IDF. Project Source:${PROJECT_SOURCE_DIR}")
|
||||
endif() # else we have not found ESP-IDF yet
|
||||
endif() # else not a local wolfSSL component
|
||||
|
||||
endif() #else not an ESP-IDF component
|
||||
endif() # else not local copy and EDP-IDF wolfSSL
|
||||
|
||||
|
||||
# RTOS_IDF_PATH is typically:
|
||||
# "/Users/{username}/Desktop/esp-idf/components/freertos/include/freertos"
|
||||
# depending on the environment, we may need to swap backslashes with forward slashes
|
||||
string(REPLACE "\\" "/" RTOS_IDF_PATH "$ENV{IDF_PATH}/components/freertos/FreeRTOS-Kernel/include/freertos")
|
||||
|
||||
string(REPLACE "\\" "/" WOLFSSL_ROOT ${WOLFSSL_ROOT})
|
||||
|
||||
if(IS_DIRECTORY "${RTOS_IDF_PATH}")
|
||||
message(STATUS "Found current RTOS path: ${RTOS_IDF_PATH}")
|
||||
else()
|
||||
# ESP-IDF prior version 4.4x has a different RTOS directory structure
|
||||
string(REPLACE "\\" "/" RTOS_IDF_PATH "$ENV{IDF_PATH}/components/freertos/include/freertos")
|
||||
if(IS_DIRECTORY "${RTOS_IDF_PATH}")
|
||||
message(STATUS "Found legacy RTOS path: ${RTOS_IDF_PATH}")
|
||||
else()
|
||||
message(STATUS "Could not find RTOS path")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
||||
set(COMPONENT_ADD_INCLUDEDIRS
|
||||
"./include" # this is the location of wolfssl user_settings.h
|
||||
"\"${WOLFSSL_ROOT}/\""
|
||||
"\"${WOLFSSL_ROOT}/wolfssl/\""
|
||||
"\"${WOLFSSL_ROOT}/wolfssl/wolfcrypt/\""
|
||||
"\"${RTOS_IDF_PATH}/\""
|
||||
)
|
||||
|
||||
|
||||
if(IS_DIRECTORY ${IDF_PATH}/components/cryptoauthlib)
|
||||
list(APPEND COMPONENT_ADD_INCLUDEDIRS "../cryptoauthlib/lib")
|
||||
endif()
|
||||
|
||||
list(APPEND COMPONENT_ADD_INCLUDEDIRS "\"${WOLFSSL_ROOT}/wolfssl/\"")
|
||||
list(APPEND COMPONENT_ADD_INCLUDEDIRS "\"${WOLFSSL_ROOT}/wolfssl/wolfcrypt/\"")
|
||||
|
||||
|
||||
|
||||
set(COMPONENT_SRCEXCLUDE
|
||||
"\"${WOLFSSL_ROOT}/src/bio.c\""
|
||||
"\"${WOLFSSL_ROOT}/src/conf.c\""
|
||||
"\"${WOLFSSL_ROOT}/src/misc.c\""
|
||||
"\"${WOLFSSL_ROOT}/src/pk.c\""
|
||||
"\"${WOLFSSL_ROOT}/src/ssl_asn1.c\"" # included by ssl.c
|
||||
"\"${WOLFSSL_ROOT}/src/ssl_bn.c\"" # included by ssl.c
|
||||
"\"${WOLFSSL_ROOT}/src/ssl_certman.c\"" # included by ssl.c
|
||||
"\"${WOLFSSL_ROOT}/src/ssl_crypto.c\"" # included by ssl.c
|
||||
"\"${WOLFSSL_ROOT}/src/ssl_misc.c\"" # included by ssl.c
|
||||
"\"${WOLFSSL_ROOT}/src/x509.c\""
|
||||
"\"${WOLFSSL_ROOT}/src/x509_str.c\""
|
||||
"\"${WOLFSSL_ROOT}/wolfcrypt/src/evp.c\""
|
||||
"\"${WOLFSSL_ROOT}/wolfcrypt/src/misc.c\""
|
||||
"\"${WOLFSSL_ROOT}/wolfcrypt/src/sp_sm2_arm32.c\""
|
||||
"\"${WOLFSSL_ROOT}/wolfcrypt/src/sp_sm2_arm64.c\""
|
||||
"\"${WOLFSSL_ROOT}/wolfcrypt/src/sp_sm2_armthumb.c\""
|
||||
"\"${WOLFSSL_ROOT}/wolfcrypt/src/sp_sm2_c32.c\""
|
||||
"\"${WOLFSSL_ROOT}/wolfcrypt/src/sp_sm2_c64.c\""
|
||||
"\"${WOLFSSL_ROOT}/wolfcrypt/src/sp_sm2_cortexm.c\""
|
||||
"\"${WOLFSSL_ROOT}/wolfcrypt/src/sp_sm2_x86_64.c\""
|
||||
"\"${WOLFSSL_ROOT}/wolfcrypt/src/sp_sm2_x86_64_asm.S\""
|
||||
"\"${EXCLUDE_ASM}\""
|
||||
)
|
||||
|
||||
spaces2list(COMPONENT_REQUIRES)
|
||||
|
||||
separate_arguments(COMPONENT_SRCDIRS NATIVE_COMMAND "${COMPONENT_SRCDIRS}")
|
||||
separate_arguments(COMPONENT_SRCEXCLUDE NATIVE_COMMAND "${COMPONENT_SRCEXCLUDE}")
|
||||
separate_arguments(COMPONENT_ADD_INCLUDEDIRS NATIVE_COMMAND "${COMPONENT_ADD_INCLUDEDIRS}")
|
||||
|
||||
#
|
||||
# See https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/build-system.html#example-component-requirements
|
||||
#
|
||||
message(STATUS "COMPONENT_SRCDIRS = ${COMPONENT_SRCDIRS}")
|
||||
message(STATUS "COMPONENT_ADD_INCLUDEDIRS = ${COMPONENT_ADD_INCLUDEDIRS}")
|
||||
message(STATUS "COMPONENT_REQUIRES = ${COMPONENT_REQUIRES}")
|
||||
message(STATUS "COMPONENT_SRCEXCLUDE = ${COMPONENT_SRCEXCLUDE}")
|
||||
|
||||
#
|
||||
# see https://docs.espressif.com/projects/esp-idf/en/stable/esp32/migration-guides/release-5.x/build-system.html?highlight=space%20path
|
||||
#
|
||||
set(EXTRA_COMPONENT_DIRS "${COMPONENT_SRCDIRS}")
|
||||
idf_component_register(
|
||||
SRC_DIRS "${COMPONENT_SRCDIRS}"
|
||||
INCLUDE_DIRS "${COMPONENT_ADD_INCLUDEDIRS}"
|
||||
REQUIRES "${COMPONENT_REQUIRES}"
|
||||
EXCLUDE_SRCS "${COMPONENT_SRCEXCLUDE}"
|
||||
PRIV_REQUIRES esp_timer driver # this will typically only be needed for wolfSSL benchmark
|
||||
)
|
||||
# some optional diagnostics
|
||||
if (1)
|
||||
get_cmake_property(_variableNames VARIABLES)
|
||||
list (SORT _variableNames)
|
||||
message(STATUS "")
|
||||
message(STATUS "ALL VARIABLES BEGIN")
|
||||
message(STATUS "")
|
||||
foreach (_variableName ${_variableNames})
|
||||
message(STATUS "${_variableName}=${${_variableName}}")
|
||||
endforeach()
|
||||
message(STATUS "")
|
||||
message(STATUS "ALL VARIABLES END")
|
||||
message(STATUS "")
|
||||
endif()
|
||||
|
||||
# target_sources(wolfssl PRIVATE "\"${WOLFSSL_ROOT}/wolfssl/\"" "\"${WOLFSSL_ROOT}/wolfssl/wolfcrypt\"")
|
||||
|
||||
endif() # CMAKE_BUILD_EARLY_EXPANSION
|
||||
|
||||
register_component()
|
||||
|
||||
# some optional diagnostics
|
||||
if (0)
|
||||
get_cmake_property(_variableNames VARIABLES)
|
||||
list (SORT _variableNames)
|
||||
message(STATUS "")
|
||||
message(STATUS "ALL VARIABLES BEGIN")
|
||||
message(STATUS "")
|
||||
foreach (_variableName ${_variableNames})
|
||||
message(STATUS "${_variableName}=${${_variableName}}")
|
||||
endforeach()
|
||||
message(STATUS "")
|
||||
message(STATUS "ALL VARIABLES END")
|
||||
message(STATUS "")
|
||||
endif()
|
||||
|
||||
# check to see if there's both a local copy and EDP-IDF copy of the wolfssl components
|
||||
if( EXISTS "${CMAKE_HOME_DIRECTORY}/components/wolfssl/" AND EXISTS "$ENV{IDF_PATH}/components/wolfssl/" )
|
||||
if( EXISTS "${WOLFSSL_PROJECT_DIR}" AND EXISTS "$ENV{IDF_PATH}/components/wolfssl/" )
|
||||
message(STATUS "")
|
||||
message(STATUS "")
|
||||
message(STATUS "********************************************************************")
|
||||
@@ -230,3 +456,69 @@ endif()
|
||||
# end multiple component check
|
||||
|
||||
|
||||
#
|
||||
# LIBWOLFSSL_SAVE_INFO(VAR_OUPUT THIS_VAR VAR_RESULT)
|
||||
#
|
||||
# Save the THIS_VAR as a string in a macro called VAR_OUPUT
|
||||
#
|
||||
# VAR_OUPUT: the name of the macro to define
|
||||
# THIS_VAR: the OUTPUT_VARIABLE result from a execute_process()
|
||||
# VAR_RESULT: the RESULT_VARIABLE from a execute_process(); "0" if successful.
|
||||
#
|
||||
function ( LIBWOLFSSL_SAVE_INFO VAR_OUPUT THIS_VAR VAR_RESULT )
|
||||
# is the RESULT_VARIABLE output value 0? If so, IS_VALID_VALUE is true.
|
||||
string(COMPARE EQUAL "${VAR_RESULT}" "0" IS_VALID_VALUE)
|
||||
|
||||
# if we had a successful operation, save the THIS_VAR in VAR_OUPUT
|
||||
if(${IS_VALID_VALUE})
|
||||
# strip newline chars in THIS_VAR parameter and save in VAR_VALUE
|
||||
string(REPLACE "\n" "" VAR_VALUE ${THIS_VAR})
|
||||
|
||||
# we'll could percolate the value to the parent for possible later use
|
||||
# set(${VAR_OUPUT} ${VAR_VALUE} PARENT_SCOPE)
|
||||
|
||||
# but we're only using it here in this function
|
||||
set(${VAR_OUPUT} ${VAR_VALUE})
|
||||
|
||||
# we'll print what we found to the console
|
||||
message(STATUS "Found ${VAR_OUPUT}=${VAR_VALUE}")
|
||||
|
||||
# the interesting part is defining the VAR_OUPUT name a value to use in the app
|
||||
add_definitions(-D${VAR_OUPUT}=\"${VAR_VALUE}\")
|
||||
else()
|
||||
# if we get here, check the execute_process command and parameters.
|
||||
message(STATUS "LIBWOLFSSL_SAVE_INFO encountered a non-zero VAR_RESULT")
|
||||
set(${VAR_OUPUT} "Unknown")
|
||||
endif()
|
||||
endfunction() # LIBWOLFSSL_SAVE_INFO
|
||||
|
||||
# create some programmatic #define values that will be used by ShowExtendedSystemInfo().
|
||||
# see wolfcrypt\src\port\Espressif\esp32_utl.c
|
||||
if(NOT CMAKE_BUILD_EARLY_EXPANSION)
|
||||
set (git_cmd "git")
|
||||
message(STATUS "Adding macro definitions:")
|
||||
|
||||
# LIBWOLFSSL_VERSION_GIT_ORIGIN: git config --get remote.origin.url
|
||||
execute_process(WORKING_DIRECTORY ${WOLFSSL_ROOT} COMMAND ${git_cmd} "config" "--get" "remote.origin.url" OUTPUT_VARIABLE TMP_OUT RESULT_VARIABLE TMP_RES ERROR_QUIET )
|
||||
LIBWOLFSSL_SAVE_INFO(LIBWOLFSSL_VERSION_GIT_ORIGIN "${TMP_OUT}" "${TMP_RES}")
|
||||
|
||||
# LIBWOLFSSL_VERSION_GIT_BRANCH: git rev-parse --abbrev-ref HEAD
|
||||
execute_process(WORKING_DIRECTORY ${WOLFSSL_ROOT} COMMAND ${git_cmd} "rev-parse" "--abbrev-ref" "HEAD" OUTPUT_VARIABLE TMP_OUT RESULT_VARIABLE TMP_RES ERROR_QUIET )
|
||||
LIBWOLFSSL_SAVE_INFO(LIBWOLFSSL_VERSION_GIT_BRANCH "${TMP_OUT}" "${TMP_RES}")
|
||||
|
||||
# LIBWOLFSSL_VERSION_GIT_HASH: git rev-parse HEAD
|
||||
execute_process(WORKING_DIRECTORY ${WOLFSSL_ROOT} COMMAND ${git_cmd} "rev-parse" "HEAD" OUTPUT_VARIABLE TMP_OUT RESULT_VARIABLE TMP_RES ERROR_QUIET )
|
||||
LIBWOLFSSL_SAVE_INFO(LIBWOLFSSL_VERSION_GIT_HASH "${TMP_OUT}" "${TMP_RES}")
|
||||
|
||||
# LIBWOLFSSL_VERSION_GIT_SHORT_HASH: git rev-parse --short HEAD
|
||||
execute_process(WORKING_DIRECTORY ${WOLFSSL_ROOT} COMMAND ${git_cmd} "rev-parse" "--short" "HEAD" OUTPUT_VARIABLE TMP_OUT RESULT_VARIABLE TMP_RES ERROR_QUIET )
|
||||
LIBWOLFSSL_SAVE_INFO(LIBWOLFSSL_VERSION_GIT_SHORT_HASH "${TMP_OUT}" "${TMP_RES}")
|
||||
|
||||
# LIBWOLFSSL_VERSION_GIT_HASH_DATE git show --no-patch --no-notes --pretty=\'\%cd\'
|
||||
execute_process(WORKING_DIRECTORY ${WOLFSSL_ROOT} COMMAND ${git_cmd} "show" "--no-patch" "--no-notes" "--pretty=\'\%cd\'" OUTPUT_VARIABLE TMP_OUT RESULT_VARIABLE TMP_RES )
|
||||
LIBWOLFSSL_SAVE_INFO(LIBWOLFSSL_VERSION_GIT_HASH_DATE "${TMP_OUT}" "${TMP_RES}")
|
||||
|
||||
message(STATUS "************************************************************************************************")
|
||||
message(STATUS "wolfssl component config complete!")
|
||||
message(STATUS "************************************************************************************************")
|
||||
endif()
|
||||
|
||||
@@ -0,0 +1,450 @@
|
||||
/* user_settings.h
|
||||
*
|
||||
* Copyright (C) 2006-2023 wolfSSL Inc.
|
||||
*
|
||||
* This file is part of wolfSSL.
|
||||
*
|
||||
* wolfSSL is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* wolfSSL is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
|
||||
*/
|
||||
|
||||
/* This user_settings.h is for Espressif ESP-IDF */
|
||||
#include <sdkconfig.h>
|
||||
|
||||
/* The Espressif sdkconfig will have chipset info.
|
||||
**
|
||||
** Possible values:
|
||||
**
|
||||
** CONFIG_IDF_TARGET_ESP32
|
||||
** CONFIG_IDF_TARGET_ESP32S2
|
||||
** CONFIG_IDF_TARGET_ESP32S3
|
||||
** CONFIG_IDF_TARGET_ESP32C3
|
||||
** CONFIG_IDF_TARGET_ESP32C6
|
||||
*/
|
||||
|
||||
#undef WOLFSSL_ESPIDF
|
||||
#define WOLFSSL_ESPIDF
|
||||
|
||||
/*
|
||||
* choose ONE of these Espressif chips to define:
|
||||
*
|
||||
* WOLFSSL_ESP32
|
||||
* WOLFSSL_ESPWROOM32SE
|
||||
* WOLFSSL_ESP8266
|
||||
*/
|
||||
#undef WOLFSSL_ESPWROOM32SE
|
||||
#undef WOLFSSL_ESP8266
|
||||
#undef WOLFSSL_ESP32
|
||||
|
||||
#define WOLFSSL_ESP32
|
||||
|
||||
/* optionally turn off SHA512/224 SHA512/256 */
|
||||
/* #define WOLFSSL_NOSHA512_224 */
|
||||
/* #define WOLFSSL_NOSHA512_256 */
|
||||
|
||||
/* when you want to use SINGLE THREAD. Note Default ESP-IDF is FreeRTOS */
|
||||
/* #define SINGLE_THREADED */
|
||||
|
||||
/* When you don't want to use the old SHA */
|
||||
/* #define NO_SHA */
|
||||
/* #define NO_OLD_TLS */
|
||||
|
||||
#define BENCH_EMBEDDED
|
||||
#define USE_CERT_BUFFERS_2048
|
||||
|
||||
/* TLS 1.3 */
|
||||
#define WOLFSSL_TLS13
|
||||
#define HAVE_TLS_EXTENSIONS
|
||||
#define WC_RSA_PSS
|
||||
#define HAVE_HKDF
|
||||
#define HAVE_AEAD
|
||||
#define HAVE_SUPPORTED_CURVES
|
||||
|
||||
#define WOLFSSL_BENCHMARK_FIXED_UNITS_KB
|
||||
|
||||
#define NO_FILESYSTEM
|
||||
|
||||
#define NO_OLD_TLS
|
||||
|
||||
#define HAVE_AESGCM
|
||||
|
||||
#define WOLFSSL_RIPEMD
|
||||
/* when you want to use SHA224 */
|
||||
#define WOLFSSL_SHA224
|
||||
|
||||
/* when you want to use SHA384 */
|
||||
#define WOLFSSL_SHA384
|
||||
|
||||
/* when you want to use SHA512 */
|
||||
#define WOLFSSL_SHA512
|
||||
|
||||
/* when you want to use SHA3 */
|
||||
#define WOLFSSL_SHA3
|
||||
|
||||
/* ED25519 requires SHA512 */
|
||||
#define HAVE_ED25519
|
||||
|
||||
#define HAVE_ECC
|
||||
#define HAVE_CURVE25519
|
||||
#define CURVE25519_SMALL
|
||||
#define HAVE_ED25519
|
||||
|
||||
#define OPENSSL_EXTRA
|
||||
/* when you want to use pkcs7 */
|
||||
/* #define HAVE_PKCS7 */
|
||||
|
||||
#define HAVE_PKCS7
|
||||
|
||||
#if defined(HAVE_PKCS7)
|
||||
#define HAVE_AES_KEYWRAP
|
||||
#define HAVE_X963_KDF
|
||||
#define WOLFSSL_AES_DIRECT
|
||||
#endif
|
||||
|
||||
/* when you want to use aes counter mode */
|
||||
/* #define WOLFSSL_AES_DIRECT */
|
||||
/* #define WOLFSSL_AES_COUNTER */
|
||||
|
||||
/* esp32-wroom-32se specific definition */
|
||||
#if defined(WOLFSSL_ESPWROOM32SE)
|
||||
#define WOLFSSL_ATECC508A
|
||||
#define HAVE_PK_CALLBACKS
|
||||
/* when you want to use a custom slot allocation for ATECC608A */
|
||||
/* unless your configuration is unusual, you can use default */
|
||||
/* implementation. */
|
||||
/* #define CUSTOM_SLOT_ALLOCATION */
|
||||
#endif
|
||||
|
||||
/* rsa primitive specific definition */
|
||||
#if defined(WOLFSSL_ESP32) || defined(WOLFSSL_ESPWROOM32SE)
|
||||
/* Define USE_FAST_MATH and SMALL_STACK */
|
||||
#define ESP32_USE_RSA_PRIMITIVE
|
||||
|
||||
#if defined(CONFIG_IDF_TARGET_ESP32)
|
||||
|
||||
/* NOTE HW unreliable for small values! */
|
||||
/* threshold for performance adjustment for HW primitive use */
|
||||
/* X bits of G^X mod P greater than */
|
||||
#undef ESP_RSA_EXPT_XBITS
|
||||
#define ESP_RSA_EXPT_XBITS 32
|
||||
|
||||
/* X and Y of X * Y mod P greater than */
|
||||
#undef ESP_RSA_MULM_BITS
|
||||
#define ESP_RSA_MULM_BITS 16
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define RSA_LOW_MEM
|
||||
|
||||
/* #define WOLFSSL_ATECC508A_DEBUG */
|
||||
|
||||
/* date/time */
|
||||
/* if it cannot adjust time in the device, */
|
||||
/* enable macro below */
|
||||
/* #define NO_ASN_TIME */
|
||||
/* #define XTIME time */
|
||||
|
||||
|
||||
/* adjust wait-timeout count if you see timeout in RSA HW acceleration */
|
||||
#define ESP_RSA_TIMEOUT_CNT 0x349F00
|
||||
|
||||
/* hash limit for test.c */
|
||||
#define HASH_SIZE_LIMIT
|
||||
|
||||
/* USE_FAST_MATH is default */
|
||||
#define USE_FAST_MATH
|
||||
|
||||
/***** Use SP_MATH *****/
|
||||
/* #undef USE_FAST_MATH */
|
||||
/* #define SP_MATH */
|
||||
/* #define WOLFSSL_SP_MATH_ALL */
|
||||
/* #define WOLFSSL_SP_RISCV32 */
|
||||
|
||||
/***** Use Integer Heap Math *****/
|
||||
/* #undef USE_FAST_MATH */
|
||||
/* #define USE_INTEGER_HEAP_MATH */
|
||||
|
||||
|
||||
#define WOLFSSL_SMALL_STACK
|
||||
|
||||
|
||||
#define HAVE_VERSION_EXTENDED_INFO
|
||||
/* #define HAVE_WC_INTROSPECTION */
|
||||
|
||||
#define HAVE_SESSION_TICKET
|
||||
|
||||
/* #define HAVE_HASHDRBG */
|
||||
|
||||
#define WOLFSSL_KEY_GEN
|
||||
#define WOLFSSL_CERT_REQ
|
||||
#define WOLFSSL_CERT_GEN
|
||||
#define WOLFSSL_CERT_EXT
|
||||
#define WOLFSSL_SYS_CA_CERTS
|
||||
|
||||
|
||||
#define WOLFSSL_CERT_TEXT
|
||||
|
||||
#define WOLFSSL_ASN_TEMPLATE
|
||||
|
||||
/*
|
||||
#undef WOLFSSL_KEY_GEN
|
||||
#undef WOLFSSL_CERT_REQ
|
||||
#undef WOLFSSL_CERT_GEN
|
||||
#undef WOLFSSL_CERT_EXT
|
||||
#undef WOLFSSL_SYS_CA_CERTS
|
||||
*/
|
||||
|
||||
/*
|
||||
--enable-keygen
|
||||
--enable-certgen
|
||||
--enable-certreq
|
||||
--enable-certext
|
||||
--enable-asn-template
|
||||
*/
|
||||
|
||||
/* Default is HW enabled unless turned off.
|
||||
** Uncomment these lines to force SW instead of HW acceleration */
|
||||
|
||||
#if defined(CONFIG_IDF_TARGET_ESP32)
|
||||
/* wolfSSL HW Acceleration supported on ESP32. Uncomment to disable: */
|
||||
/* #define NO_ESP32_CRYPT */
|
||||
/* #define NO_WOLFSSL_ESP32_CRYPT_HASH */
|
||||
/* #define NO_WOLFSSL_ESP32_CRYPT_AES */
|
||||
/* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI */
|
||||
/* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_MP_MUL */
|
||||
/* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_MULMOD */
|
||||
/* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_EXPTMOD */
|
||||
|
||||
/* These are defined automatically in esp32-crypt.h, here for clarity: */
|
||||
#define NO_WOLFSSL_ESP32_CRYPT_HASH_SHA224 /* no SHA224 HW on ESP32 */
|
||||
|
||||
#undef ESP_RSA_MULM_BITS
|
||||
#define ESP_RSA_MULM_BITS 16 /* TODO add compile-time warning */
|
||||
/***** END CONFIG_IDF_TARGET_ESP32 *****/
|
||||
|
||||
#elif defined(CONFIG_IDF_TARGET_ESP32S2)
|
||||
/* wolfSSL HW Acceleration supported on ESP32-S2. Uncomment to disable: */
|
||||
/* #define NO_ESP32_CRYPT */
|
||||
/* #define NO_WOLFSSL_ESP32_CRYPT_HASH */
|
||||
/* Note: There's no AES192 HW on the ESP32-S2; falls back to SW */
|
||||
/* #define NO_WOLFSSL_ESP32_CRYPT_AES */
|
||||
/* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI */
|
||||
/* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_MP_MUL */
|
||||
/* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_MULMOD */
|
||||
/* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_EXPTMOD */
|
||||
/***** END CONFIG_IDF_TARGET_ESP32S2 *****/
|
||||
|
||||
#elif defined(CONFIG_IDF_TARGET_ESP32S3)
|
||||
/* wolfSSL HW Acceleration supported on ESP32-S3. Uncomment to disable: */
|
||||
/* #define NO_ESP32_CRYPT */
|
||||
/* #define NO_WOLFSSL_ESP32_CRYPT_HASH */
|
||||
/* Note: There's no AES192 HW on the ESP32-S3; falls back to SW */
|
||||
/* #define NO_WOLFSSL_ESP32_CRYPT_AES */
|
||||
/* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI */
|
||||
/* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_MP_MUL */
|
||||
/* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_MULMOD */
|
||||
/* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_EXPTMOD */
|
||||
/***** END CONFIG_IDF_TARGET_ESP32S3 *****/
|
||||
|
||||
#elif defined(CONFIG_IDF_TARGET_ESP32C2) || \
|
||||
defined(CONFIG_IDF_TARGET_ESP8684)
|
||||
/* ESP8684 is essentially ESP32-C2 chip + flash embedded together in a
|
||||
* single QFN 4x4 mm package. Out of released documentation, Technical
|
||||
* Reference Manual as well as ESP-IDF Programming Guide is applicable
|
||||
* to both ESP32-C2 and ESP8684.
|
||||
*
|
||||
* See: https://www.esp32.com/viewtopic.php?f=5&t=27926#:~:text=ESP8684%20is%20essentially%20ESP32%2DC2,both%20ESP32%2DC2%20and%20ESP8684. */
|
||||
|
||||
/* wolfSSL HW Acceleration supported on ESP32-C2. Uncomment to disable: */
|
||||
/* #define NO_ESP32_CRYPT */
|
||||
/* #define NO_WOLFSSL_ESP32_CRYPT_HASH */ /* to disable all SHA HW */
|
||||
|
||||
/* These are defined automatically in esp32-crypt.h, here for clarity */
|
||||
#define NO_WOLFSSL_ESP32_CRYPT_HASH_SHA384 /* no SHA384 HW on C2 */
|
||||
#define NO_WOLFSSL_ESP32_CRYPT_HASH_SHA512 /* no SHA512 HW on C2 */
|
||||
|
||||
/* There's no AES or RSA/Math accelerator on the ESP32-C2
|
||||
* Auto defined with NO_WOLFSSL_ESP32_CRYPT_RSA_PRI, for clarity: */
|
||||
#define NO_WOLFSSL_ESP32_CRYPT_AES
|
||||
#define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI
|
||||
#define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_MP_MUL
|
||||
#define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_MULMOD
|
||||
#define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_EXPTMOD
|
||||
/***** END CONFIG_IDF_TARGET_ESP32C2 *****/
|
||||
|
||||
#elif defined(CONFIG_IDF_TARGET_ESP32C3)
|
||||
/* wolfSSL HW Acceleration supported on ESP32-C3. Uncomment to disable: */
|
||||
|
||||
/* #define NO_ESP32_CRYPT */
|
||||
/* #define NO_WOLFSSL_ESP32_CRYPT_HASH */ /* to disable all SHA HW */
|
||||
|
||||
/* These are defined automatically in esp32-crypt.h, here for clarity: */
|
||||
#define NO_WOLFSSL_ESP32_CRYPT_HASH_SHA384 /* no SHA384 HW on C6 */
|
||||
#define NO_WOLFSSL_ESP32_CRYPT_HASH_SHA512 /* no SHA512 HW on C6 */
|
||||
|
||||
/* #define NO_WOLFSSL_ESP32_CRYPT_AES */
|
||||
/* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI */
|
||||
/* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_MP_MUL */
|
||||
/* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_MULMOD */
|
||||
/* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_EXPTMOD */
|
||||
/***** END CONFIG_IDF_TARGET_ESP32C3 *****/
|
||||
|
||||
#elif defined(CONFIG_IDF_TARGET_ESP32C6)
|
||||
/* wolfSSL HW Acceleration supported on ESP32-C6. Uncomment to disable: */
|
||||
|
||||
/* #define NO_ESP32_CRYPT */
|
||||
/* #define NO_WOLFSSL_ESP32_CRYPT_HASH */
|
||||
/* These are defined automatically in esp32-crypt.h, here for clarity: */
|
||||
#define NO_WOLFSSL_ESP32_CRYPT_HASH_SHA384 /* no SHA384 HW on C6 */
|
||||
#define NO_WOLFSSL_ESP32_CRYPT_HASH_SHA512 /* no SHA512 HW on C6 */
|
||||
|
||||
/* #define NO_WOLFSSL_ESP32_CRYPT_AES */
|
||||
/* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI */
|
||||
/* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_MP_MUL */
|
||||
/* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_MULMOD */
|
||||
/* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_EXPTMOD */
|
||||
/***** END CONFIG_IDF_TARGET_ESP32C6 *****/
|
||||
|
||||
#elif defined(CONFIG_IDF_TARGET_ESP32H2)
|
||||
/* wolfSSL Hardware Acceleration not yet implemented */
|
||||
#define NO_ESP32_CRYPT
|
||||
#define NO_WOLFSSL_ESP32_CRYPT_HASH
|
||||
#define NO_WOLFSSL_ESP32_CRYPT_AES
|
||||
#define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI
|
||||
/***** END CONFIG_IDF_TARGET_ESP32H2 *****/
|
||||
|
||||
#elif defined(CONFIG_IDF_TARGET_ESP8266)
|
||||
/* TODO: Revisit ESP8266 */
|
||||
#define NO_ESP32_CRYPT
|
||||
#define NO_WOLFSSL_ESP32_CRYPT_HASH
|
||||
#define NO_WOLFSSL_ESP32_CRYPT_AES
|
||||
#define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI
|
||||
/***** END CONFIG_IDF_TARGET_ESP266 *****/
|
||||
|
||||
#elif defined(CONFIG_IDF_TARGET_ESP8684)
|
||||
/* There's no Hardware Acceleration available on ESP8684 */
|
||||
#define NO_ESP32_CRYPT
|
||||
#define NO_WOLFSSL_ESP32_CRYPT_HASH
|
||||
#define NO_WOLFSSL_ESP32_CRYPT_AES
|
||||
#define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI
|
||||
/***** END CONFIG_IDF_TARGET_ESP8684 *****/
|
||||
|
||||
#else
|
||||
/* Anything else encountered, disable HW accleration */
|
||||
#define NO_ESP32_CRYPT
|
||||
#define NO_WOLFSSL_ESP32_CRYPT_HASH
|
||||
#define NO_WOLFSSL_ESP32_CRYPT_AES
|
||||
#define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI
|
||||
#endif /* CONFIG_IDF_TARGET Check */
|
||||
|
||||
/* Debug options:
|
||||
|
||||
#define ESP_VERIFY_MEMBLOCK
|
||||
#define DEBUG_WOLFSSL
|
||||
#define DEBUG_WOLFSSL_VERBOSE
|
||||
#define DEBUG_WOLFSSL_SHA_MUTEX
|
||||
#define WOLFSSL_ESP32_CRYPT_DEBUG
|
||||
#define WOLFSSL_ESP32_CRYPT_HASH_SHA224_DEBUG
|
||||
#define NO_RECOVER_SOFTWARE_CALC
|
||||
#define WOLFSSL_TEST_STRAY 1
|
||||
#define USE_ESP_DPORT_ACCESS_READ_BUFFER
|
||||
#define WOLFSSL_ESP32_HW_LOCK_DEBUG
|
||||
#define WOLFSSL_DEBUG_ESP_RSA_MULM_BITS
|
||||
#define ESP_DISABLE_HW_TASK_LOCK
|
||||
*/
|
||||
|
||||
/* Pause in a loop rather than exit. */
|
||||
#define WOLFSSL_ESPIDF_ERROR_PAUSE
|
||||
|
||||
#define WOLFSSL_HW_METRICS
|
||||
|
||||
/* for test.c */
|
||||
/* #define HASH_SIZE_LIMIT */
|
||||
|
||||
/* Optionally turn off HW math checks */
|
||||
/* #define NO_HW_MATH_TEST */
|
||||
|
||||
/* Optionally include alternate HW test library: alt_hw_test.h */
|
||||
/* When enabling, the ./components/wolfssl/CMakeLists.txt file
|
||||
* will need the name of the library in the idf_component_register
|
||||
* for the PRIV_REQUIRES list. */
|
||||
/* #define INCLUDE_ALT_HW_TEST */
|
||||
|
||||
/* optionally turn off individual math HW acceleration features */
|
||||
|
||||
/* Turn off Large Number ESP32 HW Multiplication:
|
||||
** [Z = X * Y] in esp_mp_mul() */
|
||||
/* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_MP_MUL */
|
||||
|
||||
/* Turn off Large Number ESP32 HW Modular Exponentiation:
|
||||
** [Z = X^Y mod M] in esp_mp_exptmod() */
|
||||
/* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_EXPTMOD */
|
||||
|
||||
/* Turn off Large Number ESP32 HW Modular Multiplication
|
||||
** [Z = X * Y mod M] in esp_mp_mulmod() */
|
||||
/* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_MULMOD */
|
||||
|
||||
#define WOLFSSL_PUBLIC_MP /* used by benchmark */
|
||||
#define USE_CERT_BUFFERS_2048
|
||||
|
||||
/* when turning on ECC508 / ECC608 support
|
||||
#define WOLFSSL_ESPWROOM32SE
|
||||
#define HAVE_PK_CALLBACKS
|
||||
#define WOLFSSL_ATECC508A
|
||||
#define ATCA_WOLFSSL
|
||||
*/
|
||||
|
||||
/* optional SM4 Ciphers. See https://github.com/wolfSSL/wolfsm
|
||||
#define WOLFSSL_SM2
|
||||
#define WOLFSSL_SM3
|
||||
#define WOLFSSL_SM4
|
||||
*/
|
||||
|
||||
#if defined(WOLFSSL_SM2) || defined(WOLFSSL_SM3) || defined(WOLFSSL_SM4)
|
||||
#include <wolfssl/certs_test_sm.h>
|
||||
#define CTX_CA_CERT root_sm2
|
||||
#define CTX_CA_CERT_SIZE sizeof_root_sm2
|
||||
#define CTX_CA_CERT_TYPE WOLFSSL_FILETYPE_PEM
|
||||
#define CTX_SERVER_CERT server_sm2
|
||||
#define CTX_SERVER_CERT_SIZE sizeof_server_sm2
|
||||
#define CTX_SERVER_CERT_TYPE WOLFSSL_FILETYPE_PEM
|
||||
#define CTX_SERVER_KEY server_sm2_priv
|
||||
#define CTX_SERVER_KEY_SIZE sizeof_server_sm2_priv
|
||||
#define CTX_SERVER_KEY_TYPE WOLFSSL_FILETYPE_PEM
|
||||
|
||||
#undef WOLFSSL_BASE16
|
||||
#define WOLFSSL_BASE16
|
||||
#else
|
||||
#define USE_CERT_BUFFERS_2048
|
||||
#define USE_CERT_BUFFERS_256
|
||||
#define CTX_CA_CERT ca_cert_der_2048
|
||||
#define CTX_CA_CERT_SIZE sizeof_ca_cert_der_2048
|
||||
#define CTX_CA_CERT_TYPE WOLFSSL_FILETYPE_ASN1
|
||||
#define CTX_SERVER_CERT server_cert_der_2048
|
||||
#define CTX_SERVER_CERT_SIZE sizeof_server_cert_der_2048
|
||||
#define CTX_SERVER_CERT_TYPE WOLFSSL_FILETYPE_ASN1
|
||||
#define CTX_SERVER_KEY server_key_der_2048
|
||||
#define CTX_SERVER_KEY_SIZE sizeof_server_key_der_2048
|
||||
#define CTX_SERVER_KEY_TYPE WOLFSSL_FILETYPE_ASN1
|
||||
#endif
|
||||
|
||||
/* See settings.h for some of the possible hardening options:
|
||||
*
|
||||
* #define NO_ESPIDF_DEFAULT
|
||||
* #define WC_NO_CACHE_RESISTANT
|
||||
* #define WC_AES_BITSLICED
|
||||
* #define HAVE_AES_ECB
|
||||
* #define HAVE_AES_DIRECT
|
||||
*/
|
||||
@@ -1,10 +1,9 @@
|
||||
|
||||
#
|
||||
# wolfssl benchmark test
|
||||
#
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_USER_SETTINGS")
|
||||
|
||||
set(COMPONENT_SRCS main.c)
|
||||
set(COMPONENT_SRCS "main.c")
|
||||
set(COMPONENT_ADD_INCLUDEDIRS ".")
|
||||
|
||||
set (git_cmd "git")
|
||||
@@ -19,7 +18,9 @@ if( EXISTS "${CMAKE_HOME_DIRECTORY}/components/wolfssl/" AND EXISTS "$ENV{IDF_PA
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_MULTI_INSTALL_WARNING")
|
||||
endif()
|
||||
|
||||
register_component()
|
||||
idf_component_register(SRCS main.c
|
||||
INCLUDE_DIRS "."
|
||||
"./include")
|
||||
|
||||
#
|
||||
# LIBWOLFSSL_SAVE_INFO(VAR_OUPUT THIS_VAR VAR_RESULT)
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
#
|
||||
# Main component makefile.
|
||||
#
|
||||
# This Makefile can be left empty. By default, it will take the sources in the
|
||||
# src/ directory, compile them and link them into lib(subdirectory_name).a
|
||||
# This Makefile can be left empty. By default, it will take the sources in the
|
||||
# src/ directory, compile them and link them into lib(subdirectory_name).a
|
||||
# in the build directory. This behaviour is entirely configurable,
|
||||
# please read the ESP-IDF documents if you need to do this.
|
||||
#
|
||||
#
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
#pragma once
|
||||
/* benchmark main.h
|
||||
*
|
||||
* Copyright (C) 2006-2023 wolfSSL Inc.
|
||||
@@ -20,10 +19,12 @@
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
|
||||
*/
|
||||
|
||||
#ifndef _MAIN_
|
||||
#define _MAIN_
|
||||
|
||||
void app_main(void);
|
||||
|
||||
/* see wolfssl/wolfcrypt/benchmark/benchmark.h */
|
||||
extern void wolf_benchmark_task();
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
@@ -18,6 +18,7 @@
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
|
||||
*/
|
||||
|
||||
/* ESP-IDF */
|
||||
#include <esp_log.h>
|
||||
#include "sdkconfig.h"
|
||||
@@ -26,17 +27,23 @@
|
||||
#include <wolfssl/wolfcrypt/settings.h>
|
||||
#include <user_settings.h>
|
||||
#include <wolfssl/version.h>
|
||||
#include "wolfssl/wolfcrypt/port/Espressif/esp32-crypt.h"
|
||||
#ifndef WOLFSSL_ESPIDF
|
||||
#warning "problem with wolfSSL user_settings. Check components/wolfssl/include"
|
||||
#warning "Problem with wolfSSL user_settings."
|
||||
#warning "Check components/wolfssl/include"
|
||||
#endif
|
||||
|
||||
#include <wolfssl/wolfcrypt/types.h>
|
||||
#include <wolfcrypt/benchmark/benchmark.h>
|
||||
|
||||
/* set to 0 for one benchmark,
|
||||
** set to 1 for continous benchmark loop */
|
||||
#define BENCHMARK_LOOP 1
|
||||
|
||||
/* check BENCH_ARGV in sdkconfig to determine need to set WOLFSSL_BENCH_ARGV */
|
||||
#ifdef CONFIG_BENCH_ARGV
|
||||
#define WOLFSSL_BENCH_ARGV CONFIG_BENCH_ARGV
|
||||
#define WOLFSSL_BENCH_ARGV_MAX_ARGUMENTS 22 /* arbitrary number of max args */
|
||||
#define WOLFSSL_BENCH_ARGV CONFIG_BENCH_ARGV
|
||||
#define WOLFSSL_BENCH_ARGV_MAX_ARGUMENTS 22 /* arbitrary number of max args */
|
||||
#endif
|
||||
|
||||
/*
|
||||
@@ -67,6 +74,8 @@ static const char* const TAG = "wolfssl_benchmark";
|
||||
|
||||
static byte mSlotList[ATECC_MAX_SLOT];
|
||||
|
||||
int atmel_set_slot_allocator(atmel_slot_alloc_cb alloc, atmel_slot_dealloc_cb dealloc);
|
||||
|
||||
/* initialize slot array */
|
||||
void my_atmel_slotInit()
|
||||
{
|
||||
@@ -183,51 +192,18 @@ int construct_argv()
|
||||
/* entry point */
|
||||
void app_main(void)
|
||||
{
|
||||
int stack_start = 0;
|
||||
ESP_LOGI(TAG, "---------------- wolfSSL Benchmark Example ------------");
|
||||
ESP_LOGI(TAG, "--------------------------------------------------------");
|
||||
ESP_LOGI(TAG, "--------------------------------------------------------");
|
||||
ESP_LOGI(TAG, "---------------------- BEGIN MAIN ----------------------");
|
||||
ESP_LOGI(TAG, "--------------------------------------------------------");
|
||||
ESP_LOGI(TAG, "--------------------------------------------------------");
|
||||
ESP_LOGI(TAG, "CONFIG_IDF_TARGET = %s", CONFIG_IDF_TARGET);
|
||||
ESP_LOGI(TAG, "LIBWOLFSSL_VERSION_STRING = %s", LIBWOLFSSL_VERSION_STRING);
|
||||
|
||||
#if defined(WOLFSSL_MULTI_INSTALL_WARNING)
|
||||
ESP_LOGI(TAG, "");
|
||||
ESP_LOGI(TAG, "WARNING: Multiple wolfSSL installs found.");
|
||||
ESP_LOGI(TAG, "Check ESP-IDF and local project [components] directory.");
|
||||
ESP_LOGI(TAG, "");
|
||||
#ifdef HAVE_VERSION_EXTENDED_INFO
|
||||
esp_ShowExtendedSystemInfo();
|
||||
#endif
|
||||
|
||||
#if defined(LIBWOLFSSL_VERSION_GIT_HASH)
|
||||
ESP_LOGI(TAG, "LIBWOLFSSL_VERSION_GIT_HASH = %s", LIBWOLFSSL_VERSION_GIT_HASH);
|
||||
#endif
|
||||
|
||||
#if defined(LIBWOLFSSL_VERSION_GIT_SHORT_HASH )
|
||||
ESP_LOGI(TAG, "LIBWOLFSSL_VERSION_GIT_SHORT_HASH = %s", LIBWOLFSSL_VERSION_GIT_SHORT_HASH);
|
||||
#endif
|
||||
|
||||
#if defined(LIBWOLFSSL_VERSION_GIT_HASH_DATE)
|
||||
ESP_LOGI(TAG, "LIBWOLFSSL_VERSION_GIT_HASH_DATE = %s", LIBWOLFSSL_VERSION_GIT_HASH_DATE);
|
||||
#endif
|
||||
|
||||
|
||||
/* some interesting settings are target specific (ESP32, -C3, -S3, etc */
|
||||
#if defined(CONFIG_IDF_TARGET_ESP32C3)
|
||||
/* not available for C3 at this time */
|
||||
#elif defined(CONFIG_IDF_TARGET_ESP32S3)
|
||||
ESP_LOGI(TAG, "CONFIG_ESP32S3_DEFAULT_CPU_FREQ_MHZ = %u MHz",
|
||||
CONFIG_ESP32S3_DEFAULT_CPU_FREQ_MHZ
|
||||
);
|
||||
ESP_LOGI(TAG, "Xthal_have_ccount = %u", Xthal_have_ccount);
|
||||
#else
|
||||
ESP_LOGI(TAG, "CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ = %u MHz",
|
||||
CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ
|
||||
);
|
||||
ESP_LOGI(TAG, "Xthal_have_ccount = %u", Xthal_have_ccount);
|
||||
#endif
|
||||
|
||||
/* all platforms: stack high water mark check */
|
||||
ESP_LOGI(TAG, "Stack HWM: %d\n", uxTaskGetStackHighWaterMark(NULL));
|
||||
ESP_LOGI(TAG, "app_main CONFIG_BENCH_ARGV = %s", WOLFSSL_BENCH_ARGV);
|
||||
|
||||
/* when using atecc608a on esp32-wroom-32se */
|
||||
@@ -251,15 +227,37 @@ void app_main(void)
|
||||
/* although wolfCrypt_Init() may be explicitly called above,
|
||||
** note it is still always called in wolf_benchmark_task.
|
||||
*/
|
||||
wolf_benchmark_task();
|
||||
/* wolfCrypt_Cleanup should always be called at completion,
|
||||
** and is called in wolf_benchmark_task().
|
||||
*/
|
||||
stack_start = uxTaskGetStackHighWaterMark(NULL);
|
||||
|
||||
do {
|
||||
ESP_LOGI(TAG, "Stack HWM: %d\n", uxTaskGetStackHighWaterMark(NULL));
|
||||
|
||||
wolf_benchmark_task();
|
||||
ESP_LOGI(TAG, "Stack used: %d\n",
|
||||
stack_start - uxTaskGetStackHighWaterMark(NULL));
|
||||
|
||||
#ifdef WOLFSSL_HW_METRICS_DISABLED/* Remove _DISABLED upon #6990 Merge */
|
||||
esp_hw_show_metrics();
|
||||
#endif
|
||||
} while (BENCHMARK_LOOP);
|
||||
/* Reminder: wolfCrypt_Cleanup should always be called at completion,
|
||||
** and is called in wolf_benchmark_task(). */
|
||||
|
||||
#if defined(SINGLE_THREADED)
|
||||
/* need stack monitor for single thread */
|
||||
#else
|
||||
ESP_LOGI(TAG, "Stack HWM: %d\n", uxTaskGetStackHighWaterMark(NULL));
|
||||
#endif
|
||||
|
||||
ESP_LOGI(TAG, "\n\nDone!\n\n"
|
||||
"If running from idf.py monitor, press twice: Ctrl+]");
|
||||
|
||||
/* after the test, we'll just wait */
|
||||
while (1) {
|
||||
/* nothing */
|
||||
/* do something other than nothing to help next program/debug session*/
|
||||
#ifndef SINGLE_THREADED
|
||||
vTaskDelay(1000);
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif /* NO_CRYPT_BENCHMARK */
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
# to view: idf.py partition-table
|
||||
#
|
||||
# ESP-IDF Partition Table
|
||||
# Name, Type, SubType, Offset, Size, Flags
|
||||
nvs, data, nvs, 0x9000, 24K,
|
||||
phy_init,data, phy, 0xf000, 4K,
|
||||
factory, app, factory, 0x10000, 1500K,
|
||||
|
||||
|
||||
# For other settings, see:
|
||||
# https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/partition-tables.html#creating-custom-tables
|
||||
#
|
||||
# Here is the summary printed for the "Single factory app, no OTA" configuration:
|
||||
#
|
||||
# # ESP-IDF Partition Table
|
||||
# # Name, Type, SubType, Offset, Size, Flags
|
||||
# nvs, data, nvs, 0x9000, 0x6000,
|
||||
# phy_init, data, phy, 0xf000, 0x1000,
|
||||
# factory, app, factory, 0x10000, 1M,
|
||||
#
|
||||
#
|
||||
# Here is the summary printed for the "Factory app, two OTA definitions" configuration:
|
||||
#
|
||||
# # ESP-IDF Partition Table
|
||||
# # Name, Type, SubType, Offset, Size, Flags
|
||||
# nvs, data, nvs, 0x9000, 0x4000,
|
||||
# otadata, data, ota, 0xd000, 0x2000,
|
||||
# phy_init, data, phy, 0xf000, 0x1000,
|
||||
# factory, app, factory, 0x10000, 1M,
|
||||
# ota_0, app, ota_0, 0x110000, 1M,
|
||||
# ota_1, app, ota_1, 0x210000, 1M,
|
||||
|
Can't render this file because it contains an unexpected character in line 13 and column 39.
|
@@ -1,11 +1,96 @@
|
||||
# wolfSSL Espressif Example Project CMakeLists.txt
|
||||
# v1.0
|
||||
#
|
||||
# The following lines of boilerplate have to be in your project's
|
||||
# CMakeLists in this exact order for cmake to work correctly
|
||||
cmake_minimum_required(VERSION 3.5)
|
||||
cmake_minimum_required(VERSION 3.16)
|
||||
|
||||
# The wolfSSL CMake file should be able to find the source code.
|
||||
# Otherwise, assign an environment variable or set it here:
|
||||
#
|
||||
# set(WOLFSSL_ROOT "~/workspace/wolfssl-other-source")
|
||||
#
|
||||
# Optional WOLFSSL_CMAKE_SYSTEM_NAME detection to find
|
||||
# USE_MY_PRIVATE_CONFIG path for my_private_config.h
|
||||
#
|
||||
# Expected path varies:
|
||||
#
|
||||
# WSL: /mnt/c/workspace
|
||||
# Linux: ~/workspace
|
||||
# Windows: C:\workspace
|
||||
#
|
||||
if(WIN32)
|
||||
# Windows-specific configuration here
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_CMAKE_SYSTEM_NAME_WINDOWS")
|
||||
message("Detected Windows")
|
||||
endif()
|
||||
if(CMAKE_HOST_UNIX)
|
||||
message("Detected UNIX")
|
||||
endif()
|
||||
if(APPLE)
|
||||
message("Detected APPLE")
|
||||
endif()
|
||||
if(CMAKE_HOST_UNIX AND (NOT APPLE) AND EXISTS "/proc/sys/fs/binfmt_misc/WSLInterop")
|
||||
# Windows-specific configuration here
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_CMAKE_SYSTEM_NAME_WSL")
|
||||
message("Detected WSL")
|
||||
endif()
|
||||
if(CMAKE_HOST_UNIX AND (NOT APPLE) AND (NOT WIN32))
|
||||
# Windows-specific configuration here
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_CMAKE_SYSTEM_NAME_LINUX")
|
||||
message("Detected Linux")
|
||||
endif()
|
||||
if(APPLE)
|
||||
# Windows-specific configuration here
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_CMAKE_SYSTEM_NAME_APPLE")
|
||||
message("Detected Apple")
|
||||
endif()
|
||||
# End optional WOLFSSL_CMAKE_SYSTEM_NAME
|
||||
|
||||
# (Not part of the boilerplate)
|
||||
# This example uses an extra component for common functions such as Wi-Fi and Ethernet connection.
|
||||
# disable the following line if there isn't the directory
|
||||
set(EXTRA_COMPONENT_DIRS $ENV{IDF_PATH}/examples/common_components/protocol_examples_common)
|
||||
set (PROTOCOL_EXAMPLES_DIR $ENV{IDF_PATH}/examples/common_components/protocol_examples_common)
|
||||
|
||||
if (EXISTS "${PROTOCOL_EXAMPLES_DIR}")
|
||||
message("Found PROTOCOL_EXAMPLES_DIR=${PROTOCOL_EXAMPLES_DIR}")
|
||||
set(EXTRA_COMPONENT_DIRS $ENV{IDF_PATH}/examples/common_components/protocol_examples_common)
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DFOUND_PROTOCOL_EXAMPLES_DIR")
|
||||
else()
|
||||
message("NOT FOUND: PROTOCOL_EXAMPLES_DIR=${PROTOCOL_EXAMPLES_DIR}")
|
||||
endif()
|
||||
|
||||
# Check that there are not conflicting wolfSSL components
|
||||
# The ESP Registry Component will be in ./managed_components/wolfssl__wolfssl
|
||||
# The local component wolfSSL directory will be in ./components/wolfssl
|
||||
if( EXISTS "${CMAKE_HOME_DIRECTORY}/managed_components/wolfssl__wolfssl" AND EXISTS "${CMAKE_HOME_DIRECTORY}/components/wolfssl" )
|
||||
# These exclude statements don't seem to be honored by the $ENV{IDF_PATH}/tools/cmake/project.cmake'
|
||||
# add_subdirectory("${CMAKE_HOME_DIRECTORY}/managed_components/wolfssl__wolfssl" EXCLUDE_FROM_ALL)
|
||||
# add_subdirectory("${CMAKE_HOME_DIRECTORY}/managed_components/wolfssl__wolfssl/include" EXCLUDE_FROM_ALL)
|
||||
# So we'll error out and let the user decide how to proceed:
|
||||
message(WARNING "\nFound wolfSSL components in\n"
|
||||
"./managed_components/wolfssl__wolfssl\n"
|
||||
"and\n"
|
||||
"./components/wolfssl\n"
|
||||
"in project directory: \n"
|
||||
"${CMAKE_HOME_DIRECTORY}")
|
||||
message(FATAL_ERROR "\nPlease use either the ESP Registry Managed Component or the wolfSSL component directory but not both.\n"
|
||||
"If removing the ./managed_components/wolfssl__wolfssl directory, remember to also remove "
|
||||
"or rename the idf_component.yml file typically found in ./main/")
|
||||
else()
|
||||
message(STATUS "No conflicting wolfSSL components found.")
|
||||
endif()
|
||||
|
||||
|
||||
# This example uses an extra component for common functions such as Wi-Fi and Ethernet connection.
|
||||
set (PROTOCOL_EXAMPLES_DIR $ENV{IDF_PATH}/examples/common_components/protocol_examples_common)
|
||||
|
||||
if (EXISTS "${PROTOCOL_EXAMPLES_DIR}")
|
||||
message("Found PROTOCOL_EXAMPLES_DIR=${PROTOCOL_EXAMPLES_DIR}")
|
||||
set(EXTRA_COMPONENT_DIRS $ENV{IDF_PATH}/examples/common_components/protocol_examples_common)
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DFOUND_PROTOCOL_EXAMPLES_DIR")
|
||||
else()
|
||||
message("NOT FOUND: PROTOCOL_EXAMPLES_DIR=${PROTOCOL_EXAMPLES_DIR}")
|
||||
endif()
|
||||
|
||||
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
|
||||
|
||||
project(wolfssl_client)
|
||||
|
||||
@@ -1,6 +1,20 @@
|
||||
#wolfSSL Example
|
||||
# wolfSSL TLS Client Example
|
||||
|
||||
This is the wolfSSL TLS Client demo, typically used with the [Espressif TLS Server](../wolfssl_server/README.md)
|
||||
or the CLI [Server](https://github.com/wolfSSL/wolfssl/tree/master/examples/server).
|
||||
|
||||
When using the CLI, see the [example parameters](/IDE/Espressif/ESP-IDF/examples#interaction-with-wolfssl-cli).
|
||||
|
||||
For general information on [wolfSSL examples for Espressif](../README.md), see the
|
||||
[README](https://github.com/wolfSSL/wolfssl/blob/master/IDE/Espressif/ESP-IDF/README.md) file.
|
||||
|
||||
## VisualGDB
|
||||
|
||||
Open the VisualGDB Visual Studio Project file in the VisualGDB directory and click the "Start" button.
|
||||
No wolfSSL setup is needed. You may need to adjust your specific COM port. The default is `COM20`.
|
||||
|
||||
## ESP-IDF Commandline
|
||||
|
||||
The Example contains of wolfSSL tls client demo.
|
||||
|
||||
1. `idf.py menuconfig` to config the project
|
||||
|
||||
@@ -24,4 +38,41 @@ When you want to test the wolfSSL client
|
||||
|
||||
e.g. Launch ./examples/server/server -v 4 -b -i -d
|
||||
|
||||
See the README.md file in the upper level 'examples' directory for more information about examples.
|
||||
## SM Ciphers
|
||||
|
||||
#### Working Linux Client to ESP32 Server
|
||||
|
||||
Command:
|
||||
|
||||
```
|
||||
cd /mnt/c/workspace/wolfssl-$USER/IDE/Espressif/ESP-IDF/examples/wolfssl_server
|
||||
. /mnt/c/SysGCC/esp32/esp-idf/v5.1/export.sh
|
||||
idf.py flash -p /dev/ttyS19 -b 115200 monitor
|
||||
|
||||
```
|
||||
|
||||
```
|
||||
cd /mnt/c/workspace/wolfssl-$USER
|
||||
|
||||
./examples/client/client -h 192.168.1.108 -v 4 -l TLS_SM4_GCM_SM3 -c ./certs/sm2/client-sm2.pem -k ./certs/sm2/client-sm2-priv.pem -A ./certs/sm2/root-sm2.pem -C
|
||||
```
|
||||
|
||||
Output:
|
||||
|
||||
```text
|
||||
SSL version is TLSv1.3
|
||||
SSL cipher suite is TLS_SM4_GCM_SM3
|
||||
SSL curve name is SM2P256V1
|
||||
I hear you fa shizzle!
|
||||
```
|
||||
|
||||
#### Linux client to Linux server:
|
||||
|
||||
```
|
||||
./examples/client/client -h 127.0.0.1 -v 4 -l ECDHE-ECDSA-SM4-CBC-SM3 -c ./certs/sm2/client-sm2.pem -k ./certs/sm2/client-sm2-priv.pem -A ./certs/sm2/root-sm2.pem -C
|
||||
|
||||
./examples/server/server -v 3 -l ECDHE-ECDSA-SM4-CBC-SM3 -c ./certs/sm2/server-sm2.pem -k ./certs/sm2/server-sm2-priv.pem -A ./certs/sm2/client-sm2.pem -V
|
||||
```
|
||||
|
||||
See the README.md file in the upper level 'examples' directory for [more information about examples](../README.md).
|
||||
|
||||
|
||||
@@ -0,0 +1,512 @@
|
||||
# SM Cipher Notes
|
||||
|
||||
|
||||
### Install SM
|
||||
```
|
||||
cd /mnt/c/workspace/wolfsm-$USER
|
||||
./install.sh ../wolfssl-$USER
|
||||
```
|
||||
|
||||
|
||||
### Build Linux SM Examples
|
||||
```
|
||||
./autogen.sh
|
||||
./configure --enable-sm3 --enable-sm4-gcm --enable-sm2 \
|
||||
--enable-sm4-ecb --enable-sm4-cbc --enable-sm4-ctr \
|
||||
--enable-sm4-gcm --enable-sm4-ccm
|
||||
make clean && make
|
||||
```
|
||||
|
||||
### TLS 1.3 Server
|
||||
|
||||
```
|
||||
./examples/server/server -v 4 -b -d -p 11111 -c ./certs/sm2/server-sm2.pem -k ./certs/sm2/server-sm2-priv.pem -A ./certs/sm2/client-sm2.pem -V
|
||||
```
|
||||
|
||||
### TLS 1.3 Client
|
||||
|
||||
```
|
||||
./examples/client/client -h 127.0.0.1 -v 4 -l TLS13-SM4-CCM-SM3 -c ./certs/sm2/client-sm2.pem -k ./certs/sm2/client-sm2-priv.pem -A ./certs/sm2/root-sm2.pem -C
|
||||
```
|
||||
|
||||
### TLS 1.2 Client to Local Linux Server
|
||||
|
||||
```
|
||||
./examples/client/client -h 192.168.25.186 -v 3 -l ECDHE-ECDSA-SM4-CBC-SM3 \
|
||||
-c ./certs/sm2/client-sm2.pem \
|
||||
-k ./certs/sm2/client-sm2-priv.pem \
|
||||
-A ./certs/sm2/root-sm2.pem -C
|
||||
```
|
||||
|
||||
### TLS 1.2 Client to ESP32 Server
|
||||
|
||||
```
|
||||
./examples/client/client -h 192.168.25.186 -v 3 -l ECDHE-ECDSA-SM4-CBC-SM3 \
|
||||
-c ./certs/sm2/client-sm2.pem \
|
||||
-k ./certs/sm2/client-sm2-priv.pem \
|
||||
-A ./certs/sm2/root-sm2.pem -C
|
||||
```
|
||||
### Others...
|
||||
|
||||
```
|
||||
# Success: Linux Client to ESP32 Server TLS1.2
|
||||
./examples/client/client -h 192.168.1.113 -v 3 -l ECDHE-ECDSA-SM4-CBC-SM3 -c ./certs/sm2/client-sm2.pem -k ./certs/sm2/client-sm2-priv.pem -A ./certs/sm2/root-sm2.pem -C
|
||||
./examples/client/client -h 192.168.1.113 -v 3 -l ECDHE-ECDSA-SM4-GCM-SM3 -c ./certs/sm2/client-sm2.pem -k ./certs/sm2/client-sm2-priv.pem -A ./certs/sm2/root-sm2.pem -C
|
||||
./examples/client/client -h 192.168.1.113 -v 3 -l ECDHE-ECDSA-SM4-CCM-SM3 -c ./certs/sm2/client-sm2.pem -k ./certs/sm2/client-sm2-priv.pem -A ./certs/sm2/root-sm2.pem -C
|
||||
|
||||
# Success: Linux Client to ESP32 Server TLS1.3
|
||||
|
||||
# Reported as TLS_SM4_GCM_SM3, but parameter is TLS13-SM4-GCM-SM3
|
||||
./examples/client/client -h 192.168.1.113 -v 4 -l TLS13-SM4-GCM-SM3 -c ./certs/sm2/client-sm2.pem -k ./certs/sm2/client-sm2-priv.pem -A ./certs/sm2/root-sm2.pem -C
|
||||
|
||||
# Reported as TLS-SM4-CCM-SM3, but parameter is TLS13-SM4-CCM-SM3
|
||||
./examples/client/client -h 192.168.1.113 -v 4 -l TLS13-SM4-CCM-SM3 -c ./certs/sm2/client-sm2.pem -k ./certs/sm2/client-sm2-priv.pem -A ./certs/sm2/root-sm2.pem -C
|
||||
|
||||
./examples/client/client -h 192.168.1.113 -v 4 -l TLS13-SM4-CBC-SM3 -c ./certs/sm2/client-sm2.pem -k ./certs/sm2/client-sm2-priv.pem -A ./certs/sm2/root-sm2.pem -C
|
||||
|
||||
```
|
||||
|
||||
```
|
||||
ESP32-to-ESP32
|
||||
TLS_ECDHE_ECDSA_WITH_SM4_CBC_SM3
|
||||
TLS_ECDHE_ECDSA_WITH_SM4_GCM_SM3
|
||||
TLS_ECDHE_ECDSA_WITH_SM4_CCM_SM3
|
||||
```
|
||||
|
||||
Tried both PEM and DER format.
|
||||
|
||||
The latest server is PEM format, triple-checked to have the embedded server
|
||||
be the same as the Linux server files.
|
||||
|
||||
|
||||
| Usage | Certificate | Key | Certificate Authority file, default ./certs/client-cert.pem |
|
||||
| ----- | ---------------------------------- | ----------------------------------- | --------------------------------- |
|
||||
| server | -c ./certs/sm2/server-sm2.pem | -k ./certs/sm2/server-sm2-priv.pem | -A ./certs/sm2/client-sm2.pem -V |
|
||||
| client | -c ./certs/sm2/client-sm2.pem | -k ./certs/sm2/client-sm2-priv.pem | -A ./certs/sm2/root-sm2.pem -C |
|
||||
| emdedded:
|
||||
| server | wolfSSL_CTX_use_certificate_buffer<br/> server_sm2 | wolfSSL_CTX_use_PrivateKey_buffer<br/> server_sm2_priv | wolfSSL_CTX_load_verify_buffer<br/> client-sm2 |
|
||||
|
||||
### Code
|
||||
|
||||
See [source code](https://github.com/gojimmypi/wolfssl/blob/2c4f443aec7b151f945cb9dfe2dad6ee30449cf0/IDE/Espressif/ESP-IDF/examples/wolfssl_server/main/server-tls.c#L187):
|
||||
|
||||

|
||||
|
||||
|
||||
### Linux client talking to embedded server:
|
||||
|
||||
```
|
||||
/examples/client/client -h 192.168.1.108 -v 3 -l ECDHE-ECDSA-SM4-CBC-SM3 -c ./certs/sm2/client-sm2.pem -k ./certs/sm2/client-sm2-priv.pem -A ./certs/sm2/root-sm2.pem -C
|
||||
wolfSSL_connect error -188, ASN no signer error to confirm failure
|
||||
wolfSSL error: wolfSSL_connect failed
|
||||
```
|
||||
|
||||
Output:
|
||||
```
|
||||
ets Jul 29 2019 12:21:46
|
||||
|
||||
rst:0x3 (SW_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
|
||||
configsip: 0, SPIWP:0xee
|
||||
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
|
||||
mode:DIO, clock div:2
|
||||
load:0x3fff0030,len:7000
|
||||
load:0x40078000,len:15452
|
||||
ho 0 tail 12 room 4
|
||||
load:0x40080400,len:3840
|
||||
entry 0x4008064c
|
||||
I (29) boot: ESP-IDF v5.0-dirty 2nd stage bootloader
|
||||
I (29) boot: compile time 13:40:31
|
||||
I (29) boot: chip revision: v3.0
|
||||
I (32) boot_comm: chip revision: 3, min. bootloader chip revision: 0
|
||||
I (39) boot.esp32: SPI Speed : 40MHz
|
||||
I (44) boot.esp32: SPI Mode : DIO
|
||||
I (48) boot.esp32: SPI Flash Size : 2MB
|
||||
I (53) boot: Enabling RNG early entropy source...
|
||||
I (58) boot: Partition Table:
|
||||
I (62) boot: ## Label Usage Type ST Offset Length
|
||||
I (69) boot: 0 nvs WiFi data 01 02 00009000 00006000
|
||||
I (77) boot: 1 phy_init RF data 01 01 0000f000 00001000
|
||||
I (84) boot: 2 factory factory app 00 00 00010000 00177000
|
||||
I (92) boot: End of partition table
|
||||
I (96) boot_comm: chip revision: 3, min. application chip revision: 0
|
||||
I (103) esp_image: segment 0: paddr=00010020 vaddr=3f400020 size=338d8h (211160) map
|
||||
I (188) esp_image: segment 1: paddr=00043900 vaddr=3ffb0000 size=03b78h ( 15224) load
|
||||
I (194) esp_image: segment 2: paddr=00047480 vaddr=40080000 size=08b98h ( 35736) load
|
||||
I (209) esp_image: segment 3: paddr=00050020 vaddr=400d0020 size=c591ch (809244) map
|
||||
I (501) esp_image: segment 4: paddr=00115944 vaddr=40088b98 size=0c230h ( 49712) load
|
||||
I (522) esp_image: segment 5: paddr=00121b7c vaddr=50000000 size=00010h ( 16) load
|
||||
I (533) boot: Loaded app from partition at offset 0x10000
|
||||
I (533) boot: Disabling RNG early entropy source...
|
||||
I (545) cpu_start: Pro cpu up.
|
||||
I (545) cpu_start: Starting app cpu, entry point is 0x400812f4
|
||||
I (532) cpu_start: App cpu up.
|
||||
I (561) cpu_start: Pro cpu start user code
|
||||
I (561) cpu_start: cpu freq: 160000000 Hz
|
||||
I (561) cpu_start: Application information:
|
||||
I (566) cpu_start: Project name: wolfssl_server
|
||||
I (571) cpu_start: App version: v5.6.3-stable-1088-g560c84b2b-d
|
||||
I (578) cpu_start: Compile time: Jul 19 2023 22:20:09
|
||||
I (585) cpu_start: ELF file SHA256: 3e6e571c9e87bf44...
|
||||
I (591) cpu_start: ESP-IDF: v5.0-dirty
|
||||
I (596) heap_init: Initializing. RAM available for dynamic allocation:
|
||||
I (603) heap_init: At 3FFAE6E0 len 00001920 (6 KiB): DRAM
|
||||
I (609) heap_init: At 3FFBDA68 len 00022598 (137 KiB): DRAM
|
||||
I (615) heap_init: At 3FFE0440 len 00003AE0 (14 KiB): D/IRAM
|
||||
I (622) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM
|
||||
I (628) heap_init: At 40094DC8 len 0000B238 (44 KiB): IRAM
|
||||
I (636) spi_flash: detected chip: generic
|
||||
I (639) spi_flash: flash io: dio
|
||||
W (643) spi_flash: Detected size(4096k) larger than the size in the binary image header(2048k). Using the
|
||||
size in the binary image header.
|
||||
I (657) cpu_start: Starting scheduler on PRO CPU.
|
||||
I (0) cpu_start: Starting scheduler on APP CPU.
|
||||
I (725) tls_server: ESP_WIFI_MODE_STA
|
||||
I (735) wifi:wifi driver task: 3ffcb738, prio:23, stack:6656, core=0
|
||||
I (735) system_api: Base MAC address is not set
|
||||
I (735) system_api: read default base MAC address from EFUSE
|
||||
I (755) wifi:wifi firmware version: 0d470ef
|
||||
I (755) wifi:wifi certification version: v7.0
|
||||
I (755) wifi:config NVS flash: enabled
|
||||
I (755) wifi:config nano formating: disabled
|
||||
I (755) wifi:Init data frame dynamic rx buffer num: 32
|
||||
I (765) wifi:Init management frame dynamic rx buffer num: 32
|
||||
I (765) wifi:Init management short buffer num: 32
|
||||
I (775) wifi:Init dynamic tx buffer num: 32
|
||||
I (775) wifi:Init static rx buffer size: 1600
|
||||
I (775) wifi:Init static rx buffer num: 10
|
||||
I (785) wifi:Init dynamic rx buffer num: 32
|
||||
I (785) wifi_init: rx ba win: 6
|
||||
I (795) wifi_init: tcpip mbox: 32
|
||||
I (795) wifi_init: udp mbox: 6
|
||||
I (795) wifi_init: tcp mbox: 6
|
||||
I (805) wifi_init: tcp tx win: 5744
|
||||
I (805) wifi_init: tcp rx win: 5744
|
||||
I (815) wifi_init: tcp mss: 1440
|
||||
I (815) wifi_init: WiFi IRAM OP enabled
|
||||
I (815) wifi_init: WiFi RX IRAM OP enabled
|
||||
I (825) phy_init: phy_version 4670,719f9f6,Feb 18 2021,17:07:07
|
||||
I (925) wifi:mode : sta (24:d7:eb:41:7b:68)
|
||||
I (935) wifi:enable tsf
|
||||
I (935) tls_server: wifi_init_sta finished.
|
||||
I (945) wifi:new:<4,0>, old:<1,0>, ap:<255,255>, sta:<4,0>, prof:1
|
||||
I (945) wifi:state: init -> auth (b0)
|
||||
I (945) wifi:state: auth -> assoc (0)
|
||||
I (955) wifi:state: assoc -> run (10)
|
||||
W (955) wifi:<ba-add>idx:0 (ifx:0, c8:d7:19:cd:00:17), tid:0, ssn:0, winSize:64
|
||||
I (985) wifi:connected with testbench, aid = 1, channel 4, BW20, bssid = c8:d7:19:cd:00:17
|
||||
I (985) wifi:security: WPA2-PSK, phy: bgn, rssi: -45
|
||||
I (995) wifi:pm start, type: 1
|
||||
|
||||
I (1065) wifi:AP's beacon interval = 102400 us, DTIM period = 1
|
||||
I (3225) esp_netif_handlers: sta ip: 192.168.1.108, mask: 255.255.255.0, gw: 192.168.1.10
|
||||
I (3225) tls_server: got ip:192.168.1.108
|
||||
I (3235) Time Helper: sntp_setservername:
|
||||
I (3235) Time Helper: pool.ntp.org
|
||||
I (3245) Time Helper: time.nist.gov
|
||||
I (3245) Time Helper: utcnist.colorado.edu
|
||||
I (3255) Time Helper: sntp_init done.
|
||||
TLS13-AES128-GCM-SHA256:TLS13-CHACHA20-POLY1305-SHA256:TLS13-SM4-GCM-SM3:TLS13-SM4-CCM-SM3:ECDHE-RSA-AES12
|
||||
8-SHA:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-ECDSA-AES256-SHA:ECDHE-RSA-DES-CBC3-SHA:ECDHE-ECDS
|
||||
A-DES-CBC3-SHA:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-ECD
|
||||
SA-AES128-SHA256:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305-OLD
|
||||
:ECDHE-ECDSA-CHACHA20-POLY1305-OLD:ECDHE-ECDSA-SM4-CBC-SM3:ECDHE-ECDSA-SM4-GCM-SM3:ECDHE-ECDSA-SM4-CCM-SM3
|
||||
:ECDHE-PSK-AES128-CBC-SHA256:ECDHE-PSK-AES128-GCM-SHA256:PSK-CHACHA20-POLY1305:ECDHE-PSK-CHACHA20-POLY1305
|
||||
I (3315) wolfssl: Start wolfSSL_Init()
|
||||
I (3315) wolfssl: wolfSSL Entering wolfSSL_Init
|
||||
I (3325) wolfssl: wolfSSL Entering wolfCrypt_Init
|
||||
I (3325) wolfssl: start socket())
|
||||
I (3335) wolfssl: Create and initialize WOLFSSL_CTX
|
||||
I (3335) wolfssl: wolfSSL Entering wolfSSLv23_server_method_ex
|
||||
I (3345) wolfssl: wolfSSL Entering wolfSSL_CTX_new_ex
|
||||
I (3345) wolfssl: wolfSSL Entering wolfSSL_CertManagerNew
|
||||
I (3355) wolfssl: wolfSSL Leaving wolfSSL_CTX_new_ex, return 0
|
||||
I (3365) tls_server: Start SM2
|
||||
|
||||
I (3365) wolfssl: wolfSSL Entering wolfSSL_CTX_set_cipher_list
|
||||
I (3375) tls_server: Set cipher list: ECDHE-ECDSA-SM4-CBC-SM3
|
||||
|
||||
TLS13-AES128-GCM-SHA256:TLS13-CHACHA20-POLY1305-SHA256:TLS13-SM4-GCM-SM3:TLS13-SM4-CCM-SM3:ECDHE-RSA-AES12
|
||||
8-SHA:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-ECDSA-AES256-SHA:ECDHE-RSA-DES-CBC3-SHA:ECDHE-ECDS
|
||||
A-DES-CBC3-SHA:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-ECD
|
||||
SA-AES128-SHA256:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305-OLD
|
||||
:ECDHE-ECDSA-CHACHA20-POLY1305-OLD:ECDHE-ECDSA-SM4-CBC-SM3:ECDHE-ECDSA-SM4-GCM-SM3:ECDHE-ECDSA-SM4-CCM-SM3
|
||||
:ECDHE-PSK-AES128-CBC-SHA256:ECDHE-PSK-AES128-GCM-SHA256:PSK-CHACHA20-POLY1305:ECDHE-PSK-CHACHA20-POLY1305
|
||||
I (3435) wolfssl: Loading certificate...
|
||||
I (3435) wolfssl: wolfSSL Entering wolfSSL_CTX_use_certificate_buffer
|
||||
I (3445) wolfssl: wolfSSL Entering PemToDer
|
||||
I (3455) wolfssl: Checking cert signature type
|
||||
I (3455) wolfssl: wolfSSL Entering GetExplicitVersion
|
||||
I (3465) wolfssl: wolfSSL Entering wc_GetSerialNumber
|
||||
I (3465) wolfssl: Got Cert Header
|
||||
I (3475) wolfssl: wolfSSL Entering GetObjectId
|
||||
I (3475) wolfssl: Got Algo ID
|
||||
I (3475) wolfssl: Getting Name
|
||||
I (3485) wolfssl: Getting Cert Name
|
||||
I (3485) wolfssl: Getting Name
|
||||
I (3495) wolfssl: Getting Cert Name
|
||||
I (3495) wolfssl: Got Subject Name
|
||||
I (3495) wolfssl: wolfSSL Entering GetAlgoId
|
||||
I (3505) wolfssl: wolfSSL Entering GetObjectId
|
||||
I (3505) wolfssl: wolfSSL Entering GetObjectId
|
||||
I (3515) wolfssl: Got Key
|
||||
I (3515) wolfssl: ECDSA/ED25519/ED448 cert signature
|
||||
I (3525) wolfssl: wolfSSL Leaving wolfSSL_CTX_use_certificate_buffer, return 1
|
||||
I (3535) tls_server: Loaded server_sm2
|
||||
|
||||
I (3535) wolfssl: Loading key info...
|
||||
I (3535) wolfssl: wolfSSL Entering wolfSSL_CTX_use_PrivateKey_buffer
|
||||
I (3545) wolfssl: wolfSSL Entering PemToDer
|
||||
I (3555) wolfssl: wolfSSL Entering GetAlgoId
|
||||
I (3555) wolfssl: wolfSSL Entering GetObjectId
|
||||
I (3565) wolfssl: wolfSSL Entering GetAlgoId
|
||||
I (3565) wolfssl: wolfSSL Entering GetObjectId
|
||||
I (3575) wolfssl: wolfSSL Leaving wolfSSL_CTX_use_PrivateKey_buffer, return 1
|
||||
I (3575) tls_server: Loaded PrivateKey_buffer server_sm2_priv
|
||||
|
||||
I (3585) wolfssl: wolfSSL Entering wolfSSL_CTX_load_verify_buffer_ex
|
||||
I (3595) wolfssl: Processing CA PEM file
|
||||
I (3595) wolfssl: wolfSSL Entering PemToDer
|
||||
I (3605) wolfssl: Adding a CA
|
||||
I (3605) wolfssl: wolfSSL Entering GetExplicitVersion
|
||||
I (3615) wolfssl: wolfSSL Entering wc_GetSerialNumber
|
||||
I (3615) wolfssl: Got Cert Header
|
||||
I (3625) wolfssl: wolfSSL Entering GetObjectId
|
||||
I (3625) wolfssl: Got Algo ID
|
||||
I (3635) wolfssl: Getting Name
|
||||
I (3635) wolfssl: Getting Cert Name
|
||||
I (3635) wolfssl: Getting Name
|
||||
I (3645) wolfssl: Getting Cert Name
|
||||
I (3645) wolfssl: Got Subject Name
|
||||
I (3655) wolfssl: wolfSSL Entering GetAlgoId
|
||||
I (3655) wolfssl: wolfSSL Entering GetObjectId
|
||||
I (3665) wolfssl: wolfSSL Entering GetObjectId
|
||||
I (3665) wolfssl: Got Key
|
||||
I (3665) wolfssl: Parsed Past Key
|
||||
I (3675) wolfssl: wolfSSL Entering DecodeCertExtensions
|
||||
I (3675) wolfssl: wolfSSL Entering GetObjectId
|
||||
I (3685) wolfssl: wolfSSL Entering DecodeSubjKeyId
|
||||
I (3685) wolfssl: wolfSSL Entering GetObjectId
|
||||
I (3695) wolfssl: wolfSSL Entering DecodeAuthKeyId
|
||||
I (3705) wolfssl: wolfSSL Entering GetObjectId
|
||||
I (3705) wolfssl: wolfSSL Entering DecodeBasicCaConstraint
|
||||
I (3715) wolfssl: wolfSSL Entering GetObjectId
|
||||
I (3715) wolfssl: wolfSSL Entering DecodeAltNames
|
||||
I (3725) wolfssl: Unsupported name type, skipping
|
||||
I (3725) wolfssl: wolfSSL Entering GetObjectId
|
||||
I (3735) wolfssl: wolfSSL Entering DecodeExtKeyUsage
|
||||
I (3735) wolfssl: wolfSSL Entering GetObjectId
|
||||
I (3745) wolfssl: wolfSSL Entering GetObjectId
|
||||
I (3745) wolfssl: wolfSSL Entering GetObjectId
|
||||
I (3755) wolfssl: Parsed new CA
|
||||
I (3755) wolfssl: No key size check done on CA
|
||||
I (3765) wolfssl: Freeing Parsed CA
|
||||
I (3765) wolfssl: Freeing der CA
|
||||
I (3775) wolfssl: OK Freeing der CA
|
||||
I (3775) wolfssl: wolfSSL Leaving AddCA, return 0
|
||||
I (3785) wolfssl: Processed a CA
|
||||
I (3785) wolfssl: Processed at least one valid CA. Other stuff OK
|
||||
I (3795) wolfssl: wolfSSL Leaving wolfSSL_CTX_load_verify_buffer_ex, return 1
|
||||
I (3795) tls_server: Success: load verify buffer
|
||||
|
||||
I (3805) tls_server: Finish SM2
|
||||
|
||||
I (3805) tls_server: accept clients...
|
||||
I (3815) wolfssl: Waiting for a connection...
|
||||
I (14485) wolfssl: wolfSSL Entering wolfSSL_new
|
||||
I (14495) wolfssl: wolfSSL Entering ReinitSSL
|
||||
I (14495) wolfssl: wolfSSL Entering SetSSL_CTX
|
||||
I (14495) wolfssl: wolfSSL Entering wolfSSL_NewSession
|
||||
I (14505) wolfssl: wolfSSL Leaving wolfSSL_new, return 0
|
||||
I (14505) wolfssl: wolfSSL Entering wolfSSL_set_fd
|
||||
I (14515) wolfssl: wolfSSL Entering wolfSSL_set_read_fd
|
||||
I (14515) wolfssl: wolfSSL Leaving wolfSSL_set_read_fd, return 1
|
||||
I (14525) wolfssl: wolfSSL Entering wolfSSL_set_write_fd
|
||||
I (14535) wolfssl: wolfSSL Leaving wolfSSL_set_write_fd, return 1
|
||||
I (14535) wolfssl: wolfSSL Entering wolfSSL_accept
|
||||
I (14545) wolfssl: wolfSSL Entering ReinitSSL
|
||||
I (14545) wolfssl: growing input buffer
|
||||
I (14555) wolfssl: received record layer msg
|
||||
I (14555) wolfssl: got HANDSHAKE
|
||||
I (14565) wolfssl: wolfSSL Entering wolfSSL_get_options
|
||||
I (14565) wolfssl: wolfSSL Entering DoTls13HandShakeMsg
|
||||
I (14575) wolfssl: wolfSSL Entering DoTls13HandShakeMsgType
|
||||
I (14575) wolfssl: processing client hello
|
||||
I (14585) wolfssl: wolfSSL Entering DoTls13ClientHello
|
||||
I (14595) wolfssl: wolfSSL Entering DoClientHello
|
||||
I (14595) wolfssl: downgrading to TLSv1.2
|
||||
I (14605) wolfssl: Matched No Compression
|
||||
I (14605) wolfssl: Adding signature algorithms extension
|
||||
I (14615) wolfssl: Signature Algorithms extension received
|
||||
I (14615) wolfssl: Point Formats extension received
|
||||
I (14625) wolfssl: Supported Groups extension received
|
||||
I (14625) wolfssl: Unknown TLS extension type
|
||||
I (14635) wolfssl: Unknown TLS extension type
|
||||
I (14635) wolfssl: wolfSSL Entering MatchSuite
|
||||
I (14645) wolfssl: wolfSSL Entering VerifyServerSuite
|
||||
I (14645) wolfssl: Requires ECC
|
||||
I (14655) wolfssl: Verified suite validity
|
||||
I (14655) wolfssl: wolfSSL Leaving DoClientHello, return 0
|
||||
I (14665) wolfssl: wolfSSL Leaving DoTls13ClientHello, return 0
|
||||
I (14675) wolfssl: wolfSSL Leaving DoTls13HandShakeMsgType(), return 0
|
||||
I (14675) wolfssl: wolfSSL Leaving DoTls13HandShakeMsg, return 0
|
||||
I (14685) wolfssl: Shrinking input buffer
|
||||
I (14685) wolfssl: accept state ACCEPT_CLIENT_HELLO_DONE
|
||||
I (14695) wolfssl: accept state ACCEPT_FIRST_REPLY_DONE
|
||||
I (14705) wolfssl: wolfSSL Entering SendServerHello
|
||||
I (14705) wolfssl: growing output buffer
|
||||
I (14715) internal.c: GrowOutputBuffer ok
|
||||
I (14715) wolfssl: wolfSSL Entering wolfSSL_get_options
|
||||
I (14725) wolfssl: Point Formats extension to write
|
||||
W (14735) wolfio: ssl->wflags = 0
|
||||
I (14735) wolfio: 16 03 03 00 52 02 00 00 4e 03 03 af 87 e2 58 57
|
||||
I (14735) wolfio: 73 c3 c1 35 1a 59 39 b2 03 9d 14 03 e0 b8 fb e8
|
||||
I (14745) wolfio: 9d 5b 9c 44 4f 57 4e 47 52 44 01 20 85 77 75 20
|
||||
I (14755) wolfio: 95 dd 00 e2 91 f8 42 33 f8 61 3f 1f de 81 15 58
|
||||
I (14755) wolfio: 23 0c e7 1e 71 e6 10 e5 67 23 e0 40 e0 11 00 00
|
||||
I (14765) wolfio: 06 00 0b 00 02 01 00
|
||||
W (14775) wolfio: sz = 87
|
||||
I (14775) wolfssl: Shrinking output buffer
|
||||
I (14775) wolfssl: wolfSSL Leaving SendServerHello, return 0
|
||||
I (14785) wolfssl: accept state SERVER_HELLO_SENT
|
||||
I (14795) wolfssl: wolfSSL Entering SendCertificate
|
||||
I (14795) wolfssl: growing output buffer
|
||||
I (14805) internal.c: GrowOutputBuffer ok
|
||||
W (14815) wolfio: ssl->wflags = 0
|
||||
I (14815) wolfio: 16 03 03 02 e6 0b 00 02 e2 00 02 df 00 02 dc 30
|
||||
I (14815) wolfio: 82 02 d8 30 82 02 7e a0 03 02 01 02 02 01 01 30
|
||||
I (14825) wolfio: 0a 06 08 2a 81 1c cf 55 01 83 75 30 81 ac 31 0b
|
||||
I (14835) wolfio: 30 09 06 03 55 04 06 13 02 55 53 31 10 30 0e 06
|
||||
I (14835) wolfio: 03 55 04 08 0c 07 4d 6f 6e 74 61 6e 61 31 10 30
|
||||
I (14845) wolfio: 0e 06 03 55 04 07 0c 07 42 6f 7a 65 6d 61 6e 31
|
||||
I (14855) wolfio: 14 30 12 06 03 55 04 0a 0c 0b 77 6f 6c 66 53 53
|
||||
I (14855) wolfio: 4c 5f 73 6d 32 31 0f 30 0d 06 03 55 04 0b 0c 06
|
||||
I (14865) wolfio: 43 41 2d 73 6d 32 31 18 30 16 06 03 55 04 03 0c
|
||||
I (14875) wolfio: 0f 77 77 77 2e 77 6f 6c 66 73 73 6c 2e 63 6f 6d
|
||||
I (14875) wolfio: 31 1f 30 1d 06 09 2a 86 48 86 f7 0d 01 09 01 16
|
||||
I (14885) wolfio: 10 69 6e 66 6f 40 77 6f 6c 66 73 73 6c 2e 63 6f
|
||||
I (14895) wolfio: 6d 31 17 30 15 06 0a 09 92 26 89 93 f2 2c 64 01
|
||||
I (14895) wolfio: 01 0c 07 77 6f 6c 66 53 53 4c 30 1e 17 0d 32 33
|
||||
I (14905) wolfio: 30 32 31 35 30 36 32 33 30 37 5a 17 0d 32 35 31
|
||||
I (14915) wolfio: 31 31 31 30 36 32 33 30 37 5a 30 81 b0 31 0b 30
|
||||
I (14915) wolfio: 09 06 03 55 04 06 13 02 55 53 31 10 30 0e 06 03
|
||||
I (14925) wolfio: 55 04 08 0c 07 4d 6f 6e 74 61 6e 61 31 10 30 0e
|
||||
I (14935) wolfio: 06 03 55 04 07 0c 07 42 6f 7a 65 6d 61 6e 31 14
|
||||
I (14945) wolfio: 30 12 06 03 55 04 0a 0c 0b 77 6f 6c 66 53 53 4c
|
||||
I (14945) wolfio: 5f 73 6d 32 31 13 30 11 06 03 55 04 0b 0c 0a 53
|
||||
I (14955) wolfio: 65 72 76 65 72 2d 73 6d 32 31 18 30 16 06 03 55
|
||||
I (14965) wolfio: 04 03 0c 0f 77 77 77 2e 77 6f 6c 66 73 73 6c 2e
|
||||
I (14965) wolfio: 63 6f 6d 31 1f 30 1d 06 09 2a 86 48 86 f7 0d 01
|
||||
I (14975) wolfio: 09 01 16 10 69 6e 66 6f 40 77 6f 6c 66 73 73 6c
|
||||
I (14985) wolfio: 2e 63 6f 6d 31 17 30 15 06 0a 09 92 26 89 93 f2
|
||||
I (14985) wolfio: 2c 64 01 01 0c 07 77 6f 6c 66 53 53 4c 30 5a 30
|
||||
I (14995) wolfio: 14 06 08 2a 81 1c cf 55 01 82 2d 06 08 2a 81 1c
|
||||
I (15005) wolfio: cf 55 01 82 2d 03 42 00 04 94 70 2b 46 e4 5e 0f
|
||||
I (15005) wolfio: 41 fb 8f 2d 34 0a 41 40 19 5e fb d4 1d 11 ac fa
|
||||
I (15015) wolfio: f5 93 37 c6 fa 87 08 f7 16 1f 2c ce 30 40 9d 4f
|
||||
I (15025) wolfio: a6 2a 0a a1 d6 95 33 c3 a6 03 98 e6 8d 05 34 b0
|
||||
I (15025) wolfio: 97 0c de a4 c7 cf 53 8f d1 a3 81 89 30 81 86 30
|
||||
I (15035) wolfio: 1d 06 03 55 1d 0e 04 16 04 14 67 ae 60 ff 7e 1b
|
||||
I (15045) wolfio: 0f 95 ae 1f 82 59 f2 6c 56 2d 93 ef 17 32 30 1f
|
||||
I (15045) wolfio: 06 03 55 1d 23 04 18 30 16 80 14 47 0a 48 7e bb
|
||||
I (15055) wolfio: 02 a8 5a 26 57 2b 19 a9 7b 61 8b 7f 5d 99 6e 30
|
||||
I (15065) wolfio: 0c 06 03 55 1d 13 01 01 ff 04 02 30 00 30 0e 06
|
||||
I (15075) wolfio: 03 55 1d 0f 01 01 ff 04 04 03 02 03 a8 30 13 06
|
||||
I (15075) wolfio: 03 55 1d 25 04 0c 30 0a 06 08 2b 06 01 05 05 07
|
||||
I (15085) wolfio: 03 01 30 11 06 09 60 86 48 01 86 f8 42 01 01 04
|
||||
I (15095) wolfio: 04 03 02 06 40 30 0a 06 08 2a 81 1c cf 55 01 83
|
||||
I (15095) wolfio: 75 03 48 00 30 45 02 20 1b ca 94 28 7f f6 b2 0d
|
||||
I (15105) wolfio: 31 43 50 e1 d5 34 17 dd af 3a de 81 06 67 9a b3
|
||||
I (15115) wolfio: 06 22 7e 64 ec fd 0e b9 02 21 00 a1 48 a8 32 d1
|
||||
I (15115) wolfio: 05 09 6b 1c eb 89 12 66 d8 38 a1 c4 5c 89 09 0f
|
||||
I (15125) wolfio: fd e9 c0 3b 1d fb cd b5 4c 31 68
|
||||
W (15135) wolfio: sz = 747
|
||||
I (15135) wolfssl: Shrinking output buffer
|
||||
I (15135) wolfssl: wolfSSL Leaving SendCertificate, return 0
|
||||
I (15145) wolfssl: accept state CERT_SENT
|
||||
I (15155) wolfssl: wolfSSL Entering SendCertificateStatus
|
||||
I (15155) wolfssl: wolfSSL Leaving SendCertificateStatus, return 0
|
||||
I (15165) wolfssl: accept state CERT_STATUS_SENT
|
||||
I (15165) wolfssl: wolfSSL Entering SendServerKeyExchange
|
||||
I (15175) wolfssl: Using ephemeral ECDH
|
||||
I (15175) wolfssl: wolfSSL Entering EccMakeKey
|
||||
I (15535) wolfssl: wolfSSL Leaving EccMakeKey, return 0
|
||||
I (15535) wolfssl: Trying ECC private key, RSA didn't work
|
||||
I (15535) wolfssl: wolfSSL Entering GetAlgoId
|
||||
I (15545) wolfssl: wolfSSL Entering GetObjectId
|
||||
I (15555) wolfssl: Using ECC private key
|
||||
I (15555) wolfssl: wolfSSL Entering Sm2wSm3Sign
|
||||
I (15915) wolfssl: wolfSSL Leaving Sm2wSm3Sign, return 0
|
||||
I (15915) wolfssl: wolfSSL Entering SendHandshakeMsg
|
||||
I (15925) wolfssl: growing output buffer
|
||||
I (15925) internal.c: GrowOutputBuffer ok
|
||||
W (15925) wolfio: ssl->wflags = 0
|
||||
I (15935) wolfio: 16 03 03 00 95 0c 00 00 91 03 00 29 41 04 fd f5
|
||||
I (15935) wolfio: 5e 74 15 30 1d f3 84 ae a5 69 96 a9 5b dd 27 b3
|
||||
I (15945) wolfio: 00 7d 40 3a 59 93 93 6f 4d 1f 62 dc 60 48 34 1f
|
||||
I (15955) wolfio: a8 1d 34 b8 76 8f 8b 27 4a 1b 77 64 8e 2e d5 27
|
||||
I (15955) wolfio: 03 95 8b 9d a5 ed a4 a6 b9 40 1b ea aa 10 07 08
|
||||
I (15965) wolfio: 00 48 30 46 02 21 00 cb 89 61 e9 21 f9 c6 4d ad
|
||||
I (15975) wolfio: aa e7 f1 3f 6f 27 46 f0 35 ec 45 4e 8a ae f3 ac
|
||||
I (15985) wolfio: 7c c0 cf 68 11 44 e2 02 21 00 f6 40 5c bc 66 5a
|
||||
I (15985) wolfio: 74 1e 92 5d 9a 03 75 e7 7f 16 c2 b3 c8 fe 8d 5c
|
||||
I (15995) wolfio: 63 35 36 da 61 38 76 dc 4e d6
|
||||
W (15995) wolfio: sz = 154
|
||||
I (16005) wolfssl: Shrinking output buffer
|
||||
I (16005) wolfssl: wolfSSL Leaving SendServerKeyExchange, return 0
|
||||
I (16015) wolfssl: accept state KEY_EXCHANGE_SENT
|
||||
I (16025) wolfssl: accept state CERT_REQ_SENT
|
||||
I (16025) wolfssl: wolfSSL Entering SendServerHelloDone
|
||||
I (16035) wolfssl: growing output buffer
|
||||
I (16035) internal.c: GrowOutputBuffer ok
|
||||
W (16045) wolfio: ssl->wflags = 0
|
||||
I (16045) wolfio: 16 03 03 00 04 0e 00 00 00
|
||||
W (16045) wolfio: sz = 9
|
||||
I (16055) wolfssl: Embed Send error
|
||||
I (16055) wolfssl: Connection reset
|
||||
I (16065) int: Sent = -3
|
||||
W (16065) int: WOLFSSL_CBIO_ERR_CONN_RST
|
||||
E (16075) int: SOCKET_ERROR_E 2
|
||||
I (16075) wolfssl: wolfSSL Leaving SendServerHelloDone, return -308
|
||||
I (16085) wolfssl: wolfSSL error occurred, error = -308
|
||||
I (16085) wolfssl: wolfSSL Entering wolfSSL_get_error
|
||||
I (16095) wolfssl: wolfSSL Leaving wolfSSL_get_error, return -308
|
||||
E (16085) tls_server: wolfSSL_accept error -308
|
||||
I (16105) wolfssl: Client connected successfully
|
||||
I (16105) wolfssl: wolfSSL Entering wolfSSL_read
|
||||
I (16115) wolfssl: wolfSSL Entering wolfSSL_read_internal
|
||||
I (16125) wolfssl: wolfSSL Entering ReceiveData
|
||||
I (16125) wolfssl: User calling wolfSSL_read in error state, not allowed
|
||||
I (16135) wolfssl: wolfSSL Leaving wolfSSL_read_internal, return -308
|
||||
E (16145) tls_server: ERROR: failed to read
|
||||
I (16145) wolfssl: Client sends:
|
||||
I (16145) wolfssl:
|
||||
I (16155) wolfssl: wolfSSL Entering wolfSSL_write
|
||||
I (16155) wolfssl: handshake not complete, trying to finish
|
||||
I (16165) wolfssl: wolfSSL Entering wolfSSL_negotiate
|
||||
I (16165) wolfssl: wolfSSL Entering wolfSSL_accept
|
||||
I (16175) wolfssl: wolfSSL Entering ReinitSSL
|
||||
W (16185) wolfio: ssl->wflags = 0
|
||||
I (16185) wolfio: 16 03 03 00 04 0e 00 00 00
|
||||
W (16185) wolfio: sz = 9
|
||||
I (16195) wolfssl: Embed Send error
|
||||
I (16195) wolfssl: General error
|
||||
I (16205) int: Sent = -1
|
||||
E (16205) int: SOCKET_ERROR_E
|
||||
I (16205) wolfssl: wolfSSL error occurred, error = -308
|
||||
I (16215) wolfssl: wolfSSL Leaving wolfSSL_negotiate, return -1
|
||||
I (16225) wolfssl: wolfSSL Leaving wolfSSL_write, return -1
|
||||
E (16225) tls_server: ERROR: failed to write
|
||||
I (16235) wolfssl: wolfSSL Entering wolfSSL_free
|
||||
I (16235) wolfssl: Free'ing server ssl
|
||||
I (16245) wolfssl: Shrinking output buffer
|
||||
I (16245) wolfssl: wolfSSL Entering ClientSessionToSession
|
||||
I (16255) wolfssl: wolfSSL Entering wolfSSL_FreeSession
|
||||
I (16255) wolfssl: wolfSSL_FreeSession full free
|
||||
I (16265) wolfssl: CTX ref count not 0 yet, no free
|
||||
I (16265) wolfssl: wolfSSL Leaving wolfSSL_free, return 0
|
||||
I (16275) wolfssl: Waiting for a connection...
|
||||
```
|
||||
|
||||
### Wireshark:
|
||||
|
||||

|
||||
@@ -0,0 +1,52 @@
|
||||
# wolfSSL Project Files for Visual Studio 2022 with VisualGDB Extension
|
||||
|
||||
Include in the respective project `./VisualGDB` directory are [VisualGDB](https://visualgdb.com/) project files.
|
||||
Individual project files are included for convenience to new users, as there are [difficulties switching between ESP-IDF Versions or Chipsets](https://sysprogs.com/w/forums/topic/difficulties-switching-espressif-esp-idf-version-or-chipset/) using the VisualGDB extension.
|
||||
|
||||
The naming convention for project files is: `[project name]_IDF_[Version]_[chipset].vgdbproj`. The solution files (filename[.sln]) often will contain shortcuts to commonly used source and configuration files used by the respective project.
|
||||
|
||||
|
||||
-------- |------------- |------------- |
|
||||
ChipSet | ESP-IDF v4.4 | ESP-IDF v5.0 |
|
||||
-------- |------------- |------------- |
|
||||
ESP32 | x | |
|
||||
ESP32-S2 | | |
|
||||
ESP32-S3 | x | x |
|
||||
ESP32-C3 | x | x |
|
||||
ESP32-C6 | | |
|
||||
|
||||
|
||||
The default directories are:
|
||||
|
||||
- `C:\SysGCC` - The root directory install of VisualGDB
|
||||
- `C:\SysGCC\esp32` - The default for ESP-IDF v5.x
|
||||
- `C:\SysGCC\esp32-8.4` - Many need to manually select this name for ESP-IDF v4.x install
|
||||
- `C:\SysGCC\esp8266`- The default for ESP8266
|
||||
|
||||
## Resources
|
||||
|
||||
- [wolfSSL Website](https://www.wolfssl.com/)
|
||||
|
||||
- [wolfSSL Wiki](https://github.com/wolfSSL/wolfssl/wiki)
|
||||
|
||||
- [FIPS 140-2/140-3 FAQ](https://wolfssl.com/license/fips)
|
||||
|
||||
- [wolfSSL Documentation](https://wolfssl.com/wolfSSL/Docs.html)
|
||||
|
||||
- [wolfSSL Manual](https://wolfssl.com/wolfSSL/Docs-wolfssl-manual-toc.html)
|
||||
|
||||
- [wolfSSL API Reference](https://wolfssl.com/wolfSSL/Docs-wolfssl-manual-17-wolfssl-api-reference.html)
|
||||
|
||||
- [wolfCrypt API Reference](https://wolfssl.com/wolfSSL/Docs-wolfssl-manual-18-wolfcrypt-api-reference.html)
|
||||
|
||||
- [TLS 1.3](https://www.wolfssl.com/docs/tls13/)
|
||||
|
||||
- [wolfSSL Vulnerabilities](https://www.wolfssl.com/docs/security-vulnerabilities/)
|
||||
|
||||
- [Additional wolfSSL Examples](https://github.com/wolfssl/wolfssl-examples)
|
||||
|
||||
## Support
|
||||
|
||||
For questions please email [support@wolfssl.com](mailto:support@wolfssl.com)
|
||||
|
||||
<-- edit 5.6.0001 see https://github.com/wolfSSL/wolfssl/tree/master/IDE/Espressif/ESP-IDF/examples/wolfssl_benchmark/VisualGDB -->
|
||||
@@ -1,31 +0,0 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 16
|
||||
VisualStudioVersion = 16.0.33027.164
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{803FD0C6-D64E-4E16-9DC3-1DAEC859A3D2}") = "VisualGDB_wolfssl_client", "VisualGDB_wolfssl_client.vgdbproj", "{E903E9CC-1A23-4B00-8914-7E45EC21E351}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|VisualGDB = Debug|VisualGDB
|
||||
Release|VisualGDB = Release|VisualGDB
|
||||
Tests (Debug)|VisualGDB = Tests (Debug)|VisualGDB
|
||||
Tests (Release)|VisualGDB = Tests (Release)|VisualGDB
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{E903E9CC-1A23-4B00-8914-7E45EC21E351}.Debug|VisualGDB.ActiveCfg = Debug|VisualGDB
|
||||
{E903E9CC-1A23-4B00-8914-7E45EC21E351}.Debug|VisualGDB.Build.0 = Debug|VisualGDB
|
||||
{E903E9CC-1A23-4B00-8914-7E45EC21E351}.Release|VisualGDB.ActiveCfg = Release|VisualGDB
|
||||
{E903E9CC-1A23-4B00-8914-7E45EC21E351}.Release|VisualGDB.Build.0 = Release|VisualGDB
|
||||
{E903E9CC-1A23-4B00-8914-7E45EC21E351}.Tests (Debug)|VisualGDB.ActiveCfg = Tests (Debug)|VisualGDB
|
||||
{E903E9CC-1A23-4B00-8914-7E45EC21E351}.Tests (Debug)|VisualGDB.Build.0 = Tests (Debug)|VisualGDB
|
||||
{E903E9CC-1A23-4B00-8914-7E45EC21E351}.Tests (Release)|VisualGDB.ActiveCfg = Tests (Release)|VisualGDB
|
||||
{E903E9CC-1A23-4B00-8914-7E45EC21E351}.Tests (Release)|VisualGDB.Build.0 = Tests (Release)|VisualGDB
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {D510376F-F313-4EF6-8EF5-248D1949DFEB}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
@@ -0,0 +1,56 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.6.33829.357
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{803FD0C6-D64E-4E16-9DC3-1DAEC859A3D2}") = "wolfssl_client_IDF_v5_ESP32", "wolfssl_client_IDF_v5_ESP32.vgdbproj", "{E903E9CC-1A23-4B00-8914-7E45EC21E351}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "wolfssl", "wolfssl", "{5D78034B-FAE6-4B8D-8003-EC2B0993F286}"
|
||||
ProjectSection(SolutionItems) = preProject
|
||||
..\..\..\..\..\..\wolfssl\error-ssl.h = ..\..\..\..\..\..\wolfssl\error-ssl.h
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "include", "include", "{53267705-B3FE-418C-975D-CD898BAF1F46}"
|
||||
ProjectSection(SolutionItems) = preProject
|
||||
..\components\wolfssl\include\config.h = ..\components\wolfssl\include\config.h
|
||||
..\components\wolfssl\include\user_settings.h = ..\components\wolfssl\include\user_settings.h
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{A51226B3-88A7-4463-B443-0E321C4A3D53}"
|
||||
ProjectSection(SolutionItems) = preProject
|
||||
..\..\..\..\..\..\..\my_private_config.h = ..\..\..\..\..\..\..\my_private_config.h
|
||||
..\partitions_singleapp_large.csv = ..\partitions_singleapp_large.csv
|
||||
..\README.md = ..\README.md
|
||||
..\sdkconfig = ..\sdkconfig
|
||||
..\build\VisualGDB\Debug\config\sdkconfig.cmake = ..\build\VisualGDB\Debug\config\sdkconfig.cmake
|
||||
..\sdkconfig.defaults = ..\sdkconfig.defaults
|
||||
..\build\VisualGDB\Debug\config\sdkconfig.h = ..\build\VisualGDB\Debug\config\sdkconfig.h
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|VisualGDB = Debug|VisualGDB
|
||||
Release|VisualGDB = Release|VisualGDB
|
||||
Tests (Debug)|VisualGDB = Tests (Debug)|VisualGDB
|
||||
Tests (Release)|VisualGDB = Tests (Release)|VisualGDB
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{E903E9CC-1A23-4B00-8914-7E45EC21E351}.Debug|VisualGDB.ActiveCfg = Debug|VisualGDB
|
||||
{E903E9CC-1A23-4B00-8914-7E45EC21E351}.Debug|VisualGDB.Build.0 = Debug|VisualGDB
|
||||
{E903E9CC-1A23-4B00-8914-7E45EC21E351}.Release|VisualGDB.ActiveCfg = Release|VisualGDB
|
||||
{E903E9CC-1A23-4B00-8914-7E45EC21E351}.Release|VisualGDB.Build.0 = Release|VisualGDB
|
||||
{E903E9CC-1A23-4B00-8914-7E45EC21E351}.Tests (Debug)|VisualGDB.ActiveCfg = Tests (Debug)|VisualGDB
|
||||
{E903E9CC-1A23-4B00-8914-7E45EC21E351}.Tests (Debug)|VisualGDB.Build.0 = Tests (Debug)|VisualGDB
|
||||
{E903E9CC-1A23-4B00-8914-7E45EC21E351}.Tests (Release)|VisualGDB.ActiveCfg = Tests (Release)|VisualGDB
|
||||
{E903E9CC-1A23-4B00-8914-7E45EC21E351}.Tests (Release)|VisualGDB.Build.0 = Tests (Release)|VisualGDB
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(NestedProjects) = preSolution
|
||||
{53267705-B3FE-418C-975D-CD898BAF1F46} = {5D78034B-FAE6-4B8D-8003-EC2B0993F286}
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {BA06FD8D-BEFD-429B-9F82-B6F34B43272E}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0"?>
|
||||
<VisualGDBProjectSettings2 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
|
||||
<VisualGDBProjectSettings2 xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<Project xsi:type="com.visualgdb.project.external.esp-idf">
|
||||
<CustomSourceDirectories>
|
||||
<Directories />
|
||||
@@ -18,9 +18,9 @@
|
||||
<ToolchainID>
|
||||
<ID>com.visualgdb.xtensa-esp32-elf</ID>
|
||||
<Version>
|
||||
<GCC>11.2.0</GCC>
|
||||
<GDB>9.2.90</GDB>
|
||||
<Revision>2</Revision>
|
||||
<GCC>12.2.0</GCC>
|
||||
<GDB>12.1</GDB>
|
||||
<Revision>1</Revision>
|
||||
</Version>
|
||||
</ToolchainID>
|
||||
<RelativeSourceDirectory>..</RelativeSourceDirectory>
|
||||
@@ -67,11 +67,11 @@
|
||||
<EnableFastUpToDateCheck>true</EnableFastUpToDateCheck>
|
||||
<ESPIDFExtension>
|
||||
<IDFCheckout>
|
||||
<Version>release/v5.0</Version>
|
||||
<Subdirectory>esp-idf/v5.0</Subdirectory>
|
||||
<Version>release/v5.1</Version>
|
||||
<Subdirectory>esp-idf/v5.1</Subdirectory>
|
||||
<Type>ESPIDF</Type>
|
||||
</IDFCheckout>
|
||||
<COMPort>COM20</COMPort>
|
||||
<COMPort>COM19</COMPort>
|
||||
<SuppressTestPrerequisiteChecks>false</SuppressTestPrerequisiteChecks>
|
||||
<UseCCache>false</UseCCache>
|
||||
<DeviceID>ESP32</DeviceID>
|
||||
@@ -93,7 +93,7 @@
|
||||
</CustomDebug>
|
||||
<DeviceTerminalSettings>
|
||||
<Connection xsi:type="com.sysprogs.terminal.connection.serial">
|
||||
<ComPortName>COM20</ComPortName>
|
||||
<ComPortName>COM19</ComPortName>
|
||||
<AdvancedSettings>
|
||||
<BaudRate>115200</BaudRate>
|
||||
<DataBits>8</DataBits>
|
||||
@@ -104,7 +104,7 @@
|
||||
</Connection>
|
||||
<LastConnectionTime>0</LastConnectionTime>
|
||||
<EchoTypedCharacters>false</EchoTypedCharacters>
|
||||
<ClearContentsWhenReconnecting>false</ClearContentsWhenReconnecting>
|
||||
<ClearContentsWhenReconnecting>true</ClearContentsWhenReconnecting>
|
||||
<ReconnectAutomatically>false</ReconnectAutomatically>
|
||||
<DisplayMode>ASCII</DisplayMode>
|
||||
<Colors>
|
||||
@@ -220,7 +220,7 @@
|
||||
<DebugMethod>
|
||||
<ID>openocd</ID>
|
||||
<Configuration xsi:type="com.visualgdb.edp.openocd.settings.esp32">
|
||||
<CommandLine>-f interface/tigard.cfg -c "adapter_khz 3000" -f target/esp32.cfg</CommandLine>
|
||||
<CommandLine>-f interface/ftdi/tigard.cfg -c "adapter_khz 15000" -f interface/ftdi/tigard.cfg -f target/esp32.cfg</CommandLine>
|
||||
<ExtraParameters>
|
||||
<Frequency xsi:nil="true" />
|
||||
<BoostedFrequency xsi:nil="true" />
|
||||
@@ -17,206 +17,435 @@
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
|
||||
#
|
||||
# cmake for wolfssl
|
||||
# cmake for wolfssl Espressif projects
|
||||
#
|
||||
cmake_minimum_required(VERSION 3.5)
|
||||
# Version 5.6.0.011 for detect test/benchmark
|
||||
#
|
||||
# See https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/build-system.html
|
||||
#
|
||||
|
||||
cmake_minimum_required(VERSION 3.16)
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_USER_SETTINGS")
|
||||
set(CMAKE_CURRENT_SOURCE_DIR ".")
|
||||
set(COMPONENT_REQUIRES lwip) # we typically don't need lwip directly in wolfssl component
|
||||
set(WOLFSSL_ROOT "$ENV{WOLFSSL_ROOT}" )
|
||||
|
||||
# We are currently in [root]/IDE/Espressif/ESP-IDF/examples/wolfssl_test/components/wolfssl
|
||||
# The root of wolfSSL is 7 directories up from here:
|
||||
get_filename_component(WOLFSSL_ROOT "../../../../../../../" ABSOLUTE)
|
||||
|
||||
# Espressif may take several passes through this makefile. Check to see if we found IDF
|
||||
string(COMPARE EQUAL "${PROJECT_SOURCE_DIR}" "" WOLFSSL_FOUND_IDF)
|
||||
|
||||
if($WOLFSSL_FOUND_IDF)
|
||||
message(STATUS "IDF_PATH = $ENV{IDF_PATH}")
|
||||
message(STATUS "WOLFSSL_ROOT = ${WOLFSSL_ROOT}")
|
||||
message(STATUS "PROJECT_SOURCE_DIR = ${PROJECT_SOURCE_DIR}")
|
||||
endif()
|
||||
|
||||
# get a list of all wolfcrypt assembly files; we'll exclude them as they don't target Xtensa
|
||||
FILE(GLOB EXCLUDE_ASM *.S)
|
||||
file(GLOB_RECURSE EXCLUDE_ASM ${CMAKE_SOURCE_DIR} "${WOLFSSL_ROOT}/wolfcrypt/src/*.S")
|
||||
|
||||
if(NOT CMAKE_BUILD_EARLY_EXPANSION)
|
||||
message(STATUS "EXCLUDE_ASM = ${EXCLUDE_ASM}")
|
||||
endif()
|
||||
|
||||
set(INCLUDE_PATH ${WOLFSSL_ROOT})
|
||||
|
||||
set(COMPONENT_SRCDIRS "${WOLFSSL_ROOT}/src/"
|
||||
"${WOLFSSL_ROOT}/wolfcrypt/src/"
|
||||
"${WOLFSSL_ROOT}/wolfcrypt/src/port/Espressif/"
|
||||
"${WOLFSSL_ROOT}/wolfcrypt/src/port/atmel/"
|
||||
"${WOLFSSL_ROOT}/wolfcrypt/benchmark/"
|
||||
"${WOLFSSL_ROOT}/wolfcrypt/test/"
|
||||
)
|
||||
|
||||
set(COMPONENT_REQUIRES lwip)
|
||||
|
||||
|
||||
# check to see if there's both a local copy and EDP-IDF copy of the wolfssl and/or wolfssh components
|
||||
if( EXISTS "${CMAKE_HOME_DIRECTORY}/components/wolfssl/" AND EXISTS "$ENV{IDF_PATH}/components/wolfssl/" )
|
||||
#
|
||||
# wolfSSL found in both ESP-IDF and local project - needs to be resolved by user
|
||||
#
|
||||
message(STATUS "")
|
||||
message(STATUS "**************************************************************************************")
|
||||
message(STATUS "")
|
||||
message(STATUS "Error: Found components/wolfssl in both local project and IDF_PATH")
|
||||
message(STATUS "")
|
||||
message(STATUS "To proceed: ")
|
||||
message(STATUS "")
|
||||
message(STATUS "Remove either the local project component: ${CMAKE_HOME_DIRECTORY}/components/wolfssl/ ")
|
||||
message(STATUS "or the Espressif shared component installed at: $ENV{IDF_PATH}/components/wolfssl/ ")
|
||||
message(STATUS "")
|
||||
message(FATAL_ERROR "Please use wolfSSL in either local project or Espressif components, but not both.")
|
||||
message(STATUS "")
|
||||
message(STATUS "**************************************************************************************")
|
||||
message(STATUS "")
|
||||
|
||||
# Optional: if you change the above FATAL_ERROR to STATUS you can warn at runtime with this macro definition:
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_MULTI_INSTALL_WARNING")
|
||||
|
||||
else()
|
||||
if( EXISTS "$ENV{IDF_PATH}/components/wolfssl/" )
|
||||
#
|
||||
# wolfSSL found in ESP-IDF components and is assumed to be already configured in user_settings.h via setup.
|
||||
#
|
||||
message(STATUS "")
|
||||
message(STATUS "Using components/wolfssl in IDF_PATH = $ENV{IDF_PATH}")
|
||||
message(STATUS "")
|
||||
# find the user name to search for possible "wolfssl-username"
|
||||
message(STATUS "USERNAME = $ENV{USERNAME}")
|
||||
if( "$ENV{USER}" STREQUAL "" ) # the bash user
|
||||
if( "$ENV{USERNAME}" STREQUAL "" ) # the Windows user
|
||||
message(STATUS "could not find USER or USERNAME")
|
||||
else()
|
||||
#
|
||||
# wolfSSL is not an ESP-IDF component. We need to now determine if it is local and if so if it is part of the wolfSSL repo
|
||||
# or if wolfSSL is simply installed as a local component.
|
||||
#
|
||||
if( EXISTS "${CMAKE_HOME_DIRECTORY}/components/wolfssl/" )
|
||||
#
|
||||
# wolfSSL found in local project.
|
||||
#
|
||||
if( EXISTS "${CMAKE_HOME_DIRECTORY}/components/wolfssl/include/" )
|
||||
message(STATUS "")
|
||||
message(STATUS "Using installed project ./components/wolfssl in CMAKE_HOME_DIRECTORY = $ENV{CMAKE_HOME_DIRECTORY}")
|
||||
message(STATUS "")
|
||||
#
|
||||
# Note we already checked above and confirmed there's not another wolfSSL installed in the ESP-IDF components.
|
||||
#
|
||||
# We won't do anything else here, as it will be assumed the original install completed successfully.
|
||||
#
|
||||
else()
|
||||
#
|
||||
# This is the developer repo mode. wolfSSL will be assume to be not installed to ESP-IDF nor local project
|
||||
# In this configuration, we are likely running a wolfSSL example found directly in the repo.
|
||||
#
|
||||
message(STATUS "")
|
||||
message(STATUS "Using developer repo ./components/wolfssl in CMAKE_HOME_DIRECTORY = $ENV{CMAKE_HOME_DIRECTORY}")
|
||||
message(STATUS "")
|
||||
|
||||
message(STATUS "************************************************************************************************")
|
||||
# When in developer mode, we are typically running wolfSSL examples such as benchmark or test directories.
|
||||
# However, the as-cloned or distributed wolfSSL does not have the ./include/ directory, so we'll add it as needed.
|
||||
#
|
||||
# first check if there's a [root]/include/user_settings.h
|
||||
if( EXISTS "${WOLFSSL_ROOT}/include/user_settings.h" )
|
||||
# we won't overwrite an existing user settings file, just note that we already have one:
|
||||
message(STATUS "Found wolfSSL user_settings.h in ${WOLFSSL_ROOT}/include/user_settings.h")
|
||||
else()
|
||||
message(STATUS "Installing wolfSSL user_settings.h to ${WOLFSSL_ROOT}/include/user_settings.h")
|
||||
file(COPY "${WOLFSSL_ROOT}/IDE/Espressif/ESP-IDF/user_settings.h" DESTINATION "${WOLFSSL_ROOT}/include/")
|
||||
endif() # user_settings.h
|
||||
|
||||
# next check if there's a [root]/include/config.h
|
||||
if( EXISTS "${WOLFSSL_ROOT}/include/config.h" )
|
||||
message(STATUS "Found wolfSSL config.h in ${WOLFSSL_ROOT}/include/config.h")
|
||||
else()
|
||||
message(STATUS "Installing wolfSSL config.h to ${WOLFSSL_ROOT}/include/config.h")
|
||||
file(COPY "${WOLFSSL_ROOT}/IDE/Espressif/ESP-IDF/dummy_config_h" DESTINATION "${WOLFSSL_ROOT}/include/")
|
||||
file(RENAME "${WOLFSSL_ROOT}/include/dummy_config_h" "${WOLFSSL_ROOT}/include/config.h")
|
||||
endif() # config.h
|
||||
message(STATUS "************************************************************************************************")
|
||||
message(STATUS "")
|
||||
endif()
|
||||
|
||||
else()
|
||||
# we did not find a ./components/wolfssl/include/ directory from this pass of cmake.
|
||||
if($WOLFSSL_FOUND_IDF)
|
||||
message(STATUS "")
|
||||
message(STATUS "WARNING: wolfSSL not found.")
|
||||
message(STATUS "")
|
||||
else()
|
||||
# probably needs to be re-parsed by Espressif
|
||||
message(STATUS "wolfSSL found IDF. Project Source:${PROJECT_SOURCE_DIR}")
|
||||
endif() # else we have not found ESP-IDF yet
|
||||
endif() # else not a local wolfSSL component
|
||||
|
||||
endif() #else not an ESP-IDF component
|
||||
endif() # else not local copy and EDP-IDF wolfSSL
|
||||
|
||||
|
||||
# RTOS_IDF_PATH is typically:
|
||||
# "/Users/{username}/Desktop/esp-idf/components/freertos/include/freertos"
|
||||
# depending on the environment, we may need to swap backslashes with forward slashes
|
||||
string(REPLACE "\\" "/" RTOS_IDF_PATH "$ENV{IDF_PATH}/components/freertos/include/freertos")
|
||||
|
||||
# ESP-IDF after version 4.4x has a different RTOS directory structure
|
||||
string(REPLACE "\\" "/" RTOS_IDF_PATH5 "$ENV{IDF_PATH}/components/freertos/FreeRTOS-Kernel/include/freertos")
|
||||
|
||||
if(IS_DIRECTORY ${IDF_PATH}/components/freertos/FreeRTOS-Kernel/)
|
||||
set(COMPONENT_ADD_INCLUDEDIRS
|
||||
"."
|
||||
"${WOLFSSL_ROOT}/include"
|
||||
"${RTOS_IDF_PATH5}"
|
||||
"${WOLFSSL_ROOT}"
|
||||
)
|
||||
# the bash user is not blank, so we'll use it.
|
||||
set(THIS_USER "$ENV{USERNAME}")
|
||||
endif()
|
||||
else()
|
||||
|
||||
set(COMPONENT_ADD_INCLUDEDIRS
|
||||
"."
|
||||
"${WOLFSSL_ROOT}/include"
|
||||
"${RTOS_IDF_PATH}"
|
||||
"${WOLFSSL_ROOT}"
|
||||
)
|
||||
# the bash user is not blank, so we'll use it.
|
||||
set(THIS_USER "$ENV{USER}")
|
||||
endif()
|
||||
message(STATUS "THIS_USER = ${THIS_USER}")
|
||||
|
||||
if(IS_DIRECTORY ${IDF_PATH}/components/cryptoauthlib)
|
||||
list(APPEND COMPONENT_ADD_INCLUDEDIRS "../cryptoauthlib/lib")
|
||||
endif()
|
||||
|
||||
set(COMPONENT_SRCEXCLUDE
|
||||
"${WOLFSSL_ROOT}/src/bio.c"
|
||||
"${WOLFSSL_ROOT}/src/conf.c"
|
||||
"${WOLFSSL_ROOT}/src/misc.c"
|
||||
"${WOLFSSL_ROOT}/src/pk.c"
|
||||
"${WOLFSSL_ROOT}/src/ssl_misc.c" # included by ssl.c
|
||||
"${WOLFSSL_ROOT}/src/x509.c"
|
||||
"${WOLFSSL_ROOT}/src/x509_str.c"
|
||||
"${WOLFSSL_ROOT}/wolfcrypt/src/evp.c"
|
||||
"${WOLFSSL_ROOT}/wolfcrypt/src/misc.c"
|
||||
"${EXCLUDE_ASM}"
|
||||
)
|
||||
# COMPONENT_NAME = wolfssl
|
||||
# The component name is the directory name. "No feature to change this".
|
||||
# See https://github.com/espressif/esp-idf/issues/8978#issuecomment-1129892685
|
||||
|
||||
# set the root of wolfSSL in top-level project CMakelists.txt:
|
||||
# set(WOLFSSL_ROOT "C:/some path/with/spaces")
|
||||
# set(WOLFSSL_ROOT "c:/workspace/wolfssl-[username]")
|
||||
# set(WOLFSSL_ROOT "/mnt/c/some path/with/spaces")
|
||||
# or use this logic to assign value from Environment Variable WOLFSSL_ROOT,
|
||||
# or assume this is an example 7 subdirectories below:
|
||||
|
||||
# We are typically in [root]/IDE/Espressif/ESP-IDF/examples/wolfssl_test/components/wolfssl
|
||||
# The root of wolfSSL is 7 directories up from here:
|
||||
|
||||
# function: IS_WOLFSSL_SOURCE
|
||||
# parameter: DIRECTORY_PARAMETER - the directory to test
|
||||
# output: RESULT = contains contents of DIRECTORY_PARAMETER for wolfssl directory, otherwise blank.
|
||||
function(IS_WOLFSSL_SOURCE DIRECTORY_PARAMETER RESULT)
|
||||
if (EXISTS "${DIRECTORY_PARAMETER}/wolfcrypt/src")
|
||||
set(${RESULT} "${DIRECTORY_PARAMETER}" PARENT_SCOPE)
|
||||
else()
|
||||
set(${RESULT} "" PARENT_SCOPE)
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
# function: FIND_WOLFSSL_DIRECTORY
|
||||
# parameter: OUTPUT_FOUND_WOLFSSL_DIRECTORY contains root of source code, otherwise blank
|
||||
#
|
||||
function(FIND_WOLFSSL_DIRECTORY OUTPUT_FOUND_WOLFSSL_DIRECTORY)
|
||||
message(STATUS "Starting FIND_WOLFSSL_DIRECTORY")
|
||||
set(CURRENT_SEARCH_DIR "$ENV{WOLFSSL_ROOT}")
|
||||
if( "${CURRENT_SEARCH_DIR}" STREQUAL "" )
|
||||
message(STATUS "The WOLFSSL_ROOT environment variable is not set. Searching...")
|
||||
else()
|
||||
get_filename_component(CURRENT_SEARCH_DIR "$ENV{WOLFSSL_ROOT}" ABSOLUTE)
|
||||
IS_WOLFSSL_SOURCE("${CURRENT_SEARCH_DIR}" FOUND_WOLFSSL)
|
||||
if("${FOUND_WOLFSSL}")
|
||||
message(STATUS "Found WOLFSSL_ROOT via Environment Variable:")
|
||||
else()
|
||||
message(FATAL_ERROR "WOLFSSL_ROOT Environment Variable defined, but path not found:")
|
||||
message(STATUS "$ENV{WOLFSSL_ROOT}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# we'll start in the CMAKE_CURRENT_SOURCE_DIR, typically [something]/projectname/components/wolfssl
|
||||
message(STATUS "CMAKE_CURRENT_SOURCE_DIR = ${CMAKE_CURRENT_SOURCE_DIR}")
|
||||
get_filename_component(CURRENT_SEARCH_DIR "${CMAKE_CURRENT_SOURCE_DIR}" ABSOLUTE)
|
||||
message(STATUS "CURRENT_SEARCH_DIR = ${CURRENT_SEARCH_DIR}")
|
||||
string(LENGTH ${CURRENT_SEARCH_DIR} CURRENT_SEARCH_DIR_LENGTH)
|
||||
|
||||
# loop through all the parents, looking for wolfssl
|
||||
while(NOT CURRENT_SEARCH_DIR STREQUAL "/" AND NOT CURRENT_SEARCH_DIR STREQUAL "" )
|
||||
string(LENGTH ${CURRENT_SEARCH_DIR} CURRENT_SEARCH_DIR_LENGTH)
|
||||
# wolfSSL may simply be in a parent directory, such as for local examples in wolfssl repo
|
||||
IS_WOLFSSL_SOURCE("${CURRENT_SEARCH_DIR}" FOUND_WOLFSSL)
|
||||
if( FOUND_WOLFSSL )
|
||||
message(STATUS "Found wolfssl in CURRENT_SEARCH_DIR = ${CURRENT_SEARCH_DIR}")
|
||||
set(${OUTPUT_FOUND_WOLFSSL_DIRECTORY} ${CURRENT_SEARCH_DIR} PARENT_SCOPE)
|
||||
return()
|
||||
endif()
|
||||
|
||||
if( THIS_USER )
|
||||
# Check for "wolfssl-[username]" subdirectory as we recurse up the directory tree
|
||||
set(CURRENT_SEARCH_DIR_ALT ${CURRENT_SEARCH_DIR}/wolfssl-${THIS_USER})
|
||||
message(STATUS "Looking in ${CURRENT_SEARCH_DIR}")
|
||||
|
||||
#if(EXISTS ${CURRENT_SEARCH_DIR_ALT} AND IS_DIRECTORY ${CURRENT_SEARCH_DIR_ALT} AND EXISTS "${CURRENT_SEARCH_DIR_ALT}/wolfcrypt/src")
|
||||
IS_WOLFSSL_SOURCE("${CURRENT_SEARCH_DIR_ALT}" FOUND_WOLFSSL )
|
||||
if ( FOUND_WOLFSSL )
|
||||
message(STATUS "Found wolfssl in user-suffix CURRENT_SEARCH_DIR_ALT = ${CURRENT_SEARCH_DIR_ALT}")
|
||||
set(${OUTPUT_FOUND_WOLFSSL_DIRECTORY} ${CURRENT_SEARCH_DIR_ALT} PARENT_SCOPE)
|
||||
return()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Next check for no user suffix "wolfssl" subdirectory as we recurse up the directory tree
|
||||
set(CURRENT_SEARCH_DIR_ALT ${CURRENT_SEARCH_DIR}/wolfssl)
|
||||
# if(EXISTS ${CURRENT_SEARCH_DIR} AND IS_DIRECTORY ${CURRENT_SEARCH_DIR} AND EXISTS "${CURRENT_SEARCH_DIR}/wolfcrypt/src")
|
||||
IS_WOLFSSL_SOURCE("${CURRENT_SEARCH_DIR_ALT}" FOUND_WOLFSSL )
|
||||
if ( FOUND_WOLFSSL )
|
||||
message(STATUS "Found wolfssl in CURRENT_SEARCH_DIR = ${CURRENT_SEARCH_DIR}")
|
||||
set(${OUTPUT_FOUND_WOLFSSL_DIRECTORY} ${CURRENT_SEARCH_DIR} PARENT_SCOPE)
|
||||
return()
|
||||
endif()
|
||||
|
||||
# Move up one directory level
|
||||
set(PRIOR_SEARCH_DIR "${CURRENT_SEARCH_DIR}")
|
||||
get_filename_component(CURRENT_SEARCH_DIR "${CURRENT_SEARCH_DIR}" DIRECTORY)
|
||||
message(STATUS "Next CURRENT_SEARCH_DIR = ${CURRENT_SEARCH_DIR}")
|
||||
if( "${PRIOR_SEARCH_DIR}" STREQUAL "${CURRENT_SEARCH_DIR}" )
|
||||
# when the search directory is empty, we'll give up
|
||||
set(CURRENT_SEARCH_DIR "")
|
||||
endif()
|
||||
endwhile()
|
||||
|
||||
# If not found, set the output variable to empty before exiting
|
||||
set(${OUTPUT_FOUND_WOLFSSL_DIRECTORY} "" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
|
||||
# Example usage:
|
||||
|
||||
|
||||
|
||||
|
||||
if(CMAKE_BUILD_EARLY_EXPANSION)
|
||||
message(STATUS "wolfssl component CMAKE_BUILD_EARLY_EXPANSION:")
|
||||
idf_component_register(
|
||||
REQUIRES "${COMPONENT_REQUIRES}"
|
||||
PRIV_REQUIRES # esp_hw_support
|
||||
esp_timer
|
||||
driver # this will typically only be needed for wolfSSL benchmark
|
||||
)
|
||||
|
||||
else()
|
||||
# not CMAKE_BUILD_EARLY_EXPANSION
|
||||
message(STATUS "************************************************************************************************")
|
||||
message(STATUS "wolfssl component config:")
|
||||
message(STATUS "************************************************************************************************")
|
||||
|
||||
# search for wolfSSL
|
||||
FIND_WOLFSSL_DIRECTORY(WOLFSSL_ROOT)
|
||||
if(WOLFSSL_ROOT)
|
||||
message(STATUS "NEW Found wolfssl directory at: ${WOLFSSL_ROOT}")
|
||||
else()
|
||||
message(STATUS "NEW wolfssl directory not found.")
|
||||
# Abort. We need wolfssl _somewhere_.
|
||||
message(FATAL_ERROR "Could not find wolfssl in ${WOLFSSL_ROOT}.\n"
|
||||
"Try setting WOLFSSL_ROOT environment variable or git clone.")
|
||||
endif()
|
||||
|
||||
set(INCLUDE_PATH ${WOLFSSL_ROOT})
|
||||
|
||||
set(WOLFSSL_EXTRA_PROJECT_DIR "${WOLFSSL_ROOT}/src/")
|
||||
|
||||
if( ${CMAKE_PROJECT_NAME} STREQUAL "wolfssl_benchmark" )
|
||||
set(WOLFSSL_EXTRA_PROJECT_DIR "${WOLFSSL_ROOT}/wolfcrypt/benchmark")
|
||||
endif()
|
||||
|
||||
if( ${CMAKE_PROJECT_NAME} STREQUAL "wolfssl_test" )
|
||||
set(WOLFSSL_EXTRA_PROJECT_DIR "${WOLFSSL_ROOT}/wolfcrypt/test")
|
||||
endif()
|
||||
|
||||
set(COMPONENT_SRCDIRS "\"${WOLFSSL_ROOT}/src/\""
|
||||
"\"${WOLFSSL_ROOT}/wolfcrypt/src\""
|
||||
"\"${WOLFSSL_ROOT}/wolfcrypt/src/port/Espressif\""
|
||||
"\"${WOLFSSL_ROOT}/wolfcrypt/src/port/atmel\""
|
||||
"\"${WOLFSSL_EXTRA_PROJECT_DIR}\""
|
||||
) # COMPONENT_SRCDIRS
|
||||
|
||||
message(STATUS "This COMPONENT_SRCDIRS = ${COMPONENT_SRCDIRS}")
|
||||
|
||||
set(WOLFSSL_PROJECT_DIR "${CMAKE_HOME_DIRECTORY}/components/wolfssl")
|
||||
add_definitions(-DWOLFSSL_USER_SETTINGS_DIR="${WOLFSSL_PROJECT_DIR}/include/user_settings.h")
|
||||
|
||||
|
||||
# Espressif may take several passes through this makefile. Check to see if we found IDF
|
||||
string(COMPARE EQUAL "${PROJECT_SOURCE_DIR}" "" WOLFSSL_FOUND_IDF)
|
||||
|
||||
# get a list of all wolfcrypt assembly files; we'll exclude them as they don't target Xtensa
|
||||
file(GLOB EXCLUDE_ASM *.S)
|
||||
file(GLOB_RECURSE EXCLUDE_ASM ${CMAKE_SOURCE_DIR} "${WOLFSSL_ROOT}/wolfcrypt/src/*.S")
|
||||
|
||||
message(STATUS "IDF_PATH = $ENV{IDF_PATH}")
|
||||
message(STATUS "PROJECT_SOURCE_DIR = ${PROJECT_SOURCE_DIR}")
|
||||
message(STATUS "EXCLUDE_ASM = ${EXCLUDE_ASM}")
|
||||
|
||||
#
|
||||
# Check to see if there's both a local copy and EDP-IDF copy of the wolfssl and/or wolfssh components.
|
||||
#
|
||||
if( EXISTS "${WOLFSSL_PROJECT_DIR}" AND EXISTS "$ENV{IDF_PATH}/components/wolfssl/" )
|
||||
#
|
||||
# wolfSSL found in both ESP-IDF and local project - needs to be resolved by user
|
||||
#
|
||||
message(STATUS "")
|
||||
message(STATUS "**************************************************************************************")
|
||||
message(STATUS "")
|
||||
message(STATUS "Error: Found components/wolfssl in both local project and IDF_PATH")
|
||||
message(STATUS "")
|
||||
message(STATUS "To proceed: ")
|
||||
message(STATUS "")
|
||||
message(STATUS "Remove either the local project component: ${WOLFSSL_PROJECT_DIR} ")
|
||||
message(STATUS "or the Espressif shared component installed at: $ENV{IDF_PATH}/components/wolfssl/ ")
|
||||
message(STATUS "")
|
||||
message(FATAL_ERROR "Please use wolfSSL in either local project or Espressif components, but not both.")
|
||||
message(STATUS "")
|
||||
message(STATUS "**************************************************************************************")
|
||||
message(STATUS "")
|
||||
|
||||
# Optional: if you change the above FATAL_ERROR to STATUS you can warn at runtime with this macro definition:
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_MULTI_INSTALL_WARNING")
|
||||
|
||||
else()
|
||||
if( EXISTS "$ENV{IDF_PATH}/components/wolfssl/" )
|
||||
#
|
||||
# wolfSSL found in ESP-IDF components and is assumed to be already configured in user_settings.h via setup.
|
||||
#
|
||||
message(STATUS "")
|
||||
message(STATUS "Using components/wolfssl in IDF_PATH = $ENV{IDF_PATH}")
|
||||
message(STATUS "")
|
||||
else()
|
||||
#
|
||||
# wolfSSL is not an ESP-IDF component.
|
||||
# We need to now determine if it is local and if so if it is part of the wolfSSL repo,
|
||||
# or if wolfSSL is simply installed as a local component.
|
||||
#
|
||||
|
||||
if( EXISTS "${WOLFSSL_PROJECT_DIR}" )
|
||||
#
|
||||
# wolfSSL found in local project.
|
||||
#
|
||||
if( EXISTS "${WOLFSSL_PROJECT_DIR}/wolfcrypt/" )
|
||||
message(STATUS "")
|
||||
message(STATUS "Using installed project ./components/wolfssl in CMAKE_HOME_DIRECTORY = ${CMAKE_HOME_DIRECTORY}")
|
||||
message(STATUS "")
|
||||
#
|
||||
# Note we already checked above and confirmed there's not another wolfSSL installed in the ESP-IDF components.
|
||||
#
|
||||
# We won't do anything else here, as it will be assumed the original install completed successfully.
|
||||
#
|
||||
else() # full wolfSSL not installed in local project
|
||||
#
|
||||
# This is the developer repo mode. wolfSSL will be assumed to be not installed to ESP-IDF nor local project
|
||||
# In this configuration, we are likely running a wolfSSL example found directly in the repo.
|
||||
#
|
||||
message(STATUS "")
|
||||
message(STATUS "Using developer repo ./components/wolfssl in CMAKE_HOME_DIRECTORY = ${CMAKE_HOME_DIRECTORY}")
|
||||
message(STATUS "")
|
||||
|
||||
message(STATUS "************************************************************************************************")
|
||||
# When in developer mode, we are typically running wolfSSL examples such as benchmark or test directories.
|
||||
# However, the as-cloned or distributed wolfSSL does not have the ./include/ directory, so we'll add it as needed.
|
||||
#
|
||||
# first check if there's a [root]/include/user_settings.h
|
||||
if( EXISTS "${WOLFSSL_ROOT}/include/user_settings.h" )
|
||||
message(FATAL_ERROR "Found stray wolfSSL user_settings.h in "
|
||||
"${WOLFSSL_ROOT}/include/user_settings.h "
|
||||
" (please move it to ${WOLFSSL_PROJECT_DIR}/include/user_settings.h )")
|
||||
else()
|
||||
# we won't overwrite an existing user settings file, just note that we already have one:
|
||||
if( EXISTS "${WOLFSSL_PROJECT_DIR}/include/user_settings.h" )
|
||||
message(STATUS "Using existing wolfSSL user_settings.h in "
|
||||
"${WOLFSSL_PROJECT_DIR}/include/user_settings.h")
|
||||
else()
|
||||
message(STATUS "Installing wolfSSL user_settings.h to "
|
||||
"${WOLFSSL_PROJECT_DIR}/include/user_settings.h")
|
||||
file(COPY "${WOLFSSL_ROOT}/IDE/Espressif/ESP-IDF/user_settings.h"
|
||||
DESTINATION "${CMAKE_HOME_DIRECTORY}/wolfssl/include/")
|
||||
endif()
|
||||
endif() # user_settings.h
|
||||
|
||||
# next check if there's a [root]/include/config.h
|
||||
if( EXISTS "${WOLFSSL_ROOT}/include/config.h" )
|
||||
message(STATUS "******************************************************************************")
|
||||
message(STATUS "******************************************************************************")
|
||||
message(STATUS "Found stray wolfSSL config.h in ${WOLFSSL_ROOT}/include/config.h" )
|
||||
message(STATUS " Please move it to ${WOLFSSL_PROJECT_DIR}/include/config.h" )
|
||||
message(STATUS "******************************************************************************")
|
||||
message(STATUS "******************************************************************************")
|
||||
else()
|
||||
# we won't overwrite an existing user settings file, just note that we already have one:
|
||||
if( EXISTS "${WOLFSSL_PROJECT_DIR}/include/config.h" )
|
||||
message(STATUS "Using existing wolfSSL config.h ${WOLFSSL_PROJECT_DIR}/include/config.h")
|
||||
else()
|
||||
message(STATUS "Installing wolfSSL config.h to ${WOLFSSL_PROJECT_DIR}/include/config.h")
|
||||
file(COPY "${WOLFSSL_ROOT}/IDE/Espressif/ESP-IDF/dummy_config_h" DESTINATION "${WOLFSSL_PROJECT_DIR}/include/")
|
||||
file(RENAME "${WOLFSSL_PROJECT_DIR}/include/dummy_config_h" "${WOLFSSL_PROJECT_DIR}/include/config.h")
|
||||
endif() # Project config.h
|
||||
endif() # WOLFSSL_ROOT config.h
|
||||
message(STATUS "************************************************************************************************")
|
||||
message(STATUS "")
|
||||
endif()
|
||||
|
||||
else()
|
||||
# we did not find a ./components/wolfssl/include/ directory from this pass of cmake.
|
||||
if($WOLFSSL_FOUND_IDF)
|
||||
message(STATUS "")
|
||||
message(STATUS "WARNING: wolfSSL not found.")
|
||||
message(STATUS "")
|
||||
else()
|
||||
# probably needs to be re-parsed by Espressif
|
||||
message(STATUS "wolfSSL found IDF. Project Source:${PROJECT_SOURCE_DIR}")
|
||||
endif() # else we have not found ESP-IDF yet
|
||||
endif() # else not a local wolfSSL component
|
||||
|
||||
endif() #else not an ESP-IDF component
|
||||
endif() # else not local copy and EDP-IDF wolfSSL
|
||||
|
||||
|
||||
# RTOS_IDF_PATH is typically:
|
||||
# "/Users/{username}/Desktop/esp-idf/components/freertos/include/freertos"
|
||||
# depending on the environment, we may need to swap backslashes with forward slashes
|
||||
string(REPLACE "\\" "/" RTOS_IDF_PATH "$ENV{IDF_PATH}/components/freertos/FreeRTOS-Kernel/include/freertos")
|
||||
|
||||
string(REPLACE "\\" "/" WOLFSSL_ROOT ${WOLFSSL_ROOT})
|
||||
|
||||
if(IS_DIRECTORY "${RTOS_IDF_PATH}")
|
||||
message(STATUS "Found current RTOS path: ${RTOS_IDF_PATH}")
|
||||
else()
|
||||
# ESP-IDF prior version 4.4x has a different RTOS directory structure
|
||||
string(REPLACE "\\" "/" RTOS_IDF_PATH "$ENV{IDF_PATH}/components/freertos/include/freertos")
|
||||
if(IS_DIRECTORY "${RTOS_IDF_PATH}")
|
||||
message(STATUS "Found legacy RTOS path: ${RTOS_IDF_PATH}")
|
||||
else()
|
||||
message(STATUS "Could not find RTOS path")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
||||
set(COMPONENT_ADD_INCLUDEDIRS
|
||||
"./include" # this is the location of wolfssl user_settings.h
|
||||
"\"${WOLFSSL_ROOT}/\""
|
||||
"\"${WOLFSSL_ROOT}/wolfssl/\""
|
||||
"\"${WOLFSSL_ROOT}/wolfssl/wolfcrypt/\""
|
||||
"\"${RTOS_IDF_PATH}/\""
|
||||
)
|
||||
|
||||
|
||||
if(IS_DIRECTORY ${IDF_PATH}/components/cryptoauthlib)
|
||||
list(APPEND COMPONENT_ADD_INCLUDEDIRS "../cryptoauthlib/lib")
|
||||
endif()
|
||||
|
||||
list(APPEND COMPONENT_ADD_INCLUDEDIRS "\"${WOLFSSL_ROOT}/wolfssl/\"")
|
||||
list(APPEND COMPONENT_ADD_INCLUDEDIRS "\"${WOLFSSL_ROOT}/wolfssl/wolfcrypt/\"")
|
||||
|
||||
|
||||
|
||||
set(COMPONENT_SRCEXCLUDE
|
||||
"\"${WOLFSSL_ROOT}/src/bio.c\""
|
||||
"\"${WOLFSSL_ROOT}/src/conf.c\""
|
||||
"\"${WOLFSSL_ROOT}/src/misc.c\""
|
||||
"\"${WOLFSSL_ROOT}/src/pk.c\""
|
||||
"\"${WOLFSSL_ROOT}/src/ssl_asn1.c\"" # included by ssl.c
|
||||
"\"${WOLFSSL_ROOT}/src/ssl_bn.c\"" # included by ssl.c
|
||||
"\"${WOLFSSL_ROOT}/src/ssl_certman.c\"" # included by ssl.c
|
||||
"\"${WOLFSSL_ROOT}/src/ssl_crypto.c\"" # included by ssl.c
|
||||
"\"${WOLFSSL_ROOT}/src/ssl_misc.c\"" # included by ssl.c
|
||||
"\"${WOLFSSL_ROOT}/src/x509.c\""
|
||||
"\"${WOLFSSL_ROOT}/src/x509_str.c\""
|
||||
"\"${WOLFSSL_ROOT}/wolfcrypt/src/evp.c\""
|
||||
"\"${WOLFSSL_ROOT}/wolfcrypt/src/misc.c\""
|
||||
"\"${WOLFSSL_ROOT}/wolfcrypt/src/sp_sm2_arm32.c\""
|
||||
"\"${WOLFSSL_ROOT}/wolfcrypt/src/sp_sm2_arm64.c\""
|
||||
"\"${WOLFSSL_ROOT}/wolfcrypt/src/sp_sm2_armthumb.c\""
|
||||
"\"${WOLFSSL_ROOT}/wolfcrypt/src/sp_sm2_c32.c\""
|
||||
"\"${WOLFSSL_ROOT}/wolfcrypt/src/sp_sm2_c64.c\""
|
||||
"\"${WOLFSSL_ROOT}/wolfcrypt/src/sp_sm2_cortexm.c\""
|
||||
"\"${WOLFSSL_ROOT}/wolfcrypt/src/sp_sm2_x86_64.c\""
|
||||
"\"${WOLFSSL_ROOT}/wolfcrypt/src/sp_sm2_x86_64_asm.S\""
|
||||
"\"${EXCLUDE_ASM}\""
|
||||
)
|
||||
|
||||
spaces2list(COMPONENT_REQUIRES)
|
||||
|
||||
separate_arguments(COMPONENT_SRCDIRS NATIVE_COMMAND "${COMPONENT_SRCDIRS}")
|
||||
separate_arguments(COMPONENT_SRCEXCLUDE NATIVE_COMMAND "${COMPONENT_SRCEXCLUDE}")
|
||||
separate_arguments(COMPONENT_ADD_INCLUDEDIRS NATIVE_COMMAND "${COMPONENT_ADD_INCLUDEDIRS}")
|
||||
|
||||
#
|
||||
# See https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/build-system.html#example-component-requirements
|
||||
#
|
||||
message(STATUS "COMPONENT_SRCDIRS = ${COMPONENT_SRCDIRS}")
|
||||
message(STATUS "COMPONENT_ADD_INCLUDEDIRS = ${COMPONENT_ADD_INCLUDEDIRS}")
|
||||
message(STATUS "COMPONENT_REQUIRES = ${COMPONENT_REQUIRES}")
|
||||
message(STATUS "COMPONENT_SRCEXCLUDE = ${COMPONENT_SRCEXCLUDE}")
|
||||
|
||||
#
|
||||
# see https://docs.espressif.com/projects/esp-idf/en/stable/esp32/migration-guides/release-5.x/build-system.html?highlight=space%20path
|
||||
#
|
||||
set(EXTRA_COMPONENT_DIRS "${COMPONENT_SRCDIRS}")
|
||||
idf_component_register(
|
||||
SRC_DIRS "${COMPONENT_SRCDIRS}"
|
||||
INCLUDE_DIRS "${COMPONENT_ADD_INCLUDEDIRS}"
|
||||
REQUIRES "${COMPONENT_REQUIRES}"
|
||||
EXCLUDE_SRCS "${COMPONENT_SRCEXCLUDE}"
|
||||
PRIV_REQUIRES esp_timer driver # this will typically only be needed for wolfSSL benchmark
|
||||
)
|
||||
# some optional diagnostics
|
||||
if (1)
|
||||
get_cmake_property(_variableNames VARIABLES)
|
||||
list (SORT _variableNames)
|
||||
message(STATUS "")
|
||||
message(STATUS "ALL VARIABLES BEGIN")
|
||||
message(STATUS "")
|
||||
foreach (_variableName ${_variableNames})
|
||||
message(STATUS "${_variableName}=${${_variableName}}")
|
||||
endforeach()
|
||||
message(STATUS "")
|
||||
message(STATUS "ALL VARIABLES END")
|
||||
message(STATUS "")
|
||||
endif()
|
||||
|
||||
# target_sources(wolfssl PRIVATE "\"${WOLFSSL_ROOT}/wolfssl/\"" "\"${WOLFSSL_ROOT}/wolfssl/wolfcrypt\"")
|
||||
|
||||
endif() # CMAKE_BUILD_EARLY_EXPANSION
|
||||
|
||||
register_component()
|
||||
|
||||
# some optional diagnostics
|
||||
if (0)
|
||||
get_cmake_property(_variableNames VARIABLES)
|
||||
list (SORT _variableNames)
|
||||
message(STATUS "")
|
||||
message(STATUS "ALL VARIABLES BEGIN")
|
||||
message(STATUS "")
|
||||
foreach (_variableName ${_variableNames})
|
||||
message(STATUS "${_variableName}=${${_variableName}}")
|
||||
endforeach()
|
||||
message(STATUS "")
|
||||
message(STATUS "ALL VARIABLES END")
|
||||
message(STATUS "")
|
||||
endif()
|
||||
|
||||
# check to see if there's both a local copy and EDP-IDF copy of the wolfssl components
|
||||
if( EXISTS "${CMAKE_HOME_DIRECTORY}/components/wolfssl/" AND EXISTS "$ENV{IDF_PATH}/components/wolfssl/" )
|
||||
if( EXISTS "${WOLFSSL_PROJECT_DIR}" AND EXISTS "$ENV{IDF_PATH}/components/wolfssl/" )
|
||||
message(STATUS "")
|
||||
message(STATUS "")
|
||||
message(STATUS "********************************************************************")
|
||||
@@ -227,3 +456,69 @@ endif()
|
||||
# end multiple component check
|
||||
|
||||
|
||||
#
|
||||
# LIBWOLFSSL_SAVE_INFO(VAR_OUPUT THIS_VAR VAR_RESULT)
|
||||
#
|
||||
# Save the THIS_VAR as a string in a macro called VAR_OUPUT
|
||||
#
|
||||
# VAR_OUPUT: the name of the macro to define
|
||||
# THIS_VAR: the OUTPUT_VARIABLE result from a execute_process()
|
||||
# VAR_RESULT: the RESULT_VARIABLE from a execute_process(); "0" if successful.
|
||||
#
|
||||
function ( LIBWOLFSSL_SAVE_INFO VAR_OUPUT THIS_VAR VAR_RESULT )
|
||||
# is the RESULT_VARIABLE output value 0? If so, IS_VALID_VALUE is true.
|
||||
string(COMPARE EQUAL "${VAR_RESULT}" "0" IS_VALID_VALUE)
|
||||
|
||||
# if we had a successful operation, save the THIS_VAR in VAR_OUPUT
|
||||
if(${IS_VALID_VALUE})
|
||||
# strip newline chars in THIS_VAR parameter and save in VAR_VALUE
|
||||
string(REPLACE "\n" "" VAR_VALUE ${THIS_VAR})
|
||||
|
||||
# we'll could percolate the value to the parent for possible later use
|
||||
# set(${VAR_OUPUT} ${VAR_VALUE} PARENT_SCOPE)
|
||||
|
||||
# but we're only using it here in this function
|
||||
set(${VAR_OUPUT} ${VAR_VALUE})
|
||||
|
||||
# we'll print what we found to the console
|
||||
message(STATUS "Found ${VAR_OUPUT}=${VAR_VALUE}")
|
||||
|
||||
# the interesting part is defining the VAR_OUPUT name a value to use in the app
|
||||
add_definitions(-D${VAR_OUPUT}=\"${VAR_VALUE}\")
|
||||
else()
|
||||
# if we get here, check the execute_process command and parameters.
|
||||
message(STATUS "LIBWOLFSSL_SAVE_INFO encountered a non-zero VAR_RESULT")
|
||||
set(${VAR_OUPUT} "Unknown")
|
||||
endif()
|
||||
endfunction() # LIBWOLFSSL_SAVE_INFO
|
||||
|
||||
# create some programmatic #define values that will be used by ShowExtendedSystemInfo().
|
||||
# see wolfcrypt\src\port\Espressif\esp32_utl.c
|
||||
if(NOT CMAKE_BUILD_EARLY_EXPANSION)
|
||||
set (git_cmd "git")
|
||||
message(STATUS "Adding macro definitions:")
|
||||
|
||||
# LIBWOLFSSL_VERSION_GIT_ORIGIN: git config --get remote.origin.url
|
||||
execute_process(WORKING_DIRECTORY ${WOLFSSL_ROOT} COMMAND ${git_cmd} "config" "--get" "remote.origin.url" OUTPUT_VARIABLE TMP_OUT RESULT_VARIABLE TMP_RES ERROR_QUIET )
|
||||
LIBWOLFSSL_SAVE_INFO(LIBWOLFSSL_VERSION_GIT_ORIGIN "${TMP_OUT}" "${TMP_RES}")
|
||||
|
||||
# LIBWOLFSSL_VERSION_GIT_BRANCH: git rev-parse --abbrev-ref HEAD
|
||||
execute_process(WORKING_DIRECTORY ${WOLFSSL_ROOT} COMMAND ${git_cmd} "rev-parse" "--abbrev-ref" "HEAD" OUTPUT_VARIABLE TMP_OUT RESULT_VARIABLE TMP_RES ERROR_QUIET )
|
||||
LIBWOLFSSL_SAVE_INFO(LIBWOLFSSL_VERSION_GIT_BRANCH "${TMP_OUT}" "${TMP_RES}")
|
||||
|
||||
# LIBWOLFSSL_VERSION_GIT_HASH: git rev-parse HEAD
|
||||
execute_process(WORKING_DIRECTORY ${WOLFSSL_ROOT} COMMAND ${git_cmd} "rev-parse" "HEAD" OUTPUT_VARIABLE TMP_OUT RESULT_VARIABLE TMP_RES ERROR_QUIET )
|
||||
LIBWOLFSSL_SAVE_INFO(LIBWOLFSSL_VERSION_GIT_HASH "${TMP_OUT}" "${TMP_RES}")
|
||||
|
||||
# LIBWOLFSSL_VERSION_GIT_SHORT_HASH: git rev-parse --short HEAD
|
||||
execute_process(WORKING_DIRECTORY ${WOLFSSL_ROOT} COMMAND ${git_cmd} "rev-parse" "--short" "HEAD" OUTPUT_VARIABLE TMP_OUT RESULT_VARIABLE TMP_RES ERROR_QUIET )
|
||||
LIBWOLFSSL_SAVE_INFO(LIBWOLFSSL_VERSION_GIT_SHORT_HASH "${TMP_OUT}" "${TMP_RES}")
|
||||
|
||||
# LIBWOLFSSL_VERSION_GIT_HASH_DATE git show --no-patch --no-notes --pretty=\'\%cd\'
|
||||
execute_process(WORKING_DIRECTORY ${WOLFSSL_ROOT} COMMAND ${git_cmd} "show" "--no-patch" "--no-notes" "--pretty=\'\%cd\'" OUTPUT_VARIABLE TMP_OUT RESULT_VARIABLE TMP_RES )
|
||||
LIBWOLFSSL_SAVE_INFO(LIBWOLFSSL_VERSION_GIT_HASH_DATE "${TMP_OUT}" "${TMP_RES}")
|
||||
|
||||
message(STATUS "************************************************************************************************")
|
||||
message(STATUS "wolfssl component config complete!")
|
||||
message(STATUS "************************************************************************************************")
|
||||
endif()
|
||||
|
||||
@@ -0,0 +1,427 @@
|
||||
/* user_settings.h
|
||||
*
|
||||
* Copyright (C) 2006-2023 wolfSSL Inc.
|
||||
*
|
||||
* This file is part of wolfSSL.
|
||||
*
|
||||
* wolfSSL is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* wolfSSL is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
|
||||
*/
|
||||
|
||||
/* This user_settings.h is for Espressif ESP-IDF */
|
||||
#include <sdkconfig.h>
|
||||
|
||||
/* The Espressif sdkconfig will have chipset info.
|
||||
**
|
||||
** Possible values:
|
||||
**
|
||||
** CONFIG_IDF_TARGET_ESP32
|
||||
** CONFIG_IDF_TARGET_ESP32S2
|
||||
** CONFIG_IDF_TARGET_ESP32S3
|
||||
** CONFIG_IDF_TARGET_ESP32C3
|
||||
** CONFIG_IDF_TARGET_ESP32C6
|
||||
*/
|
||||
|
||||
#undef WOLFSSL_ESPIDF
|
||||
#define WOLFSSL_ESPIDF
|
||||
|
||||
/*
|
||||
* choose ONE of these Espressif chips to define:
|
||||
*
|
||||
* WOLFSSL_ESP32
|
||||
* WOLFSSL_ESPWROOM32SE
|
||||
* WOLFSSL_ESP8266
|
||||
*/
|
||||
#undef WOLFSSL_ESPWROOM32SE
|
||||
#undef WOLFSSL_ESP8266
|
||||
#undef WOLFSSL_ESP32
|
||||
|
||||
#define WOLFSSL_ESP32
|
||||
|
||||
/* optionally turn off SHA512/224 SHA512/256 */
|
||||
/* #define WOLFSSL_NOSHA512_224 */
|
||||
/* #define WOLFSSL_NOSHA512_256 */
|
||||
|
||||
/* when you want to use SINGLE THREAD. Note Default ESP-IDF is FreeRTOS */
|
||||
/* #define SINGLE_THREADED */
|
||||
|
||||
/* When you don't want to use the old SHA */
|
||||
/* #define NO_SHA */
|
||||
/* #define NO_OLD_TLS */
|
||||
|
||||
#define BENCH_EMBEDDED
|
||||
#define USE_CERT_BUFFERS_2048
|
||||
|
||||
/* TLS 1.3 */
|
||||
#define WOLFSSL_TLS13
|
||||
#define HAVE_TLS_EXTENSIONS
|
||||
#define WC_RSA_PSS
|
||||
#define HAVE_HKDF
|
||||
#define HAVE_AEAD
|
||||
#define HAVE_SUPPORTED_CURVES
|
||||
|
||||
#define WOLFSSL_BENCHMARK_FIXED_UNITS_KB
|
||||
|
||||
#define NO_FILESYSTEM
|
||||
|
||||
#define NO_OLD_TLS
|
||||
|
||||
#define HAVE_AESGCM
|
||||
|
||||
#define WOLFSSL_RIPEMD
|
||||
/* when you want to use SHA224 */
|
||||
#define WOLFSSL_SHA224
|
||||
|
||||
/* when you want to use SHA384 */
|
||||
#define WOLFSSL_SHA384
|
||||
|
||||
/* when you want to use SHA512 */
|
||||
#define WOLFSSL_SHA512
|
||||
|
||||
/* when you want to use SHA3 */
|
||||
#define WOLFSSL_SHA3
|
||||
|
||||
#define HAVE_ED25519 /* ED25519 requires SHA512 */
|
||||
|
||||
#define HAVE_ECC
|
||||
#define HAVE_CURVE25519
|
||||
#define CURVE25519_SMALL
|
||||
#define HAVE_ED25519
|
||||
|
||||
#define OPENSSL_EXTRA
|
||||
/* when you want to use pkcs7 */
|
||||
/* #define HAVE_PKCS7 */
|
||||
|
||||
#define HAVE_PKCS7
|
||||
|
||||
#if defined(HAVE_PKCS7)
|
||||
#define HAVE_AES_KEYWRAP
|
||||
#define HAVE_X963_KDF
|
||||
#define WOLFSSL_AES_DIRECT
|
||||
#endif
|
||||
|
||||
/* when you want to use aes counter mode */
|
||||
/* #define WOLFSSL_AES_DIRECT */
|
||||
/* #define WOLFSSL_AES_COUNTER */
|
||||
|
||||
/* esp32-wroom-32se specific definition */
|
||||
#if defined(WOLFSSL_ESPWROOM32SE)
|
||||
#define WOLFSSL_ATECC508A
|
||||
#define HAVE_PK_CALLBACKS
|
||||
/* when you want to use a custom slot allocation for ATECC608A */
|
||||
/* unless your configuration is unusual, you can use default */
|
||||
/* implementation. */
|
||||
/* #define CUSTOM_SLOT_ALLOCATION */
|
||||
#endif
|
||||
|
||||
/* rsa primitive specific definition */
|
||||
#if defined(WOLFSSL_ESP32) || defined(WOLFSSL_ESPWROOM32SE)
|
||||
/* Define USE_FAST_MATH and SMALL_STACK */
|
||||
#define ESP32_USE_RSA_PRIMITIVE
|
||||
|
||||
#if defined(CONFIG_IDF_TARGET_ESP32)
|
||||
|
||||
/* NOTE HW unreliable for small values! */
|
||||
/* threshold for performance adjustment for HW primitive use */
|
||||
/* X bits of G^X mod P greater than */
|
||||
#undef ESP_RSA_EXPT_XBITS
|
||||
#define ESP_RSA_EXPT_XBITS 32
|
||||
|
||||
/* X and Y of X * Y mod P greater than */
|
||||
#undef ESP_RSA_MULM_BITS
|
||||
#define ESP_RSA_MULM_BITS 16
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define RSA_LOW_MEM
|
||||
|
||||
/* #define WOLFSSL_ATECC508A_DEBUG */
|
||||
|
||||
/* date/time */
|
||||
/* if it cannot adjust time in the device, */
|
||||
/* enable macro below */
|
||||
/* #define NO_ASN_TIME */
|
||||
/* #define XTIME time */
|
||||
|
||||
|
||||
/* adjust wait-timeout count if you see timeout in RSA HW acceleration */
|
||||
#define ESP_RSA_TIMEOUT_CNT 0x249F00
|
||||
|
||||
#define HASH_SIZE_LIMIT /* for test.c */
|
||||
|
||||
/* USE_FAST_MATH is default */
|
||||
#define USE_FAST_MATH
|
||||
|
||||
/***** Use SP_MATH *****/
|
||||
/* #undef USE_FAST_MATH */
|
||||
/* #define SP_MATH */
|
||||
/* #define WOLFSSL_SP_MATH_ALL */
|
||||
|
||||
/***** Use Integer Heap Math *****/
|
||||
/* #undef USE_FAST_MATH */
|
||||
/* #define USE_INTEGER_HEAP_MATH */
|
||||
|
||||
|
||||
#define WOLFSSL_SMALL_STACK
|
||||
|
||||
|
||||
#define HAVE_VERSION_EXTENDED_INFO
|
||||
/* #define HAVE_WC_INTROSPECTION */
|
||||
|
||||
#define HAVE_SESSION_TICKET
|
||||
|
||||
/* #define HAVE_HASHDRBG */
|
||||
|
||||
#define WOLFSSL_KEY_GEN
|
||||
#define WOLFSSL_CERT_REQ
|
||||
#define WOLFSSL_CERT_GEN
|
||||
#define WOLFSSL_CERT_EXT
|
||||
#define WOLFSSL_SYS_CA_CERTS
|
||||
|
||||
|
||||
#define WOLFSSL_CERT_TEXT
|
||||
|
||||
#define WOLFSSL_ASN_TEMPLATE
|
||||
|
||||
/*
|
||||
#undef WOLFSSL_KEY_GEN
|
||||
#undef WOLFSSL_CERT_REQ
|
||||
#undef WOLFSSL_CERT_GEN
|
||||
#undef WOLFSSL_CERT_EXT
|
||||
#undef WOLFSSL_SYS_CA_CERTS
|
||||
*/
|
||||
|
||||
/*
|
||||
--enable-keygen
|
||||
--enable-certgen
|
||||
--enable-certreq
|
||||
--enable-certext
|
||||
--enable-asn-template
|
||||
*/
|
||||
|
||||
/* Default is HW enabled unless turned off.
|
||||
** Uncomment these lines to force SW instead of HW acceleration */
|
||||
|
||||
#if defined(CONFIG_IDF_TARGET_ESP32)
|
||||
/* wolfSSL HW Acceleration supported on ESP32. Uncomment to disable: */
|
||||
/* #define NO_ESP32_CRYPT */
|
||||
/* #define NO_WOLFSSL_ESP32_CRYPT_HASH */
|
||||
/* #define NO_WOLFSSL_ESP32_CRYPT_AES */
|
||||
/* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI */
|
||||
/* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_MP_MUL */
|
||||
/* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_MULMOD */
|
||||
/* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_EXPTMOD */
|
||||
|
||||
/* These are defined automatically in esp32-crypt.h, here for clarity: */
|
||||
#define NO_WOLFSSL_ESP32_CRYPT_HASH_SHA224 /* no SHA224 HW on ESP32 */
|
||||
|
||||
#undef ESP_RSA_MULM_BITS
|
||||
#define ESP_RSA_MULM_BITS 16 /* TODO add compile-time warning */
|
||||
/***** END CONFIG_IDF_TARGET_ESP32 *****/
|
||||
|
||||
#elif defined(CONFIG_IDF_TARGET_ESP32S2)
|
||||
/* wolfSSL HW Acceleration supported on ESP32-S2. Uncomment to disable: */
|
||||
/* #define NO_ESP32_CRYPT */
|
||||
/* #define NO_WOLFSSL_ESP32_CRYPT_HASH */
|
||||
/* Note: There's no AES192 HW on the ESP32-S2; falls back to SW */
|
||||
/* #define NO_WOLFSSL_ESP32_CRYPT_AES */
|
||||
/* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI */
|
||||
/* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_MP_MUL */
|
||||
/* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_MULMOD */
|
||||
/* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_EXPTMOD */
|
||||
/***** END CONFIG_IDF_TARGET_ESP32S2 *****/
|
||||
|
||||
#elif defined(CONFIG_IDF_TARGET_ESP32S3)
|
||||
/* wolfSSL HW Acceleration supported on ESP32-S3. Uncomment to disable: */
|
||||
/* #define NO_ESP32_CRYPT */
|
||||
/* #define NO_WOLFSSL_ESP32_CRYPT_HASH */
|
||||
/* Note: There's no AES192 HW on the ESP32-S3; falls back to SW */
|
||||
/* #define NO_WOLFSSL_ESP32_CRYPT_AES */
|
||||
/* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI */
|
||||
/* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_MP_MUL */
|
||||
/* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_MULMOD */
|
||||
/* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_EXPTMOD */
|
||||
/***** END CONFIG_IDF_TARGET_ESP32S3 *****/
|
||||
|
||||
#elif defined(CONFIG_IDF_TARGET_ESP32C2) || \
|
||||
defined(CONFIG_IDF_TARGET_ESP8684)
|
||||
/* ESP8684 is essentially ESP32-C2 chip + flash embedded together in a
|
||||
* single QFN 4x4 mm package. Out of released documentation, Technical
|
||||
* Reference Manual as well as ESP-IDF Programming Guide is applicable
|
||||
* to both ESP32-C2 and ESP8684.
|
||||
*
|
||||
* See: https://www.esp32.com/viewtopic.php?f=5&t=27926#:~:text=ESP8684%20is%20essentially%20ESP32%2DC2,both%20ESP32%2DC2%20and%20ESP8684. */
|
||||
|
||||
/* wolfSSL HW Acceleration supported on ESP32-C2. Uncomment to disable: */
|
||||
/* #define NO_ESP32_CRYPT */
|
||||
/* #define NO_WOLFSSL_ESP32_CRYPT_HASH */ /* to disable all SHA HW */
|
||||
|
||||
/* These are defined automatically in esp32-crypt.h, here for clarity */
|
||||
#define NO_WOLFSSL_ESP32_CRYPT_HASH_SHA384 /* no SHA384 HW on C2 */
|
||||
#define NO_WOLFSSL_ESP32_CRYPT_HASH_SHA512 /* no SHA512 HW on C2 */
|
||||
|
||||
/* There's no AES or RSA/Math accelerator on the ESP32-C2
|
||||
* Auto defined with NO_WOLFSSL_ESP32_CRYPT_RSA_PRI, for clarity: */
|
||||
#define NO_WOLFSSL_ESP32_CRYPT_AES
|
||||
#define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI
|
||||
#define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_MP_MUL
|
||||
#define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_MULMOD
|
||||
#define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_EXPTMOD
|
||||
/***** END CONFIG_IDF_TARGET_ESP32C2 *****/
|
||||
|
||||
#elif defined(CONFIG_IDF_TARGET_ESP32C3)
|
||||
/* wolfSSL HW Acceleration supported on ESP32-C3. Uncomment to disable: */
|
||||
|
||||
/* #define NO_ESP32_CRYPT */
|
||||
/* #define NO_WOLFSSL_ESP32_CRYPT_HASH */ /* to disable all SHA HW */
|
||||
|
||||
/* These are defined automatically in esp32-crypt.h, here for clarity: */
|
||||
#define NO_WOLFSSL_ESP32_CRYPT_HASH_SHA384 /* no SHA384 HW on C6 */
|
||||
#define NO_WOLFSSL_ESP32_CRYPT_HASH_SHA512 /* no SHA512 HW on C6 */
|
||||
|
||||
/* #define NO_WOLFSSL_ESP32_CRYPT_AES */
|
||||
/* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI */
|
||||
/* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_MP_MUL */
|
||||
/* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_MULMOD */
|
||||
/* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_EXPTMOD */
|
||||
/***** END CONFIG_IDF_TARGET_ESP32C3 *****/
|
||||
|
||||
#elif defined(CONFIG_IDF_TARGET_ESP32C6)
|
||||
/* wolfSSL HW Acceleration supported on ESP32-C6. Uncomment to disable: */
|
||||
|
||||
/* #define NO_ESP32_CRYPT */
|
||||
/* #define NO_WOLFSSL_ESP32_CRYPT_HASH */
|
||||
/* These are defined automatically in esp32-crypt.h, here for clarity: */
|
||||
#define NO_WOLFSSL_ESP32_CRYPT_HASH_SHA384 /* no SHA384 HW on C6 */
|
||||
#define NO_WOLFSSL_ESP32_CRYPT_HASH_SHA512 /* no SHA512 HW on C6 */
|
||||
|
||||
/* #define NO_WOLFSSL_ESP32_CRYPT_AES */
|
||||
/* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI */
|
||||
/* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_MP_MUL */
|
||||
/* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_MULMOD */
|
||||
/* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_EXPTMOD */
|
||||
/***** END CONFIG_IDF_TARGET_ESP32C6 *****/
|
||||
|
||||
#elif defined(CONFIG_IDF_TARGET_ESP32H2)
|
||||
/* wolfSSL Hardware Acceleration not yet implemented */
|
||||
#define NO_ESP32_CRYPT
|
||||
#define NO_WOLFSSL_ESP32_CRYPT_HASH
|
||||
#define NO_WOLFSSL_ESP32_CRYPT_AES
|
||||
#define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI
|
||||
/***** END CONFIG_IDF_TARGET_ESP32H2 *****/
|
||||
|
||||
#elif defined(CONFIG_IDF_TARGET_ESP8266)
|
||||
/* TODO: Revisit ESP8266 */
|
||||
#define NO_ESP32_CRYPT
|
||||
#define NO_WOLFSSL_ESP32_CRYPT_HASH
|
||||
#define NO_WOLFSSL_ESP32_CRYPT_AES
|
||||
#define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI
|
||||
/***** END CONFIG_IDF_TARGET_ESP266 *****/
|
||||
|
||||
#else
|
||||
/* Anything else encountered, disable HW accleration */
|
||||
#define NO_ESP32_CRYPT
|
||||
#define NO_WOLFSSL_ESP32_CRYPT_HASH
|
||||
#define NO_WOLFSSL_ESP32_CRYPT_AES
|
||||
#define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI
|
||||
#endif /* CONFIG_IDF_TARGET Check */
|
||||
|
||||
/* Debug options:
|
||||
|
||||
#define ESP_VERIFY_MEMBLOCK
|
||||
#define DEBUG_WOLFSSL
|
||||
#define DEBUG_WOLFSSL_VERBOSE
|
||||
#define DEBUG_WOLFSSL_SHA_MUTEX
|
||||
#define WOLFSSL_ESP32_CRYPT_DEBUG
|
||||
#define WOLFSSL_ESP32_CRYPT_HASH_SHA224_DEBUG
|
||||
#define NO_RECOVER_SOFTWARE_CALC
|
||||
#define WOLFSSL_TEST_STRAY 1
|
||||
#define USE_ESP_DPORT_ACCESS_READ_BUFFER
|
||||
#define WOLFSSL_ESP32_HW_LOCK_DEBUG
|
||||
#define WOLFSSL_DEBUG_ESP_RSA_MULM_BITS
|
||||
#define ESP_DISABLE_HW_TASK_LOCK
|
||||
*/
|
||||
|
||||
#define WOLFSSL_ESPIDF_ERROR_PAUSE /* Pause in a loop rather than exit. */
|
||||
#define WOLFSSL_HW_METRICS
|
||||
|
||||
/* #define HASH_SIZE_LIMIT */ /* for test.c */
|
||||
|
||||
/* #define NO_HW_MATH_TEST */ /* Optionall turn off HW math checks */
|
||||
|
||||
/* Optionally include alternate HW test library: alt_hw_test.h */
|
||||
/* When enabling, the ./components/wolfssl/CMakeLists.txt file
|
||||
* will need the name of the library in the idf_component_register
|
||||
* for the PRIV_REQUIRES list. */
|
||||
/* #define INCLUDE_ALT_HW_TEST */
|
||||
|
||||
/* optionally turn off individual math HW acceleration features */
|
||||
|
||||
/* Turn off Large Number ESP32 HW Multiplication:
|
||||
** [Z = X * Y] in esp_mp_mul() */
|
||||
/* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_MP_MUL */
|
||||
|
||||
/* Turn off Large Number ESP32 HW Modular Exponentiation:
|
||||
** [Z = X^Y mod M] in esp_mp_exptmod() */
|
||||
/* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_EXPTMOD */
|
||||
|
||||
/* Turn off Large Number ESP32 HW Modular Multiplication
|
||||
** [Z = X * Y mod M] in esp_mp_mulmod() */
|
||||
/* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_MULMOD */
|
||||
|
||||
|
||||
#define WOLFSSL_PUBLIC_MP /* used by benchmark */
|
||||
#define USE_CERT_BUFFERS_2048
|
||||
|
||||
/* when turning on ECC508 / ECC608 support
|
||||
#define WOLFSSL_ESPWROOM32SE
|
||||
#define HAVE_PK_CALLBACKS
|
||||
#define WOLFSSL_ATECC508A
|
||||
#define ATCA_WOLFSSL
|
||||
*/
|
||||
|
||||
/* optional SM4 Ciphers. See https://github.com/wolfSSL/wolfsm
|
||||
#define WOLFSSL_SM2
|
||||
#define WOLFSSL_SM3
|
||||
#define WOLFSSL_SM4
|
||||
*/
|
||||
|
||||
#if defined(WOLFSSL_SM2) || defined(WOLFSSL_SM3) || defined(WOLFSSL_SM4)
|
||||
#include <wolfssl/certs_test_sm.h>
|
||||
#define CTX_CA_CERT root_sm2
|
||||
#define CTX_CA_CERT_SIZE sizeof_root_sm2
|
||||
#define CTX_CA_CERT_TYPE WOLFSSL_FILETYPE_PEM
|
||||
#define CTX_SERVER_CERT server_sm2
|
||||
#define CTX_SERVER_CERT_SIZE sizeof_server_sm2
|
||||
#define CTX_SERVER_CERT_TYPE WOLFSSL_FILETYPE_PEM
|
||||
#define CTX_SERVER_KEY server_sm2_priv
|
||||
#define CTX_SERVER_KEY_SIZE sizeof_server_sm2_priv
|
||||
#define CTX_SERVER_KEY_TYPE WOLFSSL_FILETYPE_PEM
|
||||
|
||||
#undef WOLFSSL_BASE16
|
||||
#define WOLFSSL_BASE16
|
||||
#else
|
||||
#define USE_CERT_BUFFERS_2048
|
||||
#define USE_CERT_BUFFERS_256
|
||||
#define CTX_CA_CERT ca_cert_der_2048
|
||||
#define CTX_CA_CERT_SIZE sizeof_ca_cert_der_2048
|
||||
#define CTX_CA_CERT_TYPE WOLFSSL_FILETYPE_ASN1
|
||||
#define CTX_SERVER_CERT server_cert_der_2048
|
||||
#define CTX_SERVER_CERT_SIZE sizeof_server_cert_der_2048
|
||||
#define CTX_SERVER_CERT_TYPE WOLFSSL_FILETYPE_ASN1
|
||||
#define CTX_SERVER_KEY server_key_der_2048
|
||||
#define CTX_SERVER_KEY_SIZE sizeof_server_key_der_2048
|
||||
#define CTX_SERVER_KEY_TYPE WOLFSSL_FILETYPE_ASN1
|
||||
#endif
|
||||
@@ -1,12 +1,36 @@
|
||||
|
||||
# wolfSSL Espressif Example Project/main CMakeLists.txt
|
||||
# v1.0
|
||||
#
|
||||
# wolfssl client test
|
||||
#
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_USER_SETTINGS")
|
||||
|
||||
set(COMPONENT_SRCS "client-tls.c" "wifi_connect.c")
|
||||
set(COMPONENT_ADD_INCLUDEDIRS "." "./include")
|
||||
|
||||
if(WIN32)
|
||||
# Windows-specific configuration here
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_CMAKE_SYSTEM_NAME_WINDOWS")
|
||||
message("Detected Windows")
|
||||
endif()
|
||||
if(CMAKE_HOST_UNIX)
|
||||
message("Detected UNIX")
|
||||
endif()
|
||||
if(APPLE)
|
||||
message("Detected APPLE")
|
||||
endif()
|
||||
if(CMAKE_HOST_UNIX AND (NOT APPLE) AND EXISTS "/proc/sys/fs/binfmt_misc/WSLInterop")
|
||||
# Windows-specific configuration here
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_CMAKE_SYSTEM_NAME_WSL")
|
||||
message("Detected WSL")
|
||||
endif()
|
||||
if(CMAKE_HOST_UNIX AND (NOT APPLE) AND (NOT WIN32))
|
||||
# Windows-specific configuration here
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_CMAKE_SYSTEM_NAME_LINUX")
|
||||
message("Detected Linux")
|
||||
endif()
|
||||
if(APPLE)
|
||||
# Windows-specific configuration here
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_CMAKE_SYSTEM_NAME_APPLE")
|
||||
message("Detected Apple")
|
||||
endif()
|
||||
set (git_cmd "git")
|
||||
|
||||
if( EXISTS "${CMAKE_HOME_DIRECTORY}/components/wolfssl/" AND EXISTS "$ENV{IDF_PATH}/components/wolfssl/" )
|
||||
@@ -19,7 +43,14 @@ if( EXISTS "${CMAKE_HOME_DIRECTORY}/components/wolfssl/" AND EXISTS "$ENV{IDF_PA
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_MULTI_INSTALL_WARNING")
|
||||
endif()
|
||||
|
||||
register_component()
|
||||
## register_component()
|
||||
idf_component_register(SRCS main.c
|
||||
wifi_connect.c
|
||||
time_helper.c
|
||||
client-tls.c
|
||||
INCLUDE_DIRS "."
|
||||
"./include")
|
||||
#
|
||||
|
||||
#
|
||||
# LIBWOLFSSL_SAVE_INFO(VAR_OUPUT THIS_VAR VAR_RESULT)
|
||||
|
||||
@@ -1,9 +1,15 @@
|
||||
menu "Example Configuration"
|
||||
|
||||
config TARGET_HOST
|
||||
config WOLFSSL_TARGET_HOST
|
||||
string "Target host"
|
||||
default "127.0.01.1"
|
||||
default "127.0.0.1"
|
||||
help
|
||||
host address for the example to connect
|
||||
|
||||
|
||||
config WOLFSSL_TARGET_PORT
|
||||
int "Target port"
|
||||
default 11111
|
||||
help
|
||||
host port for the example to connect
|
||||
|
||||
endmenu
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* client-tls-callback.c
|
||||
/* client-tls.c
|
||||
*
|
||||
* Copyright (C) 2006-2023 wolfSSL Inc.
|
||||
*
|
||||
@@ -18,40 +18,108 @@
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
|
||||
*/
|
||||
/* the usual suspects */
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
|
||||
/* ESP specific */
|
||||
#include "wifi_connect.h"
|
||||
#include "client-tls.h"
|
||||
|
||||
/* Espressif FreeRTOS */
|
||||
#ifndef SINGLE_THREADED
|
||||
#include <freertos/FreeRTOS.h>
|
||||
#include <freertos/task.h>
|
||||
#include <freertos/event_groups.h>
|
||||
#endif
|
||||
|
||||
/* socket includes */
|
||||
#include "lwip/netdb.h"
|
||||
#include "lwip/sockets.h"
|
||||
#include <lwip/netdb.h>
|
||||
#include <lwip/sockets.h>
|
||||
|
||||
/* wolfSSL */
|
||||
#include <wolfssl/wolfcrypt/settings.h>
|
||||
#include "user_settings.h"
|
||||
#include <wolfssl/ssl.h>
|
||||
#include <wolfssl/certs_test.h>
|
||||
|
||||
#ifdef WOLFSSL_TRACK_MEMORY
|
||||
#include <wolfssl/wolfcrypt/mem_track.h>
|
||||
#endif
|
||||
|
||||
#ifndef NO_DH
|
||||
/* see also wolfssl/test.h */
|
||||
#undef DEFAULT_MIN_DHKEY_BITS
|
||||
#define DEFAULT_MIN_DHKEY_BITS 1024
|
||||
|
||||
#undef DEFAULT_MAX_DHKEY_BITS
|
||||
#define DEFAULT_MAX_DHKEY_BITS 2048
|
||||
#endif
|
||||
|
||||
#if defined(WOLFSSL_SM2) || defined(WOLFSSL_SM3) || defined(WOLFSSL_SM4)
|
||||
#include <wolfssl/certs_test_sm.h>
|
||||
#define CTX_CA_CERT root_sm2
|
||||
#define CTX_CA_CERT_SIZE sizeof_root_sm2
|
||||
#define CTX_CA_CERT_TYPE WOLFSSL_FILETYPE_PEM
|
||||
#define CTX_CLIENT_CERT client_sm2
|
||||
#define CTX_CLIENT_CERT_SIZE sizeof_client_sm2
|
||||
#define CTX_CLIENT_CERT_TYPE WOLFSSL_FILETYPE_PEM
|
||||
#define CTX_CLIENT_KEY client_sm2_priv
|
||||
#define CTX_CLIENT_KEY_SIZE sizeof_client_sm2_priv
|
||||
#define CTX_CLIENT_KEY_TYPE WOLFSSL_FILETYPE_PEM
|
||||
#else
|
||||
#include <wolfssl/certs_test.h>
|
||||
#define CTX_CA_CERT ca_cert_der_2048
|
||||
#define CTX_CA_CERT_SIZE sizeof_ca_cert_der_2048
|
||||
#define CTX_CA_CERT_TYPE WOLFSSL_FILETYPE_ASN1
|
||||
#define CTX_CLIENT_CERT client_cert_der_2048
|
||||
#define CTX_CLIENT_CERT_SIZE sizeof_client_cert_der_2048
|
||||
#define CTX_CLIENT_CERT_TYPE WOLFSSL_FILETYPE_ASN1
|
||||
#define CTX_CLIENT_KEY client_key_der_2048
|
||||
#define CTX_CLIENT_KEY_SIZE sizeof_client_key_der_2048
|
||||
#define CTX_CLIENT_KEY_TYPE WOLFSSL_FILETYPE_ASN1
|
||||
#endif
|
||||
|
||||
/* Project */
|
||||
#include "wifi_connect.h"
|
||||
#include "time_helper.h"
|
||||
|
||||
/* working TLS 1.2 VS client app commandline param:
|
||||
*
|
||||
* -h 192.168.1.128 -v 3 -l ECDHE-ECDSA-SM4-CBC-SM3 -c ./certs/sm2/client-sm2.pem -k ./certs/sm2/client-sm2-priv.pem -A ./certs/sm2/root-sm2.pem -C
|
||||
*
|
||||
* working Linux, non-working VS c app
|
||||
*
|
||||
* -h 192.168.1.128 -v 4 -l TLS13-SM4-CCM-SM3 -c ./certs/sm2/client-sm2.pem -k ./certs/sm2/client-sm2-priv.pem -A ./certs/sm2/root-sm2.pem -C
|
||||
*
|
||||
**/
|
||||
static const char* const TAG = "tls_client";
|
||||
|
||||
#if defined(DEBUG_WOLFSSL)
|
||||
int stack_start = -1;
|
||||
|
||||
static void ShowCiphers(void)
|
||||
int ShowCiphers(WOLFSSL* ssl)
|
||||
{
|
||||
char ciphers[4096];
|
||||
#define CLIENT_TLS_MAX_CIPHER_LENGTH 4096
|
||||
char ciphers[CLIENT_TLS_MAX_CIPHER_LENGTH];
|
||||
const char* cipher_used;
|
||||
int ret = 0;
|
||||
|
||||
int ret = wolfSSL_get_ciphers(ciphers, (int)sizeof(ciphers));
|
||||
if (ssl == NULL) {
|
||||
ESP_LOGI(TAG, "WOLFSSL* ssl is NULL, so no cipher in use");
|
||||
ret = wolfSSL_get_ciphers(ciphers, (int)sizeof(ciphers));
|
||||
if (ret == WOLFSSL_SUCCESS) {
|
||||
for (int i = 0; i < CLIENT_TLS_MAX_CIPHER_LENGTH; i++) {
|
||||
if (ciphers[i] == ':') {
|
||||
ciphers[i] = '\n';
|
||||
}
|
||||
}
|
||||
ESP_LOGI(TAG, "Available Ciphers:\n%s\n", ciphers);
|
||||
}
|
||||
else {
|
||||
ESP_LOGE(TAG, "Failed to call wolfSSL_get_ciphers. Error %d", ret);
|
||||
}
|
||||
}
|
||||
else {
|
||||
cipher_used = wolfSSL_get_cipher_name(ssl);
|
||||
ESP_LOGI(TAG, "WOLFSSL* ssl using %s", cipher_used);
|
||||
}
|
||||
|
||||
if (ret == WOLFSSL_SUCCESS)
|
||||
printf("%s\n", ciphers);
|
||||
return ret;
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -69,13 +137,13 @@ static void ShowCiphers(void)
|
||||
static byte mSlotList[ATECC_MAX_SLOT];
|
||||
|
||||
int atmel_set_slot_allocator(atmel_slot_alloc_cb alloc,
|
||||
atmel_slot_dealloc_cb dealloc);
|
||||
atmel_slot_dealloc_cb dealloc);
|
||||
/* initialize slot array */
|
||||
void my_atmel_slotInit()
|
||||
{
|
||||
int i;
|
||||
|
||||
for(i=0;i<ATECC_MAX_SLOT; i++) {
|
||||
for (i = 0; i < ATECC_MAX_SLOT; i++) {
|
||||
mSlotList[i] = ATECC_INVALID_SLOT;
|
||||
}
|
||||
}
|
||||
@@ -84,7 +152,7 @@ int my_atmel_alloc(int slotType)
|
||||
{
|
||||
int i, slot = -1;
|
||||
|
||||
switch(slotType){
|
||||
switch (slotType) {
|
||||
case ATMEL_SLOT_ENCKEY:
|
||||
slot = 2;
|
||||
break;
|
||||
@@ -98,8 +166,8 @@ int my_atmel_alloc(int slotType)
|
||||
slot = 4;
|
||||
break;
|
||||
case ATMEL_SLOT_ANY:
|
||||
for(i=0;i<ATECC_MAX_SLOT;i++){
|
||||
if(mSlotList[i] == ATECC_INVALID_SLOT){
|
||||
for (i = 0; i < ATECC_MAX_SLOT; i++) {
|
||||
if (mSlotList[i] == ATECC_INVALID_SLOT) {
|
||||
slot = i;
|
||||
break;
|
||||
}
|
||||
@@ -111,88 +179,173 @@ int my_atmel_alloc(int slotType)
|
||||
/* free slot array */
|
||||
void my_atmel_free(int slotId)
|
||||
{
|
||||
if(slotId >= 0 && slotId < ATECC_MAX_SLOT){
|
||||
if (slotId >= 0 && slotId < ATECC_MAX_SLOT) {
|
||||
mSlotList[slotId] = ATECC_INVALID_SLOT;
|
||||
}
|
||||
}
|
||||
#endif /* CUSTOM_SLOT_ALLOCATION */
|
||||
#endif /* CUSTOM_SLOT_ALLOCATION */
|
||||
#endif /* WOLFSSL_ESPWROOM32SE && HAVE_PK_CALLBACK && WOLFSSL_ATECC508A */
|
||||
|
||||
/* client task */
|
||||
void tls_smp_client_task()
|
||||
WOLFSSL_ESP_TASK tls_smp_client_task(void* args)
|
||||
{
|
||||
int ret;
|
||||
#if defined(SINGLE_THREADED)
|
||||
int ret = ESP_OK;
|
||||
#define TLS_SMP_CLIENT_TASK_RET ret
|
||||
#else
|
||||
#define TLS_SMP_CLIENT_TASK_RET
|
||||
#endif
|
||||
char buff[256];
|
||||
const char sndMsg[] = "GET /index.html HTTP/1.0\r\n\r\n";
|
||||
const char* ch = TLS_SMP_TARGET_HOST; /* see wifi_connect.h */
|
||||
struct sockaddr_in servAddr;
|
||||
|
||||
struct hostent *hp;
|
||||
struct ip4_addr *ip4_addr;
|
||||
int ret_i; /* interim return values */
|
||||
int sockfd;
|
||||
int doPeerCheck;
|
||||
int sendGet;
|
||||
struct sockaddr_in servAddr;
|
||||
char buff[256];
|
||||
const char* ch = TLS_SMP_TARGET_HOST;
|
||||
#ifndef NO_DH
|
||||
int minDhKeyBits = DEFAULT_MIN_DHKEY_BITS;
|
||||
#endif
|
||||
size_t len;
|
||||
struct hostent *hp;
|
||||
struct ip4_addr *ip4_addr;
|
||||
const char sndMsg[] = "GET /index.html HTTP/1.0\r\n\r\n";
|
||||
|
||||
/* declare wolfSSL objects */
|
||||
WOLFSSL_CTX *ctx;
|
||||
WOLFSSL *ssl;
|
||||
WOLFSSL_CTX* ctx;
|
||||
WOLFSSL* ssl;
|
||||
|
||||
WOLFSSL_ENTER("tls_smp_client_task");
|
||||
wolfSSL_Debugging_ON();
|
||||
WOLFSSL_ENTER(TLS_SMP_CLIENT_TASK_NAME);
|
||||
|
||||
doPeerCheck = 0;
|
||||
doPeerCheck = 1;
|
||||
sendGet = 0;
|
||||
|
||||
#ifdef DEBUG_WOLFSSL
|
||||
WOLFSSL_MSG("Debug ON");
|
||||
wolfSSL_Debugging_ON();
|
||||
ShowCiphers();
|
||||
ShowCiphers(NULL);
|
||||
#endif
|
||||
/* Initialize wolfSSL */
|
||||
wolfSSL_Init();
|
||||
|
||||
/* Create a socket that uses an internet IPv4 address,
|
||||
/* Create a socket that uses an Internet IPv4 address,
|
||||
* Sets the socket to be stream based (TCP),
|
||||
* 0 means choose the default protocol. */
|
||||
if ((sockfd = socket(AF_INET, SOCK_STREAM, 0)) == -1) {
|
||||
ESP_LOGE(TAG,"ERROR: failed to create the socket\n");
|
||||
ESP_LOGE(TAG, "ERROR: failed to create the socket\n");
|
||||
}
|
||||
|
||||
ESP_LOGI(TAG, "get target IP address");
|
||||
|
||||
hp = gethostbyname(TLS_SMP_TARGET_HOST);
|
||||
if (!hp) {
|
||||
ESP_LOGE(TAG, "Failed to get host name.");
|
||||
ip4_addr = NULL;
|
||||
} else {
|
||||
ESP_LOGE(TAG, "Failed to get host name.");
|
||||
ip4_addr = NULL;
|
||||
}
|
||||
else {
|
||||
ip4_addr = (struct ip4_addr *)hp->h_addr;
|
||||
}
|
||||
|
||||
ip4_addr = (struct ip4_addr *)hp->h_addr;
|
||||
ESP_LOGI(TAG, IPSTR, IP2STR(ip4_addr));
|
||||
}
|
||||
/* Create and initialize WOLFSSL_CTX */
|
||||
if ((ctx = wolfSSL_CTX_new(wolfSSLv23_client_method())) == NULL) {
|
||||
ESP_LOGE(TAG,"ERROR: failed to create WOLFSSL_CTX\n");
|
||||
ctx = wolfSSL_CTX_new(wolfSSLv23_client_method()); /* SSL 3.0 - TLS 1.3. */
|
||||
/* options: */
|
||||
/* ctx = wolfSSL_CTX_new(wolfTLSv1_2_client_method()); only TLS 1.2 */
|
||||
/* ctx = wolfSSL_CTX_new(wolfTLSv1_3_client_method()); only TLS 1.3 */
|
||||
/* wolfSSL_CTX_NoTicketTLSv12(); */
|
||||
/* wolfSSL_NoTicketTLSv12(); */
|
||||
if (ctx == NULL) {
|
||||
ESP_LOGE(TAG, "ERROR: failed to create WOLFSSL_CTX\n");
|
||||
}
|
||||
WOLFSSL_MSG("Loading...cert");
|
||||
/* Load client certificates into WOLFSSL_CTX */
|
||||
if ((ret = wolfSSL_CTX_load_verify_buffer(ctx, ca_cert_der_2048,
|
||||
sizeof_ca_cert_der_2048, WOLFSSL_FILETYPE_ASN1)) != SSL_SUCCESS) {
|
||||
ESP_LOGE(TAG,"ERROR: failed to load %d, please check the file.\n",ret);
|
||||
|
||||
#if defined(WOLFSSL_ESP32_CIPHER_SUITE)
|
||||
ESP_LOGI(TAG, "Start SM2\n");
|
||||
|
||||
/*
|
||||
*
|
||||
* reference code for SM Ciphers:
|
||||
*
|
||||
#if defined(HAVE_AESGCM) && !defined(NO_DH)
|
||||
#ifdef WOLFSSL_TLS13
|
||||
defaultCipherList = "TLS13-AES128-GCM-SHA256"
|
||||
#ifndef WOLFSSL_NO_TLS12
|
||||
":DHE-PSK-AES128-GCM-SHA256"
|
||||
#endif
|
||||
;
|
||||
#else
|
||||
defaultCipherList = "DHE-PSK-AES128-GCM-SHA256";
|
||||
#endif
|
||||
#elif defined(HAVE_AESGCM) && defined(WOLFSSL_TLS13)
|
||||
defaultCipherList = "TLS13-AES128-GCM-SHA256:PSK-AES128-GCM-SHA256"
|
||||
#ifndef WOLFSSL_NO_TLS12
|
||||
":PSK-AES128-GCM-SHA256"
|
||||
#endif
|
||||
;
|
||||
#elif defined(HAVE_NULL_CIPHER)
|
||||
defaultCipherList = "PSK-NULL-SHA256";
|
||||
#elif !defined(NO_AES_CBC)
|
||||
defaultCipherList = "PSK-AES128-CBC-SHA256";
|
||||
#else
|
||||
defaultCipherList = "PSK-AES128-GCM-SHA256";
|
||||
#endif
|
||||
*/
|
||||
|
||||
ret = wolfSSL_CTX_set_cipher_list(ctx, WOLFSSL_ESP32_CIPHER_SUITE);
|
||||
if (ret == WOLFSSL_SUCCESS) {
|
||||
ESP_LOGI(TAG, "Set cipher list: %s\n", WOLFSSL_ESP32_CIPHER_SUITE);
|
||||
}
|
||||
/* not peer check */
|
||||
if( doPeerCheck == 0 ){
|
||||
else {
|
||||
ESP_LOGE(TAG, "ERROR: failed to set cipher list: %s\n", WOLFSSL_ESP32_CIPHER_SUITE);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG_WOLFSSL
|
||||
ShowCiphers(NULL);
|
||||
ESP_LOGI(TAG,
|
||||
"Stack used: %d\n",
|
||||
CONFIG_ESP_MAIN_TASK_STACK_SIZE
|
||||
- uxTaskGetStackHighWaterMark(NULL));
|
||||
#endif
|
||||
|
||||
/* see user_settings PROJECT_DH for HAVE_DH and HAVE_FFDHE_2048 */
|
||||
#ifndef NO_DH
|
||||
ret = wolfSSL_CTX_SetMinDhKey_Sz(ctx, (word16)minDhKeyBits);
|
||||
if (ret != SSL_SUCCESS) {
|
||||
ESP_LOGE(TAG, "Error setting minimum DH key size");
|
||||
}
|
||||
#endif
|
||||
|
||||
/* no peer check */
|
||||
if (doPeerCheck == 0) {
|
||||
ESP_LOGW(TAG, "doPeerCheck == 0");
|
||||
wolfSSL_CTX_set_verify(ctx, WOLFSSL_VERIFY_NONE, 0);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
ESP_LOGW(TAG, "doPeerCheck != 0");
|
||||
WOLFSSL_MSG("Loading... our cert");
|
||||
/* load our certificate */
|
||||
if ((ret = wolfSSL_CTX_use_certificate_chain_buffer_format(ctx, client_cert_der_2048,
|
||||
sizeof_client_cert_der_2048, WOLFSSL_FILETYPE_ASN1)) != SSL_SUCCESS) {
|
||||
ESP_LOGE(TAG,"ERROR: failed to load chain %d, please check the file.\n",ret);
|
||||
ret_i = wolfSSL_CTX_use_certificate_chain_buffer_format(ctx,
|
||||
CTX_CLIENT_CERT,
|
||||
CTX_CLIENT_CERT_SIZE,
|
||||
CTX_CLIENT_CERT_TYPE);
|
||||
if (ret_i != SSL_SUCCESS) {
|
||||
ESP_LOGE(TAG, "ERROR: failed to load chain %d, please check the file.\n", ret_i);
|
||||
}
|
||||
|
||||
if ((ret = wolfSSL_CTX_use_PrivateKey_buffer(ctx, client_key_der_2048,
|
||||
sizeof_client_key_der_2048, WOLFSSL_FILETYPE_ASN1)) != SSL_SUCCESS) {
|
||||
wolfSSL_CTX_free(ctx); ctx = NULL;
|
||||
ESP_LOGE(TAG,"ERROR: failed to load key %d, please check the file.\n", ret);
|
||||
/* Load client certificates into WOLFSSL_CTX */
|
||||
WOLFSSL_MSG("Loading...cert");
|
||||
ret_i = wolfSSL_CTX_load_verify_buffer(ctx,
|
||||
CTX_CA_CERT,
|
||||
CTX_CA_CERT_SIZE,
|
||||
CTX_CA_CERT_TYPE);
|
||||
|
||||
ret_i = wolfSSL_CTX_use_PrivateKey_buffer(ctx,
|
||||
CTX_CLIENT_KEY,
|
||||
CTX_CLIENT_KEY_SIZE,
|
||||
CTX_CLIENT_KEY_TYPE);
|
||||
if(ret_i != SSL_SUCCESS) {
|
||||
wolfSSL_CTX_free(ctx) ; ctx = NULL ;
|
||||
ESP_LOGE(TAG, "ERROR: failed to load key %d, "
|
||||
"please check the file.\n", ret_i) ;
|
||||
}
|
||||
|
||||
wolfSSL_CTX_set_verify(ctx, WOLFSSL_VERIFY_PEER, 0);
|
||||
@@ -202,37 +355,60 @@ void tls_smp_client_task()
|
||||
memset(&servAddr, 0, sizeof(servAddr));
|
||||
|
||||
/* Fill in the server address */
|
||||
servAddr.sin_family = AF_INET; /* using IPv4 */
|
||||
servAddr.sin_port = htons(DEFAULT_PORT); /* on DEFAULT_PORT */
|
||||
servAddr.sin_family = AF_INET; /* using IPv4 */
|
||||
servAddr.sin_port = htons(TLS_SMP_DEFAULT_PORT); /* on DEFAULT_PORT */
|
||||
|
||||
if(*ch >= '1' && *ch <= '9') {
|
||||
if (*ch >= '1' && *ch <= '9') {
|
||||
/* Get the server IPv4 address from the command line call */
|
||||
WOLFSSL_MSG("inet_pton");
|
||||
if ((ret = inet_pton(AF_INET, TLS_SMP_TARGET_HOST,
|
||||
&servAddr.sin_addr)) != 1) {
|
||||
ESP_LOGE(TAG,"ERROR: invalid address ret=%d\n", ret);
|
||||
if ((ret_i = inet_pton(AF_INET,
|
||||
TLS_SMP_TARGET_HOST,
|
||||
&servAddr.sin_addr)) != 1) {
|
||||
ESP_LOGE(TAG, "ERROR: invalid address ret=%d\n", ret_i);
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
servAddr.sin_addr.s_addr = ip4_addr->addr;
|
||||
}
|
||||
|
||||
/* Connect to the server */
|
||||
sprintf(buff, "Connecting to server....%s(port:%d)", TLS_SMP_TARGET_HOST
|
||||
, DEFAULT_PORT);
|
||||
sprintf(buff,
|
||||
"Connecting to server....%s(port:%d)",
|
||||
TLS_SMP_TARGET_HOST,
|
||||
TLS_SMP_DEFAULT_PORT);
|
||||
WOLFSSL_MSG(buff);
|
||||
printf("%s\n",buff);
|
||||
if ((ret = connect(sockfd, (struct sockaddr *)&servAddr,
|
||||
sizeof(servAddr))) == -1){
|
||||
ESP_LOGE(TAG,"ERROR: failed to connect ret=%d\n", ret);
|
||||
printf("%s\n", buff);
|
||||
|
||||
if ((ret_i = connect(sockfd,
|
||||
(struct sockaddr *)&servAddr,
|
||||
sizeof(servAddr))) == -1) {
|
||||
ESP_LOGE(TAG, "ERROR: failed to connect ret=%d\n", ret_i);
|
||||
}
|
||||
|
||||
WOLFSSL_MSG("Create a WOLFSSL object");
|
||||
/* Create a WOLFSSL object */
|
||||
if ((ssl = wolfSSL_new(ctx)) == NULL) {
|
||||
ESP_LOGE(TAG,"ERROR: failed to create WOLFSSL object\n");
|
||||
ESP_LOGE(TAG, "ERROR: failed to create WOLFSSL object\n");
|
||||
}
|
||||
else {
|
||||
#ifdef DEBUG_WOLFSSL
|
||||
ESP_LOGI(TAG, "\nCreated WOLFSSL object:");
|
||||
ShowCiphers(ssl);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* when using atecc608a on esp32-wroom-32se */
|
||||
#if defined(WOLFSSL_SM2)
|
||||
/* SM TLS1.3 Cipher needs to have key share explicitly set. */
|
||||
ret = wolfSSL_UseKeyShare(ssl, WOLFSSL_ECC_SM2P256V1);
|
||||
if (ret == WOLFSSL_SUCCESS) {
|
||||
ESP_LOGI(TAG, "Successfully set WOLFSSL_ECC_SM2P256V1");
|
||||
}
|
||||
else {
|
||||
ESP_LOGE(TAG, "FAILED to set WOLFSSL_ECC_SM2P256V1");
|
||||
}
|
||||
#endif
|
||||
/* when using atecc608a on esp32-wroom-32se */
|
||||
|
||||
#if defined(WOLFSSL_ESPWROOM32SE) && defined(HAVE_PK_CALLBACKS) \
|
||||
&& defined(WOLFSSL_ATECC508A)
|
||||
atcatls_set_callbacks(ctx);
|
||||
@@ -248,37 +424,46 @@ void tls_smp_client_task()
|
||||
|
||||
WOLFSSL_MSG("Connect to wolfSSL on the server side");
|
||||
/* Connect to wolfSSL on the server side */
|
||||
if (wolfSSL_connect(ssl) != SSL_SUCCESS) {
|
||||
ESP_LOGE(TAG,"ERROR: failed to connect to wolfSSL\n");
|
||||
}
|
||||
if (wolfSSL_connect(ssl) == SSL_SUCCESS) {
|
||||
#ifdef DEBUG_WOLFSSL
|
||||
ShowCiphers(ssl);
|
||||
#endif
|
||||
/* Get a message for the server from stdin */
|
||||
WOLFSSL_MSG("Message for server: ");
|
||||
memset(buff, 0, sizeof(buff));
|
||||
|
||||
/* Get a message for the server from stdin */
|
||||
WOLFSSL_MSG("Message for server: ");
|
||||
memset(buff, 0, sizeof(buff));
|
||||
if (sendGet) {
|
||||
printf("SSL connect ok, sending GET...\n");
|
||||
len = XSTRLEN(sndMsg);
|
||||
strncpy(buff, sndMsg, len);
|
||||
buff[len] = '\0';
|
||||
}
|
||||
else {
|
||||
sprintf(buff, "message from esp32 tls client\n");
|
||||
len = strnlen(buff, sizeof(buff));
|
||||
}
|
||||
/* Send the message to the server */
|
||||
if (wolfSSL_write(ssl, buff, len) != len) {
|
||||
ESP_LOGE(TAG, "ERROR: failed to write\n");
|
||||
}
|
||||
|
||||
if(sendGet){
|
||||
printf("SSL connect ok, sending GET...\n");
|
||||
len = XSTRLEN(sndMsg);
|
||||
strncpy(buff, sndMsg, len);
|
||||
buff[len] = '\0';
|
||||
} else {
|
||||
sprintf(buff, "message from esp32 tls client\n");
|
||||
len = strnlen(buff, sizeof(buff));
|
||||
}
|
||||
/* Send the message to the server */
|
||||
if (wolfSSL_write(ssl, buff, len) != len) {
|
||||
ESP_LOGE(TAG,"ERROR: failed to write\n");
|
||||
}
|
||||
/* Read the server data into our buff array */
|
||||
memset(buff, 0, sizeof(buff));
|
||||
if (wolfSSL_read(ssl, buff, sizeof(buff) - 1) == -1) {
|
||||
ESP_LOGE(TAG, "ERROR: failed to read\n");
|
||||
}
|
||||
|
||||
/* Read the server data into our buff array */
|
||||
memset(buff, 0, sizeof(buff));
|
||||
if (wolfSSL_read(ssl, buff, sizeof(buff) - 1) == -1) {
|
||||
ESP_LOGE(TAG,"ERROR: failed to read\n");
|
||||
/* Print to stdout any data the server sends */
|
||||
printf("Server: ");
|
||||
printf("%s\n", buff);
|
||||
}
|
||||
else {
|
||||
ESP_LOGE(TAG, "ERROR: failed to connect to wolfSSL\n");
|
||||
}
|
||||
#ifdef DEBUG_WOLFSSL
|
||||
ShowCiphers(ssl);
|
||||
#endif
|
||||
|
||||
/* Print to stdout any data the server sends */
|
||||
printf("Server:");
|
||||
printf("%s", buff);
|
||||
/* Cleanup and return */
|
||||
wolfSSL_free(ssl); /* Free the wolfSSL object */
|
||||
wolfSSL_CTX_free(ctx); /* Free the wolfSSL context object */
|
||||
@@ -287,5 +472,32 @@ void tls_smp_client_task()
|
||||
|
||||
vTaskDelete(NULL);
|
||||
|
||||
return; /* Return reporting a success */
|
||||
return TLS_SMP_CLIENT_TASK_RET;
|
||||
}
|
||||
|
||||
#if defined(SINGLE_THREADED)
|
||||
/* we don't initialize a single thread, so no init function here */
|
||||
#else
|
||||
/* create task */
|
||||
WOLFSSL_ESP_TASK tls_smp_client_init(void* args)
|
||||
{
|
||||
int ret;
|
||||
#if ESP_IDF_VERSION_MAJOR >= 4
|
||||
TaskHandle_t _handle;
|
||||
#else
|
||||
xTaskHandle _handle;
|
||||
#endif
|
||||
/* http://esp32.info/docs/esp_idf/html/dd/d3c/group__xTaskCreate.html */
|
||||
ret = xTaskCreate(tls_smp_client_task,
|
||||
TLS_SMP_CLIENT_TASK_NAME,
|
||||
TLS_SMP_CLIENT_TASK_WORDS,
|
||||
NULL,
|
||||
TLS_SMP_CLIENT_TASK_PRIORITY,
|
||||
&_handle);
|
||||
|
||||
if (ret != pdPASS) {
|
||||
ESP_LOGI(TAG, "create thread %s failed", TLS_SMP_CLIENT_TASK_NAME);
|
||||
}
|
||||
return TLS_SMP_CLIENT_TASK_RET;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
/* server-tls.h
|
||||
*
|
||||
* Copyright (C) 2006-2023 wolfSSL Inc.
|
||||
*
|
||||
* This file is part of wolfSSL.
|
||||
*
|
||||
* wolfSSL is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* wolfSSL is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
|
||||
*/
|
||||
#ifndef _SERVER_TLS_
|
||||
#define _SERVER_TLS_
|
||||
|
||||
#include <wolfssl/wolfcrypt/settings.h>
|
||||
#include <wolfssl/ssl.h>
|
||||
#include "sdkconfig.h"
|
||||
|
||||
/* See main/Kconfig.projbuild for default configuration settings */
|
||||
#ifdef CONFIG_WOLFSSL_TARGET_HOST
|
||||
#define TLS_SMP_TARGET_HOST CONFIG_WOLFSSL_TARGET_HOST
|
||||
#else
|
||||
#define TLS_SMP_TARGET_HOST "192.168.1.38"
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_WOLFSSL_TARGET_PORT
|
||||
#define TLS_SMP_DEFAULT_PORT CONFIG_WOLFSSL_TARGET_PORT
|
||||
#else
|
||||
#define TLS_SMP_DEFAULT_PORT 11111
|
||||
#endif
|
||||
|
||||
#define TLS_SMP_CLIENT_TASK_NAME "tls_client_example"
|
||||
#define TLS_SMP_CLIENT_TASK_WORDS 22240
|
||||
#define TLS_SMP_CLIENT_TASK_PRIORITY 8
|
||||
|
||||
#if defined(SINGLE_THREADED)
|
||||
#define WOLFSSL_ESP_TASK int
|
||||
#else
|
||||
#include "freertos/FreeRTOS.h"
|
||||
#define WOLFSSL_ESP_TASK void
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
int port;
|
||||
int loops;
|
||||
} tls_args;
|
||||
|
||||
/* Function to show the ciphers available / in use. */
|
||||
#if defined(DEBUG_WOLFSSL)
|
||||
int ShowCiphers(WOLFSSL* ssl);
|
||||
#endif
|
||||
|
||||
/* This is the TLS Client function, possibly in an RTOS thread. */
|
||||
WOLFSSL_ESP_TASK tls_smp_client_task(void* args);
|
||||
|
||||
/* init will create an RTOS task, otherwise server is simply function call. */
|
||||
#if defined(SINGLE_THREADED)
|
||||
/* no init neded */
|
||||
#else
|
||||
WOLFSSL_ESP_TASK tls_smp_client_init(void* args);
|
||||
#endif
|
||||
#endif /* _SERVER_TLS_ */
|
||||
@@ -1,4 +1,4 @@
|
||||
/* error-ssl.h
|
||||
/* template main.h
|
||||
*
|
||||
* Copyright (C) 2006-2023 wolfSSL Inc.
|
||||
*
|
||||
@@ -18,6 +18,7 @@
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
|
||||
*/
|
||||
#ifndef _MAIN_H_
|
||||
#define _MAIN_H_
|
||||
|
||||
|
||||
#include <wolfssl/error-ssl.h>
|
||||
#endif
|
||||
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
* Copyright (C) 2006-2023 wolfSSL Inc.
|
||||
*
|
||||
* This file is part of wolfSSL.
|
||||
*
|
||||
* wolfSSL is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* wolfSSL is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
|
||||
*/
|
||||
|
||||
/* common Espressif time_helper v5.6.3.001 */
|
||||
|
||||
#ifndef _TIME_HELPER_H
|
||||
#define _TIME_HELPER_H
|
||||
|
||||
/* ESP-IDF uses a 64-bit signed integer to represent time_t starting from release v5.0
|
||||
* See: https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/system/system_time.html#year-2036-and-2038-overflow-issues
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* a function to show the current data and time */
|
||||
int esp_show_current_datetime();
|
||||
|
||||
/* worst case, if GitHub time not available, used fixed time */
|
||||
int set_fixed_default_time(void);
|
||||
|
||||
/* set time from string (e.g. GitHub commit time) */
|
||||
int set_time_from_string(char* time_buffer);
|
||||
|
||||
/* set time from NTP servers,
|
||||
* also initially calls set_fixed_default_time or set_time_from_string */
|
||||
int set_time(void);
|
||||
|
||||
/* wait NTP_RETRY_COUNT seconds before giving up on NTP time */
|
||||
int set_time_wait_for_ntp(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* #ifndef _TIME_HELPER_H */
|
||||
@@ -1,4 +1,4 @@
|
||||
/* user_settings.h
|
||||
/* wifi_connect.h
|
||||
*
|
||||
* Copyright (C) 2006-2023 wolfSSL Inc.
|
||||
*
|
||||
@@ -18,26 +18,76 @@
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
|
||||
*/
|
||||
#ifndef _TLS_WIFI_H_
|
||||
#define _TLS_WIFI_H_
|
||||
#ifndef _WIFI_CONNECT_H_
|
||||
#define _WIFI_CONNECT_H_
|
||||
|
||||
#include "esp_idf_version.h"
|
||||
#include "esp_log.h"
|
||||
#include "esp_wifi.h"
|
||||
#if ESP_IDF_VERSION_MAJOR >= 4
|
||||
#include "esp_event.h"
|
||||
#else
|
||||
#include "esp_event_loop.h"
|
||||
#endif
|
||||
#include <esp_idf_version.h>
|
||||
#include <esp_log.h>
|
||||
|
||||
#define DEFAULT_PORT 11111
|
||||
|
||||
#define TLS_SMP_CLIENT_TASK_NAME "tls_client_example"
|
||||
#define TLS_SMP_CLIENT_TASK_WORDS 10240
|
||||
#define TLS_SMP_CLIENT_TASK_PRIORITY 8
|
||||
/* ESP lwip */
|
||||
#define EXAMPLE_ESP_MAXIMUM_RETRY CONFIG_ESP_MAXIMUM_RETRY
|
||||
|
||||
#define TLS_SMP_WIFI_SSID CONFIG_WIFI_SSID
|
||||
#define TLS_SMP_WIFI_PASS CONFIG_WIFI_PASSWORD
|
||||
#define TLS_SMP_TARGET_HOST CONFIG_TARGET_HOST
|
||||
|
||||
#define USE_WIFI_EXAMPLE
|
||||
#ifdef USE_WIFI_EXAMPLE
|
||||
#include "esp_netif.h"
|
||||
#include "protocol_examples_common.h" /* see project CMakeLists.txt */
|
||||
#endif
|
||||
|
||||
/**
|
||||
******************************************************************************
|
||||
******************************************************************************
|
||||
** USER APPLICATION SETTINGS BEGIN
|
||||
******************************************************************************
|
||||
******************************************************************************
|
||||
**/
|
||||
|
||||
/* when using a private config with plain text passwords,
|
||||
* file my_private_config.h should be excluded from git updates */
|
||||
/* #define USE_MY_PRIVATE_CONFIG */
|
||||
|
||||
#ifdef USE_MY_PRIVATE_CONFIG
|
||||
#if defined(WOLFSSL_CMAKE_SYSTEM_NAME_WINDOWS)
|
||||
#include "/workspace/my_private_config.h"
|
||||
#elif defined(WOLFSSL_CMAKE_SYSTEM_NAME_WSL)
|
||||
#include "/mnt/c/workspace/my_private_config.h"
|
||||
#elif defined(WOLFSSL_CMAKE_SYSTEM_NAME_LINUX)
|
||||
#include "~/workspace/my_private_config.h"
|
||||
#elif defined(WOLFSSL_CMAKE_SYSTEM_NAME_APPLE)
|
||||
#include "~/Documents/my_private_config.h"
|
||||
#else
|
||||
#warning "did not detect environment. using ~/my_private_config.h"
|
||||
#include "~/my_private_config.h"
|
||||
#endif
|
||||
#else
|
||||
|
||||
/*
|
||||
** The examples use WiFi configuration that you can set via project
|
||||
** configuration menu
|
||||
**
|
||||
** If you'd rather not, just change the below entries to strings with
|
||||
** the config you want - ie #define EXAMPLE_WIFI_SSID "mywifissid"
|
||||
*/
|
||||
#ifdef CONFIG_ESP_WIFI_SSID
|
||||
#define EXAMPLE_ESP_WIFI_SSID CONFIG_ESP_WIFI_SSID
|
||||
#else
|
||||
#define EXAMPLE_ESP_WIFI_SSID "MYSSID_WIFI_CONNECT"
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_ESP_WIFI_PASSWORD
|
||||
#define EXAMPLE_ESP_WIFI_PASS CONFIG_ESP_WIFI_PASSWORD
|
||||
#else
|
||||
#define EXAMPLE_ESP_WIFI_PASS "MYPASSWORD_WIFI_CONNECT"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* ESP lwip */
|
||||
#define EXAMPLE_ESP_MAXIMUM_RETRY CONFIG_ESP_MAXIMUM_RETRY
|
||||
|
||||
int wifi_init_sta(void);
|
||||
|
||||
int wifi_show_ip(void);
|
||||
|
||||
#endif /* _WIFI_CONNECT_H_ */
|
||||
|
||||
267
IDE/Espressif/ESP-IDF/examples/wolfssl_client/main/main.c
Normal file
267
IDE/Espressif/ESP-IDF/examples/wolfssl_client/main/main.c
Normal file
@@ -0,0 +1,267 @@
|
||||
/* main.c
|
||||
*
|
||||
* Copyright (C) 2006-2023 wolfSSL Inc.
|
||||
*
|
||||
* This file is part of wolfSSL.
|
||||
*
|
||||
* wolfSSL is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* wolfSSL is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
|
||||
*/
|
||||
#include "sdkconfig.h"
|
||||
#include "main.h"
|
||||
|
||||
/* ESP specific */
|
||||
#include <nvs_flash.h>
|
||||
#include <esp_log.h>
|
||||
#include <esp_event.h>
|
||||
|
||||
/* wolfSSL */
|
||||
#include <wolfssl/wolfcrypt/settings.h>
|
||||
#include <user_settings.h>
|
||||
#include <wolfssl/wolfcrypt/port/Espressif/esp32-crypt.h>
|
||||
#ifndef WOLFSSL_ESPIDF
|
||||
#warning "Problem with wolfSSL user_settings."
|
||||
#warning "Check components/wolfssl/include"
|
||||
#endif
|
||||
|
||||
/* this project */
|
||||
#include "client-tls.h"
|
||||
#include "time_helper.h"
|
||||
|
||||
#ifndef CONFIG_IDF_TARGET_ESP32H2
|
||||
/* There's no WiFi on ESP32-H2.
|
||||
* For wired ethernet, see:
|
||||
* https://github.com/wolfSSL/wolfssl-examples/tree/master/ESP32/TLS13-ENC28J60-client */
|
||||
#include "wifi_connect.h"
|
||||
#endif
|
||||
|
||||
#ifdef WOLFSSL_TRACK_MEMORY
|
||||
#include <wolfssl/wolfcrypt/mem_track.h>
|
||||
#endif
|
||||
|
||||
static const char* const TAG = "TLS Client";
|
||||
|
||||
#if defined(WOLFSSL_ESPWROOM32SE) && defined(HAVE_PK_CALLBACKS) \
|
||||
&& defined(WOLFSSL_ATECC508A)
|
||||
|
||||
#include "wolfssl/wolfcrypt/port/atmel/atmel.h"
|
||||
|
||||
/* when you want to use a custom slot allocation */
|
||||
/* enable the definition CUSTOM_SLOT_ALLOCATION. */
|
||||
|
||||
#if defined(CUSTOM_SLOT_ALLOCATION)
|
||||
|
||||
static byte mSlotList[ATECC_MAX_SLOT];
|
||||
|
||||
int atmel_set_slot_allocator(atmel_slot_alloc_cb alloc, atmel_slot_dealloc_cb dealloc);
|
||||
|
||||
/* initialize slot array */
|
||||
void my_atmel_slotInit()
|
||||
{
|
||||
int i;
|
||||
for(i = 0;i < ATECC_MAX_SLOT;i++) {
|
||||
mSlotList[i] = ATECC_INVALID_SLOT;
|
||||
}
|
||||
}
|
||||
|
||||
/* allocate slot depending on slotType */
|
||||
int my_atmel_alloc(int slotType)
|
||||
{
|
||||
int i, slot = -1;
|
||||
|
||||
switch(slotType){
|
||||
case ATMEL_SLOT_ENCKEY:
|
||||
slot = 4;
|
||||
break;
|
||||
case ATMEL_SLOT_DEVICE:
|
||||
slot = 0;
|
||||
break;
|
||||
case ATMEL_SLOT_ECDHE:
|
||||
slot = 0;
|
||||
break;
|
||||
case ATMEL_SLOT_ECDHE_ENC:
|
||||
slot = 4;
|
||||
break;
|
||||
case ATMEL_SLOT_ANY:
|
||||
for(i = 0;i < ATECC_MAX_SLOT;i++){
|
||||
if(mSlotList[i] == ATECC_INVALID_SLOT){
|
||||
slot = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return slot;
|
||||
}
|
||||
|
||||
/* free slot array */
|
||||
void my_atmel_free(int slotId)
|
||||
{
|
||||
if(slotId >= 0 && slotId < ATECC_MAX_SLOT){
|
||||
mSlotList[slotId] = ATECC_INVALID_SLOT;
|
||||
}
|
||||
}
|
||||
#endif /* CUSTOM_SLOT_ALLOCATION */
|
||||
#endif /* WOLFSSL_ESPWROOM32SE && HAVE_PK_CALLBACK && WOLFSSL_ATECC508A */
|
||||
|
||||
/* for FreeRTOS */
|
||||
void app_main(void)
|
||||
{
|
||||
int stack_start = 0;
|
||||
esp_err_t ret = 0;
|
||||
ESP_LOGI(TAG, "---------------- wolfSSL TLS Client Example ------------");
|
||||
ESP_LOGI(TAG, "--------------------------------------------------------");
|
||||
ESP_LOGI(TAG, "--------------------------------------------------------");
|
||||
ESP_LOGI(TAG, "---------------------- BEGIN MAIN ----------------------");
|
||||
ESP_LOGI(TAG, "--------------------------------------------------------");
|
||||
ESP_LOGI(TAG, "--------------------------------------------------------");
|
||||
#ifdef ESP_TASK_MAIN_STACK
|
||||
ESP_LOGI(TAG, "ESP_TASK_MAIN_STACK: %d", ESP_TASK_MAIN_STACK);
|
||||
#endif
|
||||
#ifdef TASK_EXTRA_STACK_SIZE
|
||||
ESP_LOGI(TAG, "TASK_EXTRA_STACK_SIZE: %d", TASK_EXTRA_STACK_SIZE);
|
||||
#endif
|
||||
#ifdef INCLUDE_uxTaskGetStackHighWaterMark
|
||||
ESP_LOGI(TAG, "CONFIG_ESP_MAIN_TASK_STACK_SIZE = %d bytes (%d words)",
|
||||
CONFIG_ESP_MAIN_TASK_STACK_SIZE,
|
||||
(int)(CONFIG_ESP_MAIN_TASK_STACK_SIZE / sizeof(void*)));
|
||||
|
||||
/* Returns the high water mark of the stack associated with xTask. That is,
|
||||
* the minimum free stack space there has been (in bytes not words, unlike
|
||||
* vanilla FreeRTOS) since the task started. The smaller the returned
|
||||
* number the closer the task has come to overflowing its stack.
|
||||
* see https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/system/freertos_idf.html
|
||||
*/
|
||||
stack_start = uxTaskGetStackHighWaterMark(NULL);
|
||||
ESP_LOGI(TAG, "Stack Start HWM: %d bytes", stack_start);
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_VERSION_EXTENDED_INFO
|
||||
esp_ShowExtendedSystemInfo();
|
||||
#endif
|
||||
|
||||
/* Set time for cert validation.
|
||||
* Some lwIP APIs, including SNTP functions, are not thread safe. */
|
||||
ret = set_time(); /* need to setup NTP before WiFi */
|
||||
|
||||
/* Optionally erase flash */
|
||||
/* ESP_ERROR_CHECK(nvs_flash_erase()); */
|
||||
|
||||
#ifdef FOUND_PROTOCOL_EXAMPLES_DIR
|
||||
ESP_LOGI(TAG, "FOUND_PROTOCOL_EXAMPLES_DIR active, using example code.");
|
||||
ESP_ERROR_CHECK(nvs_flash_init());
|
||||
|
||||
#if defined(CONFIG_IDF_TARGET_ESP32H2)
|
||||
ESP_LOGE(TAG, "There's no WiFi on ESP32-H2.");
|
||||
#else
|
||||
#ifdef CONFIG_EXAMPLE_WIFI_SSID
|
||||
if (XSTRCMP(CONFIG_EXAMPLE_WIFI_SSID, "myssid") == 0) {
|
||||
ESP_LOGW(TAG, "WARNING: CONFIG_EXAMPLE_WIFI_SSID is myssid.");
|
||||
ESP_LOGW(TAG, " Do you have a WiFi AP called myssid, or ");
|
||||
ESP_LOGW(TAG, " did you forget the ESP-IDF configuration?");
|
||||
}
|
||||
#else
|
||||
#define CONFIG_EXAMPLE_WIFI_SSID "myssid"
|
||||
ESP_LOGW(TAG, "WARNING: CONFIG_EXAMPLE_WIFI_SSID not defined.");
|
||||
#endif
|
||||
ESP_ERROR_CHECK(esp_netif_init());
|
||||
ESP_ERROR_CHECK(esp_event_loop_create_default());
|
||||
ESP_ERROR_CHECK(example_connect());
|
||||
#endif
|
||||
#else
|
||||
ESP_ERROR_CHECK(nvs_flash_init());
|
||||
|
||||
/* Initialize NVS */
|
||||
ret = nvs_flash_init();
|
||||
if (ret == ESP_ERR_NVS_NO_FREE_PAGES ||
|
||||
ret == ESP_ERR_NVS_NEW_VERSION_FOUND) {
|
||||
ESP_ERROR_CHECK(nvs_flash_erase());
|
||||
ret = nvs_flash_init();
|
||||
}
|
||||
ESP_ERROR_CHECK(ret);
|
||||
|
||||
#if defined(CONFIG_IDF_TARGET_ESP32H2)
|
||||
ESP_LOGE(TAG, "There's no WiFi on ESP32-H2. ");
|
||||
#else
|
||||
/* Initialize WiFi */
|
||||
ESP_LOGI(TAG, "ESP_WIFI_MODE_STA");
|
||||
ret = wifi_init_sta();
|
||||
while (ret != 0) {
|
||||
ESP_LOGI(TAG, "Waiting...");
|
||||
vTaskDelay(60000 / portTICK_PERIOD_MS);
|
||||
ESP_LOGI(TAG, "Trying WiFi again...");
|
||||
ret = wifi_init_sta();
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Once we are connected to the network, start & wait for NTP time */
|
||||
ret = set_time_wait_for_ntp();
|
||||
|
||||
if (ret < -1) {
|
||||
/* a value of -1 means there was no NTP server, so no need to wait */
|
||||
ESP_LOGI(TAG, "Waiting 10 more seconds for NTP to complete." );
|
||||
vTaskDelay(10000 / portTICK_PERIOD_MS); /* brute-force solution */
|
||||
esp_show_current_datetime();
|
||||
}
|
||||
|
||||
/* HWM is maximum amount of stack space that has been unused, in bytes
|
||||
* not words (unlike vanilla freeRTOS). */
|
||||
ESP_LOGI(TAG, "Initial Stack Used (before wolfSSL Server): %d bytes",
|
||||
CONFIG_ESP_MAIN_TASK_STACK_SIZE
|
||||
- (uxTaskGetStackHighWaterMark(NULL))
|
||||
);
|
||||
ESP_LOGI(TAG, "Starting TLS Client task ...\n");
|
||||
|
||||
#if defined(SINGLE_THREADED)
|
||||
/* just call the task */
|
||||
tls_smp_client_task((void*)NULL);
|
||||
#else
|
||||
tls_args args[1] = {0};
|
||||
/* start a thread with the task */
|
||||
args[0].loops = 10;
|
||||
args[0].port = 11111;
|
||||
tls_smp_client_init(args);
|
||||
/* optional additional client threads
|
||||
tls_smp_client_init(args);
|
||||
tls_smp_client_init(args);
|
||||
tls_smp_client_init(args);
|
||||
tls_smp_client_init(args);
|
||||
tls_smp_client_init(args);
|
||||
tls_smp_client_init(args);
|
||||
tls_smp_client_init(args);
|
||||
*/
|
||||
#endif
|
||||
|
||||
ESP_LOGV(TAG, "\n\nvTaskDelete...\n\n");
|
||||
vTaskDelete(NULL);
|
||||
/* done */
|
||||
while (1) {
|
||||
ESP_LOGV(TAG, "\n\nLoop...\n\n");
|
||||
#ifdef INCLUDE_uxTaskGetStackHighWaterMark
|
||||
ESP_LOGI(TAG, "Stack HWM: %d", uxTaskGetStackHighWaterMark(NULL));
|
||||
|
||||
ESP_LOGI(TAG, "Stack used: %d", CONFIG_ESP_MAIN_TASK_STACK_SIZE
|
||||
- (uxTaskGetStackHighWaterMark(NULL) ));
|
||||
#endif
|
||||
|
||||
#if defined(SINGLE_THREADED)
|
||||
ESP_LOGV(TAG, "\n\nDone!\n\n");
|
||||
while (1);
|
||||
#else
|
||||
vTaskDelay(60000);
|
||||
#endif
|
||||
} /* done whle */
|
||||
|
||||
} /* app_main */
|
||||
333
IDE/Espressif/ESP-IDF/examples/wolfssl_client/main/time_helper.c
Normal file
333
IDE/Espressif/ESP-IDF/examples/wolfssl_client/main/time_helper.c
Normal file
@@ -0,0 +1,333 @@
|
||||
/* time_helper.c
|
||||
*
|
||||
* Copyright (C) 2006-2023 wolfSSL Inc.
|
||||
*
|
||||
* This file is part of wolfSSL.
|
||||
*
|
||||
* wolfSSL is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* wolfSSL is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
|
||||
*/
|
||||
|
||||
/* common Espressif time_helper v5.6.3.002 */
|
||||
#include "esp_idf_version.h"
|
||||
#include "sdkconfig.h"
|
||||
#include "time_helper.h"
|
||||
|
||||
#include <esp_log.h>
|
||||
|
||||
#if defined(ESP_IDF_VERSION_MAJOR) && defined(ESP_IDF_VERSION_MINOR)
|
||||
#if (ESP_IDF_VERSION_MAJOR == 5) && (ESP_IDF_VERSION_MINOR >= 1)
|
||||
#define HAS_ESP_NETIF_SNTP 1
|
||||
#include <lwip/apps/sntp.h>
|
||||
#include <esp_netif_sntp.h>
|
||||
#else
|
||||
#include <string.h>
|
||||
#include <esp_sntp.h>
|
||||
#endif
|
||||
#else
|
||||
/* TODO Consider pre IDF v5? */
|
||||
#endif
|
||||
|
||||
/* ESP-IDF uses a 64-bit signed integer to represent time_t starting from release v5.0
|
||||
* See: https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/system/system_time.html#year-2036-and-2038-overflow-issues
|
||||
*/
|
||||
const static char* TAG = "time_helper";
|
||||
|
||||
/* see https://www.gnu.org/software/libc/manual/html_node/TZ-Variable.html */
|
||||
#ifndef TIME_ZONE
|
||||
/*
|
||||
* PST represents Pacific Standard Time.
|
||||
* +8 specifies the offset from UTC (Coordinated Universal Time), indicating
|
||||
* that Pacific Time is UTC-8 during standard time.
|
||||
* PDT represents Pacific Daylight Time.
|
||||
* M3.2.0 indicates that Daylight Saving Time (DST) starts on the
|
||||
* second (2) Sunday (0) of March (3).
|
||||
* M11.1.0 indicates that DST ends on the first (1) Sunday (0) of November (11)
|
||||
*/
|
||||
#define TIME_ZONE "PST+8PDT,M3.2.0,M11.1.0"
|
||||
#endif /* not defined: TIME_ZONE, so we are setting our own */
|
||||
|
||||
#define NTP_RETRY_COUNT 10
|
||||
|
||||
/* NELEMS(x) number of elements
|
||||
* To determine the number of elements in the array, we can divide the total
|
||||
* size of the array by the size of the array element.
|
||||
* See https://stackoverflow.com/questions/37538/how-do-i-determine-the-size-of-my-array-in-c
|
||||
**/
|
||||
#define NELEMS(x) ( (int)(sizeof(x) / sizeof((x)[0])) )
|
||||
|
||||
/* See also CONFIG_LWIP_SNTP_MAX_SERVERS in sdkconfig */
|
||||
#define NTP_SERVER_LIST ( (char*[]) { \
|
||||
"pool.ntp.org", \
|
||||
"time.nist.gov", \
|
||||
"utcnist.colorado.edu" \
|
||||
} \
|
||||
)
|
||||
/* #define NTP_SERVER_COUNT using NELEMS:
|
||||
*
|
||||
* (int)(sizeof(NTP_SERVER_LIST) / sizeof(NTP_SERVER_LIST[0]))
|
||||
*/
|
||||
#define NTP_SERVER_COUNT NELEMS(NTP_SERVER_LIST)
|
||||
|
||||
#ifndef CONFIG_LWIP_SNTP_MAX_SERVERS
|
||||
/* We should find max value in sdkconfig, if not set it to our count:*/
|
||||
#define CONFIG_LWIP_SNTP_MAX_SERVERS NTP_SERVER_COUNT
|
||||
#endif
|
||||
|
||||
char* ntpServerList[NTP_SERVER_COUNT] = NTP_SERVER_LIST;
|
||||
|
||||
/* our NTP server list is global info */
|
||||
extern char* ntpServerList[NTP_SERVER_COUNT];
|
||||
|
||||
/* Show the current date and time */
|
||||
int esp_show_current_datetime()
|
||||
{
|
||||
time_t now;
|
||||
char strftime_buf[64];
|
||||
struct tm timeinfo;
|
||||
|
||||
time(&now);
|
||||
setenv("TZ", TIME_ZONE, 1);
|
||||
tzset();
|
||||
|
||||
localtime_r(&now, &timeinfo);
|
||||
strftime(strftime_buf, sizeof(strftime_buf), "%c", &timeinfo);
|
||||
ESP_LOGI(TAG, "The current date/time is: %s", strftime_buf);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* the worst-case scenario is a hard-coded date/time */
|
||||
int set_fixed_default_time(void)
|
||||
{
|
||||
/* ideally, we'd like to set time from network,
|
||||
* but let's set a default time, just in case */
|
||||
struct tm timeinfo = {
|
||||
.tm_year = 2023 - 1900,
|
||||
.tm_mon = 10,
|
||||
.tm_mday = 02,
|
||||
.tm_hour = 13,
|
||||
.tm_min = 01,
|
||||
.tm_sec = 05
|
||||
};
|
||||
struct timeval now;
|
||||
time_t interim_time;
|
||||
int ret = -1;
|
||||
|
||||
/* set interim static time */
|
||||
interim_time = mktime(&timeinfo);
|
||||
|
||||
ESP_LOGI(TAG, "Adjusting time from fixed value");
|
||||
now = (struct timeval){ .tv_sec = interim_time };
|
||||
ret = settimeofday(&now, NULL);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* set_time_from_string(s)
|
||||
*
|
||||
* returns 0 = success if able to set the time from the provided string
|
||||
* error for any other value, typically -1 */
|
||||
int set_time_from_string(char* time_buffer)
|
||||
{
|
||||
/* expecting github default formatting: 'Thu Aug 31 12:41:45 2023 -0700' */
|
||||
const char *format = "%3s %3s %d %d:%d:%d %d %s";
|
||||
struct tm this_timeinfo;
|
||||
struct timeval now;
|
||||
time_t interim_time;
|
||||
char offset[6]; /* expecting trailing single quote, not used */
|
||||
char day_str[4];
|
||||
char month_str[4];
|
||||
int day, year, hour, minute, second;
|
||||
int quote_offset = 0;
|
||||
int ret = 0;
|
||||
|
||||
/* we are expecting the string to be encapsulated in single quotes */
|
||||
if (*time_buffer == 0x27) {
|
||||
quote_offset = 1;
|
||||
}
|
||||
|
||||
ret = sscanf(time_buffer + quote_offset,
|
||||
format,
|
||||
day_str, month_str,
|
||||
&day, &hour, &minute, &second, &year, &offset);
|
||||
|
||||
if (ret == 8) {
|
||||
/* we found a match for all componets */
|
||||
|
||||
const char *months[] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun",
|
||||
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec" };
|
||||
|
||||
for (int i = 0; i < 12; i++) {
|
||||
if (strcmp(month_str, months[i]) == 0) {
|
||||
this_timeinfo.tm_mon = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
this_timeinfo.tm_mday = day;
|
||||
this_timeinfo.tm_hour = hour;
|
||||
this_timeinfo.tm_min = minute;
|
||||
this_timeinfo.tm_sec = second;
|
||||
this_timeinfo.tm_year = year - 1900; /* Number of years since 1900 */
|
||||
|
||||
interim_time = mktime(&this_timeinfo);
|
||||
now = (struct timeval){ .tv_sec = interim_time };
|
||||
ret = settimeofday(&now, NULL);
|
||||
ESP_LOGI(TAG, "Time updated to %s", time_buffer);
|
||||
}
|
||||
else {
|
||||
ESP_LOGE(TAG, "Failed to convert \"%s\" to a tm date.", time_buffer);
|
||||
ESP_LOGI(TAG, "Trying fixed date that was hard-coded.");
|
||||
set_fixed_default_time();
|
||||
ret = -1;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* set time; returns 0 if succecssfully configured with NTP */
|
||||
int set_time(void)
|
||||
{
|
||||
#ifndef NTP_SERVER_COUNT
|
||||
ESP_LOGW(TAG, "Warning: no sntp server names defined. "
|
||||
"Setting to empty list");
|
||||
#define NTP_SERVER_COUNT 0
|
||||
#warning "NTP not properly configured"
|
||||
#endif /* not defined: NTP_SERVER_COUNT */
|
||||
|
||||
#ifdef HAS_ESP_NETIF_SNTP
|
||||
#if CONFIG_LWIP_SNTP_MAX_SERVERS > 1
|
||||
esp_sntp_config_t config = ESP_NETIF_SNTP_DEFAULT_CONFIG_MULTIPLE(
|
||||
NTP_SERVER_COUNT,
|
||||
ESP_SNTP_SERVER_LIST(ntpServerList[0])
|
||||
);
|
||||
#else
|
||||
esp_sntp_config_t config = ESP_NETIF_SNTP_DEFAULT_CONFIG(ntpServerList[0]);
|
||||
#endif /* CONFIG_LWIP_SNTP_MAX_SERVERS > 1 */
|
||||
#endif /* HAS_ESP_NETIF_SNTP */
|
||||
|
||||
int ret = 0;
|
||||
int i = 0; /* counter for time servers */
|
||||
|
||||
ESP_LOGI(TAG, "Setting the time. Startup time:");
|
||||
esp_show_current_datetime();
|
||||
|
||||
#ifdef LIBWOLFSSL_VERSION_GIT_HASH_DATE
|
||||
/* initialy set a default approximate time from recent git commit */
|
||||
ESP_LOGI(TAG, "Found git hash date, attempting to set system date.");
|
||||
set_time_from_string(LIBWOLFSSL_VERSION_GIT_HASH_DATE);
|
||||
esp_show_current_datetime();
|
||||
|
||||
ret = -4;
|
||||
#else
|
||||
/* otherwise set a fixed time that was hard coded */
|
||||
set_fixed_default_time();
|
||||
ret = -3;
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_SNTP_TIME_SYNC_METHOD_SMOOTH
|
||||
config.smooth_sync = true;
|
||||
#endif
|
||||
|
||||
if (NTP_SERVER_COUNT) {
|
||||
/* next, let's setup NTP time servers
|
||||
*
|
||||
* see https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/system/system_time.html#sntp-time-synchronization
|
||||
*
|
||||
* WARNING: do not set operating mode while SNTP client is running!
|
||||
*/
|
||||
/* TODO Consider esp_sntp_setoperatingmode(SNTP_OPMODE_POLL); */
|
||||
sntp_setoperatingmode(SNTP_OPMODE_POLL);
|
||||
if (NTP_SERVER_COUNT > CONFIG_LWIP_SNTP_MAX_SERVERS) {
|
||||
ESP_LOGW(TAG, "WARNING: %d NTP Servers defined, but "
|
||||
"CONFIG_LWIP_SNTP_MAX_SERVERS = %d",
|
||||
NTP_SERVER_COUNT,CONFIG_LWIP_SNTP_MAX_SERVERS);
|
||||
}
|
||||
ESP_LOGI(TAG, "sntp_setservername:");
|
||||
for (i = 0; i < CONFIG_LWIP_SNTP_MAX_SERVERS; i++) {
|
||||
const char* thisServer = ntpServerList[i];
|
||||
if (strncmp(thisServer, "\x00", 1) == 0) {
|
||||
/* just in case we run out of NTP servers */
|
||||
break;
|
||||
}
|
||||
ESP_LOGI(TAG, "%s", thisServer);
|
||||
sntp_setservername(i, thisServer);
|
||||
}
|
||||
#ifdef HAS_ESP_NETIF_SNTP
|
||||
ret = esp_netif_sntp_init(&config);
|
||||
#else
|
||||
ESP_LOGW(TAG,"Warning: Consider upgrading ESP-IDF to take advantage "
|
||||
"of updated SNTP libraries");
|
||||
#endif
|
||||
if (ret == ESP_OK) {
|
||||
ESP_LOGV(TAG, "Successfully called esp_netif_sntp_init");
|
||||
}
|
||||
else {
|
||||
ESP_LOGE(TAG, "ERROR: esp_netif_sntp_init return = %d", ret);
|
||||
}
|
||||
|
||||
sntp_init();
|
||||
switch (ret) {
|
||||
case ESP_ERR_INVALID_STATE:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
ESP_LOGI(TAG, "sntp_init done.");
|
||||
}
|
||||
else {
|
||||
ESP_LOGW(TAG, "No sntp time servers found.");
|
||||
ret = -1;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* wait for NTP to actually set the time */
|
||||
int set_time_wait_for_ntp(void)
|
||||
{
|
||||
int ret = 0;
|
||||
#ifdef HAS_ESP_NETIF_SNTP
|
||||
int ntp_retry = 0;
|
||||
const int ntp_retry_count = NTP_RETRY_COUNT;
|
||||
|
||||
ret = esp_netif_sntp_start();
|
||||
|
||||
ret = esp_netif_sntp_sync_wait(500 / portTICK_PERIOD_MS);
|
||||
#endif /* HAS_ESP_NETIF_SNTP */
|
||||
esp_show_current_datetime();
|
||||
|
||||
#ifdef HAS_ESP_NETIF_SNTP
|
||||
while (ret == ESP_ERR_TIMEOUT && (ntp_retry++ < ntp_retry_count)) {
|
||||
ret = esp_netif_sntp_sync_wait(1000 / portTICK_PERIOD_MS);
|
||||
ESP_LOGI(TAG, "Waiting for NTP to sync time... (%d/%d)",
|
||||
ntp_retry,
|
||||
ntp_retry_count);
|
||||
esp_show_current_datetime();
|
||||
}
|
||||
#endif /* HAS_ESP_NETIF_SNTP */
|
||||
|
||||
#ifdef TIME_ZONE
|
||||
setenv("TZ", TIME_ZONE, 1);
|
||||
tzset();
|
||||
#endif
|
||||
|
||||
if (ret == ESP_OK) {
|
||||
ESP_LOGI(TAG, "Successfuly set time via NTP servers.");
|
||||
}
|
||||
else {
|
||||
ESP_LOGW(TAG, "Warning: Failed to set time with NTP: "
|
||||
"result = 0x%0x: %s",
|
||||
ret, esp_err_to_name(ret));
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
@@ -18,92 +18,52 @@
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
|
||||
*/
|
||||
/*ESP specific */
|
||||
#include "freertos/FreeRTOS.h"
|
||||
#include "freertos/task.h"
|
||||
#include "freertos/event_groups.h"
|
||||
#include "wifi_connect.h"
|
||||
#include "lwip/sockets.h"
|
||||
#include "lwip/netdb.h"
|
||||
#include "lwip/apps/sntp.h"
|
||||
#include "nvs_flash.h"
|
||||
#include "wifi_connect.h"
|
||||
|
||||
#include <freertos/FreeRTOS.h>
|
||||
#include <freertos/task.h>
|
||||
#include <freertos/event_groups.h>
|
||||
#include <esp_wifi.h>
|
||||
#include <esp_log.h>
|
||||
|
||||
/* wolfSSL */
|
||||
#include <wolfssl/wolfcrypt/settings.h>
|
||||
#include <user_settings.h>
|
||||
#include "user_settings.h"
|
||||
#include <wolfssl/version.h>
|
||||
#include <wolfssl/wolfcrypt/types.h>
|
||||
#ifndef WOLFSSL_ESPIDF
|
||||
#warning "problem with wolfSSL user_settings. Check components/wolfssl/include"
|
||||
#warning "Problem with wolfSSL user_settings."
|
||||
#warning "Check components/wolfssl/include"
|
||||
#endif
|
||||
|
||||
#if ESP_IDF_VERSION_MAJOR >= 4
|
||||
#if ESP_IDF_VERSION_MAJOR >= 5
|
||||
#elif ESP_IDF_VERSION_MAJOR >= 4
|
||||
#include "protocol_examples_common.h"
|
||||
#else
|
||||
const static int CONNECTED_BIT = BIT0;
|
||||
static EventGroupHandle_t wifi_event_group;
|
||||
#endif
|
||||
|
||||
/* proto-type */
|
||||
extern void tls_smp_client_task();
|
||||
static void tls_smp_client_init();
|
||||
|
||||
const static char *TAG = "tls_client";
|
||||
|
||||
static void set_time()
|
||||
{
|
||||
/* set dummy wallclock time. */
|
||||
struct timeval utctime;
|
||||
struct timezone tz;
|
||||
struct strftime_buf;
|
||||
time_t now;
|
||||
struct tm timeinfo;
|
||||
char strftime_buf[64];
|
||||
/* please update the time if seeing unknown failure when loading cert. */
|
||||
/* this could cause TLS communication failure due to time expiration */
|
||||
/* incleasing 31536000 seconds is close to spend 356 days. */
|
||||
utctime.tv_sec = 1645797600; /* dummy time: Fri 25 Feb 2022 02:00:00 2022 */
|
||||
utctime.tv_usec = 0;
|
||||
tz.tz_minuteswest = 0;
|
||||
tz.tz_dsttime = 0;
|
||||
|
||||
settimeofday(&utctime, &tz);
|
||||
|
||||
time(&now);
|
||||
localtime_r(&now, &timeinfo);
|
||||
|
||||
strftime(strftime_buf, sizeof(strftime_buf), "%c", &timeinfo);
|
||||
ESP_LOGI(TAG, "The current date/time is: %s", strftime_buf);
|
||||
|
||||
#if ESP_IDF_VERSION_MAJOR < 4
|
||||
/* wait until wifi connect */
|
||||
xEventGroupWaitBits(wifi_event_group, CONNECTED_BIT,
|
||||
false, true, portMAX_DELAY);
|
||||
#endif
|
||||
/* now we start client tasks. */
|
||||
tls_smp_client_init();
|
||||
}
|
||||
|
||||
/* create task */
|
||||
static void tls_smp_client_init(void)
|
||||
{
|
||||
int ret;
|
||||
#if ESP_IDF_VERSION_MAJOR >= 4
|
||||
TaskHandle_t _handle;
|
||||
#if defined(ESP_IDF_VERSION_MAJOR) && defined(ESP_IDF_VERSION_MINOR)
|
||||
#if ESP_IDF_VERSION_MAJOR >= 4
|
||||
/* likely using examples, see wifi_connect.h */
|
||||
#else
|
||||
/* TODO - still supporting pre V4 ? */
|
||||
const static int CONNECTED_BIT = BIT0;
|
||||
static EventGroupHandle_t wifi_event_group;
|
||||
#endif
|
||||
#if (ESP_IDF_VERSION_MAJOR == 5)
|
||||
#define HAS_WPA3_FEATURES
|
||||
#else
|
||||
#undef HAS_WPA3_FEATURES
|
||||
#endif
|
||||
#else
|
||||
xTaskHandle _handle;
|
||||
/* TODO Consider pre IDF v5? */
|
||||
#endif
|
||||
/* http://esp32.info/docs/esp_idf/html/dd/d3c/group__xTaskCreate.html */
|
||||
ret = xTaskCreate(tls_smp_client_task,
|
||||
TLS_SMP_CLIENT_TASK_NAME,
|
||||
TLS_SMP_CLIENT_TASK_WORDS,
|
||||
NULL,
|
||||
TLS_SMP_CLIENT_TASK_PRIORITY,
|
||||
&_handle);
|
||||
|
||||
if (ret != pdPASS) {
|
||||
ESP_LOGI(TAG, "create thread %s failed", TLS_SMP_CLIENT_TASK_NAME);
|
||||
}
|
||||
}
|
||||
/* breadcrumb prefix for logging */
|
||||
const static char *TAG = "wifi_connect";
|
||||
|
||||
#if ESP_IDF_VERSION_MAJOR < 4
|
||||
/* event handler for wifi events */
|
||||
static esp_err_t wifi_event_handler(void *ctx, system_event_t *event)
|
||||
@@ -121,7 +81,7 @@ static esp_err_t wifi_event_handler(void *ctx, system_event_t *event)
|
||||
ESP_LOGI(TAG, "got ip:%s",
|
||||
ip4addr_ntoa(&event->event_info.got_ip.ip_info.ip));
|
||||
#endif
|
||||
/* http://esp32.info/docs/esp_idf/html/dd/d08/group__xEventGroupSetBits.html */
|
||||
/* see https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/system/freertos_idf.html */
|
||||
xEventGroupSetBits(wifi_event_group, CONNECTED_BIT);
|
||||
break;
|
||||
case SYSTEM_EVENT_STA_DISCONNECTED:
|
||||
@@ -133,99 +93,184 @@ static esp_err_t wifi_event_handler(void *ctx, system_event_t *event)
|
||||
}
|
||||
return ESP_OK;
|
||||
}
|
||||
#else
|
||||
|
||||
#ifdef CONFIG_ESP_MAXIMUM_RETRY
|
||||
#define EXAMPLE_ESP_MAXIMUM_RETRY CONFIG_ESP_MAXIMUM_RETRY
|
||||
#else
|
||||
#define CONFIG_ESP_MAXIMUM_RETRY 5
|
||||
#endif
|
||||
/* entry point */
|
||||
void app_main(void)
|
||||
|
||||
#if CONFIG_ESP_WIFI_AUTH_OPEN
|
||||
#define ESP_WIFI_SCAN_AUTH_MODE_THRESHOLD WIFI_AUTH_OPEN
|
||||
#elif CONFIG_ESP_WIFI_AUTH_WEP
|
||||
#define ESP_WIFI_SCAN_AUTH_MODE_THRESHOLD WIFI_AUTH_WEP
|
||||
#elif CONFIG_ESP_WIFI_AUTH_WPA_PSK
|
||||
#define ESP_WIFI_SCAN_AUTH_MODE_THRESHOLD WIFI_AUTH_WPA_PSK
|
||||
#elif CONFIG_ESP_WIFI_AUTH_WPA2_PSK
|
||||
#define ESP_WIFI_SCAN_AUTH_MODE_THRESHOLD WIFI_AUTH_WPA2_PSK
|
||||
#elif CONFIG_ESP_WIFI_AUTH_WPA_WPA2_PSK
|
||||
#define ESP_WIFI_SCAN_AUTH_MODE_THRESHOLD WIFI_AUTH_WPA_WPA2_PSK
|
||||
#elif CONFIG_ESP_WIFI_AUTH_WPA3_PSK
|
||||
#define ESP_WIFI_SCAN_AUTH_MODE_THRESHOLD WIFI_AUTH_WPA3_PSK
|
||||
#elif CONFIG_ESP_WIFI_AUTH_WPA2_WPA3_PSK
|
||||
#define ESP_WIFI_SCAN_AUTH_MODE_THRESHOLD WIFI_AUTH_WPA2_WPA3_PSK
|
||||
#elif CONFIG_ESP_WIFI_AUTH_WAPI_PSK
|
||||
#define ESP_WIFI_SCAN_AUTH_MODE_THRESHOLD WIFI_AUTH_WAPI_PSK
|
||||
#endif
|
||||
|
||||
#ifndef ESP_WIFI_SCAN_AUTH_MODE_THRESHOLD
|
||||
#define CONFIG_ESP_WIFI_AUTH_WPA2_PSK 1
|
||||
#define ESP_WIFI_SCAN_AUTH_MODE_THRESHOLD CONFIG_ESP_WIFI_AUTH_WPA2_PSK
|
||||
#endif
|
||||
|
||||
/* FreeRTOS event group to signal when we are connected*/
|
||||
static EventGroupHandle_t s_wifi_event_group;
|
||||
|
||||
/* The event group allows multiple bits for each event, but we only care about two events:
|
||||
* - we are connected to the AP with an IP
|
||||
* - we failed to connect after the maximum amount of retries */
|
||||
#define WIFI_CONNECTED_BIT BIT0
|
||||
#define WIFI_FAIL_BIT BIT1
|
||||
|
||||
|
||||
static int s_retry_num = 0;
|
||||
ip_event_got_ip_t* event;
|
||||
|
||||
|
||||
static void event_handler(void* arg,
|
||||
esp_event_base_t event_base,
|
||||
int32_t event_id,
|
||||
void* event_data)
|
||||
{
|
||||
ESP_LOGI(TAG, "Start app_main...");
|
||||
ESP_LOGI(TAG, "--------------------------------------------------------");
|
||||
ESP_LOGI(TAG, "--------------------------------------------------------");
|
||||
ESP_LOGI(TAG, "---------------------- BEGIN MAIN ----------------------");
|
||||
ESP_LOGI(TAG, "--------------------------------------------------------");
|
||||
ESP_LOGI(TAG, "--------------------------------------------------------");
|
||||
ESP_LOGI(TAG, "CONFIG_IDF_TARGET = %s", CONFIG_IDF_TARGET);
|
||||
ESP_LOGI(TAG, "LIBWOLFSSL_VERSION_STRING = %s", LIBWOLFSSL_VERSION_STRING);
|
||||
if (event_base == WIFI_EVENT && event_id == WIFI_EVENT_STA_START) {
|
||||
esp_wifi_connect();
|
||||
}
|
||||
else if (event_base == WIFI_EVENT &&
|
||||
event_id == WIFI_EVENT_STA_DISCONNECTED) {
|
||||
if (s_retry_num < EXAMPLE_ESP_MAXIMUM_RETRY) {
|
||||
esp_wifi_connect();
|
||||
s_retry_num++;
|
||||
ESP_LOGI(TAG, "retry to connect to the AP");
|
||||
}
|
||||
else {
|
||||
xEventGroupSetBits(s_wifi_event_group, WIFI_FAIL_BIT);
|
||||
}
|
||||
ESP_LOGI(TAG, "connect to the AP fail");
|
||||
}
|
||||
else if (event_base == IP_EVENT && event_id == IP_EVENT_STA_GOT_IP) {
|
||||
event = (ip_event_got_ip_t*) event_data;
|
||||
wifi_show_ip();
|
||||
s_retry_num = 0;
|
||||
xEventGroupSetBits(s_wifi_event_group, WIFI_CONNECTED_BIT);
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(WOLFSSL_MULTI_INSTALL_WARNING)
|
||||
ESP_LOGI(TAG, "");
|
||||
ESP_LOGI(TAG, "WARNING: Multiple wolfSSL installs found.");
|
||||
ESP_LOGI(TAG, "Check ESP-IDF and local project [components] directory.");
|
||||
ESP_LOGI(TAG, "");
|
||||
#endif
|
||||
int wifi_init_sta(void)
|
||||
{
|
||||
int ret = ESP_OK;
|
||||
|
||||
#if defined(LIBWOLFSSL_VERSION_GIT_HASH)
|
||||
ESP_LOGI(TAG, "LIBWOLFSSL_VERSION_GIT_HASH = %s", LIBWOLFSSL_VERSION_GIT_HASH);
|
||||
#endif
|
||||
s_wifi_event_group = xEventGroupCreate();
|
||||
|
||||
#if defined(LIBWOLFSSL_VERSION_GIT_SHORT_HASH )
|
||||
ESP_LOGI(TAG, "LIBWOLFSSL_VERSION_GIT_SHORT_HASH = %s", LIBWOLFSSL_VERSION_GIT_SHORT_HASH);
|
||||
#endif
|
||||
ESP_ERROR_CHECK(esp_netif_init());
|
||||
|
||||
#if defined(LIBWOLFSSL_VERSION_GIT_HASH_DATE)
|
||||
ESP_LOGI(TAG, "LIBWOLFSSL_VERSION_GIT_HASH_DATE = %s", LIBWOLFSSL_VERSION_GIT_HASH_DATE);
|
||||
#endif
|
||||
ESP_ERROR_CHECK(esp_event_loop_create_default());
|
||||
esp_netif_create_default_wifi_sta();
|
||||
|
||||
|
||||
/* some interesting settings are target specific (ESP32, -C3, -S3, etc */
|
||||
#if defined(CONFIG_IDF_TARGET_ESP32C3)
|
||||
/* not available for C3 at this time */
|
||||
#elif defined(CONFIG_IDF_TARGET_ESP32S3)
|
||||
ESP_LOGI(TAG, "CONFIG_ESP32S3_DEFAULT_CPU_FREQ_MHZ = %u MHz",
|
||||
CONFIG_ESP32S3_DEFAULT_CPU_FREQ_MHZ
|
||||
);
|
||||
ESP_LOGI(TAG, "Xthal_have_ccount = %u", Xthal_have_ccount);
|
||||
#else
|
||||
ESP_LOGI(TAG, "CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ = %u MHz",
|
||||
CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ
|
||||
);
|
||||
ESP_LOGI(TAG, "Xthal_have_ccount = %u", Xthal_have_ccount);
|
||||
#endif
|
||||
|
||||
/* all platforms: stack high water mark check */
|
||||
ESP_LOGI(TAG, "Stack HWM: %d\n", uxTaskGetStackHighWaterMark(NULL));
|
||||
|
||||
|
||||
ESP_ERROR_CHECK(nvs_flash_init());
|
||||
|
||||
ESP_LOGI(TAG, "Initialize wifi");
|
||||
#if (ESP_IDF_VERSION_MAJOR == 4 && ESP_IDF_VERSION_MINOR >= 1) || \
|
||||
(ESP_IDF_VERSION_MAJOR >= 5)
|
||||
esp_netif_init();
|
||||
#else
|
||||
tcpip_adapter_init();
|
||||
#endif
|
||||
|
||||
/* */
|
||||
#if ESP_IDF_VERSION_MAJOR >= 4
|
||||
ESP_ERROR_CHECK(esp_event_loop_create_default());
|
||||
/* This helper function configures Wi-Fi or Ethernet, as selected in menuconfig.
|
||||
* Read "Establishing Wi-Fi or Ethernet Connection" section in
|
||||
* examples/protocols/README.md for more information about this function.
|
||||
*/
|
||||
ESP_ERROR_CHECK(example_connect());
|
||||
#else
|
||||
wifi_event_group = xEventGroupCreate();
|
||||
ESP_ERROR_CHECK(esp_event_loop_init(wifi_event_handler, NULL));
|
||||
wifi_init_config_t cfg = WIFI_INIT_CONFIG_DEFAULT();
|
||||
ESP_ERROR_CHECK(esp_wifi_init(&cfg));
|
||||
|
||||
esp_event_handler_instance_t instance_any_id;
|
||||
esp_event_handler_instance_t instance_got_ip;
|
||||
ESP_ERROR_CHECK(esp_event_handler_instance_register(WIFI_EVENT,
|
||||
ESP_EVENT_ANY_ID,
|
||||
&event_handler,
|
||||
NULL,
|
||||
&instance_any_id));
|
||||
ESP_ERROR_CHECK(esp_event_handler_instance_register(IP_EVENT,
|
||||
IP_EVENT_STA_GOT_IP,
|
||||
&event_handler,
|
||||
NULL,
|
||||
&instance_got_ip));
|
||||
|
||||
wifi_config_t wifi_config = {
|
||||
.sta = {
|
||||
.ssid = TLS_SMP_WIFI_SSID,
|
||||
.password = TLS_SMP_WIFI_PASS,
|
||||
.ssid = EXAMPLE_ESP_WIFI_SSID,
|
||||
.password = EXAMPLE_ESP_WIFI_PASS,
|
||||
/* Authmode threshold resets to WPA2 as default if password matches
|
||||
* WPA2 standards (pasword len => 8). If you want to connect the
|
||||
* device to deprecated WEP/WPA networks, Please set the threshold
|
||||
* value WIFI_AUTH_WEP/WIFI_AUTH_WPA_PSK and set the password with
|
||||
* length and format matching to WIFI_AUTH_WEP/WIFI_AUTH_WPA_PSK
|
||||
* standards. */
|
||||
.threshold.authmode = ESP_WIFI_SCAN_AUTH_MODE_THRESHOLD,
|
||||
#ifdef HAS_WPA3_FEATURES
|
||||
.sae_pwe_h2e = WPA3_SAE_PWE_BOTH,
|
||||
#endif
|
||||
},
|
||||
};
|
||||
/* WiFi station mode */
|
||||
ESP_ERROR_CHECK(esp_wifi_set_mode(WIFI_MODE_STA) );
|
||||
/* Wifi Set the configuration of the ESP32 STA or AP */
|
||||
ESP_ERROR_CHECK(esp_wifi_set_config(ESP_IF_WIFI_STA, &wifi_config) );
|
||||
/* Start Wifi */
|
||||
ESP_ERROR_CHECK(esp_wifi_set_config(WIFI_IF_STA, &wifi_config) );
|
||||
|
||||
#ifdef CONFIG_EXAMPLE_WIFI_SSID
|
||||
if (XSTRCMP(CONFIG_EXAMPLE_WIFI_SSID, "myssid") == 0) {
|
||||
ESP_LOGW(TAG, "WARNING: CONFIG_EXAMPLE_WIFI_SSID is \"myssid\".");
|
||||
ESP_LOGW(TAG, " Do you have a WiFi AP called \"myssid\", ");
|
||||
ESP_LOGW(TAG, " or did you forget the ESP-IDF configuration?");
|
||||
}
|
||||
#else
|
||||
ESP_LOGW(TAG, "WARNING: CONFIG_EXAMPLE_WIFI_SSID not defined.");
|
||||
#endif
|
||||
|
||||
ESP_ERROR_CHECK(esp_wifi_start() );
|
||||
|
||||
ESP_LOGI(TAG, "wifi_init_sta finished.");
|
||||
ESP_LOGI(TAG, "connect to ap SSID:%s password:%s",
|
||||
TLS_SMP_WIFI_SSID, TLS_SMP_WIFI_PASS);
|
||||
|
||||
/* Waiting until either the connection is established (WIFI_CONNECTED_BIT)
|
||||
* or connection failed for the maximum number of re-tries (WIFI_FAIL_BIT).
|
||||
* The bits are set by event_handler() (see above) */
|
||||
EventBits_t bits = xEventGroupWaitBits(s_wifi_event_group,
|
||||
WIFI_CONNECTED_BIT | WIFI_FAIL_BIT,
|
||||
pdFALSE,
|
||||
pdFALSE,
|
||||
portMAX_DELAY);
|
||||
|
||||
/* xEventGroupWaitBits() returns the bits before the call returned,
|
||||
* hence we can test which event actually happened. */
|
||||
#if defined(SHOW_SSID_AND_PASSWORD)
|
||||
ESP_LOGW(TAG, "Undefine SHOW_SSID_AND_PASSWORD to not show SSID/password");
|
||||
if (bits & WIFI_CONNECTED_BIT) {
|
||||
ESP_LOGI(TAG, "connected to ap SSID:%s password:%s",
|
||||
EXAMPLE_ESP_WIFI_SSID,
|
||||
EXAMPLE_ESP_WIFI_PASS);
|
||||
}
|
||||
else if (bits & WIFI_FAIL_BIT) {
|
||||
ESP_LOGI(TAG, "Failed to connect to SSID:%s, password:%s",
|
||||
EXAMPLE_ESP_WIFI_SSID,
|
||||
EXAMPLE_ESP_WIFI_PASS);
|
||||
}
|
||||
else {
|
||||
ESP_LOGE(TAG, "UNEXPECTED EVENT");
|
||||
}
|
||||
#else
|
||||
if (bits & WIFI_CONNECTED_BIT) {
|
||||
ESP_LOGI(TAG, "Connected to AP");
|
||||
}
|
||||
else if (bits & WIFI_FAIL_BIT) {
|
||||
ESP_LOGI(TAG, "Failed to connect to AP");
|
||||
ret = -1;
|
||||
}
|
||||
else {
|
||||
ESP_LOGE(TAG, "AP UNEXPECTED EVENT");
|
||||
ret = -2;
|
||||
}
|
||||
#endif
|
||||
ESP_LOGI(TAG, "Set dummy time...");
|
||||
set_time();
|
||||
return ret;
|
||||
}
|
||||
|
||||
int wifi_show_ip(void)
|
||||
{
|
||||
/* ESP_LOGI(TAG, "got ip:" IPSTR, IP2STR(&event->ip_info.ip)); */
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
# to view: idf.py partition-table
|
||||
#
|
||||
# ESP-IDF Partition Table
|
||||
# Name, Type, SubType, Offset, Size, Flags
|
||||
nvs, data, nvs, 0x9000, 24K,
|
||||
phy_init,data, phy, 0xf000, 4K,
|
||||
factory, app, factory, 0x10000, 1500K,
|
||||
|
||||
|
||||
# For other settings, see:
|
||||
# https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/partition-tables.html#creating-custom-tables
|
||||
#
|
||||
# Here is the summary printed for the "Single factory app, no OTA" configuration:
|
||||
#
|
||||
# # ESP-IDF Partition Table
|
||||
# # Name, Type, SubType, Offset, Size, Flags
|
||||
# nvs, data, nvs, 0x9000, 0x6000,
|
||||
# phy_init, data, phy, 0xf000, 0x1000,
|
||||
# factory, app, factory, 0x10000, 1M,
|
||||
#
|
||||
#
|
||||
# Here is the summary printed for the "Factory app, two OTA definitions" configuration:
|
||||
#
|
||||
# # ESP-IDF Partition Table
|
||||
# # Name, Type, SubType, Offset, Size, Flags
|
||||
# nvs, data, nvs, 0x9000, 0x4000,
|
||||
# otadata, data, ota, 0xd000, 0x2000,
|
||||
# phy_init, data, phy, 0xf000, 0x1000,
|
||||
# factory, app, factory, 0x10000, 1M,
|
||||
# ota_0, app, ota_0, 0x110000, 1M,
|
||||
# ota_1, app, ota_1, 0x210000, 1M,
|
||||
|
Can't render this file because it contains an unexpected character in line 13 and column 39.
|
@@ -1,11 +1,96 @@
|
||||
# wolfSSL Espressif Example Project CMakeLists.txt
|
||||
# v1.0
|
||||
#
|
||||
# The following lines of boilerplate have to be in your project's
|
||||
# CMakeLists in this exact order for cmake to work correctly
|
||||
cmake_minimum_required(VERSION 3.5)
|
||||
cmake_minimum_required(VERSION 3.16)
|
||||
|
||||
# The wolfSSL CMake file should be able to find the source code.
|
||||
# Otherwise, assign an environment variable or set it here:
|
||||
#
|
||||
# set(WOLFSSL_ROOT "~/workspace/wolfssl-other-source")
|
||||
#
|
||||
# Optional WOLFSSL_CMAKE_SYSTEM_NAME detection to find
|
||||
# USE_MY_PRIVATE_CONFIG path for my_private_config.h
|
||||
#
|
||||
# Expected path varies:
|
||||
#
|
||||
# WSL: /mnt/c/workspace
|
||||
# Linux: ~/workspace
|
||||
# Windows: C:\workspace
|
||||
#
|
||||
if(WIN32)
|
||||
# Windows-specific configuration here
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_CMAKE_SYSTEM_NAME_WINDOWS")
|
||||
message("Detected Windows")
|
||||
endif()
|
||||
if(CMAKE_HOST_UNIX)
|
||||
message("Detected UNIX")
|
||||
endif()
|
||||
if(APPLE)
|
||||
message("Detected APPLE")
|
||||
endif()
|
||||
if(CMAKE_HOST_UNIX AND (NOT APPLE) AND EXISTS "/proc/sys/fs/binfmt_misc/WSLInterop")
|
||||
# Windows-specific configuration here
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_CMAKE_SYSTEM_NAME_WSL")
|
||||
message("Detected WSL")
|
||||
endif()
|
||||
if(CMAKE_HOST_UNIX AND (NOT APPLE) AND (NOT WIN32))
|
||||
# Windows-specific configuration here
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_CMAKE_SYSTEM_NAME_LINUX")
|
||||
message("Detected Linux")
|
||||
endif()
|
||||
if(APPLE)
|
||||
# Windows-specific configuration here
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_CMAKE_SYSTEM_NAME_APPLE")
|
||||
message("Detected Apple")
|
||||
endif()
|
||||
# End optional WOLFSSL_CMAKE_SYSTEM_NAME
|
||||
|
||||
# (Not part of the boilerplate)
|
||||
# This example uses an extra component for common functions such as Wi-Fi and Ethernet connection.
|
||||
# disable the following line if there isn't the directory
|
||||
set(EXTRA_COMPONENT_DIRS $ENV{IDF_PATH}/examples/common_components/protocol_examples_common)
|
||||
set (PROTOCOL_EXAMPLES_DIR $ENV{IDF_PATH}/examples/common_components/protocol_examples_common)
|
||||
|
||||
if (EXISTS "${PROTOCOL_EXAMPLES_DIR}")
|
||||
message("Found PROTOCOL_EXAMPLES_DIR=${PROTOCOL_EXAMPLES_DIR}")
|
||||
set(EXTRA_COMPONENT_DIRS $ENV{IDF_PATH}/examples/common_components/protocol_examples_common)
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DFOUND_PROTOCOL_EXAMPLES_DIR")
|
||||
else()
|
||||
message("NOT FOUND: PROTOCOL_EXAMPLES_DIR=${PROTOCOL_EXAMPLES_DIR}")
|
||||
endif()
|
||||
|
||||
# Check that there are not conflicting wolfSSL components
|
||||
# The ESP Registry Component will be in ./managed_components/wolfssl__wolfssl
|
||||
# The local component wolfSSL directory will be in ./components/wolfssl
|
||||
if( EXISTS "${CMAKE_HOME_DIRECTORY}/managed_components/wolfssl__wolfssl" AND EXISTS "${CMAKE_HOME_DIRECTORY}/components/wolfssl" )
|
||||
# These exclude statements don't seem to be honored by the $ENV{IDF_PATH}/tools/cmake/project.cmake'
|
||||
# add_subdirectory("${CMAKE_HOME_DIRECTORY}/managed_components/wolfssl__wolfssl" EXCLUDE_FROM_ALL)
|
||||
# add_subdirectory("${CMAKE_HOME_DIRECTORY}/managed_components/wolfssl__wolfssl/include" EXCLUDE_FROM_ALL)
|
||||
# So we'll error out and let the user decide how to proceed:
|
||||
message(WARNING "\nFound wolfSSL components in\n"
|
||||
"./managed_components/wolfssl__wolfssl\n"
|
||||
"and\n"
|
||||
"./components/wolfssl\n"
|
||||
"in project directory: \n"
|
||||
"${CMAKE_HOME_DIRECTORY}")
|
||||
message(FATAL_ERROR "\nPlease use either the ESP Registry Managed Component or the wolfSSL component directory but not both.\n"
|
||||
"If removing the ./managed_components/wolfssl__wolfssl directory, remember to also remove "
|
||||
"or rename the idf_component.yml file typically found in ./main/")
|
||||
else()
|
||||
message(STATUS "No conflicting wolfSSL components found.")
|
||||
endif()
|
||||
|
||||
|
||||
# This example uses an extra component for common functions such as Wi-Fi and Ethernet connection.
|
||||
set (PROTOCOL_EXAMPLES_DIR $ENV{IDF_PATH}/examples/common_components/protocol_examples_common)
|
||||
|
||||
if (EXISTS "${PROTOCOL_EXAMPLES_DIR}")
|
||||
message("Found PROTOCOL_EXAMPLES_DIR=${PROTOCOL_EXAMPLES_DIR}")
|
||||
set(EXTRA_COMPONENT_DIRS $ENV{IDF_PATH}/examples/common_components/protocol_examples_common)
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DFOUND_PROTOCOL_EXAMPLES_DIR")
|
||||
else()
|
||||
message("NOT FOUND: PROTOCOL_EXAMPLES_DIR=${PROTOCOL_EXAMPLES_DIR}")
|
||||
endif()
|
||||
|
||||
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
|
||||
|
||||
project(wolfssl_server)
|
||||
|
||||
@@ -1,8 +1,23 @@
|
||||
# wolfSSL Server Example
|
||||
# wolfSSL TLS Server Example
|
||||
|
||||
This is the wolfSSL TLS Server demo, typically used with the [Espressif TLS Client](../wolfssl_client/README.md)
|
||||
or the CLI [Client](https://github.com/wolfSSL/wolfssl/tree/master/examples/client).
|
||||
|
||||
When using the CLI, see the [example parameters](/IDE/Espressif/ESP-IDF/examples#interaction-with-wolfssl-cli).
|
||||
|
||||
For general information on [wolfSSL examples for Espressif](../README.md), see the
|
||||
[README](https://github.com/wolfSSL/wolfssl/blob/master/IDE/Espressif/ESP-IDF/README.md) file.
|
||||
|
||||
## VisualGDB
|
||||
|
||||
Open the VisualGDB Visual Studio Project file in the VisualGDB directory and click the "Start" button.
|
||||
No wolfSSL setup is needed. You may need to adjust your specific COM port. The default is `COM20`.
|
||||
|
||||
## ESP-IDF Commandline
|
||||
|
||||
The Example contains a wolfSSL simple server.
|
||||
|
||||
1. `idf.py menuconfigure` to configure the project
|
||||
1. `idf.py menuconfig` to configure the project
|
||||
|
||||
1-1. Example Connection Configuration ->
|
||||
|
||||
@@ -20,3 +35,77 @@ When you want to test the wolfSSL simple server demo
|
||||
e.g ./example/client/client -h xx.xx.xx
|
||||
|
||||
See the README.md file in the upper level 'examples' directory for more information about examples.
|
||||
|
||||
|
||||
```
|
||||
# . /mnt/c/SysGCC/esp32/esp-idf/master/export.sh
|
||||
. /mnt/c/SysGCC/esp32/esp-idf/v5.1/export.sh
|
||||
cd /mnt/c/workspace/wolfssl-$USER/IDE/Espressif/ESP-IDF/examples/wolfssl_server
|
||||
|
||||
# optionally erase
|
||||
idf.py erase-flash -p /dev/ttyS19 -b 115200
|
||||
|
||||
# Program flash
|
||||
idf.py flash -p /dev/ttyS19 -b 115200 monitor
|
||||
```
|
||||
|
||||
|
||||
Linux Client to x108 SM server
|
||||
|
||||
```
|
||||
cd /mnt/c/workspace/wolfssl-$USER
|
||||
|
||||
# show the ciphers
|
||||
./examples/client/client -e
|
||||
|
||||
./examples/client/client -h 192.168.1.108 -v 4 -l TLS_SM4_GCM_SM3 -c ./certs/sm2/client-sm2.pem -k ./certs/sm2/client-sm2-priv.pem -A ./certs/sm2/root-sm2.pem -C
|
||||
```
|
||||
|
||||
|
||||
Linux Server
|
||||
|
||||
```
|
||||
./examples/server/server -v 4 -l TLS13-SM4-CCM-SM3 -c ./certs/sm2/server-sm2.pem -k ./certs/sm2/server-sm2-priv.pem -A ./certs/sm2/client-sm2.pem -V
|
||||
```
|
||||
|
||||
|
||||
Cipers to consider
|
||||
|
||||
```
|
||||
TLS13-AES128-GCM-SHA256:
|
||||
TLS13-AES256-GCM-SHA384:
|
||||
TLS13-CHACHA20-POLY1305-SHA256:
|
||||
|
||||
TLS13-SM4-GCM-SM3:
|
||||
TLS13-SM4-CCM-SM3:
|
||||
ECDHE-ECDSA-SM4-CBC-SM3:
|
||||
ECDHE-ECDSA-SM4-GCM-SM3:
|
||||
ECDHE-ECDSA-SM4-CCM-SM3
|
||||
|
||||
DHE-RSA-AES128-SHA:
|
||||
DHE-RSA-AES256-SHA:
|
||||
ECDHE-RSA-AES128-SHA:
|
||||
ECDHE-RSA-AES256-SHA:
|
||||
ECDHE-ECDSA-AES128-SHA:
|
||||
ECDHE-ECDSA-AES256-SHA:
|
||||
DHE-RSA-AES128-SHA256:
|
||||
DHE-RSA-AES256-SHA256:
|
||||
DHE-RSA-AES128-GCM-SHA256:
|
||||
DHE-RSA-AES256-GCM-SHA384:
|
||||
ECDHE-RSA-AES128-GCM-SHA256:
|
||||
ECDHE-RSA-AES256-GCM-SHA384:
|
||||
ECDHE-ECDSA-AES128-GCM-SHA256:
|
||||
ECDHE-ECDSA-AES256-GCM-SHA384:
|
||||
ECDHE-RSA-AES128-SHA256:
|
||||
ECDHE-ECDSA-AES128-SHA256:
|
||||
ECDHE-RSA-AES256-SHA384:
|
||||
ECDHE-ECDSA-AES256-SHA384:
|
||||
ECDHE-RSA-CHACHA20-POLY1305:
|
||||
ECDHE-ECDSA-CHACHA20-POLY1305:
|
||||
DHE-RSA-CHACHA20-POLY1305:
|
||||
ECDHE-RSA-CHACHA20-POLY1305-OLD:
|
||||
ECDHE-ECDSA-CHACHA20-POLY1305-OLD:
|
||||
DHE-RSA-CHACHA20-POLY1305-OLD:
|
||||
```
|
||||
|
||||
See the README.md file in the upper level 'examples' directory for [more information about examples](../README.md).
|
||||
|
||||
@@ -0,0 +1,512 @@
|
||||
# SM Cipher Notes
|
||||
|
||||
|
||||
### Install SM
|
||||
```
|
||||
cd /mnt/c/workspace/wolfsm-$USER
|
||||
./install.sh ../wolfssl-$USER
|
||||
```
|
||||
|
||||
|
||||
### Build Linux SM Examples
|
||||
```
|
||||
./autogen.sh
|
||||
./configure --enable-sm3 --enable-sm4-gcm --enable-sm2 \
|
||||
--enable-sm4-ecb --enable-sm4-cbc --enable-sm4-ctr \
|
||||
--enable-sm4-gcm --enable-sm4-ccm
|
||||
make clean && make
|
||||
```
|
||||
|
||||
### TLS 1.3 Server
|
||||
|
||||
```
|
||||
./examples/server/server -v 4 -b -d -p 11111 -c ./certs/sm2/server-sm2.pem -k ./certs/sm2/server-sm2-priv.pem -A ./certs/sm2/client-sm2.pem -V
|
||||
```
|
||||
|
||||
### TLS 1.3 Client
|
||||
|
||||
```
|
||||
./examples/client/client -h 127.0.0.1 -v 4 -l TLS13-SM4-CCM-SM3 -c ./certs/sm2/client-sm2.pem -k ./certs/sm2/client-sm2-priv.pem -A ./certs/sm2/root-sm2.pem -C
|
||||
```
|
||||
|
||||
### TLS 1.2 Client to Local Linux Server
|
||||
|
||||
```
|
||||
./examples/client/client -h 192.168.25.186 -v 3 -l ECDHE-ECDSA-SM4-CBC-SM3 \
|
||||
-c ./certs/sm2/client-sm2.pem \
|
||||
-k ./certs/sm2/client-sm2-priv.pem \
|
||||
-A ./certs/sm2/root-sm2.pem -C
|
||||
```
|
||||
|
||||
### TLS 1.2 Client to ESP32 Server
|
||||
|
||||
```
|
||||
./examples/client/client -h 192.168.25.186 -v 3 -l ECDHE-ECDSA-SM4-CBC-SM3 \
|
||||
-c ./certs/sm2/client-sm2.pem \
|
||||
-k ./certs/sm2/client-sm2-priv.pem \
|
||||
-A ./certs/sm2/root-sm2.pem -C
|
||||
```
|
||||
### Others...
|
||||
|
||||
```
|
||||
# Success: Linux Client to ESP32 Server TLS1.2
|
||||
./examples/client/client -h 192.168.1.113 -v 3 -l ECDHE-ECDSA-SM4-CBC-SM3 -c ./certs/sm2/client-sm2.pem -k ./certs/sm2/client-sm2-priv.pem -A ./certs/sm2/root-sm2.pem -C
|
||||
./examples/client/client -h 192.168.1.113 -v 3 -l ECDHE-ECDSA-SM4-GCM-SM3 -c ./certs/sm2/client-sm2.pem -k ./certs/sm2/client-sm2-priv.pem -A ./certs/sm2/root-sm2.pem -C
|
||||
./examples/client/client -h 192.168.1.113 -v 3 -l ECDHE-ECDSA-SM4-CCM-SM3 -c ./certs/sm2/client-sm2.pem -k ./certs/sm2/client-sm2-priv.pem -A ./certs/sm2/root-sm2.pem -C
|
||||
|
||||
# Success: Linux Client to ESP32 Server TLS1.3
|
||||
|
||||
# Reported as TLS_SM4_GCM_SM3, but parameter is TLS13-SM4-GCM-SM3
|
||||
./examples/client/client -h 192.168.1.113 -v 4 -l TLS13-SM4-GCM-SM3 -c ./certs/sm2/client-sm2.pem -k ./certs/sm2/client-sm2-priv.pem -A ./certs/sm2/root-sm2.pem -C
|
||||
|
||||
# Reported as TLS-SM4-CCM-SM3, but parameter is TLS13-SM4-CCM-SM3
|
||||
./examples/client/client -h 192.168.1.113 -v 4 -l TLS13-SM4-CCM-SM3 -c ./certs/sm2/client-sm2.pem -k ./certs/sm2/client-sm2-priv.pem -A ./certs/sm2/root-sm2.pem -C
|
||||
|
||||
./examples/client/client -h 192.168.1.113 -v 4 -l TLS13-SM4-CBC-SM3 -c ./certs/sm2/client-sm2.pem -k ./certs/sm2/client-sm2-priv.pem -A ./certs/sm2/root-sm2.pem -C
|
||||
|
||||
```
|
||||
|
||||
```
|
||||
ESP32-to-ESP32
|
||||
TLS_ECDHE_ECDSA_WITH_SM4_CBC_SM3
|
||||
TLS_ECDHE_ECDSA_WITH_SM4_GCM_SM3
|
||||
TLS_ECDHE_ECDSA_WITH_SM4_CCM_SM3
|
||||
```
|
||||
|
||||
Tried both PEM and DER format.
|
||||
|
||||
The latest server is PEM format, triple-checked to have the embedded server
|
||||
be the same as the Linux server files.
|
||||
|
||||
|
||||
| Usage | Certificate | Key | Certificate Authority file, default ./certs/client-cert.pem |
|
||||
| ----- | ---------------------------------- | ----------------------------------- | --------------------------------- |
|
||||
| server | -c ./certs/sm2/server-sm2.pem | -k ./certs/sm2/server-sm2-priv.pem | -A ./certs/sm2/client-sm2.pem -V |
|
||||
| client | -c ./certs/sm2/client-sm2.pem | -k ./certs/sm2/client-sm2-priv.pem | -A ./certs/sm2/root-sm2.pem -C |
|
||||
| emdedded:
|
||||
| server | wolfSSL_CTX_use_certificate_buffer<br/> server_sm2 | wolfSSL_CTX_use_PrivateKey_buffer<br/> server_sm2_priv | wolfSSL_CTX_load_verify_buffer<br/> client-sm2 |
|
||||
|
||||
### Code
|
||||
|
||||
See [source code](https://github.com/gojimmypi/wolfssl/blob/2c4f443aec7b151f945cb9dfe2dad6ee30449cf0/IDE/Espressif/ESP-IDF/examples/wolfssl_server/main/server-tls.c#L187):
|
||||
|
||||

|
||||
|
||||
|
||||
### Linux client talking to embedded server:
|
||||
|
||||
```
|
||||
/examples/client/client -h 192.168.1.108 -v 3 -l ECDHE-ECDSA-SM4-CBC-SM3 -c ./certs/sm2/client-sm2.pem -k ./certs/sm2/client-sm2-priv.pem -A ./certs/sm2/root-sm2.pem -C
|
||||
wolfSSL_connect error -188, ASN no signer error to confirm failure
|
||||
wolfSSL error: wolfSSL_connect failed
|
||||
```
|
||||
|
||||
Output:
|
||||
```
|
||||
ets Jul 29 2019 12:21:46
|
||||
|
||||
rst:0x3 (SW_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
|
||||
configsip: 0, SPIWP:0xee
|
||||
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
|
||||
mode:DIO, clock div:2
|
||||
load:0x3fff0030,len:7000
|
||||
load:0x40078000,len:15452
|
||||
ho 0 tail 12 room 4
|
||||
load:0x40080400,len:3840
|
||||
entry 0x4008064c
|
||||
I (29) boot: ESP-IDF v5.0-dirty 2nd stage bootloader
|
||||
I (29) boot: compile time 13:40:31
|
||||
I (29) boot: chip revision: v3.0
|
||||
I (32) boot_comm: chip revision: 3, min. bootloader chip revision: 0
|
||||
I (39) boot.esp32: SPI Speed : 40MHz
|
||||
I (44) boot.esp32: SPI Mode : DIO
|
||||
I (48) boot.esp32: SPI Flash Size : 2MB
|
||||
I (53) boot: Enabling RNG early entropy source...
|
||||
I (58) boot: Partition Table:
|
||||
I (62) boot: ## Label Usage Type ST Offset Length
|
||||
I (69) boot: 0 nvs WiFi data 01 02 00009000 00006000
|
||||
I (77) boot: 1 phy_init RF data 01 01 0000f000 00001000
|
||||
I (84) boot: 2 factory factory app 00 00 00010000 00177000
|
||||
I (92) boot: End of partition table
|
||||
I (96) boot_comm: chip revision: 3, min. application chip revision: 0
|
||||
I (103) esp_image: segment 0: paddr=00010020 vaddr=3f400020 size=338d8h (211160) map
|
||||
I (188) esp_image: segment 1: paddr=00043900 vaddr=3ffb0000 size=03b78h ( 15224) load
|
||||
I (194) esp_image: segment 2: paddr=00047480 vaddr=40080000 size=08b98h ( 35736) load
|
||||
I (209) esp_image: segment 3: paddr=00050020 vaddr=400d0020 size=c591ch (809244) map
|
||||
I (501) esp_image: segment 4: paddr=00115944 vaddr=40088b98 size=0c230h ( 49712) load
|
||||
I (522) esp_image: segment 5: paddr=00121b7c vaddr=50000000 size=00010h ( 16) load
|
||||
I (533) boot: Loaded app from partition at offset 0x10000
|
||||
I (533) boot: Disabling RNG early entropy source...
|
||||
I (545) cpu_start: Pro cpu up.
|
||||
I (545) cpu_start: Starting app cpu, entry point is 0x400812f4
|
||||
I (532) cpu_start: App cpu up.
|
||||
I (561) cpu_start: Pro cpu start user code
|
||||
I (561) cpu_start: cpu freq: 160000000 Hz
|
||||
I (561) cpu_start: Application information:
|
||||
I (566) cpu_start: Project name: wolfssl_server
|
||||
I (571) cpu_start: App version: v5.6.3-stable-1088-g560c84b2b-d
|
||||
I (578) cpu_start: Compile time: Jul 19 2023 22:20:09
|
||||
I (585) cpu_start: ELF file SHA256: 3e6e571c9e87bf44...
|
||||
I (591) cpu_start: ESP-IDF: v5.0-dirty
|
||||
I (596) heap_init: Initializing. RAM available for dynamic allocation:
|
||||
I (603) heap_init: At 3FFAE6E0 len 00001920 (6 KiB): DRAM
|
||||
I (609) heap_init: At 3FFBDA68 len 00022598 (137 KiB): DRAM
|
||||
I (615) heap_init: At 3FFE0440 len 00003AE0 (14 KiB): D/IRAM
|
||||
I (622) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM
|
||||
I (628) heap_init: At 40094DC8 len 0000B238 (44 KiB): IRAM
|
||||
I (636) spi_flash: detected chip: generic
|
||||
I (639) spi_flash: flash io: dio
|
||||
W (643) spi_flash: Detected size(4096k) larger than the size in the binary image header(2048k). Using the
|
||||
size in the binary image header.
|
||||
I (657) cpu_start: Starting scheduler on PRO CPU.
|
||||
I (0) cpu_start: Starting scheduler on APP CPU.
|
||||
I (725) tls_server: ESP_WIFI_MODE_STA
|
||||
I (735) wifi:wifi driver task: 3ffcb738, prio:23, stack:6656, core=0
|
||||
I (735) system_api: Base MAC address is not set
|
||||
I (735) system_api: read default base MAC address from EFUSE
|
||||
I (755) wifi:wifi firmware version: 0d470ef
|
||||
I (755) wifi:wifi certification version: v7.0
|
||||
I (755) wifi:config NVS flash: enabled
|
||||
I (755) wifi:config nano formating: disabled
|
||||
I (755) wifi:Init data frame dynamic rx buffer num: 32
|
||||
I (765) wifi:Init management frame dynamic rx buffer num: 32
|
||||
I (765) wifi:Init management short buffer num: 32
|
||||
I (775) wifi:Init dynamic tx buffer num: 32
|
||||
I (775) wifi:Init static rx buffer size: 1600
|
||||
I (775) wifi:Init static rx buffer num: 10
|
||||
I (785) wifi:Init dynamic rx buffer num: 32
|
||||
I (785) wifi_init: rx ba win: 6
|
||||
I (795) wifi_init: tcpip mbox: 32
|
||||
I (795) wifi_init: udp mbox: 6
|
||||
I (795) wifi_init: tcp mbox: 6
|
||||
I (805) wifi_init: tcp tx win: 5744
|
||||
I (805) wifi_init: tcp rx win: 5744
|
||||
I (815) wifi_init: tcp mss: 1440
|
||||
I (815) wifi_init: WiFi IRAM OP enabled
|
||||
I (815) wifi_init: WiFi RX IRAM OP enabled
|
||||
I (825) phy_init: phy_version 4670,719f9f6,Feb 18 2021,17:07:07
|
||||
I (925) wifi:mode : sta (24:d7:eb:41:7b:68)
|
||||
I (935) wifi:enable tsf
|
||||
I (935) tls_server: wifi_init_sta finished.
|
||||
I (945) wifi:new:<4,0>, old:<1,0>, ap:<255,255>, sta:<4,0>, prof:1
|
||||
I (945) wifi:state: init -> auth (b0)
|
||||
I (945) wifi:state: auth -> assoc (0)
|
||||
I (955) wifi:state: assoc -> run (10)
|
||||
W (955) wifi:<ba-add>idx:0 (ifx:0, c8:d7:19:cd:00:17), tid:0, ssn:0, winSize:64
|
||||
I (985) wifi:connected with testbench, aid = 1, channel 4, BW20, bssid = c8:d7:19:cd:00:17
|
||||
I (985) wifi:security: WPA2-PSK, phy: bgn, rssi: -45
|
||||
I (995) wifi:pm start, type: 1
|
||||
|
||||
I (1065) wifi:AP's beacon interval = 102400 us, DTIM period = 1
|
||||
I (3225) esp_netif_handlers: sta ip: 192.168.1.108, mask: 255.255.255.0, gw: 192.168.1.10
|
||||
I (3225) tls_server: got ip:192.168.1.108
|
||||
I (3235) Time Helper: sntp_setservername:
|
||||
I (3235) Time Helper: pool.ntp.org
|
||||
I (3245) Time Helper: time.nist.gov
|
||||
I (3245) Time Helper: utcnist.colorado.edu
|
||||
I (3255) Time Helper: sntp_init done.
|
||||
TLS13-AES128-GCM-SHA256:TLS13-CHACHA20-POLY1305-SHA256:TLS13-SM4-GCM-SM3:TLS13-SM4-CCM-SM3:ECDHE-RSA-AES12
|
||||
8-SHA:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-ECDSA-AES256-SHA:ECDHE-RSA-DES-CBC3-SHA:ECDHE-ECDS
|
||||
A-DES-CBC3-SHA:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-ECD
|
||||
SA-AES128-SHA256:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305-OLD
|
||||
:ECDHE-ECDSA-CHACHA20-POLY1305-OLD:ECDHE-ECDSA-SM4-CBC-SM3:ECDHE-ECDSA-SM4-GCM-SM3:ECDHE-ECDSA-SM4-CCM-SM3
|
||||
:ECDHE-PSK-AES128-CBC-SHA256:ECDHE-PSK-AES128-GCM-SHA256:PSK-CHACHA20-POLY1305:ECDHE-PSK-CHACHA20-POLY1305
|
||||
I (3315) wolfssl: Start wolfSSL_Init()
|
||||
I (3315) wolfssl: wolfSSL Entering wolfSSL_Init
|
||||
I (3325) wolfssl: wolfSSL Entering wolfCrypt_Init
|
||||
I (3325) wolfssl: start socket())
|
||||
I (3335) wolfssl: Create and initialize WOLFSSL_CTX
|
||||
I (3335) wolfssl: wolfSSL Entering wolfSSLv23_server_method_ex
|
||||
I (3345) wolfssl: wolfSSL Entering wolfSSL_CTX_new_ex
|
||||
I (3345) wolfssl: wolfSSL Entering wolfSSL_CertManagerNew
|
||||
I (3355) wolfssl: wolfSSL Leaving wolfSSL_CTX_new_ex, return 0
|
||||
I (3365) tls_server: Start SM2
|
||||
|
||||
I (3365) wolfssl: wolfSSL Entering wolfSSL_CTX_set_cipher_list
|
||||
I (3375) tls_server: Set cipher list: ECDHE-ECDSA-SM4-CBC-SM3
|
||||
|
||||
TLS13-AES128-GCM-SHA256:TLS13-CHACHA20-POLY1305-SHA256:TLS13-SM4-GCM-SM3:TLS13-SM4-CCM-SM3:ECDHE-RSA-AES12
|
||||
8-SHA:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-ECDSA-AES256-SHA:ECDHE-RSA-DES-CBC3-SHA:ECDHE-ECDS
|
||||
A-DES-CBC3-SHA:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-ECD
|
||||
SA-AES128-SHA256:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305-OLD
|
||||
:ECDHE-ECDSA-CHACHA20-POLY1305-OLD:ECDHE-ECDSA-SM4-CBC-SM3:ECDHE-ECDSA-SM4-GCM-SM3:ECDHE-ECDSA-SM4-CCM-SM3
|
||||
:ECDHE-PSK-AES128-CBC-SHA256:ECDHE-PSK-AES128-GCM-SHA256:PSK-CHACHA20-POLY1305:ECDHE-PSK-CHACHA20-POLY1305
|
||||
I (3435) wolfssl: Loading certificate...
|
||||
I (3435) wolfssl: wolfSSL Entering wolfSSL_CTX_use_certificate_buffer
|
||||
I (3445) wolfssl: wolfSSL Entering PemToDer
|
||||
I (3455) wolfssl: Checking cert signature type
|
||||
I (3455) wolfssl: wolfSSL Entering GetExplicitVersion
|
||||
I (3465) wolfssl: wolfSSL Entering wc_GetSerialNumber
|
||||
I (3465) wolfssl: Got Cert Header
|
||||
I (3475) wolfssl: wolfSSL Entering GetObjectId
|
||||
I (3475) wolfssl: Got Algo ID
|
||||
I (3475) wolfssl: Getting Name
|
||||
I (3485) wolfssl: Getting Cert Name
|
||||
I (3485) wolfssl: Getting Name
|
||||
I (3495) wolfssl: Getting Cert Name
|
||||
I (3495) wolfssl: Got Subject Name
|
||||
I (3495) wolfssl: wolfSSL Entering GetAlgoId
|
||||
I (3505) wolfssl: wolfSSL Entering GetObjectId
|
||||
I (3505) wolfssl: wolfSSL Entering GetObjectId
|
||||
I (3515) wolfssl: Got Key
|
||||
I (3515) wolfssl: ECDSA/ED25519/ED448 cert signature
|
||||
I (3525) wolfssl: wolfSSL Leaving wolfSSL_CTX_use_certificate_buffer, return 1
|
||||
I (3535) tls_server: Loaded server_sm2
|
||||
|
||||
I (3535) wolfssl: Loading key info...
|
||||
I (3535) wolfssl: wolfSSL Entering wolfSSL_CTX_use_PrivateKey_buffer
|
||||
I (3545) wolfssl: wolfSSL Entering PemToDer
|
||||
I (3555) wolfssl: wolfSSL Entering GetAlgoId
|
||||
I (3555) wolfssl: wolfSSL Entering GetObjectId
|
||||
I (3565) wolfssl: wolfSSL Entering GetAlgoId
|
||||
I (3565) wolfssl: wolfSSL Entering GetObjectId
|
||||
I (3575) wolfssl: wolfSSL Leaving wolfSSL_CTX_use_PrivateKey_buffer, return 1
|
||||
I (3575) tls_server: Loaded PrivateKey_buffer server_sm2_priv
|
||||
|
||||
I (3585) wolfssl: wolfSSL Entering wolfSSL_CTX_load_verify_buffer_ex
|
||||
I (3595) wolfssl: Processing CA PEM file
|
||||
I (3595) wolfssl: wolfSSL Entering PemToDer
|
||||
I (3605) wolfssl: Adding a CA
|
||||
I (3605) wolfssl: wolfSSL Entering GetExplicitVersion
|
||||
I (3615) wolfssl: wolfSSL Entering wc_GetSerialNumber
|
||||
I (3615) wolfssl: Got Cert Header
|
||||
I (3625) wolfssl: wolfSSL Entering GetObjectId
|
||||
I (3625) wolfssl: Got Algo ID
|
||||
I (3635) wolfssl: Getting Name
|
||||
I (3635) wolfssl: Getting Cert Name
|
||||
I (3635) wolfssl: Getting Name
|
||||
I (3645) wolfssl: Getting Cert Name
|
||||
I (3645) wolfssl: Got Subject Name
|
||||
I (3655) wolfssl: wolfSSL Entering GetAlgoId
|
||||
I (3655) wolfssl: wolfSSL Entering GetObjectId
|
||||
I (3665) wolfssl: wolfSSL Entering GetObjectId
|
||||
I (3665) wolfssl: Got Key
|
||||
I (3665) wolfssl: Parsed Past Key
|
||||
I (3675) wolfssl: wolfSSL Entering DecodeCertExtensions
|
||||
I (3675) wolfssl: wolfSSL Entering GetObjectId
|
||||
I (3685) wolfssl: wolfSSL Entering DecodeSubjKeyId
|
||||
I (3685) wolfssl: wolfSSL Entering GetObjectId
|
||||
I (3695) wolfssl: wolfSSL Entering DecodeAuthKeyId
|
||||
I (3705) wolfssl: wolfSSL Entering GetObjectId
|
||||
I (3705) wolfssl: wolfSSL Entering DecodeBasicCaConstraint
|
||||
I (3715) wolfssl: wolfSSL Entering GetObjectId
|
||||
I (3715) wolfssl: wolfSSL Entering DecodeAltNames
|
||||
I (3725) wolfssl: Unsupported name type, skipping
|
||||
I (3725) wolfssl: wolfSSL Entering GetObjectId
|
||||
I (3735) wolfssl: wolfSSL Entering DecodeExtKeyUsage
|
||||
I (3735) wolfssl: wolfSSL Entering GetObjectId
|
||||
I (3745) wolfssl: wolfSSL Entering GetObjectId
|
||||
I (3745) wolfssl: wolfSSL Entering GetObjectId
|
||||
I (3755) wolfssl: Parsed new CA
|
||||
I (3755) wolfssl: No key size check done on CA
|
||||
I (3765) wolfssl: Freeing Parsed CA
|
||||
I (3765) wolfssl: Freeing der CA
|
||||
I (3775) wolfssl: OK Freeing der CA
|
||||
I (3775) wolfssl: wolfSSL Leaving AddCA, return 0
|
||||
I (3785) wolfssl: Processed a CA
|
||||
I (3785) wolfssl: Processed at least one valid CA. Other stuff OK
|
||||
I (3795) wolfssl: wolfSSL Leaving wolfSSL_CTX_load_verify_buffer_ex, return 1
|
||||
I (3795) tls_server: Success: load verify buffer
|
||||
|
||||
I (3805) tls_server: Finish SM2
|
||||
|
||||
I (3805) tls_server: accept clients...
|
||||
I (3815) wolfssl: Waiting for a connection...
|
||||
I (14485) wolfssl: wolfSSL Entering wolfSSL_new
|
||||
I (14495) wolfssl: wolfSSL Entering ReinitSSL
|
||||
I (14495) wolfssl: wolfSSL Entering SetSSL_CTX
|
||||
I (14495) wolfssl: wolfSSL Entering wolfSSL_NewSession
|
||||
I (14505) wolfssl: wolfSSL Leaving wolfSSL_new, return 0
|
||||
I (14505) wolfssl: wolfSSL Entering wolfSSL_set_fd
|
||||
I (14515) wolfssl: wolfSSL Entering wolfSSL_set_read_fd
|
||||
I (14515) wolfssl: wolfSSL Leaving wolfSSL_set_read_fd, return 1
|
||||
I (14525) wolfssl: wolfSSL Entering wolfSSL_set_write_fd
|
||||
I (14535) wolfssl: wolfSSL Leaving wolfSSL_set_write_fd, return 1
|
||||
I (14535) wolfssl: wolfSSL Entering wolfSSL_accept
|
||||
I (14545) wolfssl: wolfSSL Entering ReinitSSL
|
||||
I (14545) wolfssl: growing input buffer
|
||||
I (14555) wolfssl: received record layer msg
|
||||
I (14555) wolfssl: got HANDSHAKE
|
||||
I (14565) wolfssl: wolfSSL Entering wolfSSL_get_options
|
||||
I (14565) wolfssl: wolfSSL Entering DoTls13HandShakeMsg
|
||||
I (14575) wolfssl: wolfSSL Entering DoTls13HandShakeMsgType
|
||||
I (14575) wolfssl: processing client hello
|
||||
I (14585) wolfssl: wolfSSL Entering DoTls13ClientHello
|
||||
I (14595) wolfssl: wolfSSL Entering DoClientHello
|
||||
I (14595) wolfssl: downgrading to TLSv1.2
|
||||
I (14605) wolfssl: Matched No Compression
|
||||
I (14605) wolfssl: Adding signature algorithms extension
|
||||
I (14615) wolfssl: Signature Algorithms extension received
|
||||
I (14615) wolfssl: Point Formats extension received
|
||||
I (14625) wolfssl: Supported Groups extension received
|
||||
I (14625) wolfssl: Unknown TLS extension type
|
||||
I (14635) wolfssl: Unknown TLS extension type
|
||||
I (14635) wolfssl: wolfSSL Entering MatchSuite
|
||||
I (14645) wolfssl: wolfSSL Entering VerifyServerSuite
|
||||
I (14645) wolfssl: Requires ECC
|
||||
I (14655) wolfssl: Verified suite validity
|
||||
I (14655) wolfssl: wolfSSL Leaving DoClientHello, return 0
|
||||
I (14665) wolfssl: wolfSSL Leaving DoTls13ClientHello, return 0
|
||||
I (14675) wolfssl: wolfSSL Leaving DoTls13HandShakeMsgType(), return 0
|
||||
I (14675) wolfssl: wolfSSL Leaving DoTls13HandShakeMsg, return 0
|
||||
I (14685) wolfssl: Shrinking input buffer
|
||||
I (14685) wolfssl: accept state ACCEPT_CLIENT_HELLO_DONE
|
||||
I (14695) wolfssl: accept state ACCEPT_FIRST_REPLY_DONE
|
||||
I (14705) wolfssl: wolfSSL Entering SendServerHello
|
||||
I (14705) wolfssl: growing output buffer
|
||||
I (14715) internal.c: GrowOutputBuffer ok
|
||||
I (14715) wolfssl: wolfSSL Entering wolfSSL_get_options
|
||||
I (14725) wolfssl: Point Formats extension to write
|
||||
W (14735) wolfio: ssl->wflags = 0
|
||||
I (14735) wolfio: 16 03 03 00 52 02 00 00 4e 03 03 af 87 e2 58 57
|
||||
I (14735) wolfio: 73 c3 c1 35 1a 59 39 b2 03 9d 14 03 e0 b8 fb e8
|
||||
I (14745) wolfio: 9d 5b 9c 44 4f 57 4e 47 52 44 01 20 85 77 75 20
|
||||
I (14755) wolfio: 95 dd 00 e2 91 f8 42 33 f8 61 3f 1f de 81 15 58
|
||||
I (14755) wolfio: 23 0c e7 1e 71 e6 10 e5 67 23 e0 40 e0 11 00 00
|
||||
I (14765) wolfio: 06 00 0b 00 02 01 00
|
||||
W (14775) wolfio: sz = 87
|
||||
I (14775) wolfssl: Shrinking output buffer
|
||||
I (14775) wolfssl: wolfSSL Leaving SendServerHello, return 0
|
||||
I (14785) wolfssl: accept state SERVER_HELLO_SENT
|
||||
I (14795) wolfssl: wolfSSL Entering SendCertificate
|
||||
I (14795) wolfssl: growing output buffer
|
||||
I (14805) internal.c: GrowOutputBuffer ok
|
||||
W (14815) wolfio: ssl->wflags = 0
|
||||
I (14815) wolfio: 16 03 03 02 e6 0b 00 02 e2 00 02 df 00 02 dc 30
|
||||
I (14815) wolfio: 82 02 d8 30 82 02 7e a0 03 02 01 02 02 01 01 30
|
||||
I (14825) wolfio: 0a 06 08 2a 81 1c cf 55 01 83 75 30 81 ac 31 0b
|
||||
I (14835) wolfio: 30 09 06 03 55 04 06 13 02 55 53 31 10 30 0e 06
|
||||
I (14835) wolfio: 03 55 04 08 0c 07 4d 6f 6e 74 61 6e 61 31 10 30
|
||||
I (14845) wolfio: 0e 06 03 55 04 07 0c 07 42 6f 7a 65 6d 61 6e 31
|
||||
I (14855) wolfio: 14 30 12 06 03 55 04 0a 0c 0b 77 6f 6c 66 53 53
|
||||
I (14855) wolfio: 4c 5f 73 6d 32 31 0f 30 0d 06 03 55 04 0b 0c 06
|
||||
I (14865) wolfio: 43 41 2d 73 6d 32 31 18 30 16 06 03 55 04 03 0c
|
||||
I (14875) wolfio: 0f 77 77 77 2e 77 6f 6c 66 73 73 6c 2e 63 6f 6d
|
||||
I (14875) wolfio: 31 1f 30 1d 06 09 2a 86 48 86 f7 0d 01 09 01 16
|
||||
I (14885) wolfio: 10 69 6e 66 6f 40 77 6f 6c 66 73 73 6c 2e 63 6f
|
||||
I (14895) wolfio: 6d 31 17 30 15 06 0a 09 92 26 89 93 f2 2c 64 01
|
||||
I (14895) wolfio: 01 0c 07 77 6f 6c 66 53 53 4c 30 1e 17 0d 32 33
|
||||
I (14905) wolfio: 30 32 31 35 30 36 32 33 30 37 5a 17 0d 32 35 31
|
||||
I (14915) wolfio: 31 31 31 30 36 32 33 30 37 5a 30 81 b0 31 0b 30
|
||||
I (14915) wolfio: 09 06 03 55 04 06 13 02 55 53 31 10 30 0e 06 03
|
||||
I (14925) wolfio: 55 04 08 0c 07 4d 6f 6e 74 61 6e 61 31 10 30 0e
|
||||
I (14935) wolfio: 06 03 55 04 07 0c 07 42 6f 7a 65 6d 61 6e 31 14
|
||||
I (14945) wolfio: 30 12 06 03 55 04 0a 0c 0b 77 6f 6c 66 53 53 4c
|
||||
I (14945) wolfio: 5f 73 6d 32 31 13 30 11 06 03 55 04 0b 0c 0a 53
|
||||
I (14955) wolfio: 65 72 76 65 72 2d 73 6d 32 31 18 30 16 06 03 55
|
||||
I (14965) wolfio: 04 03 0c 0f 77 77 77 2e 77 6f 6c 66 73 73 6c 2e
|
||||
I (14965) wolfio: 63 6f 6d 31 1f 30 1d 06 09 2a 86 48 86 f7 0d 01
|
||||
I (14975) wolfio: 09 01 16 10 69 6e 66 6f 40 77 6f 6c 66 73 73 6c
|
||||
I (14985) wolfio: 2e 63 6f 6d 31 17 30 15 06 0a 09 92 26 89 93 f2
|
||||
I (14985) wolfio: 2c 64 01 01 0c 07 77 6f 6c 66 53 53 4c 30 5a 30
|
||||
I (14995) wolfio: 14 06 08 2a 81 1c cf 55 01 82 2d 06 08 2a 81 1c
|
||||
I (15005) wolfio: cf 55 01 82 2d 03 42 00 04 94 70 2b 46 e4 5e 0f
|
||||
I (15005) wolfio: 41 fb 8f 2d 34 0a 41 40 19 5e fb d4 1d 11 ac fa
|
||||
I (15015) wolfio: f5 93 37 c6 fa 87 08 f7 16 1f 2c ce 30 40 9d 4f
|
||||
I (15025) wolfio: a6 2a 0a a1 d6 95 33 c3 a6 03 98 e6 8d 05 34 b0
|
||||
I (15025) wolfio: 97 0c de a4 c7 cf 53 8f d1 a3 81 89 30 81 86 30
|
||||
I (15035) wolfio: 1d 06 03 55 1d 0e 04 16 04 14 67 ae 60 ff 7e 1b
|
||||
I (15045) wolfio: 0f 95 ae 1f 82 59 f2 6c 56 2d 93 ef 17 32 30 1f
|
||||
I (15045) wolfio: 06 03 55 1d 23 04 18 30 16 80 14 47 0a 48 7e bb
|
||||
I (15055) wolfio: 02 a8 5a 26 57 2b 19 a9 7b 61 8b 7f 5d 99 6e 30
|
||||
I (15065) wolfio: 0c 06 03 55 1d 13 01 01 ff 04 02 30 00 30 0e 06
|
||||
I (15075) wolfio: 03 55 1d 0f 01 01 ff 04 04 03 02 03 a8 30 13 06
|
||||
I (15075) wolfio: 03 55 1d 25 04 0c 30 0a 06 08 2b 06 01 05 05 07
|
||||
I (15085) wolfio: 03 01 30 11 06 09 60 86 48 01 86 f8 42 01 01 04
|
||||
I (15095) wolfio: 04 03 02 06 40 30 0a 06 08 2a 81 1c cf 55 01 83
|
||||
I (15095) wolfio: 75 03 48 00 30 45 02 20 1b ca 94 28 7f f6 b2 0d
|
||||
I (15105) wolfio: 31 43 50 e1 d5 34 17 dd af 3a de 81 06 67 9a b3
|
||||
I (15115) wolfio: 06 22 7e 64 ec fd 0e b9 02 21 00 a1 48 a8 32 d1
|
||||
I (15115) wolfio: 05 09 6b 1c eb 89 12 66 d8 38 a1 c4 5c 89 09 0f
|
||||
I (15125) wolfio: fd e9 c0 3b 1d fb cd b5 4c 31 68
|
||||
W (15135) wolfio: sz = 747
|
||||
I (15135) wolfssl: Shrinking output buffer
|
||||
I (15135) wolfssl: wolfSSL Leaving SendCertificate, return 0
|
||||
I (15145) wolfssl: accept state CERT_SENT
|
||||
I (15155) wolfssl: wolfSSL Entering SendCertificateStatus
|
||||
I (15155) wolfssl: wolfSSL Leaving SendCertificateStatus, return 0
|
||||
I (15165) wolfssl: accept state CERT_STATUS_SENT
|
||||
I (15165) wolfssl: wolfSSL Entering SendServerKeyExchange
|
||||
I (15175) wolfssl: Using ephemeral ECDH
|
||||
I (15175) wolfssl: wolfSSL Entering EccMakeKey
|
||||
I (15535) wolfssl: wolfSSL Leaving EccMakeKey, return 0
|
||||
I (15535) wolfssl: Trying ECC private key, RSA didn't work
|
||||
I (15535) wolfssl: wolfSSL Entering GetAlgoId
|
||||
I (15545) wolfssl: wolfSSL Entering GetObjectId
|
||||
I (15555) wolfssl: Using ECC private key
|
||||
I (15555) wolfssl: wolfSSL Entering Sm2wSm3Sign
|
||||
I (15915) wolfssl: wolfSSL Leaving Sm2wSm3Sign, return 0
|
||||
I (15915) wolfssl: wolfSSL Entering SendHandshakeMsg
|
||||
I (15925) wolfssl: growing output buffer
|
||||
I (15925) internal.c: GrowOutputBuffer ok
|
||||
W (15925) wolfio: ssl->wflags = 0
|
||||
I (15935) wolfio: 16 03 03 00 95 0c 00 00 91 03 00 29 41 04 fd f5
|
||||
I (15935) wolfio: 5e 74 15 30 1d f3 84 ae a5 69 96 a9 5b dd 27 b3
|
||||
I (15945) wolfio: 00 7d 40 3a 59 93 93 6f 4d 1f 62 dc 60 48 34 1f
|
||||
I (15955) wolfio: a8 1d 34 b8 76 8f 8b 27 4a 1b 77 64 8e 2e d5 27
|
||||
I (15955) wolfio: 03 95 8b 9d a5 ed a4 a6 b9 40 1b ea aa 10 07 08
|
||||
I (15965) wolfio: 00 48 30 46 02 21 00 cb 89 61 e9 21 f9 c6 4d ad
|
||||
I (15975) wolfio: aa e7 f1 3f 6f 27 46 f0 35 ec 45 4e 8a ae f3 ac
|
||||
I (15985) wolfio: 7c c0 cf 68 11 44 e2 02 21 00 f6 40 5c bc 66 5a
|
||||
I (15985) wolfio: 74 1e 92 5d 9a 03 75 e7 7f 16 c2 b3 c8 fe 8d 5c
|
||||
I (15995) wolfio: 63 35 36 da 61 38 76 dc 4e d6
|
||||
W (15995) wolfio: sz = 154
|
||||
I (16005) wolfssl: Shrinking output buffer
|
||||
I (16005) wolfssl: wolfSSL Leaving SendServerKeyExchange, return 0
|
||||
I (16015) wolfssl: accept state KEY_EXCHANGE_SENT
|
||||
I (16025) wolfssl: accept state CERT_REQ_SENT
|
||||
I (16025) wolfssl: wolfSSL Entering SendServerHelloDone
|
||||
I (16035) wolfssl: growing output buffer
|
||||
I (16035) internal.c: GrowOutputBuffer ok
|
||||
W (16045) wolfio: ssl->wflags = 0
|
||||
I (16045) wolfio: 16 03 03 00 04 0e 00 00 00
|
||||
W (16045) wolfio: sz = 9
|
||||
I (16055) wolfssl: Embed Send error
|
||||
I (16055) wolfssl: Connection reset
|
||||
I (16065) int: Sent = -3
|
||||
W (16065) int: WOLFSSL_CBIO_ERR_CONN_RST
|
||||
E (16075) int: SOCKET_ERROR_E 2
|
||||
I (16075) wolfssl: wolfSSL Leaving SendServerHelloDone, return -308
|
||||
I (16085) wolfssl: wolfSSL error occurred, error = -308
|
||||
I (16085) wolfssl: wolfSSL Entering wolfSSL_get_error
|
||||
I (16095) wolfssl: wolfSSL Leaving wolfSSL_get_error, return -308
|
||||
E (16085) tls_server: wolfSSL_accept error -308
|
||||
I (16105) wolfssl: Client connected successfully
|
||||
I (16105) wolfssl: wolfSSL Entering wolfSSL_read
|
||||
I (16115) wolfssl: wolfSSL Entering wolfSSL_read_internal
|
||||
I (16125) wolfssl: wolfSSL Entering ReceiveData
|
||||
I (16125) wolfssl: User calling wolfSSL_read in error state, not allowed
|
||||
I (16135) wolfssl: wolfSSL Leaving wolfSSL_read_internal, return -308
|
||||
E (16145) tls_server: ERROR: failed to read
|
||||
I (16145) wolfssl: Client sends:
|
||||
I (16145) wolfssl:
|
||||
I (16155) wolfssl: wolfSSL Entering wolfSSL_write
|
||||
I (16155) wolfssl: handshake not complete, trying to finish
|
||||
I (16165) wolfssl: wolfSSL Entering wolfSSL_negotiate
|
||||
I (16165) wolfssl: wolfSSL Entering wolfSSL_accept
|
||||
I (16175) wolfssl: wolfSSL Entering ReinitSSL
|
||||
W (16185) wolfio: ssl->wflags = 0
|
||||
I (16185) wolfio: 16 03 03 00 04 0e 00 00 00
|
||||
W (16185) wolfio: sz = 9
|
||||
I (16195) wolfssl: Embed Send error
|
||||
I (16195) wolfssl: General error
|
||||
I (16205) int: Sent = -1
|
||||
E (16205) int: SOCKET_ERROR_E
|
||||
I (16205) wolfssl: wolfSSL error occurred, error = -308
|
||||
I (16215) wolfssl: wolfSSL Leaving wolfSSL_negotiate, return -1
|
||||
I (16225) wolfssl: wolfSSL Leaving wolfSSL_write, return -1
|
||||
E (16225) tls_server: ERROR: failed to write
|
||||
I (16235) wolfssl: wolfSSL Entering wolfSSL_free
|
||||
I (16235) wolfssl: Free'ing server ssl
|
||||
I (16245) wolfssl: Shrinking output buffer
|
||||
I (16245) wolfssl: wolfSSL Entering ClientSessionToSession
|
||||
I (16255) wolfssl: wolfSSL Entering wolfSSL_FreeSession
|
||||
I (16255) wolfssl: wolfSSL_FreeSession full free
|
||||
I (16265) wolfssl: CTX ref count not 0 yet, no free
|
||||
I (16265) wolfssl: wolfSSL Leaving wolfSSL_free, return 0
|
||||
I (16275) wolfssl: Waiting for a connection...
|
||||
```
|
||||
|
||||
### Wireshark:
|
||||
|
||||

|
||||
@@ -0,0 +1,52 @@
|
||||
# wolfSSL Project Files for Visual Studio 2022 with VisualGDB Extension
|
||||
|
||||
Include in the respective project `./VisualGDB` directory are [VisualGDB](https://visualgdb.com/) project files.
|
||||
Individual project files are included for convenience to new users, as there are [difficulties switching between ESP-IDF Versions or Chipsets](https://sysprogs.com/w/forums/topic/difficulties-switching-espressif-esp-idf-version-or-chipset/) using the VisualGDB extension.
|
||||
|
||||
The naming convention for project files is: `[project name]_IDF_[Version]_[chipset].vgdbproj`. The solution files (filename[.sln]) often will contain shortcuts to commonly used source and configuration files used by the respective project.
|
||||
|
||||
|
||||
-------- |------------- |------------- |
|
||||
ChipSet | ESP-IDF v4.4 | ESP-IDF v5.0 |
|
||||
-------- |------------- |------------- |
|
||||
ESP32 | x | |
|
||||
ESP32-S2 | | |
|
||||
ESP32-S3 | x | x |
|
||||
ESP32-C3 | x | x |
|
||||
ESP32-C6 | | |
|
||||
|
||||
|
||||
The default directories are:
|
||||
|
||||
- `C:\SysGCC` - The root directory install of VisualGDB
|
||||
- `C:\SysGCC\esp32` - The default for ESP-IDF v5.x
|
||||
- `C:\SysGCC\esp32-8.4` - Many need to manually select this name for ESP-IDF v4.x install
|
||||
- `C:\SysGCC\esp8266`- The default for ESP8266
|
||||
|
||||
## Resources
|
||||
|
||||
- [wolfSSL Website](https://www.wolfssl.com/)
|
||||
|
||||
- [wolfSSL Wiki](https://github.com/wolfSSL/wolfssl/wiki)
|
||||
|
||||
- [FIPS 140-2/140-3 FAQ](https://wolfssl.com/license/fips)
|
||||
|
||||
- [wolfSSL Documentation](https://wolfssl.com/wolfSSL/Docs.html)
|
||||
|
||||
- [wolfSSL Manual](https://wolfssl.com/wolfSSL/Docs-wolfssl-manual-toc.html)
|
||||
|
||||
- [wolfSSL API Reference](https://wolfssl.com/wolfSSL/Docs-wolfssl-manual-17-wolfssl-api-reference.html)
|
||||
|
||||
- [wolfCrypt API Reference](https://wolfssl.com/wolfSSL/Docs-wolfssl-manual-18-wolfcrypt-api-reference.html)
|
||||
|
||||
- [TLS 1.3](https://www.wolfssl.com/docs/tls13/)
|
||||
|
||||
- [wolfSSL Vulnerabilities](https://www.wolfssl.com/docs/security-vulnerabilities/)
|
||||
|
||||
- [Additional wolfSSL Examples](https://github.com/wolfssl/wolfssl-examples)
|
||||
|
||||
## Support
|
||||
|
||||
For questions please email [support@wolfssl.com](mailto:support@wolfssl.com)
|
||||
|
||||
<-- edit 5.6.0001 see https://github.com/wolfSSL/wolfssl/tree/master/IDE/Espressif/ESP-IDF/examples/wolfssl_benchmark/VisualGDB -->
|
||||
@@ -1,9 +1,9 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 16
|
||||
VisualStudioVersion = 16.0.33027.164
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.7.34031.279
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{803FD0C6-D64E-4E16-9DC3-1DAEC859A3D2}") = "VisualGDB_wolfssl_server", "VisualGDB_wolfssl_server.vgdbproj", "{CD5A90CA-2D40-461A-A0C3-27654371BB00}"
|
||||
Project("{803FD0C6-D64E-4E16-9DC3-1DAEC859A3D2}") = "wolfssl_server_IDF_v5_ESP32", "wolfssl_server_IDF_v5_ESP32.vgdbproj", "{CD5A90CA-2D40-461A-A0C3-27654371BB00}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
@@ -26,6 +26,6 @@ Global
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {719A8CBE-E881-4B20-89F3-9910520E1067}
|
||||
SolutionGuid = {8024AC13-8021-400B-976F-30C392D5BBD3}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0"?>
|
||||
<VisualGDBProjectSettings2 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
|
||||
<VisualGDBProjectSettings2 xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<Project xsi:type="com.visualgdb.project.external.esp-idf">
|
||||
<CustomSourceDirectories>
|
||||
<Directories />
|
||||
@@ -18,9 +18,9 @@
|
||||
<ToolchainID>
|
||||
<ID>com.visualgdb.xtensa-esp32-elf</ID>
|
||||
<Version>
|
||||
<GCC>8.4.0</GCC>
|
||||
<GDB>8.1.0</GDB>
|
||||
<Revision>9</Revision>
|
||||
<GCC>12.2.0</GCC>
|
||||
<GDB>12.1</GDB>
|
||||
<Revision>1</Revision>
|
||||
</Version>
|
||||
</ToolchainID>
|
||||
<RelativeSourceDirectory>..</RelativeSourceDirectory>
|
||||
@@ -67,11 +67,11 @@
|
||||
<EnableFastUpToDateCheck>true</EnableFastUpToDateCheck>
|
||||
<ESPIDFExtension>
|
||||
<IDFCheckout>
|
||||
<Version>v4.4.1</Version>
|
||||
<Subdirectory>esp-idf/v4.4.1</Subdirectory>
|
||||
<Version>release/v5.1</Version>
|
||||
<Subdirectory>esp-idf/v5.1</Subdirectory>
|
||||
<Type>ESPIDF</Type>
|
||||
</IDFCheckout>
|
||||
<COMPort>COM20</COMPort>
|
||||
<COMPort>COM19</COMPort>
|
||||
<SuppressTestPrerequisiteChecks>false</SuppressTestPrerequisiteChecks>
|
||||
<UseCCache>false</UseCCache>
|
||||
<DeviceID>ESP32</DeviceID>
|
||||
@@ -93,7 +93,7 @@
|
||||
</CustomDebug>
|
||||
<DeviceTerminalSettings>
|
||||
<Connection xsi:type="com.sysprogs.terminal.connection.serial">
|
||||
<ComPortName>COM20</ComPortName>
|
||||
<ComPortName>COM19</ComPortName>
|
||||
<AdvancedSettings>
|
||||
<BaudRate>115200</BaudRate>
|
||||
<DataBits>8</DataBits>
|
||||
@@ -104,7 +104,7 @@
|
||||
</Connection>
|
||||
<LastConnectionTime>0</LastConnectionTime>
|
||||
<EchoTypedCharacters>false</EchoTypedCharacters>
|
||||
<ClearContentsWhenReconnecting>false</ClearContentsWhenReconnecting>
|
||||
<ClearContentsWhenReconnecting>true</ClearContentsWhenReconnecting>
|
||||
<ReconnectAutomatically>false</ReconnectAutomatically>
|
||||
<DisplayMode>ASCII</DisplayMode>
|
||||
<Colors>
|
||||
@@ -220,7 +220,7 @@
|
||||
<DebugMethod>
|
||||
<ID>openocd</ID>
|
||||
<Configuration xsi:type="com.visualgdb.edp.openocd.settings.esp32">
|
||||
<CommandLine>-f interface/tigard.cfg -c "adapter_khz 3000" -f target/esp32.cfg</CommandLine>
|
||||
<CommandLine>-f interface/ftdi/tigard.cfg -c "adapter_khz 15000" -f interface/ftdi/tigard.cfg -f target/esp32.cfg</CommandLine>
|
||||
<ExtraParameters>
|
||||
<Frequency xsi:nil="true" />
|
||||
<BoostedFrequency xsi:nil="true" />
|
||||
@@ -252,7 +252,7 @@
|
||||
</Configuration>
|
||||
</DebugMethod>
|
||||
<AutoDetectRTOS>true</AutoDetectRTOS>
|
||||
<SemihostingSupport>Auto</SemihostingSupport>
|
||||
<SemihostingSupport>Disabled</SemihostingSupport>
|
||||
<SemihostingPollingDelay>0</SemihostingPollingDelay>
|
||||
<StepIntoEntryPoint>false</StepIntoEntryPoint>
|
||||
<ReloadFirmwareOnReset>false</ReloadFirmwareOnReset>
|
||||
@@ -17,206 +17,435 @@
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
|
||||
#
|
||||
# cmake for wolfssl
|
||||
# cmake for wolfssl Espressif projects
|
||||
#
|
||||
cmake_minimum_required(VERSION 3.5)
|
||||
# Version 5.6.0.011 for detect test/benchmark
|
||||
#
|
||||
# See https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/build-system.html
|
||||
#
|
||||
|
||||
cmake_minimum_required(VERSION 3.16)
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_USER_SETTINGS")
|
||||
set(CMAKE_CURRENT_SOURCE_DIR ".")
|
||||
set(COMPONENT_REQUIRES lwip) # we typically don't need lwip directly in wolfssl component
|
||||
set(WOLFSSL_ROOT "$ENV{WOLFSSL_ROOT}" )
|
||||
|
||||
# We are currently in [root]/IDE/Espressif/ESP-IDF/examples/wolfssl_test/components/wolfssl
|
||||
# The root of wolfSSL is 7 directories up from here:
|
||||
get_filename_component(WOLFSSL_ROOT "../../../../../../../" ABSOLUTE)
|
||||
|
||||
# Espressif may take several passes through this makefile. Check to see if we found IDF
|
||||
string(COMPARE EQUAL "${PROJECT_SOURCE_DIR}" "" WOLFSSL_FOUND_IDF)
|
||||
|
||||
if($WOLFSSL_FOUND_IDF)
|
||||
message(STATUS "IDF_PATH = $ENV{IDF_PATH}")
|
||||
message(STATUS "WOLFSSL_ROOT = ${WOLFSSL_ROOT}")
|
||||
message(STATUS "PROJECT_SOURCE_DIR = ${PROJECT_SOURCE_DIR}")
|
||||
endif()
|
||||
|
||||
# get a list of all wolfcrypt assembly files; we'll exclude them as they don't target Xtensa
|
||||
FILE(GLOB EXCLUDE_ASM *.S)
|
||||
file(GLOB_RECURSE EXCLUDE_ASM ${CMAKE_SOURCE_DIR} "${WOLFSSL_ROOT}/wolfcrypt/src/*.S")
|
||||
|
||||
if(NOT CMAKE_BUILD_EARLY_EXPANSION)
|
||||
message(STATUS "EXCLUDE_ASM = ${EXCLUDE_ASM}")
|
||||
endif()
|
||||
|
||||
set(INCLUDE_PATH ${WOLFSSL_ROOT})
|
||||
|
||||
set(COMPONENT_SRCDIRS "${WOLFSSL_ROOT}/src/"
|
||||
"${WOLFSSL_ROOT}/wolfcrypt/src/"
|
||||
"${WOLFSSL_ROOT}/wolfcrypt/src/port/Espressif/"
|
||||
"${WOLFSSL_ROOT}/wolfcrypt/src/port/atmel/"
|
||||
"${WOLFSSL_ROOT}/wolfcrypt/benchmark/"
|
||||
"${WOLFSSL_ROOT}/wolfcrypt/test/"
|
||||
)
|
||||
|
||||
set(COMPONENT_REQUIRES lwip)
|
||||
|
||||
|
||||
# check to see if there's both a local copy and EDP-IDF copy of the wolfssl and/or wolfssh components
|
||||
if( EXISTS "${CMAKE_HOME_DIRECTORY}/components/wolfssl/" AND EXISTS "$ENV{IDF_PATH}/components/wolfssl/" )
|
||||
#
|
||||
# wolfSSL found in both ESP-IDF and local project - needs to be resolved by user
|
||||
#
|
||||
message(STATUS "")
|
||||
message(STATUS "**************************************************************************************")
|
||||
message(STATUS "")
|
||||
message(STATUS "Error: Found components/wolfssl in both local project and IDF_PATH")
|
||||
message(STATUS "")
|
||||
message(STATUS "To proceed: ")
|
||||
message(STATUS "")
|
||||
message(STATUS "Remove either the local project component: ${CMAKE_HOME_DIRECTORY}/components/wolfssl/ ")
|
||||
message(STATUS "or the Espressif shared component installed at: $ENV{IDF_PATH}/components/wolfssl/ ")
|
||||
message(STATUS "")
|
||||
message(FATAL_ERROR "Please use wolfSSL in either local project or Espressif components, but not both.")
|
||||
message(STATUS "")
|
||||
message(STATUS "**************************************************************************************")
|
||||
message(STATUS "")
|
||||
|
||||
# Optional: if you change the above FATAL_ERROR to STATUS you can warn at runtime with this macro definition:
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_MULTI_INSTALL_WARNING")
|
||||
|
||||
else()
|
||||
if( EXISTS "$ENV{IDF_PATH}/components/wolfssl/" )
|
||||
#
|
||||
# wolfSSL found in ESP-IDF components and is assumed to be already configured in user_settings.h via setup.
|
||||
#
|
||||
message(STATUS "")
|
||||
message(STATUS "Using components/wolfssl in IDF_PATH = $ENV{IDF_PATH}")
|
||||
message(STATUS "")
|
||||
# find the user name to search for possible "wolfssl-username"
|
||||
message(STATUS "USERNAME = $ENV{USERNAME}")
|
||||
if( "$ENV{USER}" STREQUAL "" ) # the bash user
|
||||
if( "$ENV{USERNAME}" STREQUAL "" ) # the Windows user
|
||||
message(STATUS "could not find USER or USERNAME")
|
||||
else()
|
||||
#
|
||||
# wolfSSL is not an ESP-IDF component. We need to now determine if it is local and if so if it is part of the wolfSSL repo
|
||||
# or if wolfSSL is simply installed as a local component.
|
||||
#
|
||||
if( EXISTS "${CMAKE_HOME_DIRECTORY}/components/wolfssl/" )
|
||||
#
|
||||
# wolfSSL found in local project.
|
||||
#
|
||||
if( EXISTS "${CMAKE_HOME_DIRECTORY}/components/wolfssl/include/" )
|
||||
message(STATUS "")
|
||||
message(STATUS "Using installed project ./components/wolfssl in CMAKE_HOME_DIRECTORY = $ENV{CMAKE_HOME_DIRECTORY}")
|
||||
message(STATUS "")
|
||||
#
|
||||
# Note we already checked above and confirmed there's not another wolfSSL installed in the ESP-IDF components.
|
||||
#
|
||||
# We won't do anything else here, as it will be assumed the original install completed successfully.
|
||||
#
|
||||
else()
|
||||
#
|
||||
# This is the developer repo mode. wolfSSL will be assume to be not installed to ESP-IDF nor local project
|
||||
# In this configuration, we are likely running a wolfSSL example found directly in the repo.
|
||||
#
|
||||
message(STATUS "")
|
||||
message(STATUS "Using developer repo ./components/wolfssl in CMAKE_HOME_DIRECTORY = $ENV{CMAKE_HOME_DIRECTORY}")
|
||||
message(STATUS "")
|
||||
|
||||
message(STATUS "************************************************************************************************")
|
||||
# When in developer mode, we are typically running wolfSSL examples such as benchmark or test directories.
|
||||
# However, the as-cloned or distributed wolfSSL does not have the ./include/ directory, so we'll add it as needed.
|
||||
#
|
||||
# first check if there's a [root]/include/user_settings.h
|
||||
if( EXISTS "${WOLFSSL_ROOT}/include/user_settings.h" )
|
||||
# we won't overwrite an existing user settings file, just note that we already have one:
|
||||
message(STATUS "Found wolfSSL user_settings.h in ${WOLFSSL_ROOT}/include/user_settings.h")
|
||||
else()
|
||||
message(STATUS "Installing wolfSSL user_settings.h to ${WOLFSSL_ROOT}/include/user_settings.h")
|
||||
file(COPY "${WOLFSSL_ROOT}/IDE/Espressif/ESP-IDF/user_settings.h" DESTINATION "${WOLFSSL_ROOT}/include/")
|
||||
endif() # user_settings.h
|
||||
|
||||
# next check if there's a [root]/include/config.h
|
||||
if( EXISTS "${WOLFSSL_ROOT}/include/config.h" )
|
||||
message(STATUS "Found wolfSSL config.h in ${WOLFSSL_ROOT}/include/config.h")
|
||||
else()
|
||||
message(STATUS "Installing wolfSSL config.h to ${WOLFSSL_ROOT}/include/config.h")
|
||||
file(COPY "${WOLFSSL_ROOT}/IDE/Espressif/ESP-IDF/dummy_config_h" DESTINATION "${WOLFSSL_ROOT}/include/")
|
||||
file(RENAME "${WOLFSSL_ROOT}/include/dummy_config_h" "${WOLFSSL_ROOT}/include/config.h")
|
||||
endif() # config.h
|
||||
message(STATUS "************************************************************************************************")
|
||||
message(STATUS "")
|
||||
endif()
|
||||
|
||||
else()
|
||||
# we did not find a ./components/wolfssl/include/ directory from this pass of cmake.
|
||||
if($WOLFSSL_FOUND_IDF)
|
||||
message(STATUS "")
|
||||
message(STATUS "WARNING: wolfSSL not found.")
|
||||
message(STATUS "")
|
||||
else()
|
||||
# probably needs to be re-parsed by Espressif
|
||||
message(STATUS "wolfSSL found IDF. Project Source:${PROJECT_SOURCE_DIR}")
|
||||
endif() # else we have not found ESP-IDF yet
|
||||
endif() # else not a local wolfSSL component
|
||||
|
||||
endif() #else not an ESP-IDF component
|
||||
endif() # else not local copy and EDP-IDF wolfSSL
|
||||
|
||||
|
||||
# RTOS_IDF_PATH is typically:
|
||||
# "/Users/{username}/Desktop/esp-idf/components/freertos/include/freertos"
|
||||
# depending on the environment, we may need to swap backslashes with forward slashes
|
||||
string(REPLACE "\\" "/" RTOS_IDF_PATH "$ENV{IDF_PATH}/components/freertos/include/freertos")
|
||||
|
||||
# ESP-IDF after version 4.4x has a different RTOS directory structure
|
||||
string(REPLACE "\\" "/" RTOS_IDF_PATH5 "$ENV{IDF_PATH}/components/freertos/FreeRTOS-Kernel/include/freertos")
|
||||
|
||||
if(IS_DIRECTORY ${IDF_PATH}/components/freertos/FreeRTOS-Kernel/)
|
||||
set(COMPONENT_ADD_INCLUDEDIRS
|
||||
"."
|
||||
"${WOLFSSL_ROOT}/include"
|
||||
"${RTOS_IDF_PATH5}"
|
||||
"${WOLFSSL_ROOT}"
|
||||
)
|
||||
# the bash user is not blank, so we'll use it.
|
||||
set(THIS_USER "$ENV{USERNAME}")
|
||||
endif()
|
||||
else()
|
||||
|
||||
set(COMPONENT_ADD_INCLUDEDIRS
|
||||
"."
|
||||
"${WOLFSSL_ROOT}/include"
|
||||
"${RTOS_IDF_PATH}"
|
||||
"${WOLFSSL_ROOT}"
|
||||
)
|
||||
# the bash user is not blank, so we'll use it.
|
||||
set(THIS_USER "$ENV{USER}")
|
||||
endif()
|
||||
message(STATUS "THIS_USER = ${THIS_USER}")
|
||||
|
||||
if(IS_DIRECTORY ${IDF_PATH}/components/cryptoauthlib)
|
||||
list(APPEND COMPONENT_ADD_INCLUDEDIRS "../cryptoauthlib/lib")
|
||||
endif()
|
||||
|
||||
set(COMPONENT_SRCEXCLUDE
|
||||
"${WOLFSSL_ROOT}/src/bio.c"
|
||||
"${WOLFSSL_ROOT}/src/conf.c"
|
||||
"${WOLFSSL_ROOT}/src/misc.c"
|
||||
"${WOLFSSL_ROOT}/src/pk.c"
|
||||
"${WOLFSSL_ROOT}/src/ssl_misc.c" # included by ssl.c
|
||||
"${WOLFSSL_ROOT}/src/x509.c"
|
||||
"${WOLFSSL_ROOT}/src/x509_str.c"
|
||||
"${WOLFSSL_ROOT}/wolfcrypt/src/evp.c"
|
||||
"${WOLFSSL_ROOT}/wolfcrypt/src/misc.c"
|
||||
"${EXCLUDE_ASM}"
|
||||
)
|
||||
# COMPONENT_NAME = wolfssl
|
||||
# The component name is the directory name. "No feature to change this".
|
||||
# See https://github.com/espressif/esp-idf/issues/8978#issuecomment-1129892685
|
||||
|
||||
# set the root of wolfSSL in top-level project CMakelists.txt:
|
||||
# set(WOLFSSL_ROOT "C:/some path/with/spaces")
|
||||
# set(WOLFSSL_ROOT "c:/workspace/wolfssl-[username]")
|
||||
# set(WOLFSSL_ROOT "/mnt/c/some path/with/spaces")
|
||||
# or use this logic to assign value from Environment Variable WOLFSSL_ROOT,
|
||||
# or assume this is an example 7 subdirectories below:
|
||||
|
||||
# We are typically in [root]/IDE/Espressif/ESP-IDF/examples/wolfssl_test/components/wolfssl
|
||||
# The root of wolfSSL is 7 directories up from here:
|
||||
|
||||
# function: IS_WOLFSSL_SOURCE
|
||||
# parameter: DIRECTORY_PARAMETER - the directory to test
|
||||
# output: RESULT = contains contents of DIRECTORY_PARAMETER for wolfssl directory, otherwise blank.
|
||||
function(IS_WOLFSSL_SOURCE DIRECTORY_PARAMETER RESULT)
|
||||
if (EXISTS "${DIRECTORY_PARAMETER}/wolfcrypt/src")
|
||||
set(${RESULT} "${DIRECTORY_PARAMETER}" PARENT_SCOPE)
|
||||
else()
|
||||
set(${RESULT} "" PARENT_SCOPE)
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
# function: FIND_WOLFSSL_DIRECTORY
|
||||
# parameter: OUTPUT_FOUND_WOLFSSL_DIRECTORY contains root of source code, otherwise blank
|
||||
#
|
||||
function(FIND_WOLFSSL_DIRECTORY OUTPUT_FOUND_WOLFSSL_DIRECTORY)
|
||||
message(STATUS "Starting FIND_WOLFSSL_DIRECTORY")
|
||||
set(CURRENT_SEARCH_DIR "$ENV{WOLFSSL_ROOT}")
|
||||
if( "${CURRENT_SEARCH_DIR}" STREQUAL "" )
|
||||
message(STATUS "The WOLFSSL_ROOT environment variable is not set. Searching...")
|
||||
else()
|
||||
get_filename_component(CURRENT_SEARCH_DIR "$ENV{WOLFSSL_ROOT}" ABSOLUTE)
|
||||
IS_WOLFSSL_SOURCE("${CURRENT_SEARCH_DIR}" FOUND_WOLFSSL)
|
||||
if("${FOUND_WOLFSSL}")
|
||||
message(STATUS "Found WOLFSSL_ROOT via Environment Variable:")
|
||||
else()
|
||||
message(FATAL_ERROR "WOLFSSL_ROOT Environment Variable defined, but path not found:")
|
||||
message(STATUS "$ENV{WOLFSSL_ROOT}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# we'll start in the CMAKE_CURRENT_SOURCE_DIR, typically [something]/projectname/components/wolfssl
|
||||
message(STATUS "CMAKE_CURRENT_SOURCE_DIR = ${CMAKE_CURRENT_SOURCE_DIR}")
|
||||
get_filename_component(CURRENT_SEARCH_DIR "${CMAKE_CURRENT_SOURCE_DIR}" ABSOLUTE)
|
||||
message(STATUS "CURRENT_SEARCH_DIR = ${CURRENT_SEARCH_DIR}")
|
||||
string(LENGTH ${CURRENT_SEARCH_DIR} CURRENT_SEARCH_DIR_LENGTH)
|
||||
|
||||
# loop through all the parents, looking for wolfssl
|
||||
while(NOT CURRENT_SEARCH_DIR STREQUAL "/" AND NOT CURRENT_SEARCH_DIR STREQUAL "" )
|
||||
string(LENGTH ${CURRENT_SEARCH_DIR} CURRENT_SEARCH_DIR_LENGTH)
|
||||
# wolfSSL may simply be in a parent directory, such as for local examples in wolfssl repo
|
||||
IS_WOLFSSL_SOURCE("${CURRENT_SEARCH_DIR}" FOUND_WOLFSSL)
|
||||
if( FOUND_WOLFSSL )
|
||||
message(STATUS "Found wolfssl in CURRENT_SEARCH_DIR = ${CURRENT_SEARCH_DIR}")
|
||||
set(${OUTPUT_FOUND_WOLFSSL_DIRECTORY} ${CURRENT_SEARCH_DIR} PARENT_SCOPE)
|
||||
return()
|
||||
endif()
|
||||
|
||||
if( THIS_USER )
|
||||
# Check for "wolfssl-[username]" subdirectory as we recurse up the directory tree
|
||||
set(CURRENT_SEARCH_DIR_ALT ${CURRENT_SEARCH_DIR}/wolfssl-${THIS_USER})
|
||||
message(STATUS "Looking in ${CURRENT_SEARCH_DIR}")
|
||||
|
||||
#if(EXISTS ${CURRENT_SEARCH_DIR_ALT} AND IS_DIRECTORY ${CURRENT_SEARCH_DIR_ALT} AND EXISTS "${CURRENT_SEARCH_DIR_ALT}/wolfcrypt/src")
|
||||
IS_WOLFSSL_SOURCE("${CURRENT_SEARCH_DIR_ALT}" FOUND_WOLFSSL )
|
||||
if ( FOUND_WOLFSSL )
|
||||
message(STATUS "Found wolfssl in user-suffix CURRENT_SEARCH_DIR_ALT = ${CURRENT_SEARCH_DIR_ALT}")
|
||||
set(${OUTPUT_FOUND_WOLFSSL_DIRECTORY} ${CURRENT_SEARCH_DIR_ALT} PARENT_SCOPE)
|
||||
return()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Next check for no user suffix "wolfssl" subdirectory as we recurse up the directory tree
|
||||
set(CURRENT_SEARCH_DIR_ALT ${CURRENT_SEARCH_DIR}/wolfssl)
|
||||
# if(EXISTS ${CURRENT_SEARCH_DIR} AND IS_DIRECTORY ${CURRENT_SEARCH_DIR} AND EXISTS "${CURRENT_SEARCH_DIR}/wolfcrypt/src")
|
||||
IS_WOLFSSL_SOURCE("${CURRENT_SEARCH_DIR_ALT}" FOUND_WOLFSSL )
|
||||
if ( FOUND_WOLFSSL )
|
||||
message(STATUS "Found wolfssl in CURRENT_SEARCH_DIR = ${CURRENT_SEARCH_DIR}")
|
||||
set(${OUTPUT_FOUND_WOLFSSL_DIRECTORY} ${CURRENT_SEARCH_DIR} PARENT_SCOPE)
|
||||
return()
|
||||
endif()
|
||||
|
||||
# Move up one directory level
|
||||
set(PRIOR_SEARCH_DIR "${CURRENT_SEARCH_DIR}")
|
||||
get_filename_component(CURRENT_SEARCH_DIR "${CURRENT_SEARCH_DIR}" DIRECTORY)
|
||||
message(STATUS "Next CURRENT_SEARCH_DIR = ${CURRENT_SEARCH_DIR}")
|
||||
if( "${PRIOR_SEARCH_DIR}" STREQUAL "${CURRENT_SEARCH_DIR}" )
|
||||
# when the search directory is empty, we'll give up
|
||||
set(CURRENT_SEARCH_DIR "")
|
||||
endif()
|
||||
endwhile()
|
||||
|
||||
# If not found, set the output variable to empty before exiting
|
||||
set(${OUTPUT_FOUND_WOLFSSL_DIRECTORY} "" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
|
||||
# Example usage:
|
||||
|
||||
|
||||
|
||||
|
||||
if(CMAKE_BUILD_EARLY_EXPANSION)
|
||||
message(STATUS "wolfssl component CMAKE_BUILD_EARLY_EXPANSION:")
|
||||
idf_component_register(
|
||||
REQUIRES "${COMPONENT_REQUIRES}"
|
||||
PRIV_REQUIRES # esp_hw_support
|
||||
esp_timer
|
||||
driver # this will typically only be needed for wolfSSL benchmark
|
||||
)
|
||||
|
||||
else()
|
||||
# not CMAKE_BUILD_EARLY_EXPANSION
|
||||
message(STATUS "************************************************************************************************")
|
||||
message(STATUS "wolfssl component config:")
|
||||
message(STATUS "************************************************************************************************")
|
||||
|
||||
# search for wolfSSL
|
||||
FIND_WOLFSSL_DIRECTORY(WOLFSSL_ROOT)
|
||||
if(WOLFSSL_ROOT)
|
||||
message(STATUS "NEW Found wolfssl directory at: ${WOLFSSL_ROOT}")
|
||||
else()
|
||||
message(STATUS "NEW wolfssl directory not found.")
|
||||
# Abort. We need wolfssl _somewhere_.
|
||||
message(FATAL_ERROR "Could not find wolfssl in ${WOLFSSL_ROOT}.\n"
|
||||
"Try setting WOLFSSL_ROOT environment variable or git clone.")
|
||||
endif()
|
||||
|
||||
set(INCLUDE_PATH ${WOLFSSL_ROOT})
|
||||
|
||||
set(WOLFSSL_EXTRA_PROJECT_DIR "${WOLFSSL_ROOT}/src/")
|
||||
|
||||
if( ${CMAKE_PROJECT_NAME} STREQUAL "wolfssl_benchmark" )
|
||||
set(WOLFSSL_EXTRA_PROJECT_DIR "${WOLFSSL_ROOT}/wolfcrypt/benchmark")
|
||||
endif()
|
||||
|
||||
if( ${CMAKE_PROJECT_NAME} STREQUAL "wolfssl_test" )
|
||||
set(WOLFSSL_EXTRA_PROJECT_DIR "${WOLFSSL_ROOT}/wolfcrypt/test")
|
||||
endif()
|
||||
|
||||
set(COMPONENT_SRCDIRS "\"${WOLFSSL_ROOT}/src/\""
|
||||
"\"${WOLFSSL_ROOT}/wolfcrypt/src\""
|
||||
"\"${WOLFSSL_ROOT}/wolfcrypt/src/port/Espressif\""
|
||||
"\"${WOLFSSL_ROOT}/wolfcrypt/src/port/atmel\""
|
||||
"\"${WOLFSSL_EXTRA_PROJECT_DIR}\""
|
||||
) # COMPONENT_SRCDIRS
|
||||
|
||||
message(STATUS "This COMPONENT_SRCDIRS = ${COMPONENT_SRCDIRS}")
|
||||
|
||||
set(WOLFSSL_PROJECT_DIR "${CMAKE_HOME_DIRECTORY}/components/wolfssl")
|
||||
add_definitions(-DWOLFSSL_USER_SETTINGS_DIR="${WOLFSSL_PROJECT_DIR}/include/user_settings.h")
|
||||
|
||||
|
||||
# Espressif may take several passes through this makefile. Check to see if we found IDF
|
||||
string(COMPARE EQUAL "${PROJECT_SOURCE_DIR}" "" WOLFSSL_FOUND_IDF)
|
||||
|
||||
# get a list of all wolfcrypt assembly files; we'll exclude them as they don't target Xtensa
|
||||
file(GLOB EXCLUDE_ASM *.S)
|
||||
file(GLOB_RECURSE EXCLUDE_ASM ${CMAKE_SOURCE_DIR} "${WOLFSSL_ROOT}/wolfcrypt/src/*.S")
|
||||
|
||||
message(STATUS "IDF_PATH = $ENV{IDF_PATH}")
|
||||
message(STATUS "PROJECT_SOURCE_DIR = ${PROJECT_SOURCE_DIR}")
|
||||
message(STATUS "EXCLUDE_ASM = ${EXCLUDE_ASM}")
|
||||
|
||||
#
|
||||
# Check to see if there's both a local copy and EDP-IDF copy of the wolfssl and/or wolfssh components.
|
||||
#
|
||||
if( EXISTS "${WOLFSSL_PROJECT_DIR}" AND EXISTS "$ENV{IDF_PATH}/components/wolfssl/" )
|
||||
#
|
||||
# wolfSSL found in both ESP-IDF and local project - needs to be resolved by user
|
||||
#
|
||||
message(STATUS "")
|
||||
message(STATUS "**************************************************************************************")
|
||||
message(STATUS "")
|
||||
message(STATUS "Error: Found components/wolfssl in both local project and IDF_PATH")
|
||||
message(STATUS "")
|
||||
message(STATUS "To proceed: ")
|
||||
message(STATUS "")
|
||||
message(STATUS "Remove either the local project component: ${WOLFSSL_PROJECT_DIR} ")
|
||||
message(STATUS "or the Espressif shared component installed at: $ENV{IDF_PATH}/components/wolfssl/ ")
|
||||
message(STATUS "")
|
||||
message(FATAL_ERROR "Please use wolfSSL in either local project or Espressif components, but not both.")
|
||||
message(STATUS "")
|
||||
message(STATUS "**************************************************************************************")
|
||||
message(STATUS "")
|
||||
|
||||
# Optional: if you change the above FATAL_ERROR to STATUS you can warn at runtime with this macro definition:
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_MULTI_INSTALL_WARNING")
|
||||
|
||||
else()
|
||||
if( EXISTS "$ENV{IDF_PATH}/components/wolfssl/" )
|
||||
#
|
||||
# wolfSSL found in ESP-IDF components and is assumed to be already configured in user_settings.h via setup.
|
||||
#
|
||||
message(STATUS "")
|
||||
message(STATUS "Using components/wolfssl in IDF_PATH = $ENV{IDF_PATH}")
|
||||
message(STATUS "")
|
||||
else()
|
||||
#
|
||||
# wolfSSL is not an ESP-IDF component.
|
||||
# We need to now determine if it is local and if so if it is part of the wolfSSL repo,
|
||||
# or if wolfSSL is simply installed as a local component.
|
||||
#
|
||||
|
||||
if( EXISTS "${WOLFSSL_PROJECT_DIR}" )
|
||||
#
|
||||
# wolfSSL found in local project.
|
||||
#
|
||||
if( EXISTS "${WOLFSSL_PROJECT_DIR}/wolfcrypt/" )
|
||||
message(STATUS "")
|
||||
message(STATUS "Using installed project ./components/wolfssl in CMAKE_HOME_DIRECTORY = ${CMAKE_HOME_DIRECTORY}")
|
||||
message(STATUS "")
|
||||
#
|
||||
# Note we already checked above and confirmed there's not another wolfSSL installed in the ESP-IDF components.
|
||||
#
|
||||
# We won't do anything else here, as it will be assumed the original install completed successfully.
|
||||
#
|
||||
else() # full wolfSSL not installed in local project
|
||||
#
|
||||
# This is the developer repo mode. wolfSSL will be assumed to be not installed to ESP-IDF nor local project
|
||||
# In this configuration, we are likely running a wolfSSL example found directly in the repo.
|
||||
#
|
||||
message(STATUS "")
|
||||
message(STATUS "Using developer repo ./components/wolfssl in CMAKE_HOME_DIRECTORY = ${CMAKE_HOME_DIRECTORY}")
|
||||
message(STATUS "")
|
||||
|
||||
message(STATUS "************************************************************************************************")
|
||||
# When in developer mode, we are typically running wolfSSL examples such as benchmark or test directories.
|
||||
# However, the as-cloned or distributed wolfSSL does not have the ./include/ directory, so we'll add it as needed.
|
||||
#
|
||||
# first check if there's a [root]/include/user_settings.h
|
||||
if( EXISTS "${WOLFSSL_ROOT}/include/user_settings.h" )
|
||||
message(FATAL_ERROR "Found stray wolfSSL user_settings.h in "
|
||||
"${WOLFSSL_ROOT}/include/user_settings.h "
|
||||
" (please move it to ${WOLFSSL_PROJECT_DIR}/include/user_settings.h )")
|
||||
else()
|
||||
# we won't overwrite an existing user settings file, just note that we already have one:
|
||||
if( EXISTS "${WOLFSSL_PROJECT_DIR}/include/user_settings.h" )
|
||||
message(STATUS "Using existing wolfSSL user_settings.h in "
|
||||
"${WOLFSSL_PROJECT_DIR}/include/user_settings.h")
|
||||
else()
|
||||
message(STATUS "Installing wolfSSL user_settings.h to "
|
||||
"${WOLFSSL_PROJECT_DIR}/include/user_settings.h")
|
||||
file(COPY "${WOLFSSL_ROOT}/IDE/Espressif/ESP-IDF/user_settings.h"
|
||||
DESTINATION "${CMAKE_HOME_DIRECTORY}/wolfssl/include/")
|
||||
endif()
|
||||
endif() # user_settings.h
|
||||
|
||||
# next check if there's a [root]/include/config.h
|
||||
if( EXISTS "${WOLFSSL_ROOT}/include/config.h" )
|
||||
message(STATUS "******************************************************************************")
|
||||
message(STATUS "******************************************************************************")
|
||||
message(STATUS "Found stray wolfSSL config.h in ${WOLFSSL_ROOT}/include/config.h" )
|
||||
message(STATUS " Please move it to ${WOLFSSL_PROJECT_DIR}/include/config.h" )
|
||||
message(STATUS "******************************************************************************")
|
||||
message(STATUS "******************************************************************************")
|
||||
else()
|
||||
# we won't overwrite an existing user settings file, just note that we already have one:
|
||||
if( EXISTS "${WOLFSSL_PROJECT_DIR}/include/config.h" )
|
||||
message(STATUS "Using existing wolfSSL config.h ${WOLFSSL_PROJECT_DIR}/include/config.h")
|
||||
else()
|
||||
message(STATUS "Installing wolfSSL config.h to ${WOLFSSL_PROJECT_DIR}/include/config.h")
|
||||
file(COPY "${WOLFSSL_ROOT}/IDE/Espressif/ESP-IDF/dummy_config_h" DESTINATION "${WOLFSSL_PROJECT_DIR}/include/")
|
||||
file(RENAME "${WOLFSSL_PROJECT_DIR}/include/dummy_config_h" "${WOLFSSL_PROJECT_DIR}/include/config.h")
|
||||
endif() # Project config.h
|
||||
endif() # WOLFSSL_ROOT config.h
|
||||
message(STATUS "************************************************************************************************")
|
||||
message(STATUS "")
|
||||
endif()
|
||||
|
||||
else()
|
||||
# we did not find a ./components/wolfssl/include/ directory from this pass of cmake.
|
||||
if($WOLFSSL_FOUND_IDF)
|
||||
message(STATUS "")
|
||||
message(STATUS "WARNING: wolfSSL not found.")
|
||||
message(STATUS "")
|
||||
else()
|
||||
# probably needs to be re-parsed by Espressif
|
||||
message(STATUS "wolfSSL found IDF. Project Source:${PROJECT_SOURCE_DIR}")
|
||||
endif() # else we have not found ESP-IDF yet
|
||||
endif() # else not a local wolfSSL component
|
||||
|
||||
endif() #else not an ESP-IDF component
|
||||
endif() # else not local copy and EDP-IDF wolfSSL
|
||||
|
||||
|
||||
# RTOS_IDF_PATH is typically:
|
||||
# "/Users/{username}/Desktop/esp-idf/components/freertos/include/freertos"
|
||||
# depending on the environment, we may need to swap backslashes with forward slashes
|
||||
string(REPLACE "\\" "/" RTOS_IDF_PATH "$ENV{IDF_PATH}/components/freertos/FreeRTOS-Kernel/include/freertos")
|
||||
|
||||
string(REPLACE "\\" "/" WOLFSSL_ROOT ${WOLFSSL_ROOT})
|
||||
|
||||
if(IS_DIRECTORY "${RTOS_IDF_PATH}")
|
||||
message(STATUS "Found current RTOS path: ${RTOS_IDF_PATH}")
|
||||
else()
|
||||
# ESP-IDF prior version 4.4x has a different RTOS directory structure
|
||||
string(REPLACE "\\" "/" RTOS_IDF_PATH "$ENV{IDF_PATH}/components/freertos/include/freertos")
|
||||
if(IS_DIRECTORY "${RTOS_IDF_PATH}")
|
||||
message(STATUS "Found legacy RTOS path: ${RTOS_IDF_PATH}")
|
||||
else()
|
||||
message(STATUS "Could not find RTOS path")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
||||
set(COMPONENT_ADD_INCLUDEDIRS
|
||||
"./include" # this is the location of wolfssl user_settings.h
|
||||
"\"${WOLFSSL_ROOT}/\""
|
||||
"\"${WOLFSSL_ROOT}/wolfssl/\""
|
||||
"\"${WOLFSSL_ROOT}/wolfssl/wolfcrypt/\""
|
||||
"\"${RTOS_IDF_PATH}/\""
|
||||
)
|
||||
|
||||
|
||||
if(IS_DIRECTORY ${IDF_PATH}/components/cryptoauthlib)
|
||||
list(APPEND COMPONENT_ADD_INCLUDEDIRS "../cryptoauthlib/lib")
|
||||
endif()
|
||||
|
||||
list(APPEND COMPONENT_ADD_INCLUDEDIRS "\"${WOLFSSL_ROOT}/wolfssl/\"")
|
||||
list(APPEND COMPONENT_ADD_INCLUDEDIRS "\"${WOLFSSL_ROOT}/wolfssl/wolfcrypt/\"")
|
||||
|
||||
|
||||
|
||||
set(COMPONENT_SRCEXCLUDE
|
||||
"\"${WOLFSSL_ROOT}/src/bio.c\""
|
||||
"\"${WOLFSSL_ROOT}/src/conf.c\""
|
||||
"\"${WOLFSSL_ROOT}/src/misc.c\""
|
||||
"\"${WOLFSSL_ROOT}/src/pk.c\""
|
||||
"\"${WOLFSSL_ROOT}/src/ssl_asn1.c\"" # included by ssl.c
|
||||
"\"${WOLFSSL_ROOT}/src/ssl_bn.c\"" # included by ssl.c
|
||||
"\"${WOLFSSL_ROOT}/src/ssl_certman.c\"" # included by ssl.c
|
||||
"\"${WOLFSSL_ROOT}/src/ssl_crypto.c\"" # included by ssl.c
|
||||
"\"${WOLFSSL_ROOT}/src/ssl_misc.c\"" # included by ssl.c
|
||||
"\"${WOLFSSL_ROOT}/src/x509.c\""
|
||||
"\"${WOLFSSL_ROOT}/src/x509_str.c\""
|
||||
"\"${WOLFSSL_ROOT}/wolfcrypt/src/evp.c\""
|
||||
"\"${WOLFSSL_ROOT}/wolfcrypt/src/misc.c\""
|
||||
"\"${WOLFSSL_ROOT}/wolfcrypt/src/sp_sm2_arm32.c\""
|
||||
"\"${WOLFSSL_ROOT}/wolfcrypt/src/sp_sm2_arm64.c\""
|
||||
"\"${WOLFSSL_ROOT}/wolfcrypt/src/sp_sm2_armthumb.c\""
|
||||
"\"${WOLFSSL_ROOT}/wolfcrypt/src/sp_sm2_c32.c\""
|
||||
"\"${WOLFSSL_ROOT}/wolfcrypt/src/sp_sm2_c64.c\""
|
||||
"\"${WOLFSSL_ROOT}/wolfcrypt/src/sp_sm2_cortexm.c\""
|
||||
"\"${WOLFSSL_ROOT}/wolfcrypt/src/sp_sm2_x86_64.c\""
|
||||
"\"${WOLFSSL_ROOT}/wolfcrypt/src/sp_sm2_x86_64_asm.S\""
|
||||
"\"${EXCLUDE_ASM}\""
|
||||
)
|
||||
|
||||
spaces2list(COMPONENT_REQUIRES)
|
||||
|
||||
separate_arguments(COMPONENT_SRCDIRS NATIVE_COMMAND "${COMPONENT_SRCDIRS}")
|
||||
separate_arguments(COMPONENT_SRCEXCLUDE NATIVE_COMMAND "${COMPONENT_SRCEXCLUDE}")
|
||||
separate_arguments(COMPONENT_ADD_INCLUDEDIRS NATIVE_COMMAND "${COMPONENT_ADD_INCLUDEDIRS}")
|
||||
|
||||
#
|
||||
# See https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/build-system.html#example-component-requirements
|
||||
#
|
||||
message(STATUS "COMPONENT_SRCDIRS = ${COMPONENT_SRCDIRS}")
|
||||
message(STATUS "COMPONENT_ADD_INCLUDEDIRS = ${COMPONENT_ADD_INCLUDEDIRS}")
|
||||
message(STATUS "COMPONENT_REQUIRES = ${COMPONENT_REQUIRES}")
|
||||
message(STATUS "COMPONENT_SRCEXCLUDE = ${COMPONENT_SRCEXCLUDE}")
|
||||
|
||||
#
|
||||
# see https://docs.espressif.com/projects/esp-idf/en/stable/esp32/migration-guides/release-5.x/build-system.html?highlight=space%20path
|
||||
#
|
||||
set(EXTRA_COMPONENT_DIRS "${COMPONENT_SRCDIRS}")
|
||||
idf_component_register(
|
||||
SRC_DIRS "${COMPONENT_SRCDIRS}"
|
||||
INCLUDE_DIRS "${COMPONENT_ADD_INCLUDEDIRS}"
|
||||
REQUIRES "${COMPONENT_REQUIRES}"
|
||||
EXCLUDE_SRCS "${COMPONENT_SRCEXCLUDE}"
|
||||
PRIV_REQUIRES esp_timer driver # this will typically only be needed for wolfSSL benchmark
|
||||
)
|
||||
# some optional diagnostics
|
||||
if (1)
|
||||
get_cmake_property(_variableNames VARIABLES)
|
||||
list (SORT _variableNames)
|
||||
message(STATUS "")
|
||||
message(STATUS "ALL VARIABLES BEGIN")
|
||||
message(STATUS "")
|
||||
foreach (_variableName ${_variableNames})
|
||||
message(STATUS "${_variableName}=${${_variableName}}")
|
||||
endforeach()
|
||||
message(STATUS "")
|
||||
message(STATUS "ALL VARIABLES END")
|
||||
message(STATUS "")
|
||||
endif()
|
||||
|
||||
# target_sources(wolfssl PRIVATE "\"${WOLFSSL_ROOT}/wolfssl/\"" "\"${WOLFSSL_ROOT}/wolfssl/wolfcrypt\"")
|
||||
|
||||
endif() # CMAKE_BUILD_EARLY_EXPANSION
|
||||
|
||||
register_component()
|
||||
|
||||
# some optional diagnostics
|
||||
if (0)
|
||||
get_cmake_property(_variableNames VARIABLES)
|
||||
list (SORT _variableNames)
|
||||
message(STATUS "")
|
||||
message(STATUS "ALL VARIABLES BEGIN")
|
||||
message(STATUS "")
|
||||
foreach (_variableName ${_variableNames})
|
||||
message(STATUS "${_variableName}=${${_variableName}}")
|
||||
endforeach()
|
||||
message(STATUS "")
|
||||
message(STATUS "ALL VARIABLES END")
|
||||
message(STATUS "")
|
||||
endif()
|
||||
|
||||
# check to see if there's both a local copy and EDP-IDF copy of the wolfssl components
|
||||
if( EXISTS "${CMAKE_HOME_DIRECTORY}/components/wolfssl/" AND EXISTS "$ENV{IDF_PATH}/components/wolfssl/" )
|
||||
if( EXISTS "${WOLFSSL_PROJECT_DIR}" AND EXISTS "$ENV{IDF_PATH}/components/wolfssl/" )
|
||||
message(STATUS "")
|
||||
message(STATUS "")
|
||||
message(STATUS "********************************************************************")
|
||||
@@ -227,3 +456,69 @@ endif()
|
||||
# end multiple component check
|
||||
|
||||
|
||||
#
|
||||
# LIBWOLFSSL_SAVE_INFO(VAR_OUPUT THIS_VAR VAR_RESULT)
|
||||
#
|
||||
# Save the THIS_VAR as a string in a macro called VAR_OUPUT
|
||||
#
|
||||
# VAR_OUPUT: the name of the macro to define
|
||||
# THIS_VAR: the OUTPUT_VARIABLE result from a execute_process()
|
||||
# VAR_RESULT: the RESULT_VARIABLE from a execute_process(); "0" if successful.
|
||||
#
|
||||
function ( LIBWOLFSSL_SAVE_INFO VAR_OUPUT THIS_VAR VAR_RESULT )
|
||||
# is the RESULT_VARIABLE output value 0? If so, IS_VALID_VALUE is true.
|
||||
string(COMPARE EQUAL "${VAR_RESULT}" "0" IS_VALID_VALUE)
|
||||
|
||||
# if we had a successful operation, save the THIS_VAR in VAR_OUPUT
|
||||
if(${IS_VALID_VALUE})
|
||||
# strip newline chars in THIS_VAR parameter and save in VAR_VALUE
|
||||
string(REPLACE "\n" "" VAR_VALUE ${THIS_VAR})
|
||||
|
||||
# we'll could percolate the value to the parent for possible later use
|
||||
# set(${VAR_OUPUT} ${VAR_VALUE} PARENT_SCOPE)
|
||||
|
||||
# but we're only using it here in this function
|
||||
set(${VAR_OUPUT} ${VAR_VALUE})
|
||||
|
||||
# we'll print what we found to the console
|
||||
message(STATUS "Found ${VAR_OUPUT}=${VAR_VALUE}")
|
||||
|
||||
# the interesting part is defining the VAR_OUPUT name a value to use in the app
|
||||
add_definitions(-D${VAR_OUPUT}=\"${VAR_VALUE}\")
|
||||
else()
|
||||
# if we get here, check the execute_process command and parameters.
|
||||
message(STATUS "LIBWOLFSSL_SAVE_INFO encountered a non-zero VAR_RESULT")
|
||||
set(${VAR_OUPUT} "Unknown")
|
||||
endif()
|
||||
endfunction() # LIBWOLFSSL_SAVE_INFO
|
||||
|
||||
# create some programmatic #define values that will be used by ShowExtendedSystemInfo().
|
||||
# see wolfcrypt\src\port\Espressif\esp32_utl.c
|
||||
if(NOT CMAKE_BUILD_EARLY_EXPANSION)
|
||||
set (git_cmd "git")
|
||||
message(STATUS "Adding macro definitions:")
|
||||
|
||||
# LIBWOLFSSL_VERSION_GIT_ORIGIN: git config --get remote.origin.url
|
||||
execute_process(WORKING_DIRECTORY ${WOLFSSL_ROOT} COMMAND ${git_cmd} "config" "--get" "remote.origin.url" OUTPUT_VARIABLE TMP_OUT RESULT_VARIABLE TMP_RES ERROR_QUIET )
|
||||
LIBWOLFSSL_SAVE_INFO(LIBWOLFSSL_VERSION_GIT_ORIGIN "${TMP_OUT}" "${TMP_RES}")
|
||||
|
||||
# LIBWOLFSSL_VERSION_GIT_BRANCH: git rev-parse --abbrev-ref HEAD
|
||||
execute_process(WORKING_DIRECTORY ${WOLFSSL_ROOT} COMMAND ${git_cmd} "rev-parse" "--abbrev-ref" "HEAD" OUTPUT_VARIABLE TMP_OUT RESULT_VARIABLE TMP_RES ERROR_QUIET )
|
||||
LIBWOLFSSL_SAVE_INFO(LIBWOLFSSL_VERSION_GIT_BRANCH "${TMP_OUT}" "${TMP_RES}")
|
||||
|
||||
# LIBWOLFSSL_VERSION_GIT_HASH: git rev-parse HEAD
|
||||
execute_process(WORKING_DIRECTORY ${WOLFSSL_ROOT} COMMAND ${git_cmd} "rev-parse" "HEAD" OUTPUT_VARIABLE TMP_OUT RESULT_VARIABLE TMP_RES ERROR_QUIET )
|
||||
LIBWOLFSSL_SAVE_INFO(LIBWOLFSSL_VERSION_GIT_HASH "${TMP_OUT}" "${TMP_RES}")
|
||||
|
||||
# LIBWOLFSSL_VERSION_GIT_SHORT_HASH: git rev-parse --short HEAD
|
||||
execute_process(WORKING_DIRECTORY ${WOLFSSL_ROOT} COMMAND ${git_cmd} "rev-parse" "--short" "HEAD" OUTPUT_VARIABLE TMP_OUT RESULT_VARIABLE TMP_RES ERROR_QUIET )
|
||||
LIBWOLFSSL_SAVE_INFO(LIBWOLFSSL_VERSION_GIT_SHORT_HASH "${TMP_OUT}" "${TMP_RES}")
|
||||
|
||||
# LIBWOLFSSL_VERSION_GIT_HASH_DATE git show --no-patch --no-notes --pretty=\'\%cd\'
|
||||
execute_process(WORKING_DIRECTORY ${WOLFSSL_ROOT} COMMAND ${git_cmd} "show" "--no-patch" "--no-notes" "--pretty=\'\%cd\'" OUTPUT_VARIABLE TMP_OUT RESULT_VARIABLE TMP_RES )
|
||||
LIBWOLFSSL_SAVE_INFO(LIBWOLFSSL_VERSION_GIT_HASH_DATE "${TMP_OUT}" "${TMP_RES}")
|
||||
|
||||
message(STATUS "************************************************************************************************")
|
||||
message(STATUS "wolfssl component config complete!")
|
||||
message(STATUS "************************************************************************************************")
|
||||
endif()
|
||||
|
||||
@@ -0,0 +1,435 @@
|
||||
/* user_settings.h
|
||||
*
|
||||
* Copyright (C) 2006-2023 wolfSSL Inc.
|
||||
*
|
||||
* This file is part of wolfSSL.
|
||||
*
|
||||
* wolfSSL is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* wolfSSL is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
|
||||
*/
|
||||
|
||||
/* This user_settings.h is for Espressif ESP-IDF */
|
||||
#include <sdkconfig.h>
|
||||
|
||||
/* The Espressif sdkconfig will have chipset info.
|
||||
**
|
||||
** Possible values:
|
||||
**
|
||||
** CONFIG_IDF_TARGET_ESP32
|
||||
** CONFIG_IDF_TARGET_ESP32S2
|
||||
** CONFIG_IDF_TARGET_ESP32S3
|
||||
** CONFIG_IDF_TARGET_ESP32C3
|
||||
** CONFIG_IDF_TARGET_ESP32C6
|
||||
*/
|
||||
|
||||
#undef WOLFSSL_ESPIDF
|
||||
#define WOLFSSL_ESPIDF
|
||||
|
||||
/*
|
||||
* choose ONE of these Espressif chips to define:
|
||||
*
|
||||
* WOLFSSL_ESP32
|
||||
* WOLFSSL_ESPWROOM32SE
|
||||
* WOLFSSL_ESP8266
|
||||
*/
|
||||
#undef WOLFSSL_ESPWROOM32SE
|
||||
#undef WOLFSSL_ESP8266
|
||||
#undef WOLFSSL_ESP32
|
||||
|
||||
#define WOLFSSL_ESP32
|
||||
|
||||
/* optionally turn off SHA512/224 SHA512/256 */
|
||||
/* #define WOLFSSL_NOSHA512_224 */
|
||||
/* #define WOLFSSL_NOSHA512_256 */
|
||||
|
||||
/* when you want to use SINGLE THREAD. Note Default ESP-IDF is FreeRTOS */
|
||||
/* #define SINGLE_THREADED */
|
||||
|
||||
/* When you don't want to use the old SHA */
|
||||
/* #define NO_SHA */
|
||||
/* #define NO_OLD_TLS */
|
||||
|
||||
#define BENCH_EMBEDDED
|
||||
#define USE_CERT_BUFFERS_2048
|
||||
|
||||
/* TLS 1.3 */
|
||||
#define WOLFSSL_TLS13
|
||||
#define HAVE_TLS_EXTENSIONS
|
||||
#define WC_RSA_PSS
|
||||
#define HAVE_HKDF
|
||||
#define HAVE_AEAD
|
||||
#define HAVE_SUPPORTED_CURVES
|
||||
|
||||
#define WOLFSSL_BENCHMARK_FIXED_UNITS_KB
|
||||
|
||||
#define NO_FILESYSTEM
|
||||
|
||||
#define NO_OLD_TLS
|
||||
|
||||
#define HAVE_AESGCM
|
||||
|
||||
#define WOLFSSL_RIPEMD
|
||||
/* when you want to use SHA224 */
|
||||
#define WOLFSSL_SHA224
|
||||
|
||||
/* when you want to use SHA384 */
|
||||
#define WOLFSSL_SHA384
|
||||
|
||||
/* when you want to use SHA512 */
|
||||
#define WOLFSSL_SHA512
|
||||
|
||||
/* when you want to use SHA3 */
|
||||
#define WOLFSSL_SHA3
|
||||
|
||||
#define HAVE_ED25519 /* ED25519 requires SHA512 */
|
||||
|
||||
#define HAVE_ECC
|
||||
#define HAVE_CURVE25519
|
||||
#define CURVE25519_SMALL
|
||||
#define HAVE_ED25519
|
||||
|
||||
#define OPENSSL_EXTRA
|
||||
/* when you want to use pkcs7 */
|
||||
/* #define HAVE_PKCS7 */
|
||||
|
||||
#define HAVE_PKCS7
|
||||
|
||||
#if defined(HAVE_PKCS7)
|
||||
#define HAVE_AES_KEYWRAP
|
||||
#define HAVE_X963_KDF
|
||||
#define WOLFSSL_AES_DIRECT
|
||||
#endif
|
||||
|
||||
/* when you want to use aes counter mode */
|
||||
/* #define WOLFSSL_AES_DIRECT */
|
||||
/* #define WOLFSSL_AES_COUNTER */
|
||||
|
||||
/* esp32-wroom-32se specific definition */
|
||||
#if defined(WOLFSSL_ESPWROOM32SE)
|
||||
#define WOLFSSL_ATECC508A
|
||||
#define HAVE_PK_CALLBACKS
|
||||
/* when you want to use a custom slot allocation for ATECC608A */
|
||||
/* unless your configuration is unusual, you can use default */
|
||||
/* implementation. */
|
||||
/* #define CUSTOM_SLOT_ALLOCATION */
|
||||
#endif
|
||||
|
||||
/* rsa primitive specific definition */
|
||||
#if defined(WOLFSSL_ESP32) || defined(WOLFSSL_ESPWROOM32SE)
|
||||
/* Define USE_FAST_MATH and SMALL_STACK */
|
||||
#define ESP32_USE_RSA_PRIMITIVE
|
||||
|
||||
#if defined(CONFIG_IDF_TARGET_ESP32)
|
||||
|
||||
/* NOTE HW unreliable for small values! */
|
||||
/* threshold for performance adjustment for HW primitive use */
|
||||
/* X bits of G^X mod P greater than */
|
||||
#undef ESP_RSA_EXPT_XBITS
|
||||
#define ESP_RSA_EXPT_XBITS 32
|
||||
|
||||
/* X and Y of X * Y mod P greater than */
|
||||
#undef ESP_RSA_MULM_BITS
|
||||
#define ESP_RSA_MULM_BITS 16
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define RSA_LOW_MEM
|
||||
|
||||
/* #define WOLFSSL_ATECC508A_DEBUG */
|
||||
|
||||
/* date/time */
|
||||
/* if it cannot adjust time in the device, */
|
||||
/* enable macro below */
|
||||
/* #define NO_ASN_TIME */
|
||||
/* #define XTIME time */
|
||||
|
||||
|
||||
/* adjust wait-timeout count if you see timeout in RSA HW acceleration */
|
||||
#define ESP_RSA_TIMEOUT_CNT 0x249F00
|
||||
|
||||
#define HASH_SIZE_LIMIT /* for test.c */
|
||||
|
||||
/* USE_FAST_MATH is default */
|
||||
#define USE_FAST_MATH
|
||||
|
||||
/***** Use SP_MATH *****/
|
||||
/* #undef USE_FAST_MATH */
|
||||
/* #define SP_MATH */
|
||||
/* #define WOLFSSL_SP_MATH_ALL */
|
||||
|
||||
/***** Use Integer Heap Math *****/
|
||||
/* #undef USE_FAST_MATH */
|
||||
/* #define USE_INTEGER_HEAP_MATH */
|
||||
|
||||
|
||||
#define WOLFSSL_SMALL_STACK
|
||||
|
||||
|
||||
#define HAVE_VERSION_EXTENDED_INFO
|
||||
/* #define HAVE_WC_INTROSPECTION */
|
||||
|
||||
#define HAVE_SESSION_TICKET
|
||||
|
||||
/* #define HAVE_HASHDRBG */
|
||||
|
||||
#define WOLFSSL_KEY_GEN
|
||||
#define WOLFSSL_CERT_REQ
|
||||
#define WOLFSSL_CERT_GEN
|
||||
#define WOLFSSL_CERT_EXT
|
||||
#define WOLFSSL_SYS_CA_CERTS
|
||||
|
||||
|
||||
#define WOLFSSL_CERT_TEXT
|
||||
|
||||
#define WOLFSSL_ASN_TEMPLATE
|
||||
|
||||
/*
|
||||
#undef WOLFSSL_KEY_GEN
|
||||
#undef WOLFSSL_CERT_REQ
|
||||
#undef WOLFSSL_CERT_GEN
|
||||
#undef WOLFSSL_CERT_EXT
|
||||
#undef WOLFSSL_SYS_CA_CERTS
|
||||
*/
|
||||
|
||||
/*
|
||||
--enable-keygen
|
||||
--enable-certgen
|
||||
--enable-certreq
|
||||
--enable-certext
|
||||
--enable-asn-template
|
||||
*/
|
||||
|
||||
/* Default is HW enabled unless turned off.
|
||||
** Uncomment these lines to force SW instead of HW acceleration */
|
||||
|
||||
#if defined(CONFIG_IDF_TARGET_ESP32)
|
||||
/* wolfSSL HW Acceleration supported on ESP32. Uncomment to disable: */
|
||||
/* #define NO_ESP32_CRYPT */
|
||||
/* #define NO_WOLFSSL_ESP32_CRYPT_HASH */
|
||||
/* #define NO_WOLFSSL_ESP32_CRYPT_AES */
|
||||
/* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI */
|
||||
/* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_MP_MUL */
|
||||
/* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_MULMOD */
|
||||
/* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_EXPTMOD */
|
||||
|
||||
/* These are defined automatically in esp32-crypt.h, here for clarity: */
|
||||
#define NO_WOLFSSL_ESP32_CRYPT_HASH_SHA224 /* no SHA224 HW on ESP32 */
|
||||
|
||||
#undef ESP_RSA_MULM_BITS
|
||||
#define ESP_RSA_MULM_BITS 16 /* TODO add compile-time warning */
|
||||
/***** END CONFIG_IDF_TARGET_ESP32 *****/
|
||||
|
||||
#elif defined(CONFIG_IDF_TARGET_ESP32S2)
|
||||
/* wolfSSL HW Acceleration supported on ESP32-S2. Uncomment to disable: */
|
||||
/* #define NO_ESP32_CRYPT */
|
||||
/* #define NO_WOLFSSL_ESP32_CRYPT_HASH */
|
||||
/* Note: There's no AES192 HW on the ESP32-S2; falls back to SW */
|
||||
/* #define NO_WOLFSSL_ESP32_CRYPT_AES */
|
||||
/* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI */
|
||||
/* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_MP_MUL */
|
||||
/* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_MULMOD */
|
||||
/* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_EXPTMOD */
|
||||
/***** END CONFIG_IDF_TARGET_ESP32S2 *****/
|
||||
|
||||
#elif defined(CONFIG_IDF_TARGET_ESP32S3)
|
||||
/* wolfSSL HW Acceleration supported on ESP32-S3. Uncomment to disable: */
|
||||
/* #define NO_ESP32_CRYPT */
|
||||
/* #define NO_WOLFSSL_ESP32_CRYPT_HASH */
|
||||
/* Note: There's no AES192 HW on the ESP32-S3; falls back to SW */
|
||||
/* #define NO_WOLFSSL_ESP32_CRYPT_AES */
|
||||
/* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI */
|
||||
/* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_MP_MUL */
|
||||
/* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_MULMOD */
|
||||
/* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_EXPTMOD */
|
||||
/***** END CONFIG_IDF_TARGET_ESP32S3 *****/
|
||||
|
||||
#elif defined(CONFIG_IDF_TARGET_ESP32C2) || \
|
||||
defined(CONFIG_IDF_TARGET_ESP8684)
|
||||
/* ESP8684 is essentially ESP32-C2 chip + flash embedded together in a
|
||||
* single QFN 4x4 mm package. Out of released documentation, Technical
|
||||
* Reference Manual as well as ESP-IDF Programming Guide is applicable
|
||||
* to both ESP32-C2 and ESP8684.
|
||||
*
|
||||
* See: https://www.esp32.com/viewtopic.php?f=5&t=27926#:~:text=ESP8684%20is%20essentially%20ESP32%2DC2,both%20ESP32%2DC2%20and%20ESP8684. */
|
||||
|
||||
/* wolfSSL HW Acceleration supported on ESP32-C2. Uncomment to disable: */
|
||||
/* #define NO_ESP32_CRYPT */
|
||||
/* #define NO_WOLFSSL_ESP32_CRYPT_HASH */ /* to disable all SHA HW */
|
||||
|
||||
/* These are defined automatically in esp32-crypt.h, here for clarity */
|
||||
#define NO_WOLFSSL_ESP32_CRYPT_HASH_SHA384 /* no SHA384 HW on C2 */
|
||||
#define NO_WOLFSSL_ESP32_CRYPT_HASH_SHA512 /* no SHA512 HW on C2 */
|
||||
|
||||
/* There's no AES or RSA/Math accelerator on the ESP32-C2
|
||||
* Auto defined with NO_WOLFSSL_ESP32_CRYPT_RSA_PRI, for clarity: */
|
||||
#define NO_WOLFSSL_ESP32_CRYPT_AES
|
||||
#define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI
|
||||
#define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_MP_MUL
|
||||
#define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_MULMOD
|
||||
#define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_EXPTMOD
|
||||
/***** END CONFIG_IDF_TARGET_ESP32C2 *****/
|
||||
|
||||
#elif defined(CONFIG_IDF_TARGET_ESP32C3)
|
||||
/* wolfSSL HW Acceleration supported on ESP32-C3. Uncomment to disable: */
|
||||
|
||||
/* #define NO_ESP32_CRYPT */
|
||||
/* #define NO_WOLFSSL_ESP32_CRYPT_HASH */ /* to disable all SHA HW */
|
||||
|
||||
/* These are defined automatically in esp32-crypt.h, here for clarity: */
|
||||
#define NO_WOLFSSL_ESP32_CRYPT_HASH_SHA384 /* no SHA384 HW on C6 */
|
||||
#define NO_WOLFSSL_ESP32_CRYPT_HASH_SHA512 /* no SHA512 HW on C6 */
|
||||
|
||||
/* #define NO_WOLFSSL_ESP32_CRYPT_AES */
|
||||
/* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI */
|
||||
/* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_MP_MUL */
|
||||
/* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_MULMOD */
|
||||
/* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_EXPTMOD */
|
||||
/***** END CONFIG_IDF_TARGET_ESP32C3 *****/
|
||||
|
||||
#elif defined(CONFIG_IDF_TARGET_ESP32C6)
|
||||
/* wolfSSL HW Acceleration supported on ESP32-C6. Uncomment to disable: */
|
||||
|
||||
/* #define NO_ESP32_CRYPT */
|
||||
/* #define NO_WOLFSSL_ESP32_CRYPT_HASH */
|
||||
/* These are defined automatically in esp32-crypt.h, here for clarity: */
|
||||
#define NO_WOLFSSL_ESP32_CRYPT_HASH_SHA384 /* no SHA384 HW on C6 */
|
||||
#define NO_WOLFSSL_ESP32_CRYPT_HASH_SHA512 /* no SHA512 HW on C6 */
|
||||
|
||||
/* #define NO_WOLFSSL_ESP32_CRYPT_AES */
|
||||
/* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI */
|
||||
/* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_MP_MUL */
|
||||
/* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_MULMOD */
|
||||
/* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_EXPTMOD */
|
||||
/***** END CONFIG_IDF_TARGET_ESP32C6 *****/
|
||||
|
||||
#elif defined(CONFIG_IDF_TARGET_ESP32H2)
|
||||
/* wolfSSL Hardware Acceleration not yet implemented */
|
||||
#define NO_ESP32_CRYPT
|
||||
#define NO_WOLFSSL_ESP32_CRYPT_HASH
|
||||
#define NO_WOLFSSL_ESP32_CRYPT_AES
|
||||
#define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI
|
||||
/***** END CONFIG_IDF_TARGET_ESP32H2 *****/
|
||||
|
||||
#elif defined(CONFIG_IDF_TARGET_ESP8266)
|
||||
/* TODO: Revisit ESP8266 */
|
||||
#define NO_ESP32_CRYPT
|
||||
#define NO_WOLFSSL_ESP32_CRYPT_HASH
|
||||
#define NO_WOLFSSL_ESP32_CRYPT_AES
|
||||
#define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI
|
||||
/***** END CONFIG_IDF_TARGET_ESP266 *****/
|
||||
|
||||
#elif defined(CONFIG_IDF_TARGET_ESP8684)
|
||||
/* There's no Hardware Acceleration available on ESP8684 */
|
||||
#define NO_ESP32_CRYPT
|
||||
#define NO_WOLFSSL_ESP32_CRYPT_HASH
|
||||
#define NO_WOLFSSL_ESP32_CRYPT_AES
|
||||
#define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI
|
||||
/***** END CONFIG_IDF_TARGET_ESP8684 *****/
|
||||
|
||||
#else
|
||||
/* Anything else encountered, disable HW accleration */
|
||||
#define NO_ESP32_CRYPT
|
||||
#define NO_WOLFSSL_ESP32_CRYPT_HASH
|
||||
#define NO_WOLFSSL_ESP32_CRYPT_AES
|
||||
#define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI
|
||||
#endif /* CONFIG_IDF_TARGET Check */
|
||||
|
||||
/* Debug options:
|
||||
|
||||
#define ESP_VERIFY_MEMBLOCK
|
||||
#define DEBUG_WOLFSSL
|
||||
#define DEBUG_WOLFSSL_VERBOSE
|
||||
#define DEBUG_WOLFSSL_SHA_MUTEX
|
||||
#define WOLFSSL_ESP32_CRYPT_DEBUG
|
||||
#define WOLFSSL_ESP32_CRYPT_HASH_SHA224_DEBUG
|
||||
#define NO_RECOVER_SOFTWARE_CALC
|
||||
#define WOLFSSL_TEST_STRAY 1
|
||||
#define USE_ESP_DPORT_ACCESS_READ_BUFFER
|
||||
#define WOLFSSL_ESP32_HW_LOCK_DEBUG
|
||||
#define WOLFSSL_DEBUG_ESP_RSA_MULM_BITS
|
||||
#define ESP_DISABLE_HW_TASK_LOCK
|
||||
*/
|
||||
|
||||
#define WOLFSSL_ESPIDF_ERROR_PAUSE /* Pause in a loop rather than exit. */
|
||||
#define WOLFSSL_HW_METRICS
|
||||
|
||||
/* #define HASH_SIZE_LIMIT */ /* for test.c */
|
||||
|
||||
/* #define NO_HW_MATH_TEST */ /* Optionall turn off HW math checks */
|
||||
|
||||
/* Optionally include alternate HW test library: alt_hw_test.h */
|
||||
/* When enabling, the ./components/wolfssl/CMakeLists.txt file
|
||||
* will need the name of the library in the idf_component_register
|
||||
* for the PRIV_REQUIRES list. */
|
||||
/* #define INCLUDE_ALT_HW_TEST */
|
||||
|
||||
/* optionally turn off individual math HW acceleration features */
|
||||
|
||||
/* Turn off Large Number ESP32 HW Multiplication:
|
||||
** [Z = X * Y] in esp_mp_mul() */
|
||||
/* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_MP_MUL */
|
||||
|
||||
/* Turn off Large Number ESP32 HW Modular Exponentiation:
|
||||
** [Z = X^Y mod M] in esp_mp_exptmod() */
|
||||
/* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_EXPTMOD */
|
||||
|
||||
/* Turn off Large Number ESP32 HW Modular Multiplication
|
||||
** [Z = X * Y mod M] in esp_mp_mulmod() */
|
||||
/* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_MULMOD */
|
||||
|
||||
|
||||
#define WOLFSSL_PUBLIC_MP /* used by benchmark */
|
||||
#define USE_CERT_BUFFERS_2048
|
||||
|
||||
/* when turning on ECC508 / ECC608 support
|
||||
#define WOLFSSL_ESPWROOM32SE
|
||||
#define HAVE_PK_CALLBACKS
|
||||
#define WOLFSSL_ATECC508A
|
||||
#define ATCA_WOLFSSL
|
||||
*/
|
||||
|
||||
/* optional SM4 Ciphers. See https://github.com/wolfSSL/wolfsm
|
||||
#define WOLFSSL_SM2
|
||||
#define WOLFSSL_SM3
|
||||
#define WOLFSSL_SM4
|
||||
*/
|
||||
|
||||
#if defined(WOLFSSL_SM2) || defined(WOLFSSL_SM3) || defined(WOLFSSL_SM4)
|
||||
#include <wolfssl/certs_test_sm.h>
|
||||
#define CTX_CA_CERT root_sm2
|
||||
#define CTX_CA_CERT_SIZE sizeof_root_sm2
|
||||
#define CTX_CA_CERT_TYPE WOLFSSL_FILETYPE_PEM
|
||||
#define CTX_SERVER_CERT server_sm2
|
||||
#define CTX_SERVER_CERT_SIZE sizeof_server_sm2
|
||||
#define CTX_SERVER_CERT_TYPE WOLFSSL_FILETYPE_PEM
|
||||
#define CTX_SERVER_KEY server_sm2_priv
|
||||
#define CTX_SERVER_KEY_SIZE sizeof_server_sm2_priv
|
||||
#define CTX_SERVER_KEY_TYPE WOLFSSL_FILETYPE_PEM
|
||||
|
||||
#undef WOLFSSL_BASE16
|
||||
#define WOLFSSL_BASE16
|
||||
#else
|
||||
#define USE_CERT_BUFFERS_2048
|
||||
#define USE_CERT_BUFFERS_256
|
||||
#define CTX_CA_CERT ca_cert_der_2048
|
||||
#define CTX_CA_CERT_SIZE sizeof_ca_cert_der_2048
|
||||
#define CTX_CA_CERT_TYPE WOLFSSL_FILETYPE_ASN1
|
||||
#define CTX_SERVER_CERT server_cert_der_2048
|
||||
#define CTX_SERVER_CERT_SIZE sizeof_server_cert_der_2048
|
||||
#define CTX_SERVER_CERT_TYPE WOLFSSL_FILETYPE_ASN1
|
||||
#define CTX_SERVER_KEY server_key_der_2048
|
||||
#define CTX_SERVER_KEY_SIZE sizeof_server_key_der_2048
|
||||
#define CTX_SERVER_KEY_TYPE WOLFSSL_FILETYPE_ASN1
|
||||
#endif
|
||||
@@ -1,12 +1,36 @@
|
||||
|
||||
# wolfSSL Espressif Example Project/main CMakeLists.txt
|
||||
# v1.0
|
||||
#
|
||||
# wolfssl server test
|
||||
#
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_USER_SETTINGS")
|
||||
|
||||
set(COMPONENT_SRCS "server-tls.c" "wifi_connect.c")
|
||||
set(COMPONENT_ADD_INCLUDEDIRS "." "./include")
|
||||
|
||||
if(WIN32)
|
||||
# Windows-specific configuration here
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_CMAKE_SYSTEM_NAME_WINDOWS")
|
||||
message("Detected Windows")
|
||||
endif()
|
||||
if(CMAKE_HOST_UNIX)
|
||||
message("Detected UNIX")
|
||||
endif()
|
||||
if(APPLE)
|
||||
message("Detected APPLE")
|
||||
endif()
|
||||
if(CMAKE_HOST_UNIX AND (NOT APPLE) AND EXISTS "/proc/sys/fs/binfmt_misc/WSLInterop")
|
||||
# Windows-specific configuration here
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_CMAKE_SYSTEM_NAME_WSL")
|
||||
message("Detected WSL")
|
||||
endif()
|
||||
if(CMAKE_HOST_UNIX AND (NOT APPLE) AND (NOT WIN32))
|
||||
# Windows-specific configuration here
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_CMAKE_SYSTEM_NAME_LINUX")
|
||||
message("Detected Linux")
|
||||
endif()
|
||||
if(APPLE)
|
||||
# Windows-specific configuration here
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_CMAKE_SYSTEM_NAME_APPLE")
|
||||
message("Detected Apple")
|
||||
endif()
|
||||
set (git_cmd "git")
|
||||
|
||||
if( EXISTS "${CMAKE_HOME_DIRECTORY}/components/wolfssl/" AND EXISTS "$ENV{IDF_PATH}/components/wolfssl/" )
|
||||
@@ -19,8 +43,14 @@ if( EXISTS "${CMAKE_HOME_DIRECTORY}/components/wolfssl/" AND EXISTS "$ENV{IDF_PA
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_MULTI_INSTALL_WARNING")
|
||||
endif()
|
||||
|
||||
|
||||
register_component()
|
||||
## register_component()
|
||||
idf_component_register(SRCS main.c
|
||||
wifi_connect.c
|
||||
time_helper.c
|
||||
server-tls.c
|
||||
INCLUDE_DIRS "."
|
||||
"./include")
|
||||
#
|
||||
|
||||
#
|
||||
# LIBWOLFSSL_SAVE_INFO(VAR_OUPUT THIS_VAR VAR_RESULT)
|
||||
@@ -73,3 +103,4 @@ if(NOT CMAKE_BUILD_EARLY_EXPANSION)
|
||||
endif()
|
||||
|
||||
message(STATUS "")
|
||||
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
menu "Example Configuration"
|
||||
|
||||
config WOLFSSL_TARGET_PORT
|
||||
int "Target port"
|
||||
default 11111
|
||||
help
|
||||
Host listening port for the example to connect.
|
||||
|
||||
endmenu
|
||||
@@ -1,4 +1,4 @@
|
||||
/* callbacks.h
|
||||
/* template main.h
|
||||
*
|
||||
* Copyright (C) 2006-2023 wolfSSL Inc.
|
||||
*
|
||||
@@ -18,6 +18,7 @@
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
|
||||
*/
|
||||
#ifndef _MAIN_H_
|
||||
#define _MAIN_H_
|
||||
|
||||
|
||||
#include <wolfssl/callbacks.h>
|
||||
#endif
|
||||
@@ -0,0 +1,60 @@
|
||||
/* server-tls.h
|
||||
*
|
||||
* Copyright (C) 2006-2023 wolfSSL Inc.
|
||||
*
|
||||
* This file is part of wolfSSL.
|
||||
*
|
||||
* wolfSSL is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* wolfSSL is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
|
||||
*/
|
||||
#ifndef _SERVER_TLS_
|
||||
#define _SERVER_TLS_
|
||||
|
||||
#include <wolfssl/wolfcrypt/settings.h> /* includes wolfSSL user-settings.h */
|
||||
#include <wolfssl/ssl.h>
|
||||
#include "sdkconfig.h"
|
||||
|
||||
#if defined(SINGLE_THREADED)
|
||||
#define WOLFSSL_ESP_TASK int
|
||||
#else
|
||||
#include "freertos/FreeRTOS.h"
|
||||
#define WOLFSSL_ESP_TASK void
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_WOLFSSL_TARGET_PORT
|
||||
#define TLS_SMP_DEFAULT_PORT CONFIG_WOLFSSL_TARGET_PORT
|
||||
#else
|
||||
#define TLS_SMP_DEFAULT_PORT 11111
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
int port;
|
||||
int loops;
|
||||
} tls_args;
|
||||
|
||||
/* Function to show the ciphers available / in use. */
|
||||
#if defined(DEBUG_WOLFSSL)
|
||||
int ShowCiphers(WOLFSSL* ssl);
|
||||
#endif
|
||||
|
||||
/* This is the TLS Server function, possibly in an RTOS thread. */
|
||||
WOLFSSL_ESP_TASK tls_smp_server_task(void *args);
|
||||
|
||||
/* init will create an RTOS task, otherwise server is simply function call. */
|
||||
#if defined(SINGLE_THREADED)
|
||||
/* no init neded */
|
||||
#else
|
||||
WOLFSSL_ESP_TASK tls_smp_server_init(void* args);
|
||||
#endif
|
||||
#endif /* _SERVER_TLS_ */
|
||||
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
* Copyright (C) 2006-2023 wolfSSL Inc.
|
||||
*
|
||||
* This file is part of wolfSSL.
|
||||
*
|
||||
* wolfSSL is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* wolfSSL is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
|
||||
*/
|
||||
|
||||
/* common Espressif time_helper v5.6.3.001 */
|
||||
|
||||
#ifndef _TIME_HELPER_H
|
||||
#define _TIME_HELPER_H
|
||||
|
||||
/* ESP-IDF uses a 64-bit signed integer to represent time_t starting from release v5.0
|
||||
* See: https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/system/system_time.html#year-2036-and-2038-overflow-issues
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* a function to show the current data and time */
|
||||
int esp_show_current_datetime();
|
||||
|
||||
/* worst case, if GitHub time not available, used fixed time */
|
||||
int set_fixed_default_time(void);
|
||||
|
||||
/* set time from string (e.g. GitHub commit time) */
|
||||
int set_time_from_string(char* time_buffer);
|
||||
|
||||
/* set time from NTP servers,
|
||||
* also initially calls set_fixed_default_time or set_time_from_string */
|
||||
int set_time(void);
|
||||
|
||||
/* wait NTP_RETRY_COUNT seconds before giving up on NTP time */
|
||||
int set_time_wait_for_ntp(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* #ifndef _TIME_HELPER_H */
|
||||
@@ -18,25 +18,80 @@
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
|
||||
*/
|
||||
#ifndef _TLS_WIFI_H_
|
||||
#define _TLS_WIFI_H_
|
||||
#ifndef _WIFI_CONNECT_H_
|
||||
#define _WIFI_CONNECT_H_
|
||||
|
||||
#include "esp_idf_version.h"
|
||||
#include "esp_log.h"
|
||||
#include "esp_wifi.h"
|
||||
#if ESP_IDF_VERSION_MAJOR >= 4
|
||||
#include "esp_event.h"
|
||||
#else
|
||||
#include "esp_event_loop.h"
|
||||
#endif
|
||||
#include <esp_idf_version.h>
|
||||
#include <esp_log.h>
|
||||
|
||||
#define DEFAULT_PORT 11111
|
||||
/* ESP lwip */
|
||||
#define EXAMPLE_ESP_MAXIMUM_RETRY CONFIG_ESP_MAXIMUM_RETRY
|
||||
|
||||
#define TLS_SMP_SERVER_TASK_NAME "tls_sever_example"
|
||||
#define TLS_SMP_SERVER_TASK_WORDS 10240
|
||||
#define TLS_SMP_SERVER_TASK_WORDS 22240
|
||||
#define TLS_SMP_SERVER_TASK_PRIORITY 8
|
||||
|
||||
#define TLS_SMP_WIFI_SSID CONFIG_WIFI_SSID
|
||||
#define TLS_SMP_WIFI_PASS CONFIG_WIFI_PASSWORD
|
||||
|
||||
#define USE_WIFI_EXAMPLE
|
||||
#ifdef USE_WIFI_EXAMPLE
|
||||
#include "esp_netif.h"
|
||||
#include "protocol_examples_common.h" /* see project CMakeLists.txt */
|
||||
#endif
|
||||
|
||||
/**
|
||||
******************************************************************************
|
||||
******************************************************************************
|
||||
** USER APPLICATION SETTINGS BEGIN
|
||||
******************************************************************************
|
||||
******************************************************************************
|
||||
**/
|
||||
|
||||
/* when using a private config with plain text passwords,
|
||||
* file my_private_config.h should be excluded from git updates */
|
||||
/* #define USE_MY_PRIVATE_CONFIG */
|
||||
|
||||
#ifdef USE_MY_PRIVATE_CONFIG
|
||||
#if defined(WOLFSSL_CMAKE_SYSTEM_NAME_WINDOWS)
|
||||
#include "/workspace/my_private_config.h"
|
||||
#elif defined(WOLFSSL_CMAKE_SYSTEM_NAME_WSL)
|
||||
#include "/mnt/c/workspace/my_private_config.h"
|
||||
#elif defined(WOLFSSL_CMAKE_SYSTEM_NAME_LINUX)
|
||||
#include "~/workspace/my_private_config.h"
|
||||
#elif defined(WOLFSSL_CMAKE_SYSTEM_NAME_APPLE)
|
||||
#include "~/Documents/my_private_config.h"
|
||||
#else
|
||||
#warning "did not detect environment. using ~/my_private_config.h"
|
||||
#include "~/my_private_config.h"
|
||||
#endif
|
||||
#else
|
||||
|
||||
/*
|
||||
** The examples use WiFi configuration that you can set via project
|
||||
** configuration menu
|
||||
**
|
||||
** If you'd rather not, just change the below entries to strings with
|
||||
** the config you want - ie #define EXAMPLE_WIFI_SSID "mywifissid"
|
||||
*/
|
||||
#ifdef CONFIG_ESP_WIFI_SSID
|
||||
#define EXAMPLE_ESP_WIFI_SSID CONFIG_ESP_WIFI_SSID
|
||||
#else
|
||||
#define EXAMPLE_ESP_WIFI_SSID "MYSSID_WIFI_CONNECT"
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_ESP_WIFI_PASSWORD
|
||||
#define EXAMPLE_ESP_WIFI_PASS CONFIG_ESP_WIFI_PASSWORD
|
||||
#else
|
||||
#define EXAMPLE_ESP_WIFI_PASS "MYPASSWORD_WIFI_CONNECT"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* ESP lwip */
|
||||
#define EXAMPLE_ESP_MAXIMUM_RETRY CONFIG_ESP_MAXIMUM_RETRY
|
||||
|
||||
int wifi_init_sta(void);
|
||||
|
||||
int wifi_show_ip(void);
|
||||
|
||||
#endif /* _WIFI_CONNECT_H_ */
|
||||
|
||||
257
IDE/Espressif/ESP-IDF/examples/wolfssl_server/main/main.c
Normal file
257
IDE/Espressif/ESP-IDF/examples/wolfssl_server/main/main.c
Normal file
@@ -0,0 +1,257 @@
|
||||
/* main.c
|
||||
*
|
||||
* Copyright (C) 2006-2023 wolfSSL Inc.
|
||||
*
|
||||
* This file is part of wolfSSL.
|
||||
*
|
||||
* wolfSSL is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* wolfSSL is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
|
||||
*/
|
||||
#include "sdkconfig.h"
|
||||
#include "main.h"
|
||||
|
||||
/* ESP specific */
|
||||
#include <nvs_flash.h>
|
||||
#include <esp_log.h>
|
||||
#include <esp_event.h>
|
||||
|
||||
/* wolfSSL */
|
||||
#include <wolfssl/wolfcrypt/settings.h> /* includes wolfSSL user-settings.h */
|
||||
#include <wolfssl/wolfcrypt/port/Espressif/esp32-crypt.h>
|
||||
#ifndef WOLFSSL_ESPIDF
|
||||
#warning "Problem with wolfSSL user_settings."
|
||||
#warning "Check components/wolfssl/include"
|
||||
#endif
|
||||
|
||||
/* this project */
|
||||
#include "server-tls.h"
|
||||
#include "time_helper.h"
|
||||
|
||||
#ifndef CONFIG_IDF_TARGET_ESP32H2
|
||||
/* There's no WiFi on ESP32-H2.
|
||||
* For wired ethernet, see:
|
||||
* https://github.com/wolfSSL/wolfssl-examples/tree/master/ESP32/TLS13-ENC28J60-client */
|
||||
#include "wifi_connect.h"
|
||||
#endif
|
||||
|
||||
#ifdef WOLFSSL_TRACK_MEMORY
|
||||
#include <wolfssl/wolfcrypt/mem_track.h>
|
||||
#endif
|
||||
|
||||
static const char* const TAG = "TLS Client";
|
||||
|
||||
#if defined(WOLFSSL_ESPWROOM32SE) && defined(HAVE_PK_CALLBACKS) \
|
||||
&& defined(WOLFSSL_ATECC508A)
|
||||
|
||||
#include "wolfssl/wolfcrypt/port/atmel/atmel.h"
|
||||
|
||||
/* when you want to use a custom slot allocation */
|
||||
/* enable the definition CUSTOM_SLOT_ALLOCATION. */
|
||||
|
||||
#if defined(CUSTOM_SLOT_ALLOCATION)
|
||||
|
||||
static byte mSlotList[ATECC_MAX_SLOT];
|
||||
|
||||
int atmel_set_slot_allocator(atmel_slot_alloc_cb alloc, atmel_slot_dealloc_cb dealloc);
|
||||
|
||||
/* initialize slot array */
|
||||
void my_atmel_slotInit()
|
||||
{
|
||||
int i;
|
||||
for(i = 0;i < ATECC_MAX_SLOT;i++) {
|
||||
mSlotList[i] = ATECC_INVALID_SLOT;
|
||||
}
|
||||
}
|
||||
|
||||
/* allocate slot depending on slotType */
|
||||
int my_atmel_alloc(int slotType)
|
||||
{
|
||||
int i, slot = -1;
|
||||
|
||||
switch(slotType){
|
||||
case ATMEL_SLOT_ENCKEY:
|
||||
slot = 4;
|
||||
break;
|
||||
case ATMEL_SLOT_DEVICE:
|
||||
slot = 0;
|
||||
break;
|
||||
case ATMEL_SLOT_ECDHE:
|
||||
slot = 0;
|
||||
break;
|
||||
case ATMEL_SLOT_ECDHE_ENC:
|
||||
slot = 4;
|
||||
break;
|
||||
case ATMEL_SLOT_ANY:
|
||||
for(i = 0;i < ATECC_MAX_SLOT;i++){
|
||||
if(mSlotList[i] == ATECC_INVALID_SLOT){
|
||||
slot = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return slot;
|
||||
}
|
||||
|
||||
/* free slot array */
|
||||
void my_atmel_free(int slotId)
|
||||
{
|
||||
if(slotId >= 0 && slotId < ATECC_MAX_SLOT){
|
||||
mSlotList[slotId] = ATECC_INVALID_SLOT;
|
||||
}
|
||||
}
|
||||
#endif /* CUSTOM_SLOT_ALLOCATION */
|
||||
#endif /* WOLFSSL_ESPWROOM32SE && HAVE_PK_CALLBACK && WOLFSSL_ATECC508A */
|
||||
|
||||
/* for FreeRTOS */
|
||||
void app_main(void)
|
||||
{
|
||||
int stack_start = 0;
|
||||
esp_err_t ret = 0;
|
||||
ESP_LOGI(TAG, "---------------- wolfSSL TLS Server Example ------------");
|
||||
ESP_LOGI(TAG, "--------------------------------------------------------");
|
||||
ESP_LOGI(TAG, "--------------------------------------------------------");
|
||||
ESP_LOGI(TAG, "---------------------- BEGIN MAIN ----------------------");
|
||||
ESP_LOGI(TAG, "--------------------------------------------------------");
|
||||
ESP_LOGI(TAG, "--------------------------------------------------------");
|
||||
#ifdef ESP_TASK_MAIN_STACK
|
||||
ESP_LOGI(TAG, "ESP_TASK_MAIN_STACK: %d", ESP_TASK_MAIN_STACK);
|
||||
#endif
|
||||
#ifdef TASK_EXTRA_STACK_SIZE
|
||||
ESP_LOGI(TAG, "TASK_EXTRA_STACK_SIZE: %d", TASK_EXTRA_STACK_SIZE);
|
||||
#endif
|
||||
#ifdef INCLUDE_uxTaskGetStackHighWaterMark
|
||||
ESP_LOGI(TAG, "CONFIG_ESP_MAIN_TASK_STACK_SIZE = %d bytes (%d words)",
|
||||
CONFIG_ESP_MAIN_TASK_STACK_SIZE,
|
||||
(int)(CONFIG_ESP_MAIN_TASK_STACK_SIZE / sizeof(void*)));
|
||||
|
||||
/* Returns the high water mark of the stack associated with xTask. That is,
|
||||
* the minimum free stack space there has been (in bytes not words, unlike
|
||||
* vanilla FreeRTOS) since the task started. The smaller the returned
|
||||
* number the closer the task has come to overflowing its stack.
|
||||
* see https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/system/freertos_idf.html
|
||||
*/
|
||||
stack_start = uxTaskGetStackHighWaterMark(NULL);
|
||||
ESP_LOGI(TAG, "Stack Start HWM: %d bytes", stack_start);
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_VERSION_EXTENDED_INFO
|
||||
esp_ShowExtendedSystemInfo();
|
||||
#endif
|
||||
|
||||
/* Set time for cert validation.
|
||||
* Some lwIP APIs, including SNTP functions, are not thread safe. */
|
||||
ret = set_time(); /* need to setup NTP before WiFi */
|
||||
|
||||
/* Optionally erase flash */
|
||||
/* ESP_ERROR_CHECK(nvs_flash_erase()); */
|
||||
|
||||
#ifdef FOUND_PROTOCOL_EXAMPLES_DIR
|
||||
ESP_LOGI(TAG, "FOUND_PROTOCOL_EXAMPLES_DIR active, using example code.");
|
||||
ESP_ERROR_CHECK(nvs_flash_init());
|
||||
|
||||
#if defined(CONFIG_IDF_TARGET_ESP32H2)
|
||||
ESP_LOGE(TAG, "There's no WiFi on ESP32-H2.");
|
||||
#else
|
||||
#ifdef CONFIG_EXAMPLE_WIFI_SSID
|
||||
if (XSTRCMP(CONFIG_EXAMPLE_WIFI_SSID, "myssid") == 0) {
|
||||
ESP_LOGW(TAG, "WARNING: CONFIG_EXAMPLE_WIFI_SSID is myssid.");
|
||||
ESP_LOGW(TAG, " Do you have a WiFi AP called myssid, or ");
|
||||
ESP_LOGW(TAG, " did you forget the ESP-IDF configuration?");
|
||||
}
|
||||
#else
|
||||
#define CONFIG_EXAMPLE_WIFI_SSID "myssid"
|
||||
ESP_LOGW(TAG, "WARNING: CONFIG_EXAMPLE_WIFI_SSID not defined.");
|
||||
#endif
|
||||
ESP_ERROR_CHECK(esp_netif_init());
|
||||
ESP_ERROR_CHECK(esp_event_loop_create_default());
|
||||
ESP_ERROR_CHECK(example_connect());
|
||||
#endif
|
||||
#else
|
||||
ESP_ERROR_CHECK(nvs_flash_init());
|
||||
|
||||
/* Initialize NVS */
|
||||
ret = nvs_flash_init();
|
||||
if (ret == ESP_ERR_NVS_NO_FREE_PAGES ||
|
||||
ret == ESP_ERR_NVS_NEW_VERSION_FOUND) {
|
||||
ESP_ERROR_CHECK(nvs_flash_erase());
|
||||
ret = nvs_flash_init();
|
||||
}
|
||||
ESP_ERROR_CHECK(ret);
|
||||
|
||||
#if defined(CONFIG_IDF_TARGET_ESP32H2)
|
||||
ESP_LOGE(TAG, "There's no WiFi on ESP32-H2. ");
|
||||
#else
|
||||
/* Initialize WiFi */
|
||||
ESP_LOGI(TAG, "ESP_WIFI_MODE_STA");
|
||||
ret = wifi_init_sta();
|
||||
while (ret != 0) {
|
||||
ESP_LOGI(TAG, "Waiting...");
|
||||
vTaskDelay(60000 / portTICK_PERIOD_MS);
|
||||
ESP_LOGI(TAG, "Trying WiFi again...");
|
||||
ret = wifi_init_sta();
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Once we are connected to the network, start & wait for NTP time */
|
||||
ret = set_time_wait_for_ntp();
|
||||
|
||||
if (ret < -1) {
|
||||
/* a value of -1 means there was no NTP server, so no need to wait */
|
||||
ESP_LOGI(TAG, "Waiting 10 more seconds for NTP to complete." );
|
||||
vTaskDelay(10000 / portTICK_PERIOD_MS); /* brute-force solution */
|
||||
esp_show_current_datetime();
|
||||
}
|
||||
|
||||
/* HWM is maximum amount of stack space that has been unused, in bytes
|
||||
* not words (unlike vanilla freeRTOS). */
|
||||
ESP_LOGI(TAG, "Initial Stack Used (before wolfSSL Server): %d bytes",
|
||||
CONFIG_ESP_MAIN_TASK_STACK_SIZE
|
||||
- (uxTaskGetStackHighWaterMark(NULL))
|
||||
);
|
||||
ESP_LOGI(TAG, "Starting TLS Server...\n");
|
||||
|
||||
#if defined(SINGLE_THREADED)
|
||||
/* just call the task */
|
||||
tls_smp_server_task((void*)NULL);
|
||||
#else
|
||||
tls_args args[1] = {0};
|
||||
/* start a thread with the task */
|
||||
tls_smp_server_init(args); /* NULL will use the DEFAULT_PORT value */
|
||||
#endif
|
||||
|
||||
/* done */
|
||||
while (1) {
|
||||
ESP_LOGV(TAG, "\n\nLoop...\n\n");
|
||||
#ifdef INCLUDE_uxTaskGetStackHighWaterMark
|
||||
ESP_LOGI(TAG, "Stack HWM: %d", uxTaskGetStackHighWaterMark(NULL));
|
||||
|
||||
ESP_LOGI(TAG, "Stack used: %d", CONFIG_ESP_MAIN_TASK_STACK_SIZE
|
||||
- uxTaskGetStackHighWaterMark(NULL));
|
||||
ESP_LOGI(TAG, "Stack delta: %d\n", stack_start
|
||||
- uxTaskGetStackHighWaterMark(NULL));
|
||||
#endif
|
||||
|
||||
#if defined(SINGLE_THREADED)
|
||||
ESP_LOGV(TAG, "\n\nDone!\n\n");
|
||||
while (1);
|
||||
#else
|
||||
vTaskDelay(60000);
|
||||
ESP_LOGV(TAG, "\n\nvTaskDelete...\n\n");
|
||||
vTaskDelete(NULL);
|
||||
#endif
|
||||
} /* done whle */
|
||||
|
||||
} /* app_main */
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user