Zero the stack in crypto_box_seed_keypair()

This commit is contained in:
Frank Denis 2015-10-25 01:22:11 +02:00
parent 220e972bb1
commit 7ab8ddef94

View File

@ -4,6 +4,7 @@
#include "crypto_scalarmult_curve25519.h" #include "crypto_scalarmult_curve25519.h"
#include "api.h" #include "api.h"
#include "randombytes.h" #include "randombytes.h"
#include "utils.h"
int crypto_box_seed_keypair( int crypto_box_seed_keypair(
unsigned char *pk, unsigned char *pk,
@ -14,6 +15,7 @@ int crypto_box_seed_keypair(
unsigned char hash[64]; unsigned char hash[64];
crypto_hash_sha512(hash,seed,32); crypto_hash_sha512(hash,seed,32);
memmove(sk,hash,32); memmove(sk,hash,32);
sodium_memzero(hash, sizeof hash);
return crypto_scalarmult_curve25519_base(pk,sk); return crypto_scalarmult_curve25519_base(pk,sk);
} }