Browse Source

Link with libsodium and replace a CSPRNG.

pull/145/head
Taylor Hornby 8 years ago
parent
commit
41d4eb705b
  1. 2
      configure.ac
  2. 6
      src/zerocash/utils/util.cpp

2
configure.ac

@ -717,7 +717,7 @@ CPPFLAGS="-I$LIBSNARK_INCDIR $CPPFLAGS"
AC_CHECK_HEADER([libsnark/gadgetlib1/gadget.hpp],,AC_MSG_ERROR(libsnark headers missing))
AC_CHECK_LIB([snark],[main],LIBSNARK_LIBS=-lsnark, [AC_MSG_ERROR(libsnark missing)], [-lgmpxx])
LIBZEROCASH_LIBS="-lsnark -lcryptopp -lgmp -lgmpxx -lboost_system-mt -lcrypto"
LIBZEROCASH_LIBS="-lsnark -lcryptopp -lgmp -lgmpxx -lboost_system-mt -lcrypto -lsodium"
AC_CHECK_LIB([crypto],[RAND_egd],[],[
AC_ARG_WITH([libressl],

6
src/zerocash/utils/util.cpp

@ -9,6 +9,8 @@
#include <iomanip>
#include <algorithm>
#include <sodium.h>
#include "util.h"
namespace libzerocash {
@ -82,9 +84,7 @@ void printBytesVectorAsHex(const std::string str, const std::vector<unsigned cha
}
void getRandBytes(unsigned char* bytes, int num) {
int ret = RAND_bytes(bytes, num);
if(ret != 1)
std::cout << "rand_bytes error!" << ERR_get_error() << std::endl;
randombytes_buf(bytes, num);
}
void convertBytesToVector(const unsigned char* bytes, std::vector<bool>& v) {

Loading…
Cancel
Save