#define HR(x, l) (SHA512_Update(&ctx, (char *)(x), (l)))
#define HD(x) (SHA512_Update(&ctx, (char *)&(x), sizeof (x)))
+/* (portability) some compilers cannot take sizeof a function pointer */
+#define HF(x) (SHA512_Update(&ctx, (char *)&(x), sizeof (void*)))
int getentropy(void *buf, size_t len);
-extern int main(int, char *argv[]);
+/* referencing functions in other link modules is not portable */
+/* extern int main(int, char *argv[]); */
static int gotdata(char *buf, size_t len);
static int getentropy_urandom(void *buf, size_t len);
#ifdef CTL_MAXNAME
HX(sigprocmask(SIG_BLOCK, NULL, &sigset) == -1,
sigset);
- HD(main); /* an addr in program */
- HD(getentropy); /* an addr in this library */
- HD(printf); /* an addr in libc */
+ /* HF(main); */ /* an addr in program */
+ HF(getentropy); /* an addr in this library */
+ HF(printf); /* an addr in libc */
p = (char *)&p;
HD(p); /* an addr on stack */
p = (char *)&errno;
} while (0)
#define HR(x, l) (SHA512_Update(&ctx, (char *)(x), (l)))
#define HD(x) (SHA512_Update(&ctx, (char *)&(x), sizeof (x)))
+/* (portability) some compilers cannot take sizeof a function pointer */
+#define HF(x) (SHA512_Update(&ctx, (char *)&(x), sizeof (void*)))
int getentropy(void *buf, size_t len);
-/* using log_info instead of main for unbound */
+/* cannot reference main, or log_info for unbound, it
+ gives portability problems */
/*extern int main(int, char *argv[]);*/
-extern void log_info(const char* format, ...);
static int gotdata(char *buf, size_t len);
static int getentropy_urandom(void *buf, size_t len);
static int getentropy_fallback(void *buf, size_t len);
sigset);
/* using log_info instead of main for unbound */
- /*HD(main);*/ /* an addr in program */
- HD(log_info); /* an addr in program */
- HD(getentropy); /* an addr in this library */
- HD(printf); /* an addr in libc */
+ /*HF(main);*/ /* an addr in program */
+ HF(getentropy); /* an addr in this library */
+ HF(printf); /* an addr in libc */
p = (char *)&p;
HD(p); /* an addr on stack */
p = (char *)&errno;
int getentropy(void *buf, size_t len);
-/* a function in the main program, but main is only in executables,
- referencing main does not work in sun-cc, but does work with gcc */
+/* cannot refernce main, or log_info for unbound, it gives
+ portability problems. For solaris specifically, sun-cc and gcc
+ have different link semantics (but it also fails on other platforms) */
/* extern int main(int, char *argv[]); */
-extern void log_info(const char* format, ...);
static int gotdata(char *buf, size_t len);
static int getentropy_urandom(void *buf, size_t len);
static int getentropy_fallback(void *buf, size_t len);
/* replaced main with log_info */
/*HF(main);*/ /* an addr in program */
- HF(log_info); /* an addr in program */
HF(getentropy); /* an addr in this library */
HF(printf); /* an addr in libc */
p = (char *)&p;
+12 July 2014: Wouter
+ - Fix getentropy compat code, function refs were not portable.
+
11 July 2014: Matthijs
- fake-rfc2553 patch (thanks Benjamin Baier).