summaryrefslogtreecommitdiff
path: root/util.h
diff options
context:
space:
mode:
Diffstat (limited to 'util.h')
-rw-r--r--util.h11
1 files changed, 2 insertions, 9 deletions
diff --git a/util.h b/util.h
index 5c4a604..9cd2bd4 100644
--- a/util.h
+++ b/util.h
@@ -17,6 +17,7 @@
#define RAND_POOL_SIZE 512
/* SHA-256 */
#define HASH_LEN 32
+#define HASH_STR_LEN 65
/* The salt is the random data */
#define SALT_LEN RAND_POOL_SIZE
@@ -24,15 +25,7 @@ static inline bool streq(const char *s1, const char *s2) {
return !strcmp(s1, s2);
}
-static inline ssize_t random_get(void *buf, size_t buflen, unsigned int flags) {
- long rv = syscall(SYS_getrandom, buf, buflen, flags);
- if (rv == -1 && errno == ENOSYS) {
- fputs("getrandom returned ENOSYS. random-seed requires Linux 3.17", stderr);
- exit(1);
- }
- return rv;
-}
-
+ssize_t random_get(void *buf, size_t buflen, unsigned int flags);
size_t hex2mem(unsigned char *dest, size_t size, const char *src);
void mem2hex(char *dest, const void *src, size_t size);
void hash(const unsigned char salt[static SALT_LEN], unsigned char *out, const void *in, size_t size);