Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/external/isc/libsodium/dist/src/libsodium/crypto_core/ed...



details:   https://anonhg.NetBSD.org/src/rev/68c756007fd8
branches:  trunk
changeset: 937495:68c756007fd8
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Thu Aug 20 21:20:37 2020 +0000

description:
Reuse temporaries in ge25519_scalarmult to reduce stack usage.

diffstat:

 sys/external/isc/libsodium/dist/src/libsodium/crypto_core/ed25519/ref10/ed25519_ref10.c |  40 +++++-----
 1 files changed, 20 insertions(+), 20 deletions(-)

diffs (65 lines):

diff -r 1a62bdacbc16 -r 68c756007fd8 sys/external/isc/libsodium/dist/src/libsodium/crypto_core/ed25519/ref10/ed25519_ref10.c
--- a/sys/external/isc/libsodium/dist/src/libsodium/crypto_core/ed25519/ref10/ed25519_ref10.c   Thu Aug 20 21:20:16 2020 +0000
+++ b/sys/external/isc/libsodium/dist/src/libsodium/crypto_core/ed25519/ref10/ed25519_ref10.c   Thu Aug 20 21:20:37 2020 +0000
@@ -755,41 +755,41 @@
     signed char     carry;
     ge25519_p1p1    r;
     ge25519_p2      s;
-    ge25519_p1p1    t2, t3, t4, t5, t6, t7, t8;
-    ge25519_p3      p2, p3, p4, p5, p6, p7, p8;
+    ge25519_p1p1    t1;
+    ge25519_p3      p2, p3, p4, pt;
     ge25519_cached  pi[8];
     ge25519_cached  t;
     int             i;
 
     ge25519_p3_to_cached(&pi[1 - 1], p);   /* p */
 
-    ge25519_p3_dbl(&t2, p);
-    ge25519_p1p1_to_p3(&p2, &t2);
+    ge25519_p3_dbl(&t1, p);
+    ge25519_p1p1_to_p3(&p2, &t1);
     ge25519_p3_to_cached(&pi[2 - 1], &p2); /* 2p = 2*p */
 
-    ge25519_add(&t3, p, &pi[2 - 1]);
-    ge25519_p1p1_to_p3(&p3, &t3);
+    ge25519_add(&t1, p, &pi[2 - 1]);
+    ge25519_p1p1_to_p3(&p3, &t1);
     ge25519_p3_to_cached(&pi[3 - 1], &p3); /* 3p = 2p+p */
 
-    ge25519_p3_dbl(&t4, &p2);
-    ge25519_p1p1_to_p3(&p4, &t4);
+    ge25519_p3_dbl(&t1, &p2);
+    ge25519_p1p1_to_p3(&p4, &t1);
     ge25519_p3_to_cached(&pi[4 - 1], &p4); /* 4p = 2*2p */
 
-    ge25519_add(&t5, p, &pi[4 - 1]);
-    ge25519_p1p1_to_p3(&p5, &t5);
-    ge25519_p3_to_cached(&pi[5 - 1], &p5); /* 5p = 4p+p */
+    ge25519_add(&t1, p, &pi[4 - 1]);
+    ge25519_p1p1_to_p3(&pt, &t1);
+    ge25519_p3_to_cached(&pi[5 - 1], &pt); /* 5p = 4p+p */
 
-    ge25519_p3_dbl(&t6, &p3);
-    ge25519_p1p1_to_p3(&p6, &t6);
-    ge25519_p3_to_cached(&pi[6 - 1], &p6); /* 6p = 2*3p */
+    ge25519_p3_dbl(&t1, &p3);
+    ge25519_p1p1_to_p3(&pt, &t1);
+    ge25519_p3_to_cached(&pi[6 - 1], &pt); /* 6p = 2*3p */
 
-    ge25519_add(&t7, p, &pi[6 - 1]);
-    ge25519_p1p1_to_p3(&p7, &t7);
-    ge25519_p3_to_cached(&pi[7 - 1], &p7); /* 7p = 6p+p */
+    ge25519_add(&t1, p, &pi[6 - 1]);
+    ge25519_p1p1_to_p3(&pt, &t1);
+    ge25519_p3_to_cached(&pi[7 - 1], &pt); /* 7p = 6p+p */
 
-    ge25519_p3_dbl(&t8, &p4);
-    ge25519_p1p1_to_p3(&p8, &t8);
-    ge25519_p3_to_cached(&pi[8 - 1], &p8); /* 8p = 2*4p */
+    ge25519_p3_dbl(&t1, &p4);
+    ge25519_p1p1_to_p3(&pt, &t1);
+    ge25519_p3_to_cached(&pi[8 - 1], &pt); /* 8p = 2*4p */
 
     for (i = 0; i < 32; ++i) {
         e[2 * i + 0] = (a[i] >> 0) & 15;



Home | Main Index | Thread Index | Old Index