Skip to content

Commit b38ab8a

Browse files
authored
Merge pull request #8514 from gojimmypi/pr-introduce-arduino-wolfssl_AES_CTR
Introduce and move new Arduino examples and configuration updates.
2 parents 75501fd + 241a1ed commit b38ab8a

17 files changed

Lines changed: 354 additions & 1939 deletions

File tree

.wolfssl_known_macro_extras

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,17 @@ APP_ESP_HTTP_CLIENT_EXAMPLE
99
APSTUDIO_INVOKED
1010
ARCH_sim
1111
ARDUINO
12+
ARDUINO_ARCH_ESP32
13+
ARDUINO_ARCH_ESP8266
14+
ARDUINO_ARCH_MBED
15+
ARDUINO_ARCH_NRF52
1216
ARDUINO_ARCH_RP2040
17+
ARDUINO_ARCH_SAMD
18+
ARDUINO_ARCH_STM32
1319
ARDUINO_SAMD_NANO_33_IOT
1420
ARDUINO_SAM_DUE
21+
ARDUINO_SEEED_XIAO
22+
ARDUINO_TEENSY41
1523
ASN_DUMP_OID
1624
ASN_TEMPLATE_SKIP_ISCA_CHECK
1725
ATCAPRINTF
@@ -176,6 +184,7 @@ ESP_IDF_VERSION_MAJOR
176184
ESP_IDF_VERSION_MINOR
177185
ESP_PLATFORM
178186
ESP_TASK_MAIN_STACK
187+
ETHERNET_AVAILABLE
179188
EV_TRIGGER
180189
FP_ECC_CONTROL
181190
FREERTOS_TCP_WINSIM
@@ -554,11 +563,13 @@ WC_SSIZE_TYPE
554563
WC_STRICT_SIG
555564
WC_WANT_FLAG_DONT_USE_AESNI
556565
WC_XMSS_FULL_HASH
566+
WIFI_AVAILABLE
557567
WOLFCRYPT_FIPS_CORE_DYNAMIC_HASH_VALUE
558568
WOLFSENTRY_H
559569
WOLFSENTRY_NO_JSON
560570
WOLFSSL_32BIT_MILLI_TIME
561571
WOLFSSL_AARCH64_PRIVILEGE_MODE
572+
WOLFSSL_AES_CTR_EXAMPLE
562573
WOLFSSL_AESNI_BY4
563574
WOLFSSL_AESNI_BY6
564575
WOLFSSL_AFTER_DATE_CLOCK_SKEW
@@ -607,6 +618,7 @@ WOLFSSL_CHECK_DESKEY
607618
WOLFSSL_CHECK_MEM_ZERO
608619
WOLFSSL_CHIBIOS
609620
WOLFSSL_CLANG_TIDY
621+
WOLFSSL_CLIENT_EXAMPLE
610622
WOLFSSL_COMMERCIAL_LICENSE
611623
WOLFSSL_CONTIKI
612624
WOLFSSL_CRL_ALLOW_MISSING_CDP
@@ -780,6 +792,7 @@ WOLFSSL_SE050_INIT
780792
WOLFSSL_SE050_NO_RSA
781793
WOLFSSL_SE050_NO_TRNG
782794
WOLFSSL_SECURE_RENEGOTIATION_ON_BY_DEFAULT
795+
WOLFSSL_SERVER_EXAMPLE
783796
WOLFSSL_SETTINGS_FILE
784797
WOLFSSL_SH224
785798
WOLFSSL_SHA256_ALT_CH_MAJ
@@ -797,6 +810,7 @@ WOLFSSL_STM32_RNG_NOLIB
797810
WOLFSSL_STRONGEST_HASH_SIG
798811
WOLFSSL_STSAFE_TAKES_SLOT
799812
WOLFSSL_TELIT_M2MB
813+
WOLFSSL_TEMPLATE_EXAMPLE
800814
WOLFSSL_THREADED_CRYPT
801815
WOLFSSL_TICKET_DECRYPT_NO_CREATE
802816
WOLFSSL_TICKET_ENC_AES128_GCM

IDE/ARDUINO/README.md

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,19 @@
22

33
See the [example sketches](./sketches/README.md):
44

