-
Notifications
You must be signed in to change notification settings - Fork 834
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ECC: blind private key after use in signing #7416
Conversation
e06c022
to
361dc0b
Compare
19a2d86
to
3c79312
Compare
There was a problem hiding this 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?
@@ -297,6 +297,48 @@ ECC Curve Sizes: | |||
|
|||
#endif | |||
|
|||
#ifdef WOLFSSL_ECC_BLIND_K |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
void sp_xor_ct(const sp_int* a, const sp_int* b, int len, sp_int* r) | ||
{ | ||
if ((a != NULL) && (b != NULL) && (r != NULL)) { | ||
unsigned int i; |
There was a problem hiding this comment.
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
?
There was a problem hiding this comment.
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.
@@ -601,7 +612,17 @@ struct ecc_key { | |||
#endif | |||
}; | |||
|
|||
#define wc_ecc_key_get_priv(key) ((key)->k) | |||
#ifndef WOLFSSL_ECC_BLIND_K |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
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.
retest this please |
ECC: blind private key after use in signing
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