From 1b3a8f40b80c79682ec09951a5d390c1a852c6fe Mon Sep 17 00:00:00 2001 From: Jacob Barthelmeh Date: Tue, 12 Sep 2017 14:57:44 -0600 Subject: [PATCH] account for 8k keys with MySQL compatibility --- wolfcrypt/src/integer.c | 2 +- wolfssl/wolfcrypt/integer.h | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/wolfcrypt/src/integer.c b/wolfcrypt/src/integer.c index 785493c75..3c948917e 100644 --- a/wolfcrypt/src/integer.c +++ b/wolfcrypt/src/integer.c @@ -1043,7 +1043,7 @@ top: /* if not zero goto step 4 */ if (mp_iszero (&u) == MP_NO) { - if (++loop_check > 4096) { + if (++loop_check > MAX_INVMOD_SZ) { res = MP_VAL; goto LBL_ERR; } diff --git a/wolfssl/wolfcrypt/integer.h b/wolfssl/wolfcrypt/integer.h index 9c7bc01b0..de78b55bf 100644 --- a/wolfssl/wolfcrypt/integer.h +++ b/wolfssl/wolfcrypt/integer.h @@ -230,6 +230,14 @@ typedef int ltm_prime_callback(unsigned char *dst, int len, void *dat); #define PRIME_SIZE 256 #endif +#ifndef MAX_INVMOD_SZ + #if defined(WOLFSSL_MYSQL_COMPATIBLE) + #define MAX_INVMOD_SZ 8192 + #else + #define MAX_INVMOD_SZ 4096 + #endif +#endif + #define mp_prime_random(a, t, size, bbs, cb, dat) \ mp_prime_random_ex(a, t, ((size) * 8) + 1, (bbs==1)?LTM_PRIME_BBS:0, cb, dat)