summaryrefslogtreecommitdiff
path: root/curve448-mul.c
diff options
context:
space:
mode:
authorNiels Möller <nisse@lysator.liu.se>2019-12-09 18:58:53 +0100
committerNiels Möller <nisse@lysator.liu.se>2019-12-09 18:58:53 +0100
commitb5ae97a8892fd4ad2021d58d4af87d95314a8f44 (patch)
tree35dc0023ba9f90170a617d68a305a097742557e2 /curve448-mul.c
parentd13bb31227f9fa58f3b1a41c79d7d39e4a0167b2 (diff)
downloadnettle-b5ae97a8892fd4ad2021d58d4af87d95314a8f44.tar.gz
Trim scratch usage of curve448 operations.
* ecc-448.c (ecc_mod_pow_446m224m1): Reduce scratch space from 9*n to 6*n. (ECC_448_INV_ITCH, ECC_448_SQRT_ITCH): Reduce accordingly. * curve448-mul.c (curve448_mul): Reduce allocation from 14*n to 12*n.
Diffstat (limited to 'curve448-mul.c')
-rw-r--r--curve448-mul.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/curve448-mul.c b/curve448-mul.c
index afa814a4..59cf7664 100644
--- a/curve448-mul.c
+++ b/curve448-mul.c
@@ -34,6 +34,7 @@
# include "config.h"
#endif
+#include <assert.h>
#include <string.h>
#include "curve448.h"
@@ -72,7 +73,8 @@ curve448_mul (uint8_t *q, const uint8_t *n, const uint8_t *p)
#define a24 39081
- itch = ecc->p.size * 14;
+ itch = ecc->p.size * 12;
+ assert (ecc->p.invert_itch + 5*ecc->p.size <= itch);
scratch = gmp_alloc_limbs (itch);
/* Note that 255 % GMP_NUMB_BITS == 0 isn't supported, so x1 always