mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-04-17 20:42:44 +00:00
Provide additional comments for claryfication
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com>
This commit is contained in:
parent
e80bbf4dbf
commit
615cbcdbdf
@ -1770,10 +1770,16 @@ static int ssl_parse_server_ecdh_params(mbedtls_ssl_context *ssl,
|
|||||||
return MBEDTLS_ERR_SSL_DECODE_ERROR;
|
return MBEDTLS_ERR_SSL_DECODE_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* When FFDH is enabled, the array handshake->xxdh_psa_peer_key size takes into account
|
||||||
|
the sizes of the FFDH keys which are at least 2048 bits.
|
||||||
|
The size of the array is thus greater than 256 bytes which is greater than any
|
||||||
|
possible value of ecpoint_len (type uint8_t) and the check below can be skipped.*/
|
||||||
#if !defined(PSA_WANT_ALG_FFDH)
|
#if !defined(PSA_WANT_ALG_FFDH)
|
||||||
if (ecpoint_len > sizeof(handshake->xxdh_psa_peerkey)) {
|
if (ecpoint_len > sizeof(handshake->xxdh_psa_peerkey)) {
|
||||||
return MBEDTLS_ERR_SSL_HANDSHAKE_FAILURE;
|
return MBEDTLS_ERR_SSL_HANDSHAKE_FAILURE;
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
MBEDTLS_STATIC_ASSERT(sizeof(handshake->xxdh_psa_peerkey) >= UINT8_MAX, "peer key buffer too small");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
memcpy(handshake->xxdh_psa_peerkey, *p, ecpoint_len);
|
memcpy(handshake->xxdh_psa_peerkey, *p, ecpoint_len);
|
||||||
|
@ -3909,12 +3909,18 @@ static int ssl_parse_client_key_exchange(mbedtls_ssl_context *ssl)
|
|||||||
return MBEDTLS_ERR_SSL_DECODE_ERROR;
|
return MBEDTLS_ERR_SSL_DECODE_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* When FFDH is enabled, the array handshake->xxdh_psa_peer_key size takes into account
|
||||||
|
the sizes of the FFDH keys which are at least 2048 bits.
|
||||||
|
The size of the array is thus greater than 256 bytes which is greater than any
|
||||||
|
possible value of ecpoint_len (type uint8_t) and the check below can be skipped.*/
|
||||||
#if !defined(PSA_WANT_ALG_FFDH)
|
#if !defined(PSA_WANT_ALG_FFDH)
|
||||||
if (ecpoint_len > sizeof(handshake->xxdh_psa_peerkey)) {
|
if (ecpoint_len > sizeof(handshake->xxdh_psa_peerkey)) {
|
||||||
psa_destroy_key(handshake->xxdh_psa_privkey);
|
psa_destroy_key(handshake->xxdh_psa_privkey);
|
||||||
handshake->xxdh_psa_privkey = MBEDTLS_SVC_KEY_ID_INIT;
|
handshake->xxdh_psa_privkey = MBEDTLS_SVC_KEY_ID_INIT;
|
||||||
return MBEDTLS_ERR_SSL_HANDSHAKE_FAILURE;
|
return MBEDTLS_ERR_SSL_HANDSHAKE_FAILURE;
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
MBEDTLS_STATIC_ASSERT(sizeof(handshake->xxdh_psa_peerkey) >= UINT8_MAX, "peer key buffer too small");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
memcpy(handshake->xxdh_psa_peerkey, p, ecpoint_len);
|
memcpy(handshake->xxdh_psa_peerkey, p, ecpoint_len);
|
||||||
|
@ -67,10 +67,10 @@ NAMED_GROUP_IANA_VALUE = {
|
|||||||
'secp521r1': 0x19,
|
'secp521r1': 0x19,
|
||||||
'x25519': 0x1d,
|
'x25519': 0x1d,
|
||||||
'x448': 0x1e,
|
'x448': 0x1e,
|
||||||
|
# Only one finite field group to keep testing time within reasonable bounds.
|
||||||
'ffdhe2048': 0x100,
|
'ffdhe2048': 0x100,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class TLSProgram:
|
class TLSProgram:
|
||||||
"""
|
"""
|
||||||
Base class for generate server/client command.
|
Base class for generate server/client command.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user