diff options
-rw-r--r-- | networking/tls_fe.c | 32 |
1 files changed, 21 insertions, 11 deletions
diff --git a/networking/tls_fe.c b/networking/tls_fe.c index 37fea34f7..dcb41468a 100644 --- a/networking/tls_fe.c +++ b/networking/tls_fe.c | |||
@@ -556,19 +556,29 @@ static void xc_double(byte *x3, byte *z3, | |||
556 | 556 | ||
557 | void curve25519(byte *result, const byte *e, const byte *q) | 557 | void curve25519(byte *result, const byte *e, const byte *q) |
558 | { | 558 | { |
559 | /* from wolfssl-3.15.3/wolfssl/wolfcrypt/fe_operations.h */ | ||
560 | static const byte f25519_one[F25519_SIZE] = {1}; | ||
561 | |||
562 | /* Current point: P_m */ | ||
563 | byte xm[F25519_SIZE]; | ||
564 | byte zm[F25519_SIZE] = {1}; | ||
565 | |||
566 | /* Predecessor: P_(m-1) */ | ||
567 | byte xm1[F25519_SIZE] = {1}; | ||
568 | byte zm1[F25519_SIZE] = {0}; | ||
569 | |||
570 | int i; | 559 | int i; |
571 | 560 | ||
561 | struct { | ||
562 | /* from wolfssl-3.15.3/wolfssl/wolfcrypt/fe_operations.h */ | ||
563 | /*static const*/ byte f25519_one[F25519_SIZE]; // = {1}; | ||
564 | |||
565 | /* Current point: P_m */ | ||
566 | byte xm[F25519_SIZE]; | ||
567 | byte zm[F25519_SIZE]; // = {1}; | ||
568 | /* Predecessor: P_(m-1) */ | ||
569 | byte xm1[F25519_SIZE]; // = {1}; | ||
570 | byte zm1[F25519_SIZE]; // = {0}; | ||
571 | } z; | ||
572 | #define f25519_one z.f25519_one | ||
573 | #define xm z.xm | ||
574 | #define zm z.zm | ||
575 | #define xm1 z.xm1 | ||
576 | #define zm1 z.zm1 | ||
577 | memset(&z, 0, sizeof(z)); | ||
578 | f25519_one[0] = 1; | ||
579 | zm[0] = 1; | ||
580 | xm1[0] = 1; | ||
581 | |||
572 | /* Note: bit 254 is assumed to be 1 */ | 582 | /* Note: bit 254 is assumed to be 1 */ |
573 | lm_copy(xm, q); | 583 | lm_copy(xm, q); |
574 | 584 | ||