diff options
author | Oleksij Rempel <o.rempel@pengutronix.de> | 2017-03-22 10:14:38 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2017-03-30 08:23:20 +0200 |
commit | eba85be0f25dd1af9cdab3af2a4f98b14fe9c41e (patch) | |
tree | d391faae6996dfb5e95360d913235712076d1ab1 /common/password.c | |
parent | ef4144b4ab6301d7417af3eb4d79cfc66bf0e731 (diff) | |
download | barebox-eba85be0f25dd1af9cdab3af2a4f98b14fe9c41e.tar.gz barebox-eba85be0f25dd1af9cdab3af2a4f98b14fe9c41e.tar.xz |
common: password: make use of get_crypto_bytes
get_random_bytes is providing prng, if we have HWRNG we should be
able to use it over get_crypto_bytes
Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'common/password.c')
-rw-r--r-- | common/password.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/common/password.c b/common/password.c index d52b746f0f..74d328f4b2 100644 --- a/common/password.c +++ b/common/password.c @@ -365,7 +365,11 @@ int set_env_passwd(unsigned char* passwd, size_t length) char *salt = passwd_sum; int keylen = PBKDF2_LENGTH - PBKDF2_SALT_LEN; - get_random_bytes(passwd_sum, PBKDF2_SALT_LEN); + ret = get_crypto_bytes(passwd_sum, PBKDF2_SALT_LEN); + if (ret) { + pr_err("Can't get random numbers\n"); + return ret; + } ret = pkcs5_pbkdf2_hmac_sha1(passwd, length, salt, PBKDF2_SALT_LEN, PBKDF2_COUNT, keylen, key); |