1
mirror of https://github.com/jedisct1/libsodium.git synced 2024-12-24 04:25:10 -07:00
This commit is contained in:
Frank Denis 2019-02-23 21:32:23 +01:00
parent eeb1f26924
commit b5975f97e4

View File

@ -2687,9 +2687,9 @@ ristretto255_frombytes(ge25519_p3 *h, const unsigned char *s)
fe25519_neg(v, v); /* v = -d*u1^2 */
fe25519_sub(v, v, u2u2); /* v = -(d*u1^2)-u2^2 */
fe25519_1(one);
fe25519_mul(v_u2u2, v, u2u2); /* v_u2u2 = v*u2^2 */
fe25519_1(one);
was_square = ristretto255_sqrt_ratio_m1(inv_sqrt, one, v_u2u2);
fe25519_mul(h->X, inv_sqrt, u2);
fe25519_mul(h->Y, inv_sqrt, h->X);
@ -2730,10 +2730,10 @@ ristretto255_p3_tobytes(unsigned char *s, const ge25519_p3 *h)
fe25519_mul(u1, u1, zmy); /* u1 = (Z+Y)*(Z-Y) */
fe25519_mul(u2, h->X, h->Y); /* u2 = X*Y */
fe25519_1(one);
fe25519_sq(u1_u2u2, u2); /* u1_u2u2 = u2^2 */
fe25519_mul(u1_u2u2, u1, u1_u2u2); /* u1_u2u2 = u1*u2^2 */
fe25519_1(one);
(void) ristretto255_sqrt_ratio_m1(inv_sqrt, one, u1_u2u2);
fe25519_mul(den1, inv_sqrt, u1); /* den1 = inv_sqrt*u1 */
fe25519_mul(den2, inv_sqrt, u2); /* den2 = inv_sqrt*u2 */