mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-08-01 10:06:53 +03:00
pk_set_type() cannot be used to reset key type
This commit is contained in:
committed by
Paul Bakker
parent
0a64e8f1fd
commit
374e4b87d4
@ -88,6 +88,12 @@ int pk_set_type( pk_context *ctx, pk_type_t type )
|
||||
{
|
||||
size_t size = 0;
|
||||
|
||||
if( ctx->type == type )
|
||||
return( 0 );
|
||||
|
||||
if( ctx->type != POLARSSL_PK_NONE )
|
||||
return( POLARSSL_ERR_PK_TYPE_MISMATCH );
|
||||
|
||||
switch( type )
|
||||
{
|
||||
#if defined(POLARSSL_RSA_C)
|
||||
@ -104,7 +110,7 @@ int pk_set_type( pk_context *ctx, pk_type_t type )
|
||||
#endif
|
||||
|
||||
case POLARSSL_PK_NONE:
|
||||
; /* Should not happen */
|
||||
; /* Cannot happen, but the cmpiler doesn't know */
|
||||
}
|
||||
|
||||
if( ( ctx->data = malloc( size ) ) == NULL )
|
||||
|
Reference in New Issue
Block a user