mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-12-27 03:05:30 +00:00
Test mbedtls_dhm_make_params with different x_size
mbedtls_dhm_make_params() with x_size != size of P is not likely to be useful, but it's supported, so test it. Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
This commit is contained in:
parent
a2ce04e0eb
commit
33ec863570
|
@ -1,50 +1,83 @@
|
||||||
|
Diffie-Hellman full exchange: tiny x_size
|
||||||
|
dhm_do_dhm:10:"93450983094850938450983409623":1:10:"9345098304850938450983409622":0
|
||||||
|
|
||||||
Diffie-Hellman parameter validation
|
Diffie-Hellman parameter validation
|
||||||
dhm_invalid_params:
|
dhm_invalid_params:
|
||||||
|
|
||||||
|
Diffie-Hellman full exchange: 5-bit, x_size=3
|
||||||
|
dhm_do_dhm:10:"23":3:10:"5":0
|
||||||
|
|
||||||
|
Diffie-Hellman full exchange: 5-bit, x_size=2
|
||||||
|
dhm_do_dhm:10:"23":2:10:"5":0
|
||||||
|
|
||||||
Diffie-Hellman full exchange: 5-bit #1
|
Diffie-Hellman full exchange: 5-bit #1
|
||||||
dhm_do_dhm:10:"23":10:"5":0
|
dhm_do_dhm:10:"23":1:10:"5":0
|
||||||
|
|
||||||
Diffie-Hellman full exchange: 5-bit #2
|
Diffie-Hellman full exchange: 5-bit #2
|
||||||
dhm_do_dhm:10:"23":10:"5":0
|
dhm_do_dhm:10:"23":1:10:"5":0
|
||||||
|
|
||||||
Diffie-Hellman full exchange: 5-bit #3
|
Diffie-Hellman full exchange: 5-bit #3
|
||||||
dhm_do_dhm:10:"23":10:"5":0
|
dhm_do_dhm:10:"23":1:10:"5":0
|
||||||
|
|
||||||
Diffie-Hellman full exchange: 5-bit #4
|
Diffie-Hellman full exchange: 5-bit #4
|
||||||
dhm_do_dhm:10:"23":10:"5":0
|
dhm_do_dhm:10:"23":1:10:"5":0
|
||||||
|
|
||||||
Diffie-Hellman full exchange: 5-bit #5
|
Diffie-Hellman full exchange: 5-bit #5
|
||||||
dhm_do_dhm:10:"23":10:"5":0
|
dhm_do_dhm:10:"23":1:10:"5":0
|
||||||
|
|
||||||
|
Diffie-Hellman full exchange: 97-bit, x_size=14
|
||||||
|
dhm_do_dhm:10:"93450983094850938450983409623":14:10:"9345098304850938450983409622":0
|
||||||
|
|
||||||
Diffie-Hellman full exchange: 97-bit #1
|
Diffie-Hellman full exchange: 97-bit #1
|
||||||
dhm_do_dhm:10:"93450983094850938450983409623":10:"9345098304850938450983409622":0
|
dhm_do_dhm:10:"93450983094850938450983409623":13:10:"9345098304850938450983409622":0
|
||||||
|
|
||||||
Diffie-Hellman full exchange: 97-bit #2
|
Diffie-Hellman full exchange: 97-bit #2
|
||||||
dhm_do_dhm:10:"93450983094850938450983409623":10:"9345098304850938450983409622":0
|
dhm_do_dhm:10:"93450983094850938450983409623":13:10:"9345098304850938450983409622":0
|
||||||
|
|
||||||
Diffie-Hellman full exchange: 97-bit #3
|
Diffie-Hellman full exchange: 97-bit #3
|
||||||
dhm_do_dhm:10:"93450983094850938450983409623":10:"9345098304850938450983409622":0
|
dhm_do_dhm:10:"93450983094850938450983409623":13:10:"9345098304850938450983409622":0
|
||||||
|
|
||||||
Diffie-Hellman full exchange: 97-bit #4
|
Diffie-Hellman full exchange: 97-bit #4
|
||||||
dhm_do_dhm:10:"93450983094850938450983409623":10:"9345098304850938450983409622":0
|
dhm_do_dhm:10:"93450983094850938450983409623":13:10:"9345098304850938450983409622":0
|
||||||
|
|
||||||
Diffie-Hellman full exchange: 97-bit #5
|
Diffie-Hellman full exchange: 97-bit #5
|
||||||
dhm_do_dhm:10:"93450983094850938450983409623":10:"9345098304850938450983409622":0
|
dhm_do_dhm:10:"93450983094850938450983409623":13:10:"9345098304850938450983409622":0
|
||||||
|
|
||||||
|
Diffie-Hellman full exchange: 97-bit, x_size=12
|
||||||
|
dhm_do_dhm:10:"93450983094850938450983409623":12:10:"9345098304850938450983409622":0
|
||||||
|
|
||||||
|
Diffie-Hellman full exchange: 97-bit, x_size=11
|
||||||
|
dhm_do_dhm:10:"93450983094850938450983409623":11:10:"9345098304850938450983409622":0
|
||||||
|
|
||||||
|
Diffie-Hellman full exchange: 97-bit, x_size=1 #1
|
||||||
|
dhm_do_dhm:10:"93450983094850938450983409623":1:10:"9345098304850938450983409622":0
|
||||||
|
|
||||||
|
Diffie-Hellman full exchange: 97-bit, x_size=1 #2
|
||||||
|
dhm_do_dhm:10:"93450983094850938450983409623":1:10:"9345098304850938450983409622":0
|
||||||
|
|
||||||
|
Diffie-Hellman full exchange: 97-bit, x_size=1 #3
|
||||||
|
dhm_do_dhm:10:"93450983094850938450983409623":1:10:"9345098304850938450983409622":0
|
||||||
|
|
||||||
|
Diffie-Hellman full exchange: 97-bit, x_size=1 #4
|
||||||
|
dhm_do_dhm:10:"93450983094850938450983409623":1:10:"9345098304850938450983409622":0
|
||||||
|
|
||||||
|
Diffie-Hellman full exchange: 97-bit, x_size=1 #5
|
||||||
|
dhm_do_dhm:10:"93450983094850938450983409623":1:10:"9345098304850938450983409622":0
|
||||||
|
|
||||||
Diffie-Hellman full exchange: 286-bit
|
Diffie-Hellman full exchange: 286-bit
|
||||||
dhm_do_dhm:10:"93450983094850938450983409623982317398171298719873918739182739712938719287391879381271":10:"9345098309485093845098340962223981329819812792137312973297123912791271":0
|
dhm_do_dhm:10:"93450983094850938450983409623982317398171298719873918739182739712938719287391879381271":36:10:"9345098309485093845098340962223981329819812792137312973297123912791271":0
|
||||||
|
|
||||||
Diffie-Hellman trivial subgroup #1
|
Diffie-Hellman trivial subgroup #1
|
||||||
dhm_do_dhm:10:"23":10:"1":MBEDTLS_ERR_DHM_BAD_INPUT_DATA
|
dhm_do_dhm:10:"23":1:10:"1":MBEDTLS_ERR_DHM_BAD_INPUT_DATA
|
||||||
|
|
||||||
Diffie-Hellman trivial subgroup #2
|
Diffie-Hellman trivial subgroup #2
|
||||||
dhm_do_dhm:10:"23":10:"-1":MBEDTLS_ERR_DHM_BAD_INPUT_DATA
|
dhm_do_dhm:10:"23":1:10:"-1":MBEDTLS_ERR_DHM_BAD_INPUT_DATA
|
||||||
|
|
||||||
Diffie-Hellman small modulus
|
Diffie-Hellman small modulus
|
||||||
dhm_do_dhm:10:"3":10:"5":MBEDTLS_ERR_DHM_MAKE_PARAMS_FAILED
|
dhm_do_dhm:10:"3":1:10:"5":MBEDTLS_ERR_DHM_MAKE_PARAMS_FAILED
|
||||||
|
|
||||||
Diffie-Hellman zero modulus
|
Diffie-Hellman zero modulus
|
||||||
dhm_do_dhm:10:"0":10:"5":MBEDTLS_ERR_DHM_BAD_INPUT_DATA
|
dhm_do_dhm:10:"0":1:10:"5":MBEDTLS_ERR_DHM_BAD_INPUT_DATA
|
||||||
|
|
||||||
Diffie-Hellman MPI_MAX_SIZE modulus
|
Diffie-Hellman MPI_MAX_SIZE modulus
|
||||||
dhm_make_public:MBEDTLS_MPI_MAX_SIZE:10:"5":0
|
dhm_make_public:MBEDTLS_MPI_MAX_SIZE:10:"5":0
|
||||||
|
|
|
@ -171,7 +171,7 @@ exit:
|
||||||
/* END_CASE */
|
/* END_CASE */
|
||||||
|
|
||||||
/* BEGIN_CASE */
|
/* BEGIN_CASE */
|
||||||
void dhm_do_dhm( int radix_P, char *input_P,
|
void dhm_do_dhm( int radix_P, char *input_P, int x_size,
|
||||||
int radix_G, char *input_G, int result )
|
int radix_G, char *input_G, int result )
|
||||||
{
|
{
|
||||||
mbedtls_dhm_context ctx_srv;
|
mbedtls_dhm_context ctx_srv;
|
||||||
|
@ -185,7 +185,7 @@ void dhm_do_dhm( int radix_P, char *input_P,
|
||||||
size_t pub_cli_len = 0;
|
size_t pub_cli_len = 0;
|
||||||
size_t sec_srv_len;
|
size_t sec_srv_len;
|
||||||
size_t sec_cli_len;
|
size_t sec_cli_len;
|
||||||
int x_size, i;
|
int i;
|
||||||
mbedtls_test_rnd_pseudo_info rnd_info;
|
mbedtls_test_rnd_pseudo_info rnd_info;
|
||||||
|
|
||||||
mbedtls_dhm_init( &ctx_srv );
|
mbedtls_dhm_init( &ctx_srv );
|
||||||
|
@ -201,8 +201,7 @@ void dhm_do_dhm( int radix_P, char *input_P,
|
||||||
*/
|
*/
|
||||||
TEST_ASSERT( mbedtls_mpi_read_string( &ctx_srv.P, radix_P, input_P ) == 0 );
|
TEST_ASSERT( mbedtls_mpi_read_string( &ctx_srv.P, radix_P, input_P ) == 0 );
|
||||||
TEST_ASSERT( mbedtls_mpi_read_string( &ctx_srv.G, radix_G, input_G ) == 0 );
|
TEST_ASSERT( mbedtls_mpi_read_string( &ctx_srv.G, radix_G, input_G ) == 0 );
|
||||||
x_size = mbedtls_mpi_size( &ctx_srv.P );
|
pub_cli_len = mbedtls_mpi_size( &ctx_srv.P );
|
||||||
pub_cli_len = x_size;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* First key exchange
|
* First key exchange
|
||||||
|
|
Loading…
Reference in a new issue