Commit Graph

1776 Commits (2bf2c060560b5385755947cccaaba596fd679851)

Author SHA1 Message Date
David Garske 2bf2c06056 rtl8735b: enable WOLF_CRYPTO_CB_COPY/FREE for HUK HMAC
The HUK HMAC accumulation buffer now lives on the inner SHA-256 devCtx and relies
on the cryptocb copy/free ops so wc_HmacCopy/wc_HmacFree manage it correctly.
2026-07-02 16:34:16 -07:00
David Garske 36af63f1dd Add RealTek AmebaPro2 (RTL8735B) HUK-in-TLS example
In-memory TLS 1.2 ECDHE-ECDSA handshake with the server certificate ECDSA P-256
signature produced on the HUK HW engine via a PK sign callback. The rest of TLS
(PRF/HMAC, record AES-GCM, ECDHE) stays in software: a whole-CTX WC_HUK_DEVID
would route TLS's own 32-byte HMAC keys (e.g. the P-256 ECDHE pre-master in the
PRF) to the HUK, whose key==seed semantics break key derivation. Validated on
RTL8735B silicon.
2026-07-02 16:18:01 -07:00
David Garske 9bdd578564 Add RealTek AmebaPro2 (RTL8735B) HUK wolfCrypt example (AES, HMAC-SHA256, ECDSA) 2026-06-25 10:23:54 -07:00
Juliusz Sosinowicz 54f85adb37
Merge pull request #573 from helkoulak/ascon-examples
Ascon examples
2026-06-18 16:42:40 +02:00
Hosam Elkoulak cdcebdc1e2 move var declarations to the beginning of the block 2026-06-17 13:45:28 +02:00
Hosam Elkoulak 7744b613d7 Move declarations to the beginning of the block 2026-06-16 17:26:27 +02:00
Hosam Elkoulak 7727575e95 Fix logic when to opt out in case of empty password 2026-06-16 17:25:11 +02:00
Hosam Elkoulak c8d9c3b193 Add error checks for fseek and ftell function calls 2026-06-16 17:23:58 +02:00
Hosam Elkoulak 2da7daf2b9 Avoid overflowing the key array by providing a separate array for the password 2026-06-16 17:22:26 +02:00
Hosam Elkoulak 53855725f2 Zero byte files are now supported by Ascon file encrypt + fix for loop index, it should be defined as long as well for huge files 2026-06-12 17:29:15 +02:00
Hosam Elkoulak 7c26f5dbaf Decrypt in blocks and some fixes 2026-06-08 21:03:45 +02:00
Hosam Elkoulak c5584726bf Some more fixes 2026-06-05 18:50:48 +02:00
Hosam Elkoulak 04329e4aa1 Use goto instead of while loop 2026-05-30 00:04:14 +02:00
Hosam Elkoulak 6ffa7eac4c Fix input len at cleanup 2026-05-29 23:51:15 +02:00
Hosam Elkoulak c2a0ec1471 More fixes for ascon file encrypt 2026-05-29 23:29:07 +02:00
David Garske 8eb7fa11c8
Merge pull request #568 from night1rider/fips-linux-yocto-pi
Fips linux yocto pi
2026-05-28 09:33:11 -07:00
Hosam Elkoulak e7d781e84b Fixes for ascon-hash256 2026-05-26 01:12:01 +02:00
Hosam Elkoulak d36f572a33 Fixes for ascon-file-encrypt 2026-05-26 00:41:28 +02:00
David Garske 9bc3022097
Merge pull request #572 from padelsbach/minor-fenrir-fixes
Add error checking and cleanup in examples
2026-05-05 10:45:01 -07:00
David Garske 6437dcdb83
Merge pull request #566 from sameehj/http-sign
Add RFC 9421 HTTP Message Signatures example using wolfCrypt Ed25519
2026-05-05 10:40:14 -07:00
David Garske cab3cb7ff6 Fixes from peer review. Thank you Daniele 2026-05-05 10:30:42 +02:00
David Garske 6a036ffe6e Peer review feedback 2026-05-05 10:30:42 +02:00
David Garske 87e913955f Example for wolfCrypt PUF on STM32H5 2026-05-05 10:30:42 +02:00
Hosam Elkoulak 09d5072fdb Fixes for Ascon-Hash256 2026-05-01 09:07:21 +02:00
Hosam Elkoulak ae042f171c Fixes for ascon-file-encrypt 2026-05-01 08:33:16 +02:00
Hosam Elkoulak d000810206 Two examples for Ascon-AEAD128 and Ascon-Hash256
Fix typos

