Commit fd83079a authored by Bernd Paysan's avatar Bernd Paysan

Make sure your secrets aren't tainted

parent c10b20d5
Pipeline #681 failed with stage
in 1 minute and 14 seconds
......@@ -2,6 +2,14 @@
#define HAVE_GE25519_SCALARMULT_BASE_CHOOSE_NIELS
#ifdef FORCE_SYMVER
#ifdef __x86_64
#define TOSTRING(x) #x
#define STRINGIFY(x) TOSTRING(x) /* Two stages necessary */
__asm__(".symver memcpy,memcpy@GLIBC_" STRINGIFY(FORCE_SYMVER));
#endif
#endif
DONNA_NOINLINE static void
ge25519_scalarmult_base_choose_niels(ge25519_niels *t, const uint8_t table[256][96], uint32_t pos, signed char b) {
int64_t breg = (int64_t)b;
......
......@@ -291,6 +291,8 @@ STATIC void ge25519_double_scalarmult_vartime(ge25519 *r, const ge25519 *p1, con
ge25519_p1p1_to_partial(r, &t);
}
expilcit_bzero(slide1, sizeof(slide1));
expilcit_bzero(slide2, sizeof(slide2));
}
/* computes [s1]p1 */
......@@ -325,6 +327,7 @@ STATIC void ge25519_scalarmult_vartime(ge25519 *r, const ge25519 *p1, const bign
ge25519_p1p1_to_partial(r, &t);
}
expilcit_bzero(slide1, sizeof(slide1));
}
/*
......@@ -440,6 +443,7 @@ STATIC void ge25519_scalarmult(ge25519 *r, const ge25519 *p1, const bignum256mod
ge25519_pnielsadd_p1p1(&t, r, &pre, (unsigned char)slide1[i] >> 7);
ge25519_p1p1_to_partial(r, &t);
}
expilcit_bzero(slide1, sizeof(slide1));
}
#if !defined(HAVE_GE25519_SCALARMULT_BASE_CHOOSE_NIELS)
......
......@@ -328,6 +328,8 @@ ge25519_double_scalarmult_vartime(ge25519 *r, const ge25519 *p1, const bignum256
ge25519_p1p1_to_partial(r, &t);
}
expilcit_bzero(slide1, sizeof(slide1));
expilcit_bzero(slide2, sizeof(slide2));
}
#ifndef MM16
......@@ -368,6 +370,7 @@ ge25519_scalarmult_vartime(ge25519 *r, const ge25519 *p1, const bignum256modm s1
ge25519_p1p1_to_partial(r, &t);
}
expilcit_bzero(slide1, sizeof(slide1));
}
DONNA_INLINE static void ge25519_cmove_stride4(long * r, long * p, long * pos, long * n, int stride) {
......@@ -452,6 +455,7 @@ STATIC void ge25519_scalarmult(ge25519 *r, const ge25519 *p1, const bignum256mod
ge25519_pnielsadd_p1p1(&t, r, &pre, (unsigned char)slide1[i] >> 7);
ge25519_p1p1_to_partial(r, &t);
}
expilcit_bzero(slide1, sizeof(slide1));
}
#if !defined(HAVE_GE25519_SCALARMULT_BASE_CHOOSE_NIELS)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment