about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorChristian Neukirchen <chneukirchen@gmail.com>2016-06-22 13:08:29 +0200
committerChristian Neukirchen <chneukirchen@gmail.com>2016-06-22 13:08:29 +0200
commite66a7f9fab601e35d435e97e450e647d92cc05ae (patch)
tree071cce0729662a91ed464e89323e4f0d0689512b /src
parent57adb92eb05e0eab41342d6d1896d18624fd1619 (diff)
downloadoutils-e66a7f9fab601e35d435e97e450e647d92cc05ae.tar.gz
outils-e66a7f9fab601e35d435e97e450e647d92cc05ae.tar.xz
outils-e66a7f9fab601e35d435e97e450e647d92cc05ae.zip
getentropy_linux: use included SHA512.
Revamp Makefile to only use -lcrypto for gzsig.

Idea by @dalias.
Diffstat (limited to 'src')
-rw-r--r--src/liboutils/getentropy_linux.c18
1 files changed, 9 insertions, 9 deletions
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 <errno.h>
 #include <unistd.h>
 #include <time.h>
-#include <openssl/sha.h>
+#include <sha2.h>
 
 #include <linux/types.h>
 #include <linux/random.h>
@@ -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);
 	}