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-868f383699ef65c828fbc41e7c7c7368ab56f8a5.tar.gz
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)
* to avoid copying temporaries.
*/
- /* 1 1 */
- fe_mul__distinct(s, x, x);
- fe_mul__distinct(r, s, x);
+ lm_copy(r, x);
- /* 1 x 248 */
- for (i = 0; i < 248; i++) {
+ /* 1, 1 x 249 */
+ for (i = 0; i < 249; i++) {
fe_mul__distinct(s, r, r);
fe_mul__distinct(r, s, x);
}
@@ -403,13 +401,11 @@ static void fe_inv__distinct(byte *r, const byte *x)
/* 0 */
fe_mul__distinct(r, s, s);
- /* 1 */
- fe_mul__distinct(s, r, r);
- fe_mul__distinct(r, s, x);
-
- /* 1 */
- fe_mul__distinct(s, r, r);
- fe_mul__distinct(r, s, x);
+ /* 1, 1 */
+ for (i = 0; i < 2; i++) {
+ fe_mul__distinct(s, r, r);
+ fe_mul__distinct(r, s, x);
+ }
}
#if 0 //UNUSED
@@ -435,12 +431,10 @@ static void exp2523(byte *r, const byte *x, byte *s)
* 111111... 01
*/
- /* 1 1 */
- fe_mul__distinct(r, x, x);
- fe_mul__distinct(s, r, x);
+ lm_copy(s, x);
- /* 1 x 248 */
- for (i = 0; i < 248; i++) {
+ /* 1, 1 x 249 */
+ for (i = 0; i < 249; i++) {
fe_mul__distinct(r, s, s);
fe_mul__distinct(s, r, x);
}