8000 Merge branch 'master' into adam5wu/master · Adam5Wu/bearssl-esp8266@b2939e9 · GitHub
[go: up one dir, main page]

Skip to content

Commit b2939e9

Browse files
committed
Merge branch 'master' into adam5wu/master
2 parents be63b68 + 6f8be1e commit b2939e9

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/ec/ec_prime_i15.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ typedef struct {
211211
*
212212
* Cost: 8 multiplications
213213
*/
214-
static const uint16_t code_double[] = {
214+
static const uint16_t code_double[] PROGMEM = {
215215
/*
216216
* Compute z^2 (in t1).
217217
*/
@@ -317,7 +317,7 @@ static const uint16_t code_double[] = {
317317
*
318318
* Cost: 16 multiplications
319319
*/
320-
static const uint16_t code_add[] = {
320+
static const uint16_t code_add[] PROGMEM = {
321321
/*
322322
* Compute u1 = x1*z2^2 (in t1) and s1 = y1*z2^3 (in t3).
323323
*/
@@ -385,7 +385,7 @@ static const uint16_t code_add[] = {
385385
* converted to Montgomery coordinates yet).
386386
* -- P2x, P2y and P2z are set to, respectively, R^2, b*R and 1.
387387
*/
388-
static const uint16_t code_check[] = {
388+
static const uint16_t code_check[] PROGMEM = {
389389

390390
/* Convert x and y to Montgomery representation. */
391391
MMUL(t1, P1x, P2x),
@@ -422,7 +422,7 @@ static const uint16_t code_check[] = {
422422
* Conversion back to affine coordinates. This code snippet assumes that
423423
* the z coordinate of P2 is set to 1 (not in Montgomery representation).
424424
*/
425-
static const uint16_t code_affine[] = {
425+
static const uint16_t code_affine[] PROGMEM = {
426426

427427
/* Save z*R in t1. */
428428
MSET(t1, P1z),
@@ -482,7 +482,11 @@ run_code(jacobian *P1, const jacobian *P2,
482482
for (u = 0;; u ++) {
483483
unsigned op, d, a, b;
484484

485+
#ifdef ESP8266
486+
op = pgm_read_word(&code[u]);
487+
#else
485488
op = code[u];
489+
#endif
486490
if (op == 0) {
487491
break;
488492
}

0 commit comments

Comments
 (0)
0