Skip to content

update to latest release of wolfssl (5.9.1)#29

Open
gasbytes wants to merge 5 commits into
wolfSSL:mainfrom
gasbytes:update-wolfssl-version
Open

update to latest release of wolfssl (5.9.1)#29
gasbytes wants to merge 5 commits into
wolfSSL:mainfrom
gasbytes:update-wolfssl-version

Conversation

@gasbytes
Copy link
Copy Markdown
Contributor

@gasbytes gasbytes commented May 12, 2026

  • updated build.rs to build the bindings to the latest release;
  • updated the wc_sha_* shas to use the update wc_HashType_Wc_hash_*;
  • updated ecc ids;
  • add cfg config flag to detect if blinding is enabled or not (if so, set the rng and associate it with the private key);
  • remove --enable-all (since we already have --enable-all-crypto anyway);
  • decode pkcs#8 v2 keys via DecodeAsymKey directly;

@gasbytes gasbytes self-assigned this May 12, 2026
@gasbytes gasbytes marked this pull request as draft May 12, 2026 07:45
@gasbytes gasbytes force-pushed the update-wolfssl-version branch 3 times, most recently from 2ab5e6a to f649f70 Compare May 26, 2026 12:23
- updated build.rs to build the bindings to the latest release;
- updated the wc_sha_* shas to use the update wc_HashType_Wc_hash_*;
- updated ecc ids;
- per wolfSSL#24 (comment)
refactored the eddsa.rs file in order to import the key using the asn
parsing directly from wolfcrypt, with proper slicing since the private
key gets imported full size (64) instead of 32.
@gasbytes gasbytes force-pushed the update-wolfssl-version branch 5 times, most recently from 175c87e to f5699f5 Compare May 27, 2026 12:51
- Also removed --enable-all since it was pretty much useless;
- If blinding is enabled, set the rng and associate it with the private key;

This was necessary since starting from 5.9.1 curve blinding is enabled
by default on pure-c builds (no asm is selected). This change prevents a
-173 failure when deriving a secret with curve25519.
@gasbytes gasbytes force-pushed the update-wolfssl-version branch from f5699f5 to b3ec7ca Compare May 27, 2026 13:13
@gasbytes gasbytes marked this pull request as ready for review June 4, 2026 13:53
Decode pkcs#8v2 keys via DecodeAsymKey and strip the BIT STRING
prefix from the embedded public key, avoiding
wc_Ed25519PrivateKeyDecode's BAD_FUNC_ARG (-173)
on RFC 5958 keys
Comment thread rustls-wolfcrypt-provider/src/verify/rsapkcs1.rs
Comment thread wolfcrypt-rs/src/lib.rs
Comment thread wolfcrypt-rs/build.rs
holtrop-wolfssl
holtrop-wolfssl previously approved these changes Jun 4, 2026
@holtrop-wolfssl holtrop-wolfssl removed their assignment Jun 4, 2026
@MarkAtwood
Copy link
Copy Markdown

Reviewed — looks good. The EdDSA rewrite replacing hand-rolled DER parsing with DecodeAsymKey is a clear improvement, and the build-time blinding detection is clean. No concerns with the changes.

@gasbytes please go ahead and merge when ready.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates the vendored wolfSSL/wolfCrypt integration to target wolfSSL 5.9.1, adjusting FFI constant names and key-handling behavior so the Rust provider continues to build and interoperate correctly (including PKCS#8 v2 ED25519 keys and Curve25519 blinding configurations).

Changes:

  • Bump wolfSSL source download/build to v5.9.1-stable, update SHA256, and remove --enable-all from the configure flags.
  • Update wolfCrypt constant usage to the newer enum/identifier names (hash types and ECC curve IDs) across signing/verification and tests.
  • Add Curve25519 RNG attachment plumbing for blinding-enabled builds and switch ED25519 PKCS#8 parsing to DecodeAsymKey with public-key normalization.

Reviewed changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
wolfcrypt-rs/src/lib.rs Adds a curve25519_set_rng wrapper that becomes a no-op when curve25519 blinding support isn’t compiled in.
wolfcrypt-rs/build.rs Updates wolfSSL version/SHA; emits a cfg for curve25519 blinding based on generated bindings; removes --enable-all.
rustls-wolfcrypt-provider/tests/e2e.rs Updates test server path to the new wolfSSL version and adjusts curve ID constants.
rustls-wolfcrypt-provider/src/verify/rsapkcs1.rs Updates FFI key pointer cast to match updated wolfCrypt signature API expectations.
rustls-wolfcrypt-provider/src/verify/ecdsa.rs Updates ECC curve IDs to the new identifier names.
rustls-wolfcrypt-provider/src/sign/rsa.rs Updates FFI key pointer cast for RSA signature generation.
rustls-wolfcrypt-provider/src/sign/eddsa.rs Switches ED25519 PKCS#8 parsing to DecodeAsymKey and normalizes embedded public-key encodings.
rustls-wolfcrypt-provider/src/sign/ecdsa.rs Updates ECC curve IDs to the new identifier names.
rustls-wolfcrypt-provider/src/kx/x25519.rs Attaches an RNG to Curve25519 private keys to support blinding builds; improves shared-secret error reporting.
rustls-wolfcrypt-provider/src/kx/sec521r1.rs Updates ECC curve IDs to the new identifier names.
rustls-wolfcrypt-provider/src/kx/sec384r1.rs Updates ECC curve IDs to the new identifier names.
rustls-wolfcrypt-provider/src/kx/sec256r1.rs Updates ECC curve IDs to the new identifier names.
rustls-wolfcrypt-provider/src/hmac/mod.rs Updates HMAC hash-type constants to the newer wolfCrypt hash-type enum values.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread rustls-wolfcrypt-provider/src/sign/ecdsa.rs Outdated
Comment thread rustls-wolfcrypt-provider/src/sign/eddsa.rs Outdated
Comment thread rustls-wolfcrypt-provider/src/sign/eddsa.rs
Comment thread rustls-wolfcrypt-provider/src/sign/eddsa.rs Outdated
Comment thread rustls-wolfcrypt-provider/src/sign/eddsa.rs Outdated
…rsing

Since "uncompressed point" is technically wrong for ed25519 keys
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.

6 participants