mirror of
https://github.com/jedisct1/libsodium.git
synced 2026-08-25 17:57:21 +09:00
randombytes() -> randombytes_buf()
Since randombytes() wraps randombytes_buf(), that's one more function the linker can strip out until it's actually used by the app.
This commit is contained in:
+1
-1
@@ -22,6 +22,6 @@ int crypto_box_keypair(
|
|||||||
unsigned char *sk
|
unsigned char *sk
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
randombytes(sk,32);
|
randombytes_buf(sk,32);
|
||||||
return crypto_scalarmult_curve25519_base(pk,sk);
|
return crypto_scalarmult_curve25519_base(pk,sk);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ int crypto_sign_keypair(unsigned char *pk, unsigned char *sk)
|
|||||||
unsigned char seed[32];
|
unsigned char seed[32];
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
randombytes(seed, sizeof seed);
|
randombytes_buf(seed, sizeof seed);
|
||||||
ret = crypto_sign_seed_keypair(pk, sk, seed);
|
ret = crypto_sign_seed_keypair(pk, sk, seed);
|
||||||
sodium_memzero(seed, sizeof seed);
|
sodium_memzero(seed, sizeof seed);
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -13,7 +13,7 @@ int crypto_sign_keypair(
|
|||||||
sc25519 scsk;
|
sc25519 scsk;
|
||||||
ge25519 gepk;
|
ge25519 gepk;
|
||||||
|
|
||||||
randombytes(sk, 32);
|
randombytes_buf(sk, 32);
|
||||||
crypto_hash_sha512(sk, sk, 32);
|
crypto_hash_sha512(sk, sk, 32);
|
||||||
sk[0] &= 248;
|
sk[0] &= 248;
|
||||||
sk[31] &= 127;
|
sk[31] &= 127;
|
||||||
|
|||||||
Reference in New Issue
Block a user