From 85b1bc65a0f84aa6e453f316ce73e778b2cf8717 Mon Sep 17 00:00:00 2001 From: Gilles Peskine Date: Tue, 25 May 2021 09:20:26 +0200 Subject: [PATCH] pk_debug: build with RSA_ALT implementations When MBEDTLS_RSA_ALT is defined, mbedtls_rsa_context does not necessarily have fields called N and E of type mbedtls_mpi. Don't emit pk_debug information with MBEDTLS_RSA_ALT. This is not ideal but at least the library compiles. Signed-off-by: Gilles Peskine --- library/pk_wrap.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/library/pk_wrap.c b/library/pk_wrap.c index ec0ff45cc..7c317c52d 100644 --- a/library/pk_wrap.c +++ b/library/pk_wrap.c @@ -178,6 +178,11 @@ static void rsa_free_wrap( void *ctx ) static void rsa_debug( const void *ctx, mbedtls_pk_debug_item *items ) { +#if defined(MBEDTLS_RSA_ALT) + /* Not supported */ + (void) ctx; + (void) items; +#else items->type = MBEDTLS_PK_DEBUG_MPI; items->name = "rsa.N"; items->value = &( ((mbedtls_rsa_context *) ctx)->N ); @@ -187,6 +192,7 @@ static void rsa_debug( const void *ctx, mbedtls_pk_debug_item *items ) items->type = MBEDTLS_PK_DEBUG_MPI; items->name = "rsa.E"; items->value = &( ((mbedtls_rsa_context *) ctx)->E ); +#endif } const mbedtls_pk_info_t mbedtls_rsa_info = {