compare to original type when searching private key headers, prevent deadcode when WOLF_PRIVATE_KEY_ID enabled

This commit is contained in:
Ruby Martin
2026-02-24 14:31:46 -07:00
parent ff84de2680
commit 7a8550c217
+3 -2
View File
@@ -27618,6 +27618,7 @@ int PemToDer(const unsigned char* buff, long longSz, int type,
#ifdef OPENSSL_EXTRA
char beginBuf[PEM_LINE_LEN + 1]; /* add 1 for null terminator */
char endBuf[PEM_LINE_LEN + 1]; /* add 1 for null terminator */
int origType = type;
#endif
#ifdef WOLFSSL_ENCRYPTED_KEYS
int hashType = WC_HASH_TYPE_NONE;
@@ -27740,9 +27741,9 @@ int PemToDer(const unsigned char* buff, long longSz, int type,
if (!headerEnd) {
#ifdef OPENSSL_EXTRA
if (type == PRIVATEKEY_TYPE
if (origType == PRIVATEKEY_TYPE
#ifdef WOLFSSL_DUAL_ALG_CERTS
|| type == ALT_PRIVATEKEY_TYPE
|| origType == ALT_PRIVATEKEY_TYPE
#endif
) {
/* see if there is a -----BEGIN * PRIVATE KEY----- header */