Clear the high bit the same way everywhere

This commit is contained in:
Frank Denis
2017-10-24 17:10:16 +02:00
parent 7e75ad4ca9
commit c150ceb677
4 changed files with 4 additions and 4 deletions
@@ -23,7 +23,7 @@ static inline void
_crypto_scalarmult_ed25519_clamp(unsigned char k[32])
{
k[0] &= 248;
k[31] &= 63;
k[31] &= 127;
k[31] |= 64;
}
@@ -21,7 +21,7 @@ crypto_sign_ed25519_seed_keypair(unsigned char *pk, unsigned char *sk,
crypto_hash_sha512(sk, seed, 32);
#endif
sk[0] &= 248;
sk[31] &= 63;
sk[31] &= 127;
sk[31] |= 64;
ge_scalarmult_base(&A, sk);
@@ -19,7 +19,7 @@ crypto_sign_edwards25519sha512batch_keypair(unsigned char *pk,
randombytes_buf(sk, 32);
crypto_hash_sha512(sk, sk, 32);
sk[0] &= 248;
sk[31] &= 63;
sk[31] &= 127;
sk[31] |= 64;
ge_scalarmult_base(&A, sk);
ge_p3_tobytes(pk, &A);
@@ -28,7 +28,7 @@ static inline void
_crypto_sign_ed25519_clamp(unsigned char k[32])
{
k[0] &= 248;
k[31] &= 63;
k[31] &= 127;
k[31] |= 64;
}