Set MAX_ENCODED_SIG_SZ to FP_MAX_BITS / 16 rather than / 8

FP_MAX_BITS is the largest possible size of any intermediate operand.
RSA requires multiplying together integers with the size of signatures
(N), resulting in a size of 2N. So we must assume FP_MAX_BITS is 2N, not
N (in bits: 16N, not 8N).
This commit is contained in:
Mattia Moffa
2026-04-15 04:43:08 +02:00
parent 6ac0f82b85
commit 95c177b441
+1 -1
View File
@@ -2315,7 +2315,7 @@ enum Max_ASN {
MAX_ENCODED_SIG_SZ = 5120,
#elif !defined(NO_RSA)
#if defined(USE_FAST_MATH) && defined(FP_MAX_BITS)
MAX_ENCODED_SIG_SZ = FP_MAX_BITS / 8,
MAX_ENCODED_SIG_SZ = FP_MAX_BITS / 16,
#elif (defined(WOLFSSL_SP_MATH_ALL) || defined(WOLFSSL_SP_MATH)) && \
defined(SP_INT_BITS)
MAX_ENCODED_SIG_SZ = WC_BITS_TO_BYTES(SP_INT_BITS),