From e66a7f9fab601e35d435e97e450e647d92cc05ae Mon Sep 17 00:00:00 2001 From: Christian Neukirchen Date: Wed, 22 Jun 2016 13:08:29 +0200 Subject: getentropy_linux: use included SHA512. Revamp Makefile to only use -lcrypto for gzsig. Idea by @dalias. --- src/liboutils/getentropy_linux.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/liboutils/getentropy_linux.c b/src/liboutils/getentropy_linux.c index f0e3d40..adfd2fe 100644 --- a/src/liboutils/getentropy_linux.c +++ b/src/liboutils/getentropy_linux.c @@ -47,7 +47,7 @@ #include #include #include -#include +#include #include #include @@ -67,9 +67,9 @@ HD(b); \ } while (0) -#define HR(x, l) (SHA512_Update(&ctx, (char *)(x), (l))) -#define HD(x) (SHA512_Update(&ctx, (char *)&(x), sizeof (x))) -#define HF(x) (SHA512_Update(&ctx, (char *)&(x), sizeof (void*))) +#define HR(x, l) (SHA512Update(&ctx, (void *)(x), (l))) +#define HD(x) (SHA512Update(&ctx, (void *)&(x), sizeof (x))) +#define HF(x) (SHA512Update(&ctx, (void *)&(x), sizeof (void*))) int getentropy(void *buf, size_t len); @@ -327,9 +327,9 @@ static const int cl[] = { static int getentropy_phdr(struct dl_phdr_info *info, size_t size, void *data) { - SHA512_CTX *ctx = data; + SHA2_CTX *ctx = data; - SHA512_Update(ctx, &info->dlpi_addr, sizeof (info->dlpi_addr)); + SHA512Update(ctx, (void *)&info->dlpi_addr, sizeof (info->dlpi_addr)); return (0); } @@ -344,7 +344,7 @@ getentropy_fallback(void *buf, size_t len) struct rusage ru; sigset_t sigset; struct stat st; - SHA512_CTX ctx; + SHA2_CTX ctx; static pid_t lastpid; pid_t pid; size_t i, ii, m; @@ -361,7 +361,7 @@ getentropy_fallback(void *buf, size_t len) } for (i = 0; i < len; ) { int j; - SHA512_Init(&ctx); + SHA512Init(&ctx); for (j = 0; j < repeat; j++) { HX((e = gettimeofday(&tv, NULL)) == -1, tv); if (e != -1) { @@ -532,7 +532,7 @@ getentropy_fallback(void *buf, size_t len) #endif #endif - SHA512_Final(results, &ctx); + SHA512Final(results, &ctx); memcpy((char *)buf + i, results, min(sizeof(results), len - i)); i += min(sizeof(results), len - i); } -- cgit 1.4.1