No need to input key size as the size for ascon AEAD algorithm is fixed

Add an example for algorithm Ascon-Hash256
2026-04-27 17:22:49 +02:00
Kaleb Himes bfdda5612e
Merge pull request #571 from lealem47/ecc_verify_minimal
Add a minimal example for ecc verify
2026-04-24 13:59:19 -06:00
Lealem Amedie 7271cc07e8 Add a minimal example for ecc verify 2026-04-24 12:31:14 -06:00
Paul Adelsbach 6d316999ff Misc fenrir fixes 2026-04-24 11:24:06 -07:00
Sameeh Jubran 09966434e4 http-message-signatures: address Skoll review feedback
- http_client_signed: check build_http_request() return before
  send() and cast to size_t; free key on import_private_only
  failure.
- http_server_verify: consolidate main() error paths around a
  single "cleanup:" label so pubKey and listenFd are released
  uniformly (import_public, socket, bind, listen).
- test_vectors: guard ed25519_free with per-key init flags so
  the shared cleanup path never frees an uninitialized struct.
- wc_http_sig.h: document that WC_SF_MAX_STRING / WC_SF_MAX_ITEMS
  drive ~12KB stack usage and must be tuned for embedded targets.
- wc_sf: reject *outSz > INT_MAX in wc_SfGenSigParams and
  wc_SfGenSigInput to guard word32 -> int casts (matches
  build_signature_base).

Signed-off-by: Sameeh Jubran <sameeh@wolfssl.com>
2026-04-23 12:37:58 +03:00
night1rider 28fcdbbc24 Example project for using a FIPs Ready linux image on qemu and on RPI 5 with an initramfs kernel module loading, and ported projects to utilize wolfCrypt throughout the image example 2026-04-20 14:29:03 -06:00
David Garske 44e31acbc6
Merge pull request #570 from julek-wolfssl/ocsp-responder-examples
Add OCSP responder examples
2026-04-13 09:51:11 -07:00
Juliusz Sosinowicz e9a5c757e0 Address review feedback
- LoadFile now validates fread read the full file size and returns NULL
  on short read.
- ocsp-responder-http checks wolfSSL_Init return value.
- Remove bare scope block around sigaction setup.
2026-04-13 12:41:29 +02:00
Juliusz Sosinowicz b79c987789
Update ocsp/responder/nginx-scgi/run.sh
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-04-10 14:17:01 +02:00
Juliusz Sosinowicz 04ff1c7ddd Address PR #570 review feedback for OCSP responder examples
- Add SO_RCVTIMEO (5s) on accepted client sockets to prevent indefinite
  blocking from incomplete requests
- Move 64KB httpBuf/respBuf from stack to static globals
- Fix SendAll infinite loop when send() returns 0 (check n <= 0)
- Ignore SIGPIPE to prevent crash on client disconnect during writes
- Use case-insensitive Content-Length header matching per RFC 7230
- Track error state and return nonzero from main on fatal errors
- Reset ret after wolfSSL_CertManagerLoadCABuffer to avoid leaking
  WOLFSSL_SUCCESS (1) into error paths in ocsp-request-response.c
- Add -Wextra to Makefile CFLAGS
2026-04-09 19:06:33 +02:00
Sameeh Jubran 330c9b258b wc_http_sig: remove extra braces around header lookup loop
Signed-off-by: Sameeh Jubran <sameeh@wolfssl.com>
2026-04-09 13:32:58 +03:00
David Garske 011d7f3146
Merge pull request #569 from night1rider/csr-fix
refactor csr_example to use filled Cert struct workflow
2026-04-08 13:49:09 -07:00
Juliusz Sosinowicz 1f6aa9c259 Address code review feedback for OCSP responder examples
- Add missing <time.h> include for time(NULL) usage
- Replace atoi() with strtol() and validate Content-Length in RecvHttp
  and ParsePost to reject negative/overflowing values
