blob: c2f35bdd41aa82c97e610a40487c9e1507a653ee [file] [log] [blame]
Manuel Pégourié-Gonnard4d8685b2015-08-05 15:44:42 +02001/* BEGIN_HEADER */
2#include "mbedtls/ecjpake.h"
3/* END_HEADER */
4
5/* BEGIN_DEPENDENCIES
6 * depends_on:MBEDTLS_ECJPAKE_C
7 * END_DEPENDENCIES
8 */
9
10/* BEGIN_CASE depends_on:MBEDTLS_SELF_TEST */
11void ecjpake_selftest()
12{
13 TEST_ASSERT( mbedtls_ecjpake_self_test( 0 ) == 0 );
14}
15/* END_CASE */
Manuel Pégourié-Gonnardbbe4e522015-08-14 17:12:50 +020016
17/* BEGIN_CASE depends_on:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_SHA256_C */
18void read_round_one( int role, char *data, int ref_ret )
19{
20 mbedtls_ecjpake_context ctx;
21 const unsigned char pw[] = {};
22 unsigned char *msg;
23 size_t len;
24
25 mbedtls_ecjpake_init( &ctx );
26
27 msg = unhexify_alloc( data, &len );
28 TEST_ASSERT( msg != NULL );
29
30 TEST_ASSERT( mbedtls_ecjpake_setup( &ctx, role,
31 MBEDTLS_MD_SHA256, MBEDTLS_ECP_DP_SECP256R1, pw, 0 ) == 0 );
32
33 TEST_ASSERT( mbedtls_ecjpake_read_round_one( &ctx, msg, len ) == ref_ret );
34
35exit:
36 mbedtls_ecjpake_free( &ctx );
37 mbedtls_free( msg );
38}
39/* END_CASE */