summaryrefslogtreecommitdiff
path: root/util.h
diff options
context:
space:
mode:
authorAlex Xu (Hello71) <alex_y_xu@yahoo.ca>2018-08-15 11:26:39 -0400
committerAlex Xu (Hello71) <alex_y_xu@yahoo.ca>2018-08-15 11:26:39 -0400
commit94d6b7954dc5b7c98171095b56b15ed695923bb5 (patch)
tree97dd840beed1dcc185723c1bbdd881828b37ad49 /util.h
parentce34bf86fbdc5471493a39033f7f09d9ae37da6d (diff)
downloadrandom-seed-94d6b7954dc5b7c98171095b56b15ed695923bb5.tar.xz
random-seed-94d6b7954dc5b7c98171095b56b15ed695923bb5.zip
Move source files to src
Diffstat (limited to 'util.h')
-rw-r--r--util.h34
1 files changed, 0 insertions, 34 deletions
diff --git a/util.h b/util.h
deleted file mode 100644
index 9cd2bd4..0000000
--- a/util.h
+++ /dev/null
@@ -1,34 +0,0 @@
-#ifndef UTIL_H
-#define UTIL_H
-
-#include <errno.h>
-#include <stdbool.h>
-#include <stddef.h>
-#include <string.h>
-#include <sys/syscall.h>
-#include <unistd.h>
-
-#include "sha2.h"
-
-#define GRND_NONBLOCK 0x01
-#define GRND_RANDOM 0x02
-
-/* The pool size is fixed at 4096 bits since Linux 2.6. */
-#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
-
-static inline bool streq(const char *s1, const char *s2) {
- return !strcmp(s1, s2);
-}
-
-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);
-bool hash_match(const unsigned char digest[static HASH_LEN], const char *arg);
-
-#endif