Fix warnings (enum value missing from switch/case)

This commit is contained in:
Manuel Pégourié-Gonnard 2013-07-10 12:29:57 +02:00 committed by Paul Bakker
parent 72ef0b775d
commit 7c5819eb1e
2 changed files with 19 additions and 2 deletions

View File

@ -33,6 +33,9 @@
#if defined(POLARSSL_ECP_C) #if defined(POLARSSL_ECP_C)
#include "polarssl/ecp.h" #include "polarssl/ecp.h"
#endif #endif
#if defined(POLARSSL_ECDSA_C)
#include "polarssl/ecdsa.h"
#endif
#include <stdlib.h> #include <stdlib.h>
@ -74,6 +77,12 @@ void pk_free( pk_context *ctx )
ecp_keypair_free( ctx->data ); ecp_keypair_free( ctx->data );
break; break;
#endif #endif
#if defined(POLARSSL_ECDSA_C)
case POLARSSL_PK_ECDSA:
ecdsa_free( ctx->data );
break;
#endif
} }
if( ! ctx->dont_free ) if( ! ctx->dont_free )
@ -111,8 +120,14 @@ int pk_set_type( pk_context *ctx, pk_type_t type )
break; break;
#endif #endif
#if defined(POLARSSL_ECDSA_C)
case POLARSSL_PK_ECDSA:
size = sizeof( ecdsa_context );
break;
#endif
case POLARSSL_PK_NONE: 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 ) if( ( ctx->data = malloc( size ) ) == NULL )

View File

@ -637,7 +637,9 @@ static int x509_get_pubkey( unsigned char **p,
switch( pk_alg ) switch( pk_alg )
{ {
case POLARSSL_PK_NONE: 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; break;
case POLARSSL_PK_RSA: case POLARSSL_PK_RSA: