1
0
mirror of https://github.com/wolfSSL/wolfssl.git synced 2026-10-24 04:09:07 +03:00
Commit Graph

12449 Commits

Author SHA1 Message Date
Daniele Lacamera
5c6f5a5a9f F-11238: validate arguments before use in the A100 verify path
The A100/A110 stsafe_verify wrote *pResult before validating any of
its arguments, unlike the A120 variant which rejects NULL inputs.
Move the argument validation (pointers plus hashSz) ahead of the
*pResult write and the buffer allocation, so a NULL argument returns
BAD_FUNC_ARG instead of dereferencing, and the early return happens
before the SMALL_STACK buffers are allocated.

Addresses the PR review note on *pResult before validation.
2026-08-26 09:26:24 +02:00
Daniele Lacamera
2b1d12f871 F-11238: clamp hashSz to key_sz before the int conversion
hashSz is a caller-supplied word32 (the public wc_ecc_verify_hash API
passes its length straight through to the crypto-cb). Converting it to
int before clamping lets values above INT_MAX wrap negative, and the
normalized-copy pointer arithmetic then writes out of bounds of the
field-size digest buffer. Clamp in the word32 domain first; the int
conversion then only happens for values bounded by key_sz.

Both variants (A120, A100/A110) carry the same fix. Both call sites
already reject key_sz <= 0, so no key_sz check is added here.

Addresses the PR review note on the copy_sz cast.
2026-08-26 09:26:08 +02:00
Daniele Lacamera
68888746b7 F-11238: normalize the digest to field size in STSAFE ECDSA verify
stsafe_verify copied key_sz bytes from the caller's digest buffer and
told the SE the digest was key_sz bytes long. For a digest shorter than
the field size (P-256 with a 28-byte SHA-224 hash, P-384 with SHA-256)
that reads past the end of the buffer and submits a wrong digest, so a
valid signature fails to verify.

The A120 expects a field-size prehash on the wire, so the digest is
normalized host-side before submission: truncate if longer, left-pad if
shorter - the same convention the sign path already applies. The SE
still receives key_sz bytes, so the wire contract is unchanged; only
the buffer contents for short digests are corrected.

Both variants (A120 STSELib, A100/A110 legacy SDK) and both call sites
(crypto-cb, TLS verify-peer callback) now use the real digest length.

Verification:
- Built: host x86_64, --enable-stsafe=a120, STSELib v1.1.7 + Rust
  A120 simulator.
- Tested: wolfCrypt STSAFE-A120 sim test (wolfSSL/simulators
  wolfcrypt-test): new P-256 + 28-byte-digest verify case fails on the
  pre-fix build (valid signature rejected) and passes post-fix; rng,
  on-device keygen, sign and 32-byte verify round-trip unchanged.
- A100/A110 variant not runnable here (closed SDK, no silicon); change
  mirrors the A120 logic on the existing buffer and keeps Length=key_sz.
2026-08-26 09:06:54 +02:00
philljj
b83f5d60f3 Merge pull request #11216 from dgarske/rng_seed_device
random: add WC_RNG_SEED_DEVICE to seed from a nominated device
2026-08-25 14:20:57 -05:00
philljj
7afd4a2c68 Merge pull request #11236 from JacobBarthelmeh/netscape
Restrict duplicate netscape certificate type extensions f-10626
2026-08-25 14:12:11 -05:00
David Garske
fcb31dea21 random: add WC_RNG_SEED_DEVICE to seed from a nominated device 2026-08-25 08:19:24 -07:00
Sean Parkinson
94dca6fdd4 Merge pull request #11228 from aidangarske/fenrir-fixes-9961
Encode default cert validity as UTCTime through 2049
2026-08-25 17:16:56 +10:00
Sean Parkinson
feca5c4247 Merge pull request #11249 from night1rider/Expand-AES-Benchmark
Expand aes benchmark and fix leak in benchmark
2026-08-25 16:19:57 +10:00
Sean Parkinson
6c36c71c5f Merge pull request #11237 from holtrop-wolfssl/f-7106
wolfssl_local_MatchBaseName: fix 1-byte read out of bounds looking for "@"
2026-08-25 16:09:06 +10:00
Sean Parkinson
df727d6b90 Merge pull request #11233 from dgarske/ecc_blind_k_fixes
Fix private scalar handling under ECC key blinding and add CI coverage
2026-08-25 16:07:06 +10:00
JacobBarthelmeh
678a065f10 Merge pull request #11248 from night1rider/ASU-ECIES-Improvements
Asu ecies improvements
2026-08-24 16:42:06 -06:00
night1rider
d851d60427 Free the Aes on every AES-OFB benchmark error path 2026-08-24 15:48:30 -06:00
night1rider
2d81662d6c Route the AES-CFB and AES-OFB benchmarks through the crypto callback devId 2026-08-24 15:46:32 -06:00
philljj
f8b140f511 Merge pull request #11204 from padelsbach/falcon-cb-free
Add CB_FREE mode for Falcon
2026-08-24 16:30:18 -05:00
philljj
d3c63a06f6 Merge pull request #11224 from anhu/fake_alloc
Macro guard to prevent dead code.
2026-08-24 15:15:40 -05:00
philljj
cf27755f89 Merge pull request #11244 from SparkiDev/asn_template_doc
ASN Template documentation: add more content
2026-08-24 15:09:08 -05:00
night1rider
6d2454826f Offload ASU ECIES on NIST P-192 2026-08-24 13:40:37 -06:00
night1rider
69e82f1f40 Use the caller's RNG for the ASU ECIES GCM nonce 2026-08-24 11:51:36 -06:00
JacobBarthelmeh
ff17d489d3 Merge pull request #11209 from night1rider/curve448-callbacks
Add curve448 crypto callback support
2026-08-24 09:50:17 -06:00
JacobBarthelmeh
74b8207b72 Merge pull request #11053 from night1rider/Xilinx-ASU-ECC-standalone
Xilinx asu ecc standalone
2026-08-24 09:46:02 -06:00
Sean Parkinson
78c2528c56 ASN Template documentation: add more content
Added a bunch of content about how to use ASN templates.
Added a section with a list of things to do when adding a new template.
Added mappiong of ASN.1 notation to template lines.
Added ASN.1 type specific information.
Added a checklist at the end to head off the common issues.
Added references to ASN_TEMPLATE.md.
Added other informatrion.
2026-08-24 10:52:23 +10:00
night1rider
51975e27a5 Guard curve448 shared secret software path on ret so the cryptocb reset is read 2026-08-21 17:04:19 -06:00
night1rider
2c5d885233 Fix curve448_key_make_pub being unused under WOLF_CRYPTO_CB_ONLY_CURVE448 with key export disabled 2026-08-21 17:04:19 -06:00
night1rider
06abdc18e6 Only offload a key-owned X448 private scalar to that key's own device
wc_curve448_make_key and wc_curve448_export_public_ex derived the public
point through the keyless wc_curve448_make_pub, which dispatches to the
first registered device; route them through a devId-carrying helper.
2026-08-21 17:04:19 -06:00
night1rider
93d71fdda9 Address second round of review findings on curve448 cryptocb support
Restore key devId on the keygen stub's error return, full-buffer-check
callback output, cover the new/delete NULL out-params, drop a dead guard.
2026-08-21 17:04:19 -06:00
night1rider
eb1cde51ab Address review findings on curve448 cryptocb support
Assert cryptocb output in curve448_onlycb_test, reject an all-zero
wc_curve448_generic result, guard the new API test for CB-only builds.
2026-08-21 17:04:18 -06:00
night1rider
3d7f7ad4d6 Add curve448 crypto callback support
Mirror curve25519: keygen, shared secret, make pub and generic
callbacks, wc_curve448_init_ex/new/delete, new wc_curve448_generic
API with scalar clamp checks, WOLF_CRYPTO_CB_ONLY_CURVE448 mode,
TLS devId plumbing, tests (test.c, api unit tests, swdev),
benchmark devId, CI entries.
2026-08-21 17:04:18 -06:00
philljj
ac45965828 Merge pull request #11217 from night1rider/ShakeCB-Issue
Set hashType on SHAKE128/256 contexts so crypto-callback Copy/Free can clean up correctly
2026-08-21 17:58:06 -05:00
Josh Holtrop
4eb192d4c8 wolfssl_local_MatchBaseName: fix 1-byte read out of bounds looking for "@"
Fixes F-7106
2026-08-21 15:47:05 -04:00
JacobBarthelmeh
986066c856 Restrict duplicate netscape certificate type extensions f-10626 2026-08-21 13:19:09 -06:00
night1rider
ddbd4c10b0 Xilinx Versal Gen2 ASU: TRNG seed in the template, no compressed key ECIES 2026-08-21 11:58:32 -06:00
David Garske
addd5ea04b Fix private scalar handling under ECC key blinding and add CI coverage 2026-08-21 11:53:29 -04:00
philljj
4d1bd552d0 Merge pull request #11220 from LinuxJedi/fix-se050-asn-key-to-der-guards
Fix ASN guards for RSA key DER export
2026-08-21 10:39:00 -05:00
night1rider
76b81a11e6 Xilinx Versal Gen2 ASU: offload ECIES on Brainpool P-320 and P-512 as well 2026-08-21 01:26:33 -06:00
Aidan Garske
1c73648177 F-9961 - Encode default cert validity as UTCTime through 2049 2026-08-20 18:38:39 -07:00
Paul Adelsbach
cecf35171d PR feedback: test updates, invalidate shake.devId 2026-08-20 17:46:42 -07:00
night1rider
420c919f60 Xilinx Versal Gen2 ASU: log why ECDH and ECIES send work to software 2026-08-20 16:50:26 -06:00
philljj
9ab8a4b19d Merge pull request #11172 from dgarske/fenrir_threadsafety_keys
Thread safety and private key handling
2026-08-20 16:32:51 -05:00
Anthony Hu
9fd8f2b45a Macro guard to prevent dead code. 2026-08-20 16:21:54 -04:00
Josh Holtrop
25224b6827 Add wc_ecc_key_new_ex (#11160)
* Add wc_ecc_key_new_ex

Rust wrapper: use wc_ecc_key_new_ex for ECC when available.

Fixes F-8300.

* Check devId after wc_ecc_key_new_ex() call in unit test
2026-08-20 13:05:51 -07:00
philljj
27de130fb0 Merge pull request #11170 from dgarske/fenrir_align_ports
Alignment and vendor port hardening
2026-08-20 11:38:30 -05:00
philljj
08c7d3389b Merge pull request #10762 from julek-wolfssl/fenrir/20260623
AES reject-no-key guard and RSA-PSS hash-binding test (F-6151, F-6157)
2026-08-20 11:09:49 -05:00
JacobBarthelmeh
87d41e2dd5 Merge pull request #11140 from holtrop-wolfssl/zd22282
Fix directoryName NameConstraints bypass
2026-08-20 09:21:47 -06:00
philljj
19755092a8 Merge pull request #11153 from yosuke-wolfssl/fix/f_7075
Fix TSP message imprint algorithm/digest length consistency
2026-08-20 09:35:12 -05:00
night1rider
aa1f85114b Xilinx Versal Gen2 ASU: fix the Vitis build and correct the benchmark rows
The config probe now uses the target include path, and ARM assembly builds in
both modes. Documents the ECIES hardware path, drops a dead protocol branch,
declines a zero length message, and builds the ECC request helpers only where
they are called. Benchmark rows no longer claim hardware they cannot reach.
2026-08-20 08:14:14 -06:00
Andrew Hutchings
b741dd8cfd Fix ASN guards for RSA key DER export
WOLFSSL_SE050 enables WOLFSSL_KEY_TO_DER, but the original ASN implementation only compiled SetASNIntMP and SetBitString when unrelated features such as ECC or key generation were enabled. An ECC-free SE050 build therefore compiled the RSA DER callers without these helpers and failed at link time.

Include WOLFSSL_KEY_TO_DER in both helper guards, while retaining the NO_CERTS constraint for the public-key BIT STRING encoder. This allows SE050 RSA builds to disable HAVE_ECC without unresolved ASN symbols.
2026-08-20 13:52:31 +01:00
night1rider
2c67d6af50 Set hashType on SHAKE128/256 contexts so crypto-callback Copy/Free
dispatch with the correct type instead of WC_HASH_TYPE_NONE
2026-08-20 01:30:20 -06:00
David Garske
060113ec90 Peer review feedback (thanks Douzzer) 2026-08-19 23:54:09 -04:00
David Garske
5343b2b8c3 Mask the RSA blinding factor before inverting it (F-2972) 2026-08-19 23:54:09 -04:00
David Garske
3363f2150a Zero private key DER buffers before release in SE050 port (F-2636) 2026-08-19 23:54:09 -04:00