-
Notifications
You must be signed in to change notification settings - Fork 923
Description
Version
5.5.4
Description
wolfSSL_connect fails connecting to a server that supplies a certificate signed by a certificate authority that use a 4096 bit RSA key when running on ESP32s3 hardware (no hardware acceleration). The same connection completes successfully when running on:
- Windows 11 x64,
- ESP32 using a certificate signed by a certificate authority that uses a 2048 bit key.
The failure occurs when ParseCertRelative in asn.c calls ConfirmSignature, which returns ASN_SIG_CONFIRM_E along the following path:
ConfirmSignature→wc_RsaSSL_VerifyInline→RsaPrivateDecryptEx→wc_RsaFunction_ex→wc_RsaFunctionSync→wc_RsaFunctionSync(line 2797 in caseRSA_PUBLIC_DECRYPT,RSA_PUBLIC_ENCRYPT) when it callsmp_exptmod_nct.
wc_RsaFunctionSync returns MP_EXPTMOD_E when mp_exptmod_nct fails, which gets translated into ASN_SIG_CONFIRM_E further up the call-stack.
mp_exptmod_nct returns MP_VAL when it fails the test with m->used = 128 and r->size = 193:
int sp_exptmod_nct(const sp_int* b, const sp_int* e, const sp_int* m, sp_int* r)
{
// ....
else if (m->used * 2 >= r->size) {
err = MP_VAL;
// ....
return err;
}
When running on Windows with the same trust chain, m->used = 128 and r->size = 257 (so it doesn't fail).
I attached my user_settings.zip configuration file. Notably, I'm not using hardware acceleration for this test.
Is there some configuration I need to enable to support 4096 bit keys on embedded devices, or is this a bug or a known library limitation?