Skip to content

Commit 87a796d

Browse files
committed
Fixed computing of intermediate buffer size for maximum-size RSA keys.
1 parent 6433cc2 commit 87a796d

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/rsa/rsa_i15_modulus.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
size_t
2929
br_rsa_i15_compute_modulus(void *n, const br_rsa_private_key *sk)
3030
{
31-
uint16_t tmp[2 * ((BR_MAX_RSA_SIZE + 14) / 15) + 5];
31+
uint16_t tmp[4 * (((BR_MAX_RSA_SIZE / 2) + 14) / 15) + 5];
3232
uint16_t *t, *p, *q;
3333
const unsigned char *pbuf, *qbuf;
3434
size_t nlen, plen, qlen, tlen;

src/rsa/rsa_i31_modulus.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
size_t
2929
br_rsa_i31_compute_modulus(void *n, const br_rsa_private_key *sk)
3030
{
31-
uint32_t tmp[2 * ((BR_MAX_RSA_SIZE + 30) / 31) + 5];
31+
uint32_t tmp[4 * (((BR_MAX_RSA_SIZE / 2) + 30) / 31) + 5];
3232
uint32_t *t, *p, *q;
3333
const unsigned char *pbuf, *qbuf;
3434
size_t nlen, plen, qlen, tlen;

0 commit comments

Comments
 (0)