From 7c5819eb1e6a7ce146b65f599c5cf29905121b74 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20P=C3=A9gouri=C3=A9-Gonnard?= Date: Wed, 10 Jul 2013 12:29:57 +0200 Subject: [PATCH] Fix warnings (enum value missing from switch/case) --- library/pk.c | 17 ++++++++++++++++- library/x509parse.c | 4 +++- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/library/pk.c b/library/pk.c index 6762c75bb..3ea600ac9 100644 --- a/library/pk.c +++ b/library/pk.c @@ -33,6 +33,9 @@ #if defined(POLARSSL_ECP_C) #include "polarssl/ecp.h" #endif +#if defined(POLARSSL_ECDSA_C) +#include "polarssl/ecdsa.h" +#endif #include @@ -74,6 +77,12 @@ void pk_free( pk_context *ctx ) ecp_keypair_free( ctx->data ); break; #endif + +#if defined(POLARSSL_ECDSA_C) + case POLARSSL_PK_ECDSA: + ecdsa_free( ctx->data ); + break; +#endif } if( ! ctx->dont_free ) @@ -111,8 +120,14 @@ int pk_set_type( pk_context *ctx, pk_type_t type ) break; #endif +#if defined(POLARSSL_ECDSA_C) + case POLARSSL_PK_ECDSA: + size = sizeof( ecdsa_context ); + break; +#endif + case POLARSSL_PK_NONE: - ; /* Cannot happen, but the cmpiler doesn't know */ + ; /* Cannot happen, but the compiler doesn't know */ } if( ( ctx->data = malloc( size ) ) == NULL ) diff --git a/library/x509parse.c b/library/x509parse.c index 9e05f98cb..62396987b 100644 --- a/library/x509parse.c +++ b/library/x509parse.c @@ -637,7 +637,9 @@ static int x509_get_pubkey( unsigned char **p, switch( pk_alg ) { case POLARSSL_PK_NONE: - ret = POLARSSL_ERR_X509_UNKNOWN_PK_ALG; + case POLARSSL_PK_ECDSA: + /* Should never happen */ + ret = POLARSSL_ERR_X509_CERT_INVALID_ALG; break; case POLARSSL_PK_RSA: