mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-12-23 06:05:28 +00:00
40 lines
939 B
Plaintext
40 lines
939 B
Plaintext
/* BEGIN_HEADER */
|
|
#include "mbedtls/ecjpake.h"
|
|
/* END_HEADER */
|
|
|
|
/* BEGIN_DEPENDENCIES
|
|
* depends_on:MBEDTLS_ECJPAKE_C
|
|
* END_DEPENDENCIES
|
|
*/
|
|
|
|
/* BEGIN_CASE depends_on:MBEDTLS_SELF_TEST */
|
|
void ecjpake_selftest()
|
|
{
|
|
TEST_ASSERT( mbedtls_ecjpake_self_test( 0 ) == 0 );
|
|
}
|
|
/* END_CASE */
|
|
|
|
/* BEGIN_CASE depends_on:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_SHA256_C */
|
|
void read_round_one( int role, char *data, int ref_ret )
|
|
{
|
|
mbedtls_ecjpake_context ctx;
|
|
const unsigned char pw[] = {};
|
|
unsigned char *msg;
|
|
size_t len;
|
|
|
|
mbedtls_ecjpake_init( &ctx );
|
|
|
|
msg = unhexify_alloc( data, &len );
|
|
TEST_ASSERT( msg != NULL );
|
|
|
|
TEST_ASSERT( mbedtls_ecjpake_setup( &ctx, role,
|
|
MBEDTLS_MD_SHA256, MBEDTLS_ECP_DP_SECP256R1, pw, 0 ) == 0 );
|
|
|
|
TEST_ASSERT( mbedtls_ecjpake_read_round_one( &ctx, msg, len ) == ref_ret );
|
|
|
|
exit:
|
|
mbedtls_ecjpake_free( &ctx );
|
|
mbedtls_free( msg );
|
|
}
|
|
/* END_CASE */
|