1
0
mirror of https://github.com/Mbed-TLS/mbedtls.git synced 2025-07-29 11:41:15 +03:00

Add tests for round 2

Also move one check earlier as it makes more sense
This commit is contained in:
Manuel Pégourié-Gonnard
2015-08-17 12:47:38 +02:00
parent 3059095e86
commit d9802af1d0
3 changed files with 279 additions and 10 deletions

View File

@ -548,7 +548,15 @@ int mbedtls_ecjpake_read_round_two( mbedtls_ecjpake_context *ctx,
* } Client/ServerECJPAKEParams;
*/
if( ctx->role == MBEDTLS_ECJPAKE_CLIENT )
{
MBEDTLS_MPI_CHK( mbedtls_ecp_tls_read_group( &grp, &p, len ) );
if( grp.id != ctx->grp.id )
{
ret = MBEDTLS_ERR_ECP_FEATURE_UNAVAILABLE;
goto cleanup;
}
}
MBEDTLS_MPI_CHK( ecjpake_kkp_read( ctx->md_info, &ctx->grp,
&G, &ctx->Xp, ID_PEER, &p, end ) );
@ -558,14 +566,6 @@ int mbedtls_ecjpake_read_round_two( mbedtls_ecjpake_context *ctx,
goto cleanup;
}
/*
* Xs already checked, only thing left to check is the group,
*/
if( ctx->role == MBEDTLS_ECJPAKE_CLIENT && grp.id != ctx->grp.id )
{
ret = MBEDTLS_ERR_ECP_FEATURE_UNAVAILABLE;
goto cleanup;
}
cleanup:
mbedtls_ecp_group_free( &grp );
mbedtls_ecp_point_free( &G );