Always print gmt_unix_time in TLS client
Change ssl_parse_server_hello() so that the parsed first four random bytes from the ServerHello message are printed by the TLS client as a Unix timestamp regardless of whether MBEDTLS_DEBUG_C is defined. The debug message will only be printed if debug_level is 3 or higher. Unconditionally enabling the debug print enabled testing of this value.
This commit is contained in:
parent
ec82da4cb2
commit
074c58f08b
1 changed files with 5 additions and 10 deletions
|
@ -1448,9 +1448,6 @@ static int ssl_parse_server_hello( mbedtls_ssl_context *ssl )
|
||||||
#endif
|
#endif
|
||||||
int handshake_failure = 0;
|
int handshake_failure = 0;
|
||||||
const mbedtls_ssl_ciphersuite_t *suite_info;
|
const mbedtls_ssl_ciphersuite_t *suite_info;
|
||||||
#if defined(MBEDTLS_DEBUG_C)
|
|
||||||
uint32_t t;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
MBEDTLS_SSL_DEBUG_MSG( 2, ( "=> parse server hello" ) );
|
MBEDTLS_SSL_DEBUG_MSG( 2, ( "=> parse server hello" ) );
|
||||||
|
|
||||||
|
@ -1553,13 +1550,11 @@ static int ssl_parse_server_hello( mbedtls_ssl_context *ssl )
|
||||||
return( MBEDTLS_ERR_SSL_BAD_HS_PROTOCOL_VERSION );
|
return( MBEDTLS_ERR_SSL_BAD_HS_PROTOCOL_VERSION );
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(MBEDTLS_DEBUG_C)
|
MBEDTLS_SSL_DEBUG_MSG( 3, ( "server hello, current time: %lu",
|
||||||
t = ( (uint32_t) buf[2] << 24 )
|
( (uint32_t) buf[2] << 24 ) |
|
||||||
| ( (uint32_t) buf[3] << 16 )
|
( (uint32_t) buf[3] << 16 ) |
|
||||||
| ( (uint32_t) buf[4] << 8 )
|
( (uint32_t) buf[4] << 8 ) |
|
||||||
| ( (uint32_t) buf[5] );
|
( (uint32_t) buf[5] ) ) );
|
||||||
MBEDTLS_SSL_DEBUG_MSG( 3, ( "server hello, current time: %lu", t ) );
|
|
||||||
#endif
|
|
||||||
|
|
||||||
memcpy( ssl->handshake->randbytes + 32, buf + 2, 32 );
|
memcpy( ssl->handshake->randbytes + 32, buf + 2, 32 );
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue