Use libmd hashing function implementations instead of embedding our own

This splits the implementation responsibilities, and reduces embedded
code copies, which was one of the driving points with this project to
start with, so it's nice to give a good example.
This commit is contained in:
Guillem Jover
2021-02-07 00:09:30 +01:00
parent 68f980c90d
commit 847e682f8d
20 changed files with 163 additions and 831 deletions

View File

@@ -39,7 +39,7 @@
#include <string.h>
#include <termios.h>
#include "hash/sha512.h"
#include <sha512.h>
#include <libperfstat.h>
@@ -54,9 +54,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) (SHA512_Update(&ctx, (uint8_t *)(x), (l)))
#define HD(x) (SHA512_Update(&ctx, (uint8_t *)&(x), sizeof (x)))
#define HF(x) (SHA512_Update(&ctx, (uint8_t *)&(x), sizeof (void*)))
int getentropy(void *buf, size_t len);