Skip to content

Curve25519: lshift of a negative value is undefined in C#9372

Merged
JacobBarthelmeh merged 2 commits intowolfSSL:masterfrom
SparkiDev:curve25519_no_lshift_neg_val
Nov 6, 2025
Merged

Curve25519: lshift of a negative value is undefined in C#9372
JacobBarthelmeh merged 2 commits intowolfSSL:masterfrom
SparkiDev:curve25519_no_lshift_neg_val

Conversation

@SparkiDev
Copy link
Copy Markdown
Contributor

@SparkiDev SparkiDev commented Nov 3, 2025

Description

Change all left shifts to be of unsigned values.
In some cases the values were negative.

Added macros to make the code easier to be consistent.

Fixes zd#20728

Testing

./configure --disable-shared --enable-curve25519=no128bit
and thrashed it with curve25519_thrash.c
./configure --disable-shared --enable-curve25519
and thrashed it with curve25519_thrash.c

./configure --disable-shared --enable-curve25519=no128bit --enable-ed25519
and thrashed it with ed25519_thrash.c
./configure --disable-shared --enable-curve25519 --enable-ed25519
and thrashed it with ed25519_thrash.c

./configure --disable-shared --enable-curve448=no128bit
and thrashed it with curve448_thrash.c
./configure --disable-shared --enable-curve448
and thrashed it with curve448_thrash.c

./configure --disable-shared --enable-curve448=no128bit --enable-ed448
and thrashed it with ed448_thrash.c
./configure --disable-shared --enable-curve448 --enable-ed448
and thrashed it with ed448_thrash.c

Checklist

  • added tests
  • updated/added doxygen
  • updated appropriate READMEs
  • Updated manual and documentation

@SparkiDev SparkiDev self-assigned this Nov 3, 2025
Change all left shifts to be of unsigned values.
In some cases the values were negative.

Added macros to make the code easier to be consistent.
@SparkiDev SparkiDev force-pushed the curve25519_no_lshift_neg_val branch from 54c54bf to 574067e Compare November 3, 2025 12:09
@SparkiDev
Copy link
Copy Markdown
Contributor Author

Code is generated using scripts modified by:
https://github.com/wolfSSL/scripts/pull/513

@SparkiDev SparkiDev added the For This Release Release version 5.9.1 label Nov 4, 2025
@SparkiDev SparkiDev force-pushed the curve25519_no_lshift_neg_val branch 2 times, most recently from 5929dc0 to 8372fba Compare November 4, 2025 00:35
Change all left shifts to be of unsigned values.
In some cases the values were negative.

Changed 128-bit variable implementation of Curve25519. (generated)
Changed Ed25519 C implementation.
Changed Curve448 C implementation. (generated)
Changed Ed448 C implementation. (generated)
@SparkiDev SparkiDev force-pushed the curve25519_no_lshift_neg_val branch from 8372fba to e4d47fb Compare November 4, 2025 00:40
@SparkiDev SparkiDev assigned wolfSSL-Bot and unassigned SparkiDev Nov 4, 2025
@SparkiDev SparkiDev requested a review from wolfSSL-Bot November 4, 2025 21:43
@JacobBarthelmeh JacobBarthelmeh merged commit ca51fda into wolfSSL:master Nov 6, 2025
261 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

For This Release Release version 5.9.1

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants