mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-08-01 10:06:53 +03:00
Merged EC key generation support
This commit is contained in:
@ -1,3 +1,35 @@
|
||||
ECP curve info #1
|
||||
depends_on:POLARSSL_ECP_DP_BP512R1_ENABLED
|
||||
ecp_curve_info:POLARSSL_ECP_DP_BP512R1:28:512:"brainpoolP512r1"
|
||||
|
||||
ECP curve info #2
|
||||
depends_on:POLARSSL_ECP_DP_BP384R1_ENABLED
|
||||
ecp_curve_info:POLARSSL_ECP_DP_BP384R1:27:384:"brainpoolP384r1"
|
||||
|
||||
ECP curve info #3
|
||||
depends_on:POLARSSL_ECP_DP_BP256R1_ENABLED
|
||||
ecp_curve_info:POLARSSL_ECP_DP_BP256R1:26:256:"brainpoolP256r1"
|
||||
|
||||
ECP curve info #4
|
||||
depends_on:POLARSSL_ECP_DP_SECP521R1_ENABLED
|
||||
ecp_curve_info:POLARSSL_ECP_DP_SECP521R1:25:521:"secp521r1"
|
||||
|
||||
ECP curve info #5
|
||||
depends_on:POLARSSL_ECP_DP_SECP384R1_ENABLED
|
||||
ecp_curve_info:POLARSSL_ECP_DP_SECP384R1:24:384:"secp384r1"
|
||||
|
||||
ECP curve info #6
|
||||
depends_on:POLARSSL_ECP_DP_SECP256R1_ENABLED
|
||||
ecp_curve_info:POLARSSL_ECP_DP_SECP256R1:23:256:"secp256r1"
|
||||
|
||||
ECP curve info #7
|
||||
depends_on:POLARSSL_ECP_DP_SECP224R1_ENABLED
|
||||
ecp_curve_info:POLARSSL_ECP_DP_SECP224R1:21:224:"secp224r1"
|
||||
|
||||
ECP curve info #8
|
||||
depends_on:POLARSSL_ECP_DP_SECP192R1_ENABLED
|
||||
ecp_curve_info:POLARSSL_ECP_DP_SECP192R1:19:192:"secp192r1"
|
||||
|
||||
ECP small addition #1
|
||||
ecp_small_add:1:"":"":1:"":"":1:0:0
|
||||
|
||||
@ -247,6 +279,10 @@ ECP gen keypair
|
||||
depends_on:POLARSSL_ECP_DP_SECP192R1_ENABLED
|
||||
ecp_gen_keypair:POLARSSL_ECP_DP_SECP192R1
|
||||
|
||||
ECP gen keypair wrapper
|
||||
depends_on:POLARSSL_ECP_DP_SECP192R1_ENABLED
|
||||
ecp_gen_key:POLARSSL_ECP_DP_SECP192R1
|
||||
|
||||
ECP mod p192 small (more than 192 bits, less limbs than 2 * 192 bits)
|
||||
depends_on:POLARSSL_ECP_DP_SECP192R1_ENABLED
|
||||
ecp_fast_mod:POLARSSL_ECP_DP_SECP192R1:"0100000000000103010000000000010201000000000001010100000000000100"
|
||||
|
@ -9,6 +9,22 @@
|
||||
* END_DEPENDENCIES
|
||||
*/
|
||||
|
||||
/* BEGIN_CASE */
|
||||
void ecp_curve_info( int id, int tls_id, int size, char *name )
|
||||
{
|
||||
const ecp_curve_info *by_id, *by_tls, *by_name;
|
||||
|
||||
TEST_ASSERT( ( by_id = ecp_curve_info_from_grp_id( id ) ) != NULL );
|
||||
TEST_ASSERT( ( by_tls = ecp_curve_info_from_tls_id( tls_id ) ) != NULL );
|
||||
TEST_ASSERT( ( by_name = ecp_curve_info_from_name( name ) ) != NULL );
|
||||
|
||||
TEST_ASSERT( by_id == by_tls );
|
||||
TEST_ASSERT( by_id == by_name );
|
||||
|
||||
TEST_ASSERT( by_id->size == size );
|
||||
}
|
||||
/* END_CASE */
|
||||
|
||||
/* BEGIN_CASE */
|
||||
void ecp_small_add( int a_zero, char *x_a, char *y_a, int b_zero, char *x_b,
|
||||
char *y_b, int c_zero, int x_c, int y_c )
|
||||
@ -522,6 +538,24 @@ void ecp_gen_keypair( int id )
|
||||
}
|
||||
/* END_CASE */
|
||||
|
||||
/* BEGIN_CASE */
|
||||
void ecp_gen_key( int id )
|
||||
{
|
||||
ecp_keypair key;
|
||||
rnd_pseudo_info rnd_info;
|
||||
|
||||
ecp_keypair_init( &key );
|
||||
memset( &rnd_info, 0x00, sizeof( rnd_pseudo_info ) );
|
||||
|
||||
TEST_ASSERT( ecp_gen_key( id, &key, &rnd_pseudo_rand, &rnd_info ) == 0 );
|
||||
|
||||
TEST_ASSERT( ecp_check_pubkey( &key.grp, &key.Q ) == 0 );
|
||||
TEST_ASSERT( ecp_check_privkey( &key.grp, &key.d ) == 0 );
|
||||
|
||||
ecp_keypair_free( &key );
|
||||
}
|
||||
/* END_CASE */
|
||||
|
||||
/* BEGIN_CASE depends_on:POLARSSL_SELF_TEST */
|
||||
void ecp_selftest()
|
||||
{
|
||||
|
Reference in New Issue
Block a user