Skip to content

Commit

Permalink
Wrap derive_keys with TLS1_2 option
Browse files Browse the repository at this point in the history
Signed-off-by: Jerry Yu <[email protected]>
  • Loading branch information
yuhaoth committed Feb 21, 2022
1 parent cc43c6b commit bef175d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
3 changes: 3 additions & 0 deletions library/ssl_misc.h
Original file line number Diff line number Diff line change
Expand Up @@ -1140,7 +1140,10 @@ void mbedtls_ssl_handshake_wrapup( mbedtls_ssl_context *ssl );
int mbedtls_ssl_send_fatal_handshake_failure( mbedtls_ssl_context *ssl );

void mbedtls_ssl_reset_checksum( mbedtls_ssl_context *ssl );

#if defined(MBEDTLS_SSL_PROTO_TLS1_2)
int mbedtls_ssl_derive_keys( mbedtls_ssl_context *ssl );
#endif /* MBEDTLS_SSL_PROTO_TLS1_2 */

int mbedtls_ssl_handle_message_type( mbedtls_ssl_context *ssl );
int mbedtls_ssl_prepare_handshake_record( mbedtls_ssl_context *ssl );
Expand Down
13 changes: 5 additions & 8 deletions library/ssl_tls.c
Original file line number Diff line number Diff line change
Expand Up @@ -1114,6 +1114,7 @@ static int ssl_tls12_populate_transform( mbedtls_ssl_transform *transform,
return( ret );
}

#if defined(MBEDTLS_SSL_PROTO_TLS1_2)
/*
* Set appropriate PRF function and other SSL / TLS1.2 functions
*
Expand All @@ -1128,12 +1129,6 @@ static int ssl_set_handshake_prfs( mbedtls_ssl_handshake_params *handshake,
int minor_ver,
mbedtls_md_type_t hash )
{
#if !defined(MBEDTLS_SSL_PROTO_TLS1_2) || !defined(MBEDTLS_SHA384_C)
(void) hash;
(void) minor_ver;
(void) handshake;
#endif
#if defined(MBEDTLS_SSL_PROTO_TLS1_2)

#if defined(MBEDTLS_SHA384_C)
if( minor_ver == MBEDTLS_SSL_MINOR_VERSION_3 &&
Expand All @@ -1155,9 +1150,12 @@ static int ssl_set_handshake_prfs( mbedtls_ssl_handshake_params *handshake,
else
#endif
{
(void) hash;
(void) minor_ver;
(void) handshake;
return( MBEDTLS_ERR_SSL_INTERNAL_ERROR );
}
#endif /* MBEDTLS_SSL_PROTO_TLS1_2 */


return( 0 );
}
Expand Down Expand Up @@ -1371,7 +1369,6 @@ int mbedtls_ssl_derive_keys( mbedtls_ssl_context *ssl )
return( 0 );
}

#if defined(MBEDTLS_SSL_PROTO_TLS1_2)
#if defined(MBEDTLS_SHA256_C)
void ssl_calc_verify_tls_sha256( const mbedtls_ssl_context *ssl,
unsigned char *hash,
Expand Down

0 comments on commit bef175d

Please sign in to comment.