1
mirror of https://github.com/jedisct1/libsodium.git synced 2024-12-24 12:36:01 -07:00

Allows RANDOMBYTES_DEFAULT_IMPLEMENTATION to be overriden

This commit is contained in:
Frank Denis 2016-10-13 22:57:01 +02:00
parent 1ede5cc0bc
commit 49741c59e8

View File

@ -11,10 +11,14 @@
#endif #endif
#include "randombytes.h" #include "randombytes.h"
#include "randombytes_sysrandom.h" #ifdef RANDOMBYTES_DEFAULT_IMPLEMENTATION
# include "randombytes_default.h"
#ifdef __native_client__ #else
# include "randombytes_nativeclient.h" # ifdef __native_client__
# include "randombytes_nativeclient.h"
# else
# include "randombytes_sysrandom.h"
# endif
#endif #endif
/* C++Builder defines a "random" macro */ /* C++Builder defines a "random" macro */
@ -22,13 +26,15 @@
static const randombytes_implementation *implementation; static const randombytes_implementation *implementation;
#ifdef __EMSCRIPTEN__ #ifndef RANDOMBYTES_DEFAULT_IMPLEMENTATION
# define RANDOMBYTES_DEFAULT_IMPLEMENTATION NULL # ifdef __EMSCRIPTEN__
#else # define RANDOMBYTES_DEFAULT_IMPLEMENTATION NULL
# ifdef __native_client__
# define RANDOMBYTES_DEFAULT_IMPLEMENTATION &randombytes_nativeclient_implementation;
# else # else
# define RANDOMBYTES_DEFAULT_IMPLEMENTATION &randombytes_sysrandom_implementation; # ifdef __native_client__
# define RANDOMBYTES_DEFAULT_IMPLEMENTATION &randombytes_nativeclient_implementation;
# else
# define RANDOMBYTES_DEFAULT_IMPLEMENTATION &randombytes_sysrandom_implementation;
# endif
# endif # endif
#endif #endif