Fix unused variable warnings in pkparse.c

In a reduced configuration without PEM, PKCS5 or PKCS12, armc5 found that ret
was set but not used. Fixing that lead to a new warning about the variable not
being used at all. Now the variable is only declared when it's needed.
This commit is contained in:
Manuel Pégourié-Gonnard 2019-06-18 11:31:59 +02:00
parent 070f107a61
commit e83b2c2a50

View file

@ -1164,7 +1164,11 @@ int mbedtls_pk_parse_key( mbedtls_pk_context *pk,
const unsigned char *key, size_t keylen,
const unsigned char *pwd, size_t pwdlen )
{
#if defined(MBEDTLS_PKCS12_C) || \
defined(MBEDTLS_PKCS5_C) || \
defined(MBEDTLS_PEM_PARSE_C)
int ret;
#endif
const mbedtls_pk_info_t *pk_info;
#if defined(MBEDTLS_PEM_PARSE_C)
size_t len;
@ -1327,7 +1331,7 @@ int mbedtls_pk_parse_key( mbedtls_pk_context *pk,
}
#endif /* MBEDTLS_PKCS12_C || MBEDTLS_PKCS5_C */
if( ( ret = pk_parse_key_pkcs8_unencrypted_der( pk, key, keylen ) ) == 0 )
if( pk_parse_key_pkcs8_unencrypted_der( pk, key, keylen ) == 0 )
return( 0 );
mbedtls_pk_free( pk );