| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
|
Can one of the admins verify this patch? |
Sorry, something went wrong.
|
Sorry, something went wrong.
There was a problem hiding this comment.
Scan targets checked: wolfcrypt-bugs, wolfcrypt-port-bugs, wolfcrypt-rs-bugs, wolfcrypt-src, wolfssl-bugs, wolfssl-src
Findings: 1
1 finding(s) posted as inline comments (see file-level comments below)
This review was generated automatically by Fenrir. Reported findings require changes before merge.
Sorry, something went wrong.
wc_CryptoCb_Curve25519MakePub took no devId and resolved its device with a lookup for INVALID_DEVID, falling back to the first registered device. Every route to an X25519 public point derivation went through it, so a key bound to one device had its private scalar offered to whichever device happened to be registered first, with no way to opt out. Give both wc_CryptoCb_Curve25519MakePub and wc_CryptoCb_Curve25519Generic a devId parameter and let only a caller that selected no device settle for the first registered one, matching the curve448 siblings. wc_curve25519_make_key and wc_curve25519_export_public_ex now derive the point through a devId carrying helper instead of the keyless public API; the keyless API itself keeps its old behaviour since it has no key to take a devId from. Under WOLFSSL_CURVE25519_BLINDING both wc_curve25519_make_pub and wc_curve25519_generic fall through to their blinded variant after the callback declined, which dispatched the same private scalar to the same device a second time. The blinded call now runs with the callback disabled, so a declining device is offered the scalar once. Under WOLF_CRYPTO_CB_ONLY_CURVE25519 an unbound key passed to wc_curve25519_export_public_ex now returns NO_VALID_DEVID rather than reaching the first registered device. Such builds must create keys with wc_curve25519_init_ex and a real devId.
…test curve25519_keyagree_test and curve448_keyagree_test fill pubKey by exporting userA's public point and importing it back, inside a block guarded on the key export. The block that then computes a shared secret against pubKey is guarded on the shared secret and the key import alone, so building with NO_CURVE25519_KEY_EXPORT or NO_CURVE448_KEY_EXPORT leaves it running against a key that never received a public point, and testwolfcrypt fails. Require the export in the consuming block too, and add a CI entry building wolfCrypt with the X25519 export compiled out so the combination stays covered. That entry is wolfCrypt only, since src/internal.c and src/tls.c call wc_curve25519_export_public_ex unconditionally and TLS therefore cannot link without it, and it carries its own -Werror so an unreferenced static fails the build rather than passing as a warning.
There was a problem hiding this comment.
Scan targets checked: wolfcrypt-bugs, wolfcrypt-port-bugs, wolfcrypt-rs-bugs, wolfcrypt-src, wolfssl-bugs, wolfssl-src
Fenrir result: Approved ✅
No new issues found in the changed files.
Advisory only — this automated result does not count as a GitHub approval.
Sorry, something went wrong.
Fenrir's latest completed scan found no issues; clearing the prior automated change request.
| Back | FazBrowse Home | New Git URL |
Description
wc_CryptoCb_Curve25519MakePub() took no devId. It looked up INVALID_DEVID and then fell back to wc_CryptoCb_FindDeviceByIndex(0), so it always landed on whichever device was registered first. Every route to an X25519 public point derivation went through it, so a key created with wc_curve25519_init_ex(&key, heap, myDevId) had its private scalar offered to a device the application never selected, with no way to opt out. wc_CryptoCb_Curve25519Generic() had the same shape. This mirrors what #11209 did for curve448.
Second commit, independent: curve25519_keyagree_test() fills pubKey inside a block guarded on HAVE_CURVE25519_KEY_EXPORT, but the block computing a shared secret against pubKey required only the import, so NO_CURVE25519_KEY_EXPORT builds failed in testwolfcrypt. curve448_keyagree_test() has the identical defect. Both consuming guards now require the export.
Behaviour change: under WOLF_CRYPTO_CB_ONLY_CURVE25519, an unbound key passed to wc_curve25519_export_public_ex() now returns NO_VALID_DEVID instead of reaching the first registered device, since there is no software fallback. Such builds must use wc_curve25519_init_ex() with a real devId. wc_curve25519_make_key() already behaved this way. Documented as a \return.
Testing
New test_wc_curve25519_cryptocb registers two spy devices, the decoy first so it holds the slot the old fallback would have picked, and covers a key bound to device A (B sees nothing), a key naming an unregistered devId, an unbound key on both the keygen and export paths, and the keyless APIs. Each derived point is compared against the one keygen produced.
Proofs rather than claims:
make check green (17 pass / 6 skip / 0 fail) on --enable-all --enable-cryptocb and on the same with --disable-armasm. The second leg matters: WOLFSSL_CURVE25519_BLINDING is only auto-enabled when ARMASM is off, so on aarch64 a plain --enable-all compiles none of the blinded paths this PR touches. testwolfcrypt also passes with -DNO_CURVE25519_KEY_EXPORT and with -DNO_CURVE448_KEY_EXPORT.
New CI entry cryptocb-curve25519-no-key-export covers a build with the X25519 export compiled out, which nothing in CI compiled before. wolfCrypt only, because src/internal.c and src/tls.c call wc_curve25519_export_public_ex() unconditionally and TLS cannot link without it. It carries its own cflags adding -Werror (a per-entry value replaces the job's --cflags), so an unreferenced static fails the build. Narrowing curve25519_key_make_pub()'s guard makes that entry fail, so it has teeth.