wincng: align bits to bytes calculation in all functions
Этот коммит содержится в:
родитель
cc00ece962
Коммит
e7d5439119
@ -1916,7 +1916,8 @@ _libssh2_wincng_bignum_rand(_libssh2_bn *rnd, int bits, int top, int bottom)
|
|||||||
if(!rnd)
|
if(!rnd)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
length = (unsigned long)(ceil((float)bits / 8) * sizeof(unsigned char));
|
length = (unsigned long) (ceil(((double)bits) / 8.0) *
|
||||||
|
sizeof(unsigned char));
|
||||||
if(_libssh2_wincng_bignum_resize(rnd, length))
|
if(_libssh2_wincng_bignum_resize(rnd, length))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
@ -2032,8 +2033,9 @@ _libssh2_wincng_bignum_set_word(_libssh2_bn *bn, unsigned long word)
|
|||||||
number = word;
|
number = word;
|
||||||
while(number >>= 1)
|
while(number >>= 1)
|
||||||
bits++;
|
bits++;
|
||||||
|
bits++;
|
||||||
|
|
||||||
length = (unsigned long) (ceil(((double)(bits + 1)) / 8.0) *
|
length = (unsigned long) (ceil(((double)bits) / 8.0) *
|
||||||
sizeof(unsigned char));
|
sizeof(unsigned char));
|
||||||
if(_libssh2_wincng_bignum_resize(bn, length))
|
if(_libssh2_wincng_bignum_resize(bn, length))
|
||||||
return -1;
|
return -1;
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user