No need for memmove() when no overlap is possible
This commit is contained in:
parent
6349e75304
commit
6ac55a30be
@ -21,7 +21,7 @@ crypto_box_curve25519xchacha20poly1305_seed_keypair(unsigned char * pk,
|
|||||||
unsigned char hash[64];
|
unsigned char hash[64];
|
||||||
|
|
||||||
crypto_hash_sha512(hash, seed, 32);
|
crypto_hash_sha512(hash, seed, 32);
|
||||||
memmove(sk, hash, 32);
|
memcpy(sk, hash, 32);
|
||||||
sodium_memzero(hash, sizeof hash);
|
sodium_memzero(hash, sizeof hash);
|
||||||
|
|
||||||
return crypto_scalarmult_curve25519_base(pk, sk);
|
return crypto_scalarmult_curve25519_base(pk, sk);
|
||||||
|
@ -16,7 +16,7 @@ crypto_box_curve25519xsalsa20poly1305_seed_keypair(unsigned char * pk,
|
|||||||
unsigned char hash[64];
|
unsigned char hash[64];
|
||||||
|
|
||||||
crypto_hash_sha512(hash, seed, 32);
|
crypto_hash_sha512(hash, seed, 32);
|
||||||
memmove(sk, hash, 32);
|
memcpy(sk, hash, 32);
|
||||||
sodium_memzero(hash, sizeof hash);
|
sodium_memzero(hash, sizeof hash);
|
||||||
|
|
||||||
return crypto_scalarmult_curve25519_base(pk, sk);
|
return crypto_scalarmult_curve25519_base(pk, sk);
|
||||||
|
Loading…
Reference in New Issue
Block a user