diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2018-11-13 03:15:15 +0100 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2018-11-13 03:15:15 +0100 |
commit | 375fc78d51f128f36c4fe17df0d284cecd28d55e (patch) | |
tree | b83628bc06cb487b393e9eef4ef72bd448847edb | |
parent | bddb6545a982696bde417a9ae621f9e2d3c22b3d (diff) | |
download | busybox-w32-375fc78d51f128f36c4fe17df0d284cecd28d55e.tar.gz busybox-w32-375fc78d51f128f36c4fe17df0d284cecd28d55e.tar.bz2 busybox-w32-375fc78d51f128f36c4fe17df0d284cecd28d55e.zip |
tls: code shrink
function old new delta
static.f25519_one 32 - -32
curve25519 835 802 -33
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 0/1 up/down: 0/-65) Total: -65 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-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 | ||