Fixed computing of intermediate buffer size for maximum-size RSA keys.

This commit is contained in:
Thomas Pornin 2019-01-22 00:04:08 +01:00
parent 6433cc2e9d
commit 87a796dd69
2 changed files with 2 additions and 2 deletions

View file

@ -28,7 +28,7 @@
size_t size_t
br_rsa_i15_compute_modulus(void *n, const br_rsa_private_key *sk) br_rsa_i15_compute_modulus(void *n, const br_rsa_private_key *sk)
{ {
uint16_t tmp[2 * ((BR_MAX_RSA_SIZE + 14) / 15) + 5]; uint16_t tmp[4 * (((BR_MAX_RSA_SIZE / 2) + 14) / 15) + 5];
uint16_t *t, *p, *q; uint16_t *t, *p, *q;
const unsigned char *pbuf, *qbuf; const unsigned char *pbuf, *qbuf;
size_t nlen, plen, qlen, tlen; size_t nlen, plen, qlen, tlen;

View file

@ -28,7 +28,7 @@
size_t size_t
br_rsa_i31_compute_modulus(void *n, const br_rsa_private_key *sk) br_rsa_i31_compute_modulus(void *n, const br_rsa_private_key *sk)
{ {
uint32_t tmp[2 * ((BR_MAX_RSA_SIZE + 30) / 31) + 5]; uint32_t tmp[4 * (((BR_MAX_RSA_SIZE / 2) + 30) / 31) + 5];
uint32_t *t, *p, *q; uint32_t *t, *p, *q;
const unsigned char *pbuf, *qbuf; const unsigned char *pbuf, *qbuf;
size_t nlen, plen, qlen, tlen; size_t nlen, plen, qlen, tlen;