From: Thomas Pornin Date: Mon, 21 Jan 2019 23:04:08 +0000 (+0100) Subject: Fixed computing of intermediate buffer size for maximum-size RSA keys. X-Git-Url: https://bearssl.org/gitweb//home/git/?p=BearSSL;a=commitdiff_plain;h=87a796dd69fcdbd1c0dd7594f3ddb16c90abee5e;hp=6433cc2e9dff891a2e4669cf50cec36bcf0bae61 Fixed computing of intermediate buffer size for maximum-size RSA keys. --- diff --git a/src/rsa/rsa_i15_modulus.c b/src/rsa/rsa_i15_modulus.c index d61c794..16458c3 100644 --- a/src/rsa/rsa_i15_modulus.c +++ b/src/rsa/rsa_i15_modulus.c @@ -28,7 +28,7 @@ size_t 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; const unsigned char *pbuf, *qbuf; size_t nlen, plen, qlen, tlen; diff --git a/src/rsa/rsa_i31_modulus.c b/src/rsa/rsa_i31_modulus.c index c469cf3..f5f997f 100644 --- a/src/rsa/rsa_i31_modulus.c +++ b/src/rsa/rsa_i31_modulus.c @@ -28,7 +28,7 @@ size_t 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; const unsigned char *pbuf, *qbuf; size_t nlen, plen, qlen, tlen;