Skip to content

ECC: blind private key after use in signing#7416

Merged
dgarske merged 2 commits intowolfSSL:masterfrom
SparkiDev:ecc_blind_k
May 14, 2024
Merged

ECC: blind private key after use in signing#7416
dgarske merged 2 commits intowolfSSL:masterfrom
SparkiDev:ecc_blind_k

Conversation

@SparkiDev
Copy link
Copy Markdown
Contributor

Description

Use a mask to blind the private key after use so that stored private key is always changing.

Fixes zd#17783

Testing

./configure '--disable-shared' 'CFLAGS=-DWOLFSSL_ECC_BLIND_K'

Checklist

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

@SparkiDev SparkiDev self-assigned this Apr 12, 2024
@SparkiDev SparkiDev force-pushed the ecc_blind_k branch 7 times, most recently from e06c022 to 361dc0b Compare April 18, 2024 06:14
@SparkiDev SparkiDev force-pushed the ecc_blind_k branch 4 times, most recently from 19a2d86 to 3c79312 Compare April 23, 2024 01:31
@SparkiDev SparkiDev assigned wolfSSL-Bot and unassigned SparkiDev May 9, 2024
@SparkiDev SparkiDev requested a review from wolfSSL-Bot May 9, 2024 12:47
Copy link
Copy Markdown
Member

@dgarske dgarske left a comment

Choose a reason for hiding this comment

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

Have you checked code size and performance impact with the new options?

Comment thread wolfcrypt/src/ecc.c Outdated
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Please document WOLFSSL_BLIND_PRIVATE_KEY and WOLFSSL_ECC_BLIND_K at the top of ecc.c.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

fixed

Comment thread wolfcrypt/src/sp_int.c Outdated
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Is unsigned int the right type here? Should it be sp_digit or sp_int_digit?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

'i' is only used as an index.
It shouldn't be sp_int_digit.

Comment thread wolfssl/wolfcrypt/ecc.h Outdated
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Please add WOLFSSL_LOCAL or WOLFSSL_API to these....

$./configure CFLAGS="-DWOLFSSL_ECC_BLIND_K -DWOLFSSL_BLIND_PRIVATE_KEY" && make
...
/usr/bin/ld: wolfcrypt/test/test.o: in function `ecc_def_curve_test':
test.c:(.text+0x1ae8): undefined reference to `ecc_get_k'
/usr/bin/ld: test.c:(.text+0x1af4): undefined reference to `ecc_get_k'
/usr/bin/ld: test.c:(.text+0x1b00): undefined reference to `ecc_get_k'
collect2: error: ld returned 1 exit status
make[2]: *** [Makefile:6196: wolfcrypt/test/testwolfcrypt] Error 1
make[2]: *** Waiting for unfinished jobs....
make[2]: Leaving directory '/home/davidgarske/GitHub/wolfssl'
make[1]: *** [Makefile:8391: check-recursive] Error 1
make[1]: Leaving directory '/home/davidgarske/GitHub/wolfssl'
make: *** [Makefile:8860: check] Error 2

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

fixed

@dgarske dgarske assigned SparkiDev and unassigned wolfSSL-Bot May 13, 2024
SparkiDev added 2 commits May 14, 2024 09:41
Use a mask to blind the private key after use so that stored private key
is always changing.
When WOLFSSL_BLIND_PRIVATE_KEY is defined, blind the private key DER
encoding so that stored private key data is always changing.
@SparkiDev
Copy link
Copy Markdown
Contributor Author

retest this please

@SparkiDev SparkiDev assigned dgarske and wolfSSL-Bot and unassigned SparkiDev May 14, 2024
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.

3 participants