diff options
author | Nick Mathewson <nickm@torproject.org> | 2018-09-11 10:35:18 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2018-09-11 10:35:18 -0400 |
commit | e5601f14ed4384e8de1030d21cc7442df48adabe (patch) | |
tree | a27ca8ea6a8c70a86a34365123fcda5acac8b014 /src/ext | |
parent | b87a95289b63c891f4e12e0d40f41a39dae5aa7e (diff) | |
download | tor-e5601f14ed4384e8de1030d21cc7442df48adabe.tar.gz tor-e5601f14ed4384e8de1030d21cc7442df48adabe.zip |
Initialize 't' in ge25519_scalarmult_base_niels()
OSS-Fuzz's version of memorysanitizer can't tell that this value is
not going to be used unsafely.
Diffstat (limited to 'src/ext')
-rw-r--r-- | src/ext/ed25519/donna/ed25519-donna-impl-base.h | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/ext/ed25519/donna/ed25519-donna-impl-base.h b/src/ext/ed25519/donna/ed25519-donna-impl-base.h index 48913edcb4..67b3b49b96 100644 --- a/src/ext/ed25519/donna/ed25519-donna-impl-base.h +++ b/src/ext/ed25519/donna/ed25519-donna-impl-base.h @@ -6,15 +6,15 @@ DONNA_INLINE static void ge25519_p1p1_to_partial(ge25519 *r, const ge25519_p1p1 *p) { curve25519_mul(r->x, p->x, p->t); curve25519_mul(r->y, p->y, p->z); - curve25519_mul(r->z, p->z, p->t); + curve25519_mul(r->z, p->z, p->t); } DONNA_INLINE static void ge25519_p1p1_to_full(ge25519 *r, const ge25519_p1p1 *p) { curve25519_mul(r->x, p->x, p->t); curve25519_mul(r->y, p->y, p->z); - curve25519_mul(r->z, p->z, p->t); - curve25519_mul(r->t, p->x, p->y); + curve25519_mul(r->z, p->z, p->t); + curve25519_mul(r->t, p->x, p->y); } static void @@ -249,7 +249,7 @@ ge25519_unpack_negative_vartime(ge25519 *r, const unsigned char p[32]) { #define S2_TABLE_SIZE (1<<(S2_SWINDOWSIZE-2)) /* computes [s1]p1 + [s2]basepoint */ -static void +static void ge25519_double_scalarmult_vartime(ge25519 *r, const ge25519 *p1, const bignum256modm s1, const bignum256modm s2) { signed char slide1[256], slide2[256]; ge25519_pniels pre1[S1_TABLE_SIZE]; @@ -336,6 +336,7 @@ ge25519_scalarmult_base_niels(ge25519 *r, const uint8_t basepoint_table[256][96] signed char b[64]; uint32_t i; ge25519_niels t; + memset(&t, 0, sizeof(t)); contract256_window4_modm(b, s); @@ -344,7 +345,7 @@ ge25519_scalarmult_base_niels(ge25519 *r, const uint8_t basepoint_table[256][96] curve25519_add_reduce(r->y, t.xaddy, t.ysubx); memset(r->z, 0, sizeof(bignum25519)); curve25519_copy(r->t, t.t2d); - r->z[0] = 2; + r->z[0] = 2; for (i = 3; i < 64; i += 2) { ge25519_scalarmult_base_choose_niels(&t, basepoint_table, i / 2, b[i]); ge25519_nielsadd2(r, &t); @@ -361,4 +362,3 @@ ge25519_scalarmult_base_niels(ge25519 *r, const uint8_t basepoint_table[256][96] ge25519_nielsadd2(r, &t); } } - |