aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2021-01-01 18:48:38 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2021-01-01 18:48:38 +0100
commit868f383699ef65c828fbc41e7c7c7368ab56f8a5 (patch)
tree54d435cd729ee61aac14b44f0eca3cf85b020184
parent9daa877d6bdc8dd470ffd86839550c54957eac73 (diff)
downloadbusybox-w32-868f383699ef65c828fbc41e7c7c7368ab56f8a5.tar.gz
busybox-w32-868f383699ef65c828fbc41e7c7c7368ab56f8a5.tar.bz2
busybox-w32-868f383699ef65c828fbc41e7c7c7368ab56f8a5.zip
tls: code shrink
function old new delta curve25519 881 832 -49 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--networking/tls_fe.c28
1 files changed, 11 insertions, 17 deletions
diff --git a/networking/tls_fe.c b/networking/tls_fe.c
index 10971bbff..f810e112a 100644
--- a/networking/tls_fe.c
+++ b/networking/tls_fe.c
@@ -383,12 +383,10 @@ static void fe_inv__distinct(byte *r, const byte *x)
383 * to avoid copying temporaries. 383 * to avoid copying temporaries.
384 */ 384 */
385 385
386 /* 1 1 */ 386 lm_copy(r, x);
387 fe_mul__distinct(s, x, x);
388 fe_mul__distinct(r, s, x);
389 387
390 /* 1 x 248 */ 388 /* 1, 1 x 249 */
391 for (i = 0; i < 248; i++) { 389 for (i = 0; i < 249; i++) {
392 fe_mul__distinct(s, r, r); 390 fe_mul__distinct(s, r, r);
393 fe_mul__distinct(r, s, x); 391 fe_mul__distinct(r, s, x);
394 } 392 }
@@ -403,13 +401,11 @@ static void fe_inv__distinct(byte *r, const byte *x)
403 /* 0 */ 401 /* 0 */
404 fe_mul__distinct(r, s, s); 402 fe_mul__distinct(r, s, s);
405 403
406 /* 1 */ 404 /* 1, 1 */
407 fe_mul__distinct(s, r, r); 405 for (i = 0; i < 2; i++) {
408 fe_mul__distinct(r, s, x); 406 fe_mul__distinct(s, r, r);
409 407 fe_mul__distinct(r, s, x);
410 /* 1 */ 408 }
411 fe_mul__distinct(s, r, r);
412 fe_mul__distinct(r, s, x);
413} 409}
414 410
415#if 0 //UNUSED 411#if 0 //UNUSED
@@ -435,12 +431,10 @@ static void exp2523(byte *r, const byte *x, byte *s)
435 * 111111... 01 431 * 111111... 01
436 */ 432 */
437 433
438 /* 1 1 */ 434 lm_copy(s, x);
439 fe_mul__distinct(r, x, x);
440 fe_mul__distinct(s, r, x);
441 435
442 /* 1 x 248 */ 436 /* 1, 1 x 249 */
443 for (i = 0; i < 248; i++) { 437 for (i = 0; i < 249; i++) {
444 fe_mul__distinct(r, s, s); 438 fe_mul__distinct(r, s, s);
445 fe_mul__distinct(s, r, x); 439 fe_mul__distinct(s, r, x);
446 } 440 }