Files
wolfssl/IDE/Espressif/ESP-IDF/examples
Tobias Frauenschläger 9393d62591 Replace liboqs SPHINCS+ with SLH-DSA in certificate layer
Replace the liboqs-based pre-standardization SPHINCS+ implementation
with the native FIPS 205 SLH-DSA implementation across the
certificate / ASN.1 / X.509 layers, and add SLH-DSA-rooted test
certificates plus TLS 1.3 .conf scenarios that exercise the new
verification path. All liboqs SPHINCS+ code is removed.

This enables SLH-DSA for certificate chain authentication: CA
certificates signed with SLH-DSA, certificate signature verification
against an SLH-DSA root. TLS 1.3 entity authentication via
CertificateVerify with SLH-DSA will be added in a follow-up PR.

Follows RFC 9909 (X.509 Algorithm Identifiers for SLH-DSA) and
NIST FIPS 205. Supports both SHAKE and SHA-2 parameter families
across all twelve standardized variants.

DER codec:
- New PrivateKeyDecode, PublicKeyDecode, KeyToDer, PrivateKeyToDer,
  PublicKeyToDer with RFC 9909 encoding (bare OCTET STRING containing
  4*n raw bytes = SK.seed || SK.prf || PK.seed || PK.root, no nested
  wrapper). OID auto-detection across all twelve SHAKE / SHA-2 variants.
- PublicKeyDecode raw-bytes fast path mirrors wc_Falcon_PublicKeyDecode
  and wc_Dilithium_PublicKeyDecode so callers (notably
  wolfssl_x509_make_der and ConfirmSignature, which pass the raw
  BIT STRING contents stashed by StoreKey) decode correctly. Honours
  the caller's *inOutIdx start offset.
- Error paths in Private/PublicKeyDecode preserve params/flags/
  inOutIdx and only ForceZero the buffer half each helper actually
  writes; skip the wipe entirely on BAD_LENGTH_E (no bytes touched).
- ImportPublic uses |= on flags so a Private-then-Public import
  sequence retains FLAG_PRIVATE.

OID dispatch:
- 12 standardized NIST OIDs (6 SHAKE + 6 SHA-2) per RFC 9909. The
  pre-standardization OID-collision mechanism is removed since NIST
  OIDs do not collide.
- wc_SlhDsaOidToParam / wc_SlhDsaOidToCertType return NOT_COMPILED_IN
  (rather than -1) for recognised SLH-DSA OIDs whose parameter set
  isn't built; wc_IsSlhDsaOid recognises both. The x509 dispatch
  surfaces this as a precise diagnostic instead of the generic
  "No public key found".
- wc_GetKeyOID picks a placeholder parameter from whatever variant is
  compiled in and #errors at compile time if none is.
- asn_orig.c EncodeCert / EncodeCertReq accept SHA-2 SLH-DSA keyTypes
  alongside SHAKE.

Tests and fixtures:
- Test cert chain in certs/slhdsa/: SLH-DSA-SHAKE-128s and
  SLH-DSA-SHA2-128s self-signed roots that sign reused ML-DSA-44
  entity keys (server + client), plus the gen script
  (gen-slhdsa-mldsa-certs.sh, OpenSSL >= 3.5).
- New TLS 1.3 .conf scenarios under tests/suites.c dispatch:
  test-tls13-slhdsa-shake.conf, test-tls13-slhdsa-sha2.conf, and a
  wrong-CA negative test test-tls13-slhdsa-fail.conf.
- DER round-trip and on-disk decode tests; bench_slhdsa_*_key.der
  fixtures regenerated with wolfSSL's own encoder so the codec is
  pinned to RFC 9909.
- New unit test test_wc_slhdsa_x509_i2d_roundtrip exercises the raw
  PublicKeyDecode entry point that wolfssl_x509_make_der relies on.
- test_wc_slhdsa_check_key now tests both Public-then-Private and
  Private-then-Public import orderings.

Build / ABI:
- DYNAMIC_TYPE_SPHINCS = 98 kept as RESERVED with a tombstone comment
  for ABI stability; new code should use DYNAMIC_TYPE_SLHDSA (107).
- All build system / IDE project files updated; SPHINCS+ sources,
  headers, and test data removed.
- Dead bench_slhdsa_*_key arrays removed from gencertbuf.pl and
  certs_test.h; the .der files on disk drive the decode tests.
2026-04-30 18:32:07 +02:00
..
2026-02-18 09:52:21 -07:00
2024-10-15 18:36:28 -07:00

wolfSSL Examples for Espressif

Core Examples

These are the core examples for wolfSSL:

Other Espressif wolfSSL Examples

See these other repositories for additional examples:

Interaction with wolfSSL CLI

See the server and 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:

Installing wolfSSL for Espressif projects

Core 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 and wolfSSH.

The Espressif Managed Component for wolfSSL also installs source code locally, instead of pointing to a source repository.

VisualGDB

Users of VisualGDB 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 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

See also the ESP-FAQ Handbook.