From a9cb98a3e83cc357cf15bff1327a86b99f869549 Mon Sep 17 00:00:00 2001 From: Nicholas Tay Date: Sun, 7 May 2023 20:37:31 +1000 Subject: Use wincrypt on msys2 Not sure what I was using, this actually does work. Maybe I was just missing the package in the w32api headers in the past... --- Makefile | 2 +- passgen.c | 11 ++++------- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index 2bc2752..947ba94 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,7 @@ NAME = passgen PREFIX = $(HOME)/.local CC = gcc -CFLAGS += -std=c99 -Wall -Wextra -Wshadow -Werror -pedantic +CFLAGS += -std=c99 -Wall -Wextra -Wshadow -pedantic default: $(NAME) diff --git a/passgen.c b/passgen.c index d8b2201..1961793 100644 --- a/passgen.c +++ b/passgen.c @@ -12,7 +12,8 @@ || defined (__FreeBSD__) \ || defined (__OpenBSD__) # define USE_GETENTROPY -#elif defined (_WIN32) && ! defined (__MINGW32__) +#elif defined (_WIN32) \ + || defined(__CYGWIN__) # define USE_WINCRYPT #endif @@ -30,12 +31,7 @@ # include #else # include -/* getpid() on Windows */ -# if defined (_WIN32) && ! defined (__MINGW32__) -# include -# else -# include -# endif +# include #endif @@ -71,6 +67,7 @@ bool init_rng(void) )) return false; #elif ! defined (USE_GETENTROPY) && ! defined (USE_WINCRYPT) +#pragma message "Using fallback insecure RNG seeding!" /* * TODO: seed better RNG * this isn't very good, but it's enough(?) for now -- cgit