mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-03-03 01:13:37 +00:00
tests: Added test for mbedtls_ecdh_context_grp
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
This commit is contained in:
parent
d753738fc0
commit
b4ce628b64
@ -100,3 +100,19 @@ ecdh_exchange_get_params_fail:MBEDTLS_ECP_DP_BP256R1:"12345678123456781234567812
|
||||
ECDH get_params with mismatched groups: their SECP256R1, our BP256R1
|
||||
depends_on:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_ECP_DP_BP256R1_ENABLED
|
||||
ecdh_exchange_get_params_fail:MBEDTLS_ECP_DP_BP256R1:"1234567812345678123456781234567812345678123456781234567812345678":MBEDTLS_ECP_DP_SECP256R1:"04dad0b65394221cf9b051e1feca5787d098dfe637fc90b9ef945d0c37725811805271a0461cdb8252d61f1c456fa3e59ab1f45b33accf5f58389e0577b8990bb3":1:MBEDTLS_ERR_ECP_BAD_INPUT_DATA
|
||||
|
||||
Context get ECP Group #1
|
||||
depends_on:MBEDTLS_ECP_DP_SECP256R1_ENABLED
|
||||
ecdh_context_grp:MBEDTLS_ECP_DP_SECP256R1
|
||||
|
||||
Context get ECP Group #2
|
||||
depends_on:MBEDTLS_ECP_DP_SECP384R1_ENABLED
|
||||
ecdh_primitive_random:MBEDTLS_ECP_DP_SECP384R1
|
||||
|
||||
Context get ECP Group #3
|
||||
depends_on:MBEDTLS_ECP_DP_SECP521R1_ENABLED
|
||||
ecdh_primitive_random:MBEDTLS_ECP_DP_SECP521R1
|
||||
|
||||
Context get ECP Group #4
|
||||
depends_on:MBEDTLS_ECP_DP_CURVE448_ENABLED
|
||||
ecdh_primitive_random:MBEDTLS_ECP_DP_CURVE448
|
||||
|
@ -464,3 +464,20 @@ exit:
|
||||
mbedtls_ecp_keypair_free(&their_key);
|
||||
}
|
||||
/* END_CASE */
|
||||
|
||||
/* BEGIN_CASE */
|
||||
void ecdh_context_grp(int id)
|
||||
{
|
||||
mbedtls_ecdh_context srv;
|
||||
|
||||
mbedtls_ecdh_init(&srv);
|
||||
TEST_ASSERT(mbedtls_ecdh_setup(&srv, id) == 0);
|
||||
|
||||
/* Test the retrieved group id matches/*/
|
||||
TEST_ASSERT((int) mbedtls_ecdh_get_grp_id(&srv) == id);
|
||||
|
||||
exit:
|
||||
mbedtls_ecdh_free(&srv);
|
||||
|
||||
}
|
||||
/* END_CASE */
|
||||
|
Loading…
x
Reference in New Issue
Block a user