hcrypto: Fix warnings

This commit is contained in:
Nicolas Williams
2021-12-02 21:24:52 -06:00
parent ea61f68d55
commit 77392d5d9c
2 changed files with 3 additions and 4 deletions

View File

@@ -142,6 +142,7 @@ BN_bin2bn(const void *s, int len, BIGNUM *bn)
return NULL;
}
hi->length = len;
if (len)
memcpy(hi->data, s, len);
return (BIGNUM *)hi;
}
@@ -250,7 +251,7 @@ BN_set_bit(BIGNUM *bn, int bit)
unsigned char *p;
if ((bit / 8) > hi->length || hi->length == 0) {
size_t len = (bit + 7) / 8;
size_t len = bit == 0 ? 1 : (bit + 7) / 8;
void *d = realloc(hi->data, len);
if (d == NULL)
return 0;

View File

@@ -534,8 +534,6 @@ ltm_rsa_generate_key(RSA *rsa, int bits, BIGNUM *e, BN_GENCB *cb)
bitsp = (bits + 1) / 2;
ret = -1;
FIRST(mp_init_multi(&el, &p, &q, &n, &d,
&dmp1, &dmq1, &iqmp,
&t1, &t2, &t3, NULL));