Add tests for accessors for ciphersuite info
Signed-off-by: Glenn Strauss <gstrauss@gluelogic.com>
This commit is contained in:
parent
8f52690956
commit
6eef56392a
4 changed files with 39 additions and 5 deletions
|
@ -2144,9 +2144,19 @@ int main( int argc, char *argv[] )
|
|||
}
|
||||
}
|
||||
|
||||
mbedtls_printf( " ok\n [ Protocol is %s ]\n [ Ciphersuite is %s ]\n",
|
||||
mbedtls_ssl_get_version( &ssl ),
|
||||
mbedtls_ssl_get_ciphersuite( &ssl ) );
|
||||
{
|
||||
int suite_id = mbedtls_ssl_get_ciphersuite_id_from_ssl( &ssl );
|
||||
const mbedtls_ssl_ciphersuite_t *ciphersuite_info;
|
||||
ciphersuite_info = mbedtls_ssl_ciphersuite_from_id( suite_id );
|
||||
|
||||
mbedtls_printf( " ok\n [ Protocol is %s ]\n"
|
||||
" [ Ciphersuite is %s ]\n"
|
||||
" [ Key size is %u ]\n",
|
||||
mbedtls_ssl_get_version( &ssl ),
|
||||
mbedtls_ssl_ciphersuite_get_name( ciphersuite_info ),
|
||||
(unsigned int)
|
||||
mbedtls_ssl_ciphersuite_get_cipher_key_bitlen( ciphersuite_info ) );
|
||||
}
|
||||
|
||||
if( ( ret = mbedtls_ssl_get_record_expansion( &ssl ) ) >= 0 )
|
||||
mbedtls_printf( " [ Record expansion is %d ]\n", ret );
|
||||
|
|
|
@ -3231,8 +3231,17 @@ handshake:
|
|||
}
|
||||
else /* ret == 0 */
|
||||
{
|
||||
mbedtls_printf( " ok\n [ Protocol is %s ]\n [ Ciphersuite is %s ]\n",
|
||||
mbedtls_ssl_get_version( &ssl ), mbedtls_ssl_get_ciphersuite( &ssl ) );
|
||||
int suite_id = mbedtls_ssl_get_ciphersuite_id_from_ssl( &ssl );
|
||||
const mbedtls_ssl_ciphersuite_t *ciphersuite_info;
|
||||
ciphersuite_info = mbedtls_ssl_ciphersuite_from_id( suite_id );
|
||||
|
||||
mbedtls_printf( " ok\n [ Protocol is %s ]\n"
|
||||
" [ Ciphersuite is %s ]\n"
|
||||
" [ Key size is %u ]\n",
|
||||
mbedtls_ssl_get_version( &ssl ),
|
||||
mbedtls_ssl_ciphersuite_get_name( ciphersuite_info ),
|
||||
(unsigned int)
|
||||
mbedtls_ssl_ciphersuite_get_cipher_key_bitlen( ciphersuite_info ) );
|
||||
}
|
||||
|
||||
if( ( ret = mbedtls_ssl_get_record_expansion( &ssl ) ) >= 0 )
|
||||
|
|
|
@ -72,6 +72,7 @@
|
|||
|
||||
#include "mbedtls/net_sockets.h"
|
||||
#include "mbedtls/ssl.h"
|
||||
#include "mbedtls/ssl_ciphersuites.h"
|
||||
#include "mbedtls/entropy.h"
|
||||
#include "mbedtls/ctr_drbg.h"
|
||||
#include "mbedtls/hmac_drbg.h"
|
||||
|
|
|
@ -1475,6 +1475,20 @@ run_test "TLS client auth: required" \
|
|||
0 \
|
||||
-s "Verifying peer X.509 certificate... ok"
|
||||
|
||||
run_test "key size: TLS-ECDHE-ECDSA-WITH-CHACHA20-POLY1305-SHA256" \
|
||||
"$P_SRV" \
|
||||
"$P_CLI force_ciphersuite=TLS-ECDHE-ECDSA-WITH-CHACHA20-POLY1305-SHA256" \
|
||||
0 \
|
||||
-c "Ciphersuite is TLS-ECDHE-ECDSA-WITH-CHACHA20-POLY1305-SHA256" \
|
||||
-c "Key size is 256"
|
||||
|
||||
run_test "key size: TLS-ECDHE-ECDSA-WITH-AES-128-CCM-8" \
|
||||
"$P_SRV" \
|
||||
"$P_CLI force_ciphersuite=TLS-ECDHE-ECDSA-WITH-AES-128-CCM-8" \
|
||||
0 \
|
||||
-c "Ciphersuite is TLS-ECDHE-ECDSA-WITH-AES-128-CCM-8" \
|
||||
-c "Key size is 128"
|
||||
|
||||
requires_config_enabled MBEDTLS_X509_CRT_PARSE_C
|
||||
requires_config_enabled MBEDTLS_ECDSA_C
|
||||
requires_config_enabled MBEDTLS_SHA256_C
|
||||
|
|
Loading…
Reference in a new issue