Merge pull request #769 from jin-eld/alternative-sodium-init

Allow to optionally use randombytes_stir() instead of sodium_init()
This commit is contained in:
irungentoo 2014-02-25 18:05:53 -05:00
commit b01c19ce56
2 changed files with 21 additions and 1 deletions

View File

@ -66,6 +66,20 @@ AC_ARG_ENABLE([nacl],
]
)
AC_ARG_ENABLE([randombytes-stir],
[AC_HELP_STRING([--enable-randombytes-stir], [use randombytes_stir() instead of sodium_init() for faster startup on android (default: disabled)]) ],
[
if test "x$enableval" = "xyes"; then
if test "x$WANT_NACL" = "xyes"; then
AC_MSG_WARN([randombytes_stir() is not available with NaCl library])
else
AC_DEFINE([USE_RANDOMBYTES_STIR], [1], [randombytes_stir() instead of sodium_init()])
fi
fi
]
)
PKG_PROG_PKG_CONFIG
AC_ARG_ENABLE([phone],

View File

@ -415,8 +415,14 @@ static int at_startup(void)
return 0;
#ifndef VANILLA_NACL
#ifdef USE_RANDOMBYTES_STIR
randombytes_stir();
#else
sodium_init();
#endif
#endif /*USE_RANDOMBYTES_STIR*/
#endif/*VANILLA_NACL*/
#if defined(_WIN32) || defined(__WIN32__) || defined (WIN32)
WSADATA wsaData;