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.
diff --git a/library/pkparse.c b/library/pkparse.c
index ae210bc..4ec63e4 100644
--- a/library/pkparse.c
+++ b/library/pkparse.c
@@ -1164,7 +1164,11 @@
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 @@
}
#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 );