commit 1d16f22bf280b27c6ce63e14156a791e788f3431
parent 74f650f0b6a8723269dcc9e6199b08eb05612e5e
Author: Nihal Jere <nihal@nihaljere.xyz>
Date: Tue, 12 Oct 2021 13:51:30 -0500
npm-core: fix getentropy usage
getentropy returns a status, not the number of bytes written like
getrandom.
Diffstat:
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/npm-core.c b/npm-core.c
@@ -107,7 +107,7 @@ int main(int argc, char *argv[]) {
}
if (strcmp(argv[1], "-e") == 0) {
- if (getentropy(salt, SALT_LEN) < SALT_LEN) {
+ if (getentropy(salt, SALT_LEN) < 0) {
error("failed to generate salt");
goto fail;
}
@@ -129,7 +129,7 @@ int main(int argc, char *argv[]) {
crypto_argon2i(key, KEY_LEN, work, M_COST, T_COST, master, len, salt, SALT_LEN);
- if (getentropy(nonce, NONCE_LEN) < NONCE_LEN) {
+ if (getentropy(nonce, NONCE_LEN) < 0) {
error("failed to generate nonce");
goto fail;
}