Make BN_DEBUG_RAND less painfully slow by only consuming one byte of
pseudo-random data for each bn_pollute().
This commit is contained in:
parent
657a919598
commit
5734bebe05
@ -635,12 +635,14 @@ int RAND_pseudo_bytes(unsigned char *buf,int num);
|
|||||||
do { \
|
do { \
|
||||||
const BIGNUM *_bnum1 = (a); \
|
const BIGNUM *_bnum1 = (a); \
|
||||||
if(_bnum1->top < _bnum1->dmax) { \
|
if(_bnum1->top < _bnum1->dmax) { \
|
||||||
|
unsigned char _tmp_char; \
|
||||||
/* We cast away const without the compiler knowing, any \
|
/* We cast away const without the compiler knowing, any \
|
||||||
* *genuinely* constant variables that aren't mutable \
|
* *genuinely* constant variables that aren't mutable \
|
||||||
* wouldn't be constructed with top!=dmax. */ \
|
* wouldn't be constructed with top!=dmax. */ \
|
||||||
BN_ULONG *_not_const; \
|
BN_ULONG *_not_const; \
|
||||||
memcpy(&_not_const, &_bnum1->d, sizeof(BN_ULONG*)); \
|
memcpy(&_not_const, &_bnum1->d, sizeof(BN_ULONG*)); \
|
||||||
RAND_pseudo_bytes((unsigned char *)(_not_const + _bnum1->top), \
|
RAND_pseudo_bytes(&_tmp_char, 1); \
|
||||||
|
memset((unsigned char *)(_not_const + _bnum1->top), _tmp_char, \
|
||||||
(_bnum1->dmax - _bnum1->top) * sizeof(BN_ULONG)); \
|
(_bnum1->dmax - _bnum1->top) * sizeof(BN_ULONG)); \
|
||||||
} \
|
} \
|
||||||
} while(0)
|
} while(0)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user