forked from openwrt/openwrt
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
wolfssl: always export wc_ecc_set_rng
Since commit 6467de5a8840 ("Randomize z ordinates in scalar mult when timing resistant") wolfssl requires a RNG for an EC key when the hardened built option is selected. wc_ecc_set_rng is only available when built hardened, so there is no safe way to install the RNG to the key regardless whether or not wolfssl is compiled hardened. Always export wc_ecc_set_rng so tools such as hostapd can install RNG regardless of the built settings for wolfssl. Signed-off-by: David Bauer <[email protected]>
- Loading branch information
1 parent
a9ebd3a
commit ef9b103
Showing
2 changed files
with
51 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
Since commit 6467de5a8840 ("Randomize z ordinates in scalar | ||
mult when timing resistant") wolfssl requires a RNG for an EC | ||
key when the hardened built option is selected. | ||
|
||
wc_ecc_set_rng is only available when built hardened, so there | ||
is no safe way to install the RNG to the key regardless whether | ||
or not wolfssl is compiled hardened. | ||
|
||
Always export wc_ecc_set_rng so tools such as hostapd can install | ||
RNG regardless of the built settings for wolfssl. | ||
|
||
--- a/wolfcrypt/src/ecc.c | ||
+++ b/wolfcrypt/src/ecc.c | ||
@@ -10293,21 +10293,21 @@ void wc_ecc_fp_free(void) | ||
|
||
#endif /* FP_ECC */ | ||
|
||
-#ifdef ECC_TIMING_RESISTANT | ||
int wc_ecc_set_rng(ecc_key* key, WC_RNG* rng) | ||
{ | ||
int err = 0; | ||
|
||
+#ifdef ECC_TIMING_RESISTANT | ||
if (key == NULL) { | ||
err = BAD_FUNC_ARG; | ||
} | ||
else { | ||
key->rng = rng; | ||
} | ||
+#endif | ||
|
||
return err; | ||
} | ||
-#endif | ||
|
||
#ifdef HAVE_ECC_ENCRYPT | ||
|
||
--- a/wolfssl/wolfcrypt/ecc.h | ||
+++ b/wolfssl/wolfcrypt/ecc.h | ||
@@ -584,10 +584,8 @@ WOLFSSL_API | ||
void wc_ecc_fp_free(void); | ||
WOLFSSL_LOCAL | ||
void wc_ecc_fp_init(void); | ||
-#ifdef ECC_TIMING_RESISTANT | ||
WOLFSSL_API | ||
int wc_ecc_set_rng(ecc_key* key, WC_RNG* rng); | ||
-#endif | ||
|
||
WOLFSSL_API | ||
int wc_ecc_set_curve(ecc_key* key, int keysize, int curve_id); |