5-
- [sketches/wolfssl_server](./sketches/wolfssl_server/README.md)
6-
- [sketches/wolfssl_client](./sketches/wolfssl_client/README.md)
5+
NOTE: Moving; See https://github.com/wolfSSL/wolfssl-examples/pull/499
6+
7+
Bare-bones templates:
8+
9+
- [sketches/wolfssl_version](./sketches/wolfssl_version/README.md) single file.
10+
- [sketches/template](./sketches/template/README.md) multiple file example.
11+
12+
Functional examples:
13+
- [sketches/wolfssl_AES_CTR](./sketches/wolfssl_AES_CTR/README.md) AES CTR Encrypt / decrypt.
14+
- [sketches/wolfssl_client](./sketches/wolfssl_client/README.md) TLS Client.
15+
- [sketches/wolfssl_server](./sketches/wolfssl_server/README.md) TLS Server.
16+
17+
Both the `template` and `wolfssl_AES_CTR` examples include VisualGDB project files.
718

819
When publishing a new version to the Arduino Registry, be sure to edit `WOLFSSL_VERSION_ARUINO_SUFFIX` in the `wolfssl-arduino.sh` script.
920

@@ -62,7 +73,7 @@ from within the `wolfssl/IDE/ARDUINO` directory:
6273

6374
1. `./wolfssl-arduino.sh`
6475
- Creates an Arduino Library directory structure in the local `wolfSSL` directory of `IDE/ARDUINO`.
65-
- You can add your own `user_settings.h`, or copy/rename the [default](../../examples/configs/user_settings_arduino.h).
76+
- You can add your own `user_settings.h`, or copy/rename the [default](https://github.com/wolfSSL/wolfssl/blob/master/examples/configs/user_settings_arduino.h).
6677

6778
2. `./wolfssl-arduino.sh INSTALL` (The most common option)
6879
- Creates an Arduino Library in the local `wolfSSL` directory

IDE/ARDUINO/include.am

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,32 @@
22
# included from Top Level Makefile.am
33
# All paths should be given relative to the root
44

5+
# Library files:
56
EXTRA_DIST+= IDE/ARDUINO/README.md
7+
8+
# There's an Arduino-specific Arduino_README_prepend.md that will be prepended to wolfSSL README.md
9+
# Not to be confused with the interim PREPENDED_README.md that is created by script.
610
EXTRA_DIST+= IDE/ARDUINO/Arduino_README_prepend.md
11+
12+
# Core library files
13+
EXTRA_DIST+= IDE/ARDUINO/wolfssl.h
14+
EXTRA_DIST+= IDE/ARDUINO/wolfssl.h
15+
EXTRA_DIST+= IDE/ARDUINO/wolfssl-arduino.cpp
16+
717
EXTRA_DIST+= IDE/ARDUINO/keywords.txt
818
EXTRA_DIST+= IDE/ARDUINO/library.properties.template
19+
20+
# Sketch Examples
921
EXTRA_DIST+= IDE/ARDUINO/sketches/README.md
22+
23+
# wolfssl_client example sketch
1024
EXTRA_DIST+= IDE/ARDUINO/sketches/wolfssl_client/README.md
11-
EXTRA_DIST+= IDE/ARDUINO/sketches/wolfssl_client/wolfssl_client.ino
25+
26+
# wolfssl_server example sketch
1227
EXTRA_DIST+= IDE/ARDUINO/sketches/wolfssl_server/README.md
13-
EXTRA_DIST+= IDE/ARDUINO/sketches/wolfssl_server/wolfssl_server.ino
28+
29+
# wolfssl_version example sketch
1430
EXTRA_DIST+= IDE/ARDUINO/sketches/wolfssl_version/README.md
15-
EXTRA_DIST+= IDE/ARDUINO/sketches/wolfssl_version/wolfssl_version.ino
16-
EXTRA_DIST+= IDE/ARDUINO/wolfssl.h
31+
32+
# Publishing script, either local install or to github.com/wolfSSL/Arduino-wolfSSL clone directory.
1733
EXTRA_DIST+= IDE/ARDUINO/wolfssl-arduino.sh

IDE/ARDUINO/sketches/README.md

Lines changed: 46 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,20 @@
11
# wolfSSL Arduino Examples
22

3-
There are currently two example Arduino sketches:
3+
There are currently five example Arduino sketches:
44

5-
* [wolfssl_client](./wolfssl_client/README.md): Basic TLS listening client.
6-
* [wolfssl_server](./wolfssl_server/README.md): Basic TLS server.
5+
NOTE: Moving; See https://github.com/wolfSSL/wolfssl-examples/pull/499
6+
7+
* `template`: Reference template wolfSSL example, including optional VisualGDB project files.
8+
* `wolfssl_AES_CTR`: Basic AES CTR Encryption / Decryption example.
9+
* `wolfssl_client`: Basic TLS listening client.
10+
* `wolfssl_server`: Basic TLS server.
11+
* `wolfssl_version`: Bare-bones wolfSSL example.
712

813
Examples have been most recently confirmed operational on the
914
[Arduino IDE](https://www.arduino.cc/en/software) 2.2.1.
1015

1116
For examples on other platforms, see the [IDE directory](https://github.com/wolfssl/wolfssl/tree/master/IDE).
12-
Additional examples can be found on [wolfSSL/wolfssl-examples](https://github.com/wolfSSL/wolfssl-examples/).
17+
Additional wolfssl examples can be found at [wolfSSL/wolfssl-examples](https://github.com/wolfSSL/wolfssl-examples/).
1318

1419
## Using wolfSSL
1520

@@ -20,15 +25,51 @@ The typical include will look something like this:
2025
2126
/* wolfSSL user_settings.h must be included from settings.h
2227
* Make all configurations changes in user_settings.h
23-
* Do not edit wolfSSL `settings.h` or `configh.h` files.
28+
* Do not edit wolfSSL `settings.h` or `config.h` files.
2429
* Do not explicitly include user_settings.h in any source code.
2530
* Each Arduino sketch that uses wolfSSL must have: #include "wolfssl.h"
2631
* C/C++ source files can use: #include <wolfssl/wolfcrypt/settings.h>
2732
* The wolfSSL "settings.h" must be included in each source file using wolfSSL.
2833
* The wolfSSL "settings.h" must appear before any other wolfSSL include.
2934
*/
3035
#include <wolfssl.h>
36+
37+
/* settings.h is typically included in wolfssl.h, but here as a reminder: */
38+
#include <wolfssl/wolfcrypt/settings.h>
39+
40+
/* Any other wolfSSL includes follow:*
3141
#include <wolfssl/version.h>
3242
```
3343

44+
## Configuring wolfSSL
45+
46+
See the `user_settings.h` in the Arduino library `wolfssl/src` directory. For Windows users this is typically:
47+
48+
```
49+
C:\Users\%USERNAME%\Documents\Arduino\libraries\wolfssl\src
50+
```
51+
52+
WARNING: Changes to the library `user_settings.h` file will be lost when upgrading wolfSSL using the Arduino IDE.
53+
54+
## Troubleshooting
55+
56+
If compile problems are encountered, for example:
57+
58+
```
59+
ctags: cannot open temporary file : File exists
60+
exit status 1
61+
62+
Compilation error: exit status 1
63+
```
64+
65+
Try deleting the Arduino cache directory:
66+
67+
```
68+
C:\Users\%USERNAME%\AppData\Local\arduino\sketches
69+
```
70+
71+
For VisualGDB users, delete the project `.vs`, `Output`, and `TraceReports` directories.
72+
73+
## More Information
74+
3475
For more details, see [IDE/ARDUINO/README.md](https://github.com/wolfSSL/wolfssl/blob/master/IDE/ARDUINO/README.md)

IDE/ARDUINO/sketches/wolfssl_client/README.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
# Arduino Basic TLS Listening Client
22

3-
Open the [wolfssl_client.ino](./wolfssl_client.ino) file in the Arduino IDE.
3+
Open the `wolfssl_client.ino` file in the Arduino IDE.
4+
5+
NOTE: Moving; See https://github.com/wolfSSL/wolfssl-examples/pull/499
6+
7+
If using WiFi, be sure to set `ssid` and `password` values.
8+
9+
May need "Ethernet by Various" library to be installed. Tested with v2.0.2 and v2.8.1.
10+
11+
See the `#define WOLFSSL_TLS_SERVER_HOST` to set your own server address.
412

513
Other IDE products are also supported, such as:
614

0 commit comments

Comments
 (0)