mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-11-30 05:14:15 +01:00
TinyCrypt SSL: Adapt calculation of maximum PMS size in ssl.h
ssl.h contains a dummy union of fields each large enough to hold the PMS for a particular ciphersuite. In particular, for pure-ECDH ciphersuites, it contains a field large enough to hold the ECDH shared secret in any of the enabled curves. So far, this upper bound was unconditionally chosen to be MBEDTLS_ECP_MAX_BYTES from the ECP module. With the introduction of TinyCrypt as an alternative implementation for ECDH, we need to - guard the use of MBEDTLS_ECP_MAX_BYTES because MBEDTLS_ECP_C is no longer implied by the surrounding MBEDTLS_KEY_EXCHANGE_XXX guards - add another field which contains the maximum length of shared ECDH secrets for curves supported by TinyCrypt.
This commit is contained in:
parent
27b7e50dcd
commit
728a38b40d
@ -46,6 +46,10 @@
|
|||||||
#include "ecdh.h"
|
#include "ecdh.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(MBEDTLS_USE_TINYCRYPT)
|
||||||
|
#include "tinycrypt/ecc.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(MBEDTLS_ZLIB_SUPPORT)
|
#if defined(MBEDTLS_ZLIB_SUPPORT)
|
||||||
|
|
||||||
#if defined(MBEDTLS_DEPRECATED_WARNING)
|
#if defined(MBEDTLS_DEPRECATED_WARNING)
|
||||||
@ -510,8 +514,13 @@ union mbedtls_ssl_premaster_secret
|
|||||||
defined(MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED) || \
|
defined(MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED) || \
|
||||||
defined(MBEDTLS_KEY_EXCHANGE_ECDH_RSA_ENABLED) || \
|
defined(MBEDTLS_KEY_EXCHANGE_ECDH_RSA_ENABLED) || \
|
||||||
defined(MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA_ENABLED)
|
defined(MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA_ENABLED)
|
||||||
|
#if defined(MBEDTLS_ECDH_C)
|
||||||
unsigned char _pms_ecdh[MBEDTLS_ECP_MAX_BYTES]; /* RFC 4492 5.10 */
|
unsigned char _pms_ecdh[MBEDTLS_ECP_MAX_BYTES]; /* RFC 4492 5.10 */
|
||||||
#endif
|
#endif
|
||||||
|
#if defined(MBEDTLS_USE_TINYCRYPT)
|
||||||
|
unsigned char _pms_ecdh_uecc[ NUM_ECC_BYTES ];
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
#if defined(MBEDTLS_KEY_EXCHANGE_PSK_ENABLED)
|
#if defined(MBEDTLS_KEY_EXCHANGE_PSK_ENABLED)
|
||||||
unsigned char _pms_psk[4 + 2 * MBEDTLS_PSK_MAX_LEN]; /* RFC 4279 2 */
|
unsigned char _pms_psk[4 + 2 * MBEDTLS_PSK_MAX_LEN]; /* RFC 4279 2 */
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user