aboutsummaryrefslogtreecommitdiff
path: root/random/gnupg-glue.h
diff options
context:
space:
mode:
authorJustus Winter <4winter@informatik.uni-hamburg.de>2014-06-09 11:42:22 +0200
committerJustus Winter <4winter@informatik.uni-hamburg.de>2014-06-09 11:42:22 +0200
commit1ba2ed95690396bf081d0af043d878b26b8563c2 (patch)
tree2f381ea0ad053718df0f99b830ee4c5051335d12 /random/gnupg-glue.h
parentf937e9eae8012b66eeabcd10e4188d6410e7c5c4 (diff)
downloadhurd-1ba2ed95690396bf081d0af043d878b26b8563c2.tar.gz
hurd-1ba2ed95690396bf081d0af043d878b26b8563c2.tar.bz2
hurd-1ba2ed95690396bf081d0af043d878b26b8563c2.zip
Prepare the random translator to be merged into the Hurd sources
Move the random translator to its own subdirectory 'random'. This is the last commit to this repository. Development of the random translator will continue in the main Hurd repository.
Diffstat (limited to 'random/gnupg-glue.h')
-rw-r--r--random/gnupg-glue.h40
1 files changed, 40 insertions, 0 deletions
diff --git a/random/gnupg-glue.h b/random/gnupg-glue.h
new file mode 100644
index 00000000..cbf0a103
--- /dev/null
+++ b/random/gnupg-glue.h
@@ -0,0 +1,40 @@
+#ifndef __GNUPG_GLUE_H__
+#define __GNUPG_GLUE_H__
+
+#include <sys/types.h>
+#include <random.h>
+
+#define SIZEOF_UNSIGNED_LONG 4
+typedef unsigned int u32;
+typedef unsigned char byte;
+
+/* GnuPG's config.h */
+#define HAVE_GETTIMEOFDAY 1
+#define HAVE_GETRUSAGE 1
+#define HAVE_RAND 1
+
+/* GnuPG's memory.h */
+#define m_alloc malloc
+#define m_alloc_secure malloc
+#define m_alloc_clear(x) calloc(x, 1)
+#define m_alloc_secure_clear(x) calloc(x, 1)
+#define m_free free
+#define m_strdup strdup
+
+/* GnuPG's dynaload.h */
+#define dynload_getfnc_fast_random_poll() (0)
+#define dynload_getfnc_gather_random() &gather_random
+int
+gather_random( void (*add)(const void*, size_t, int), int requester,
+ size_t length, int level );
+
+/* GnuPG's miscellaneous stuff. */
+#define BUG() assert(0)
+#define _(x) x
+#define make_timestamp() time(0)
+#define tty_printf printf
+#define log_info(format, args...) printf(format , ## args)
+#define log_fatal(format, args...) { printf(format , ## args) ; exit(2); }
+#define DIM(v) (sizeof(v)/sizeof((v)[0]))
+
+#endif /* __GNUPG_GLUE_H__ */