Curl_rand: Use a fake entropy for debug builds when CURL_ENTROPY set
This commit is contained in:
parent
bde0d89c3d
commit
51bb067a42
@ -5,7 +5,7 @@
|
|||||||
* | (__| |_| | _ <| |___
|
* | (__| |_| | _ <| |___
|
||||||
* \___|\___/|_| \_\_____|
|
* \___|\___/|_| \_\_____|
|
||||||
*
|
*
|
||||||
* Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al.
|
* Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||||
*
|
*
|
||||||
* This software is licensed as described in the file COPYING, which
|
* This software is licensed as described in the file COPYING, which
|
||||||
* you should have received as part of this distribution. The terms
|
* you should have received as part of this distribution. The terms
|
||||||
@ -197,6 +197,23 @@ unsigned int Curl_rand(struct SessionHandle *data)
|
|||||||
static unsigned int randseed;
|
static unsigned int randseed;
|
||||||
static bool seeded = FALSE;
|
static bool seeded = FALSE;
|
||||||
|
|
||||||
|
#ifdef CURLDEBUG
|
||||||
|
char *force_entropy = getenv("CURL_ENTROPY");
|
||||||
|
if(force_entropy) {
|
||||||
|
if(!seeded) {
|
||||||
|
size_t elen = strlen(force_entropy);
|
||||||
|
size_t clen = sizeof(randseed);
|
||||||
|
size_t min = elen < clen ? elen : clen;
|
||||||
|
memcpy((char *)&randseed, force_entropy, min);
|
||||||
|
seeded = TRUE;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
randseed++;
|
||||||
|
|
||||||
|
return randseed;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef have_curlssl_random
|
#ifndef have_curlssl_random
|
||||||
(void)data;
|
(void)data;
|
||||||
#else
|
#else
|
||||||
|
@ -311,6 +311,7 @@ if (!$USER) {
|
|||||||
|
|
||||||
# enable memory debugging if curl is compiled with it
|
# enable memory debugging if curl is compiled with it
|
||||||
$ENV{'CURL_MEMDEBUG'} = $memdump;
|
$ENV{'CURL_MEMDEBUG'} = $memdump;
|
||||||
|
$ENV{'CURL_ENTROPY'}="12345678";
|
||||||
$ENV{'HOME'}=$pwd;
|
$ENV{'HOME'}=$pwd;
|
||||||
|
|
||||||
sub catch_zap {
|
sub catch_zap {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user