1
0
Fork 0
mirror of https://github.com/warmcat/libwebsockets.git synced 2025-03-09 00:00:04 +01:00

rsa-aes-gcm: only strip padding when required

This commit is contained in:
Andy Green 2019-01-30 08:08:16 +08:00
parent e7aacc8510
commit c0b0c0ed72
2 changed files with 6 additions and 0 deletions

View file

@ -170,12 +170,14 @@ lws_jwe_auth_and_decrypt_rsa_aes_gcm(struct lws_jwe *jwe)
return -1;
}
#if defined(LWS_WITH_MBEDTLS) && defined(LWS_PLAT_OPTEE)
/* strip padding */
n = jwe->jws.map.buf[LJWE_CTXT][jwe->jws.map.len[LJWE_CTXT] - 1];
if (n > 16)
return -1;
jwe->jws.map.len[LJWE_CTXT] -= n;
#endif
return jwe->jws.map.len[LJWE_CTXT];
}

View file

@ -549,6 +549,9 @@ bail:
#endif
#if defined(MBEDTLS_CONFIG_H) && !defined(MBEDTLS_CIPHER_MODE_XTS)
#else
static const uint8_t
/*
* Fedora openssl tool doesn't support xts... this data produced
@ -633,6 +636,7 @@ bail:
return -1;
}
#endif
static const uint8_t
/*