Browse Source

null terminate seed, proper includes for non-WIN32

master
Odilitime 2 years ago
parent
commit
07ba81d762
1 changed files with 8 additions and 2 deletions
  1. 8
    2
      src/networking/HTTPSRequest.cpp

+ 8
- 2
src/networking/HTTPSRequest.cpp View File

@@ -7,6 +7,11 @@
#define WIN32_LEAN_AND_MEAN 1
#include <windows.h>
#include <wincrypt.h>
#else
#include <sys/types.h>
#include <sys/uio.h>
#include <unistd.h>
#include <fcntl.h>
#endif
// PolarSSL internal state
@@ -177,13 +182,14 @@ bool HTTPSRequest::initTLS(){
if (try_close(fd) != 0)
return false;
seed[63] = 0;
#endif
#endif
// only define FIXED_SEED if yer platform does NOT provide a source of (extra) randomness!!!
#ifdef FIXED_SEED
const char *seed = "!@netrunner_ssl_seed$%?rvx86_despair##^^%$#@";
#endif
mbedtls_entropy_init( &entropy );
if(mbedtls_ctr_drbg_seed( &ctr_drbg, mbedtls_entropy_func, &entropy, reinterpret_cast<const unsigned char*>(seed), strlen(seed) ) != 0 ){
return false;
@@ -233,4 +239,4 @@ static int try_read(int fd, char *out, size_t count){
return 0;
}
#endif
#endif

Loading…
Cancel
Save