commit 77987d57d869ab2843dfbd5b2f9e0f1c26b0f583 from: Alexander Arkhipov date: Wed Apr 05 17:55:12 2023 UTC remove libsodium dependency The libsodium dependency was originally introduced because GNU systems didn't have arc4random(3) in stdlib.h, and simply reading /dev/urandom seemed like a bad idea. Glibc does have arc4random(3) now (since the release 2.36 of august 2022), and last time I checked musl developers seemed to be for the idea of supporting arc4random(3) once glibc does (Though they don't yet). People wishing to compile gpass with unusual (i.e. not BSD or GNU) libcs may modify the Makefile to link against libbsd. commit - fab801a19e2b0cacd281bf38f1d7889ef2ffcc6c commit + 77987d57d869ab2843dfbd5b2f9e0f1c26b0f583 blob - 71f0f66eaf69014a43ad2c868c8eb716eb252e4a blob + 0f457f31eef73b486315d42f72898e8a2e61e358 --- config.mk +++ config.mk @@ -3,18 +3,13 @@ VERSION = 0.3.4 PREFIX = /usr/local MANPREFIX = $(PREFIX)/man -INCS = -I/usr/local/include -LIBS = -L/usr/local/lib -lm -lsodium - CC = cc CPPFLAGS = -D_DEFAULT_SOURCE -CFLAGS = -std=c99 -Wall -pedantic $(INCS) -O2 -LDFLAGS = $(LIBS) +CFLAGS = -std=c99 -Wall -pedantic -O2 +LDFLAGS = -lm -# Debug -#CFLAGS = -std=c99 -Wall -pedantic $(INCS) -Wextra -O0 -g - # Linux #MANPREFIX = $(PREFIX)/share/man -#INCS = -#LIBS = -lm -lsodium + +# Debug +#CFLAGS = -std=c99 -Wall -pedantic -Wextra -O0 -g blob - 78ac0b578eecc06acd9c2976066f2824afcba822 blob + 720e5d29369c312702fcf3b4ae7dafb6513e335a --- gpass.c +++ gpass.c @@ -9,8 +9,6 @@ #include #include -#include - #define MAXWORDS 32768 #ifndef PREFIX # define PREFIX "/usr/local" @@ -67,7 +65,7 @@ gen(void) uint32_t n; for (left = plen; left; left--) { - n = randombytes_uniform(nwords) + 1; + n = arc4random_uniform(nwords) + 1; if (fseek(dicfp, offs[n], SEEK_SET) == -1) err(1, "fseek"); while ((c = getc(dicfp)) != EOF && !isspace(c)) @@ -92,9 +90,6 @@ main(int argc, char *argv[]) if (pledge("stdio unveil rpath", NULL) == -1) /* first call */ err(1, "pledge"); #endif - if (sodium_init() < 0) - err(1, "libsodium"); - while ((c = getopt(argc, argv, "d:e:n:")) != -1) { switch (c) { case 'd':