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

Introduce mbedtls_pk_restart_ctx and use it

The fact that you needed to pass a pointer to mbedtls_ecdsa_restart_ctx (or
that you needed to know the key type of the PK context) was a breach of
abstraction.

Change the API (and callers) now, and the implementation will be changed in
the next commit.
This commit is contained in:
Manuel Pégourié-Gonnard
2017-08-17 14:33:31 +02:00
parent 98a6778d47
commit 15d7df2ba8
6 changed files with 69 additions and 25 deletions

View File

@ -1875,7 +1875,7 @@ static int x509_crt_check_signature( const mbedtls_x509_crt *child,
{
return( mbedtls_pk_verify_restartable( &parent->pk,
child->sig_md, hash, mbedtls_md_get_size( md_info ),
child->sig.p, child->sig.len, &rs_ctx->ecdsa ) );
child->sig.p, child->sig.len, &rs_ctx->pk ) );
}
#else
(void) rs_ctx;
@ -2653,7 +2653,7 @@ void mbedtls_x509_crt_free( mbedtls_x509_crt *crt )
*/
void mbedtls_x509_crt_restart_init( mbedtls_x509_crt_restart_ctx *ctx )
{
mbedtls_ecdsa_restart_init( &ctx->ecdsa );
mbedtls_pk_restart_init( &ctx->pk );
ctx->parent = NULL;
ctx->fallback_parent = NULL;
@ -2675,7 +2675,7 @@ void mbedtls_x509_crt_restart_free( mbedtls_x509_crt_restart_ctx *ctx )
if( ctx == NULL )
return;
mbedtls_ecdsa_restart_free( &ctx->ecdsa );
mbedtls_pk_restart_free( &ctx->pk );
mbedtls_x509_crt_restart_init( ctx );
}