diff options
author | George Hazan <ghazan@miranda.im> | 2017-02-13 22:43:15 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2017-02-13 22:43:15 +0300 |
commit | 9498261ca115235b41c5738049577ab163e01fce (patch) | |
tree | 99d4ffcac6cd16b83810ba8cd2873d15d29c3ee8 | |
parent | 38b42a8f83ded6065562610b18bd4abb0f40469f (diff) |
complation fix
3 files changed, 19 insertions, 17 deletions
diff --git a/libs/libaxolotl/src/curve25519/ed25519/additions/elligator.c b/libs/libaxolotl/src/curve25519/ed25519/additions/elligator.c index 8a8131ff2f..5294c86669 100644 --- a/libs/libaxolotl/src/curve25519/ed25519/additions/elligator.c +++ b/libs/libaxolotl/src/curve25519/ed25519/additions/elligator.c @@ -7,6 +7,7 @@ unsigned int legendre_is_nonsquare(fe in) { + unsigned char bytes[32]; fe temp; fe_pow22523(temp, in); /* temp = in^((q-5)/8) */ fe_sq(temp, temp); /* in^((q-5)/4) */ @@ -19,7 +20,6 @@ unsigned int legendre_is_nonsquare(fe in) * 0 = input is zero * -1 = nonsquare */ - unsigned char bytes[32]; fe_tobytes(bytes, temp); return 1 & bytes[31]; } diff --git a/libs/libaxolotl/src/curve25519/ed25519/additions/uopen_modified.c b/libs/libaxolotl/src/curve25519/ed25519/additions/uopen_modified.c index 412f8c4c9b..537858db6a 100644 --- a/libs/libaxolotl/src/curve25519/ed25519/additions/uopen_modified.c +++ b/libs/libaxolotl/src/curve25519/ed25519/additions/uopen_modified.c @@ -20,6 +20,9 @@ int crypto_usign_open_modified( ge_p2 R; unsigned char hcheck[64]; int count; + // Ru = sBu + h(-U) + ge_p3 sBu, hU; + ge_p3 Ru; if (smlen < 96) goto badsig; if (sm[63] & 224) goto badsig; /* strict parsing of h */ @@ -52,9 +55,6 @@ int crypto_usign_open_modified( // R = sB + h(-A) ge_double_scalarmult_vartime(&R,h,&A,s); - // Ru = sBu + h(-U) - ge_p3 sBu, hU; - // sBu ge_scalarmult(&sBu, s, Bu); @@ -62,13 +62,13 @@ int crypto_usign_open_modified( ge_scalarmult(&hU, h, &U); // Ru = sBu + h(-U) - ge_p1p1 Rp1p1; - ge_p3 Ru; - ge_cached hUcached; - ge_p3_to_cached(&hUcached, &hU); - ge_add(&Rp1p1, &sBu, &hUcached); - ge_p1p1_to_p3(&Ru, &Rp1p1); - + { + ge_p1p1 Rp1p1; + ge_cached hUcached; + ge_p3_to_cached(&hUcached, &hU); + ge_add(&Rp1p1, &sBu, &hUcached); + ge_p1p1_to_p3(&Ru, &Rp1p1); + } // Check h == SHA512(label(4) || A || U || R || Ru || M) m[0] = 0xFB; diff --git a/libs/libaxolotl/src/curve25519/ed25519/additions/vopen_modified.c b/libs/libaxolotl/src/curve25519/ed25519/additions/vopen_modified.c index 3dfc7fba6f..035ec0e0a3 100644 --- a/libs/libaxolotl/src/curve25519/ed25519/additions/vopen_modified.c +++ b/libs/libaxolotl/src/curve25519/ed25519/additions/vopen_modified.c @@ -16,6 +16,7 @@ int crypto_vsign_open_modified( unsigned char h[32]; unsigned char s[32]; ge_p2 R; + ge_p3 Rv; unsigned char hcheck[64]; unsigned char vrf_output[64]; int count; @@ -51,12 +52,13 @@ int crypto_vsign_open_modified( ge_scalarmult(&h_Vneg, h, &Vneg); // Rv = (sc * Bv) + (hc * (-V)) - ge_p1p1 Rp1p1; - ge_p3 Rv; - ge_cached h_Vnegcached; - ge_p3_to_cached(&h_Vnegcached, &h_Vneg); - ge_add(&Rp1p1, &s_Bv, &h_Vnegcached); - ge_p1p1_to_p3(&Rv, &Rp1p1); + { + ge_p1p1 Rp1p1; + ge_cached h_Vnegcached; + ge_p3_to_cached(&h_Vnegcached, &h_Vneg); + ge_add(&Rp1p1, &s_Bv, &h_Vnegcached); + ge_p1p1_to_p3(&Rv, &Rp1p1); + } // Check h == SHA512(label(4) || A || V || R || Rv || M) m[0] = 0xFB; // label 4 |