mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2025-07-29 18:27:29 +02:00
Review comments and cast
This commit is contained in:
@ -914,9 +914,12 @@ int wc_RNG_GenerateBlock(WC_RNG* rng, byte* output, word32 sz)
|
||||
{
|
||||
int ret;
|
||||
|
||||
if (rng == NULL || output == NULL || sz == 0 )
|
||||
if (rng == NULL || output == NULL)
|
||||
return BAD_FUNC_ARG;
|
||||
|
||||
if (sz == 0)
|
||||
return 0;
|
||||
|
||||
#ifdef WOLF_CRYPTO_CB
|
||||
if (rng->devId != INVALID_DEVID) {
|
||||
ret = wc_CryptoCb_RandomBlock(rng, output, sz);
|
||||
|
@ -9240,7 +9240,7 @@ int sp_div_2d(sp_int* a, int e, sp_int* r, sp_int* rem)
|
||||
rem->used = (e + SP_WORD_SIZE - 1) >> SP_WORD_SHIFT;
|
||||
e &= SP_WORD_MASK;
|
||||
if (e > 0) {
|
||||
rem->dp[rem->used - 1] &= (1 << e) - 1;
|
||||
rem->dp[rem->used - 1] &= ((sp_int_digit)1 << e) - 1;
|
||||
}
|
||||
sp_clamp(rem);
|
||||
}
|
||||
@ -12979,10 +12979,13 @@ int sp_rand_prime(sp_int* r, int len, WC_RNG* rng, void* heap)
|
||||
|
||||
(void)heap;
|
||||
|
||||
if ((r == NULL) || (rng == NULL) || len <= 0 ) {
|
||||
if ((r == NULL) || (rng == NULL) || len < 0 ) {
|
||||
err = MP_VAL;
|
||||
}
|
||||
|
||||
if (len == 0)
|
||||
return MP_OKAY;
|
||||
|
||||
if (err == MP_OKAY) {
|
||||
/* get type */
|
||||
if (len < 0) {
|
||||
|
Reference in New Issue
Block a user