- Add SendAll() helper to handle partial send() writes
- Check return values of socket(), setsockopt(), and listen()
2026-04-08 11:31:35 +02:00
Juliusz Sosinowicz b0ceceb0c8 Add OCSP responder examples
Three examples demonstrating the new OCSP Responder API:

1. ocsp-request-response.c - Pure API usage: encode DER OCSP requests
   from certificates, generate signed responses, and verify them
   in memory without networking.

2. ocsp-responder-http.c - Minimal HTTP server that accepts POST
   requests with DER OCSP payloads and returns signed responses.

3. nginx-scgi/ - Production-style deployment using nginx as HTTP
   frontend with wolfclu running as an SCGI backend for OCSP
   processing.
2026-04-07 14:11:36 +02:00
night1rider 00c263c7db refactor csr_example.c to clarify CSR API and show how to use a filled out Cert struct (req) to fully create a CSR with proper error handling and memory management. 2026-04-02 20:17:59 -06:00
Sameeh Jubran 9a3b8458b3 Add RFC 9421 HTTP Message Signatures example using wolfCrypt Ed25519
Initial implementation of RFC 9421 HTTP Message Signatures as a
wolfssl-examples project. Covers a minimal interoperable subset:
derived components (@method, @authority, @path, @query), arbitrary
HTTP header fields, Ed25519 signing/verification, single signature
(sig1), and timestamp-based replay protection.

Files:
- common/wc_sf.{c,h}: Minimal RFC 8941 structured fields subset
  (dictionary lookup, inner lists, parameters, byte sequences)
- common/wc_http_sig.{c,h}: RFC 9421 Sign/Verify/GetKeyId API
- sign_request.c: Standalone signing example
- http_server_verify.c: Demo HTTP server with signature verification
- http_client_signed.c: Demo HTTP client sending signed requests
- test_vectors.c: 11 tests including RFC 9421 Appendix B.2.6

Design decisions:
- Ed25519-only (alg enforced on verify path)
- sigOut/inputOut are char* (NUL-terminated strings)
- Header names lowercased per RFC 9421 Section 2.1
- Portable case-insensitive comparison (no POSIX strcasecmp)
- SO_RCVTIMEO on server to prevent blocking on slow clients
- Signature base written directly to caller buffer (no double-buffer)

Known limitations:
- 32-bit long: parse_sf_integer caps at 9 digits, breaking current
  UNIX timestamps (needs fix, see below)
- No content-digest, multi-signature, or full RFC 8941 support
- Duplicate headers: first match wins, no folding

Signed-off-by: Sameeh Jubran <sameeh@wolfssl.com>
2026-03-30 13:17:51 +03:00
David Garske 9afdb0603c
Merge pull request #556 from sebastian-carpenter/client-ech-fix
fixing up ech examples
2026-03-21 15:50:42 -07:00
David Garske 52e44499f0
Merge pull request #563 from padelsbach/padelsbach/aesgcm-rdseed
Extend AES minimal and rdseed examples
2026-03-21 15:21:50 -07:00
Paul Adelsbach 1ac9c87c3b Extend minimal and rdseed examples 2026-03-20 15:27:46 -07:00
tmael 498d78e6d3
Merge pull request #562 from padelsbach/aes256-gcm-minimal
Add minimal buffer encrypt and decrypt example for AES-GCM
2026-03-12 10:17:02 -07:00
Paul Adelsbach 62476b1871 Add minimal buffer encrypt and decrypt example for AES-GCM 2026-03-12 09:52:47 -07:00
JacobBarthelmeh f2dec15dde
Merge pull request #560 from embhorn/fix_psk_resume_client
Set ssl to null after free to avoid double free
2026-02-24 14:52:02 -07:00
Eric Blankenhorn 205ff32c6e Set ssl to null after free to avoid double free 2026-02-24 15:36:39 -06:00
sebastian-carpenter 0e45f2fe9f fixing up ech examples + GREASE ECH example 2026-02-24 14:14:17 -07:00
JacobBarthelmeh a71710ec4f
Merge pull request #554 from anhu/dtlsmcast
Add DTLS 1.2 Mulicast Example.
2026-02-24 09:32:32 -07:00