Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce new Arduino examples and configuration updates. TLSX gating #8514

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

gojimmypi
Copy link
Contributor

@gojimmypi gojimmypi commented Feb 28, 2025

Description

This PR introduces a new AES CTR (Counter Mode) Arduino example sketch along with supporting template files and configuration updates. The example demonstrates AES CTR encryption and decryption capabilities of wolfSSL on Arduino platforms.

Key Changes

  1. New AES CTR Example:

    • Added IDE/ARDUINO/sketches/wolfssl_AES_CTR/wolfssl_AES_CTR.ino - A complete example demonstrating AES CTR encryption/decryption
    • Added supporting project files (README.md, .adeps, .sln, .vgdbproj) for various Arduino IDE environments
    • Tested on Arduino using Teensy 4.1 (ARM Cortex-M7 at 600 MHz)
    • AES CTR GPLV2 Contributed by Chris Jennings Feb 2025; Thank you!
  2. Arduino Template Example:

    • Added IDE/ARDUINO/sketches/template/ directory with reference template files
    • Includes multi-file example structure with helper files and library organization
    • Provides VisualGDB project files for easier development
  3. Configuration Updates:

    • Updated examples/configs/user_settings_arduino.h to include AES CTR support
    • Added WOLFSSL_AES and WOLFSSL_AES_COUNTER macros
    • Updated version identifier to v5.7.6
    • Added ECC and RSA hardening options
  4. Arduino Integration Improvements:

    • Added wolfssl-arduino.cpp with Arduino-specific Serial.print helper function
    • Updated wolfssl.h to properly declare the helper function
    • Updated wolfssl-arduino.sh script to include the new cpp file in Arduino library builds
  5. Documentation Updates:

    • Updated IDE/ARDUINO/README.md with references to new examples
    • Updated IDE/ARDUINO/sketches/README.md to include new examples
    • Added troubleshooting information for common Arduino build issues
  6. Code Cleanup:

    • Fixed file locations and directory references
    • Removed stray tabs and improved formatting
    • Fixed spelling errors in documentation and comments

Fixes zd# 19275

Testing

How did you test?

Tested on Arduino using Teensy 4.1

  • ARM Cortex-M7 at 600 MHz
  • Float point math unit, 64 & 32 bits
  • 7936K Flash, 1024K RAM (512K tightly coupled), 4K EEPROM (emulated)
  • QSPI memory expansion, locations for 2 extra RAM or Flash chips

See https://www.pjrc.com/store/teensy41.html

Checklist

  • added tests
  • updated/added doxygen
  • updated appropriate READMEs
  • Updated manual and documentation

@gojimmypi gojimmypi requested a review from dgarske February 28, 2025 02:09
@gojimmypi gojimmypi force-pushed the pr-introduce-arduino-wolfssl_AES_CTR branch from 7fc7e57 to 8ce26d8 Compare February 28, 2025 02:31
@gojimmypi
Copy link
Contributor Author

Jenkins retest this please

to retry "Unable to create live FilePath for wolf-linux-cloud-node"

@gojimmypi gojimmypi force-pushed the pr-introduce-arduino-wolfssl_AES_CTR branch from 8ce26d8 to 34043ab Compare March 3, 2025 20:10
@gojimmypi
Copy link
Contributor Author

Edit: I added a new updated file: examples/configs/user_settings_arduino.h that includes these macros for the AES_CTR example that would otherwise need to be added manually.

#define WOLFSSL_AES
#define WOLFSSL_AES_COUNTER

This user_settings_arduino.h file will be the new default user_settings.h for the next release of the Arduino-wolfSSL library. In the meantime, the changes can be made manually or with the install script.

I also included some minor changes to avoid warnings in Arduino related to hardening and not using client nor server examples.

@gojimmypi
Copy link
Contributor Author

Jenkins retest this please.

To retry unrelated DTLS 1.3 group 6 failure 4740 "invalid stream header: 636F7272"

#define WOLFSSL_USER_SETTINGS_ID "Arduino user_settings.h v5.7.6"

/* Disable wolfcrypt cryptographic security hardening. Comment out to enable: */
#define WC_NO_HARDEN
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't support any examples that define this... Hardening should always be enabled unless the build is public operations only.

Copy link
Contributor Author

@gojimmypi gojimmypi Mar 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've added these to the Arduino user_settings.h to avoid the hardening warnings and not use WC_NO_HARDEN:

#define ECC_TIMING_RESISTANT
#define WC_RSA_BLINDING

@dgarske dgarske removed their assignment Mar 7, 2025
@gojimmypi gojimmypi requested a review from dgarske March 11, 2025 20:50
@gojimmypi gojimmypi changed the title Introduce wolfssl_AES_CTR Arduino example Introduce new Arduino examples and configuration updates. TLSX gating Mar 11, 2025
@gojimmypi gojimmypi force-pushed the pr-introduce-arduino-wolfssl_AES_CTR branch from 71539ce to 34d7a35 Compare March 11, 2025 21:39
@gojimmypi gojimmypi force-pushed the pr-introduce-arduino-wolfssl_AES_CTR branch from 34d7a35 to c4a2975 Compare March 11, 2025 23:46
@gojimmypi
Copy link
Contributor Author

Jenkins retest this please.

For "Unable to create live FilePath for wolf-linux-cloud-node-nnn; wolf-linux-cloud-node-nnn was marked offline: Connection was broken"

@dgarske I've expanded the scope of this PR to include an additional example. See ZD 19275. Updated description and PR title.

In particular note the new additional gating changes to tls.c that otherwise gave compiler warnings depending on client / server settings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants