npm

Nihal's Password Manager (WIP)
git clone git://git.nihaljere.xyz/npm
Log | Files | Refs | README | LICENSE

commit 904f76ca0ea5ca5a1cc81877e046cf3ffd73891e
parent f082f6fa55f79cd967f2ed1234684109d55e9795
Author: Nihal Jere <nihal@nihaljere.xyz>
Date:   Sat,  9 Oct 2021 10:48:53 -0500

npm-core: use getentropy instead of getrandom

getentropy is POSIX, getrandom isn't

Diffstat:
Mnpm-core.c | 6+++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/npm-core.c b/npm-core.c @@ -6,7 +6,7 @@ #include <stdio.h> #include <stdlib.h> #include <sys/mman.h> -#include <sys/random.h> +#include <unistd.h> #include "common.h" #include "monocypher.h" @@ -112,7 +112,7 @@ int main(int argc, char *argv[]) { } if (strcmp(argv[1], "-e") == 0) { - if (getrandom(salt, SALT_LEN, 0) < SALT_LEN) { + if (getentropy(salt, SALT_LEN) < SALT_LEN) { error("failed to generate salt"); goto fail; } @@ -134,7 +134,7 @@ int main(int argc, char *argv[]) { crypto_argon2i(key, KEY_LEN, work, M_COST, T_COST, master, len, salt, SALT_LEN); - if (getrandom(nonce, NONCE_LEN, 0) < NONCE_LEN) { + if (getentropy(nonce, NONCE_LEN) < NONCE_LEN) { error("failed to generate nonce"); goto fail; }