mirror of
https://github.com/jedisct1/libsodium.git
synced 2024-12-20 02:25:14 -07:00
Shave some lines in crypto_sign_keypair(), reintroduce @bascule's original code
This commit is contained in:
parent
5ca15fa3e8
commit
55d0b9f486
@ -24,19 +24,8 @@ int crypto_sign_seed_keypair(unsigned char *pk, unsigned char *sk,
|
||||
|
||||
int crypto_sign_keypair(unsigned char *pk, unsigned char *sk)
|
||||
{
|
||||
unsigned char h[64];
|
||||
ge_p3 A;
|
||||
int i;
|
||||
unsigned char seed[32];
|
||||
|
||||
randombytes(sk,32);
|
||||
crypto_hash_sha512(h,sk,32);
|
||||
h[0] &= 248;
|
||||
h[31] &= 63;
|
||||
h[31] |= 64;
|
||||
|
||||
ge_scalarmult_base(&A,h);
|
||||
ge_p3_tobytes(pk,&A);
|
||||
|
||||
for (i = 0;i < 32;++i) sk[32 + i] = pk[i];
|
||||
return 0;
|
||||
randombytes(seed,32);
|
||||
return crypto_sign_seed_keypair(pk,sk,seed);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user