diff --git a/library/pkparse.c b/library/pkparse.c index d8ee64af2..aec43f1db 100644 --- a/library/pkparse.c +++ b/library/pkparse.c @@ -924,6 +924,7 @@ static int pk_parse_key_pkcs8_unencrypted_der( /* * Parse an encrypted PKCS#8 encoded private key */ +#if defined(POLARSSL_PKCS12_C) || defined(POLARSSL_PKCS5_C) static int pk_parse_key_pkcs8_encrypted_der( pk_context *pk, const unsigned char *key, size_t keylen, @@ -1041,6 +1042,7 @@ static int pk_parse_key_pkcs8_encrypted_der( return( pk_parse_key_pkcs8_unencrypted_der( pk, buf, len ) ); } +#endif /* POLARSSL_PKCS12_C || POLARSSL_PKCS5_C */ /* * Parse a private key @@ -1132,6 +1134,7 @@ int pk_parse_key( pk_context *pk, else if( ret != POLARSSL_ERR_PEM_NO_HEADER_FOOTER_PRESENT ) return( ret ); +#if defined(POLARSSL_PKCS12_C) || defined(POLARSSL_PKCS5_C) ret = pem_read_buffer( &pem, "-----BEGIN ENCRYPTED PRIVATE KEY-----", "-----END ENCRYPTED PRIVATE KEY-----", @@ -1150,6 +1153,7 @@ int pk_parse_key( pk_context *pk, } else if( ret != POLARSSL_ERR_PEM_NO_HEADER_FOOTER_PRESENT ) return( ret ); +#endif /* POLARSSL_PKCS12_C || POLARSSL_PKCS5_C */ #else ((void) pwd); ((void) pwdlen); @@ -1162,6 +1166,7 @@ int pk_parse_key( pk_context *pk, * We try the different DER format parsers to see if one passes without * error */ +#if defined(POLARSSL_PKCS12_C) || defined(POLARSSL_PKCS5_C) if( ( ret = pk_parse_key_pkcs8_encrypted_der( pk, key, keylen, pwd, pwdlen ) ) == 0 ) { @@ -1174,6 +1179,7 @@ int pk_parse_key( pk_context *pk, { return( ret ); } +#endif /* POLARSSL_PKCS12_C || POLARSSL_PKCS5_C */ if( ( ret = pk_parse_key_pkcs8_unencrypted_der( pk, key, keylen ) ) == 0 ) return( 0 );