mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2025-04-28 19:36:39 +00:00
Don't allow calling CID API outside of DTLS
This commit is contained in:
parent
6943920839
commit
78c430269b
|
@ -119,6 +119,9 @@ int mbedtls_ssl_set_cid( mbedtls_ssl_context *ssl,
|
||||||
unsigned char const *own_cid,
|
unsigned char const *own_cid,
|
||||||
size_t own_cid_len )
|
size_t own_cid_len )
|
||||||
{
|
{
|
||||||
|
if( ssl->conf->transport != MBEDTLS_SSL_TRANSPORT_DATAGRAM )
|
||||||
|
return( MBEDTLS_ERR_SSL_BAD_INPUT_DATA );
|
||||||
|
|
||||||
ssl->negotiate_cid = enable;
|
ssl->negotiate_cid = enable;
|
||||||
if( enable == MBEDTLS_SSL_CID_DISABLED )
|
if( enable == MBEDTLS_SSL_CID_DISABLED )
|
||||||
{
|
{
|
||||||
|
@ -153,8 +156,11 @@ int mbedtls_ssl_get_peer_cid( mbedtls_ssl_context *ssl,
|
||||||
{
|
{
|
||||||
*enabled = MBEDTLS_SSL_CID_DISABLED;
|
*enabled = MBEDTLS_SSL_CID_DISABLED;
|
||||||
|
|
||||||
if( ssl->state != MBEDTLS_SSL_HANDSHAKE_OVER )
|
if( ssl->conf->transport != MBEDTLS_SSL_TRANSPORT_DATAGRAM ||
|
||||||
|
ssl->state != MBEDTLS_SSL_HANDSHAKE_OVER )
|
||||||
|
{
|
||||||
return( MBEDTLS_ERR_SSL_BAD_INPUT_DATA );
|
return( MBEDTLS_ERR_SSL_BAD_INPUT_DATA );
|
||||||
|
}
|
||||||
|
|
||||||
/* We report MBEDTLS_SSL_CID_DISABLED in case the CID extensions
|
/* We report MBEDTLS_SSL_CID_DISABLED in case the CID extensions
|
||||||
* were used, but client and server requested the empty CID.
|
* were used, but client and server requested the empty CID.
|
||||||
|
|
Loading…
Reference in a new issue