Just use constants instead of macros

In this context, they are actually less confusing.
This commit is contained in:
Frank Denis 2017-10-12 13:14:25 +02:00
parent 64604f8eef
commit b28a8ad896

View File

@ -27,8 +27,8 @@ crypto_sign_ed25519_seed_keypair(unsigned char *pk, unsigned char *sk,
ge_scalarmult_base(&A, sk); ge_scalarmult_base(&A, sk);
ge_p3_tobytes(pk, &A); ge_p3_tobytes(pk, &A);
memmove(sk, seed, crypto_sign_ed25519_SECRETKEYBYTES); memmove(sk, seed, 32);
memmove(sk + 32, pk, crypto_sign_ed25519_PUBLICKEYBYTES); memmove(sk + 32, pk, 32);
return 0; return 0;
} }
@ -81,11 +81,9 @@ crypto_sign_ed25519_sk_to_curve25519(unsigned char *curve25519_sk,
unsigned char h[crypto_hash_sha512_BYTES]; unsigned char h[crypto_hash_sha512_BYTES];
#ifdef ED25519_NONDETERMINISTIC #ifdef ED25519_NONDETERMINISTIC
memcpy(h, ed25519_sk, crypto_sign_ed25519_SECRETKEYBYTES); memcpy(h, ed25519_sk, 32);
#else #else
crypto_hash_sha512(h, ed25519_sk, crypto_hash_sha512(h, ed25519_sk, 32);
crypto_sign_ed25519_SECRETKEYBYTES -
crypto_sign_ed25519_PUBLICKEYBYTES);
#endif #endif
h[0] &= 248; h[0] &= 248;
h[31] &= 127; h[31] &= 127;