mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2025-01-25 19:30:58 +00:00
avoid errorneous computation of RSA_PRV_DER_MAX_BYTES if MBEDTLS_MPI_MAX_SIZE is odd.
if MBEDTLS_MPI_MAX_SIZE is odd then RSA_PRV_DER_MAX_BYTES will be two less than expected, since the macros are lacking parentheses. Signed-off-by: Daniel Otte <d.otte@wut.de>
This commit is contained in:
parent
78d9663ace
commit
f9111bbdd8
|
@ -454,8 +454,8 @@ int mbedtls_pk_write_key_der( mbedtls_pk_context *key, unsigned char *buf, size_
|
||||||
* otherPrimeInfos OtherPrimeInfos OPTIONAL 0 (not supported)
|
* otherPrimeInfos OtherPrimeInfos OPTIONAL 0 (not supported)
|
||||||
* }
|
* }
|
||||||
*/
|
*/
|
||||||
#define MPI_MAX_SIZE_2 MBEDTLS_MPI_MAX_SIZE / 2 + \
|
#define MPI_MAX_SIZE_2 ( MBEDTLS_MPI_MAX_SIZE / 2 + \
|
||||||
MBEDTLS_MPI_MAX_SIZE % 2
|
MBEDTLS_MPI_MAX_SIZE % 2 )
|
||||||
#define RSA_PRV_DER_MAX_BYTES 47 + 3 * MBEDTLS_MPI_MAX_SIZE \
|
#define RSA_PRV_DER_MAX_BYTES 47 + 3 * MBEDTLS_MPI_MAX_SIZE \
|
||||||
+ 5 * MPI_MAX_SIZE_2
|
+ 5 * MPI_MAX_SIZE_2
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue