Skip to content

Commit 7a8550c

Browse files
committed
compare to original type when searching private key headers, prevent deadcode when WOLF_PRIVATE_KEY_ID enabled
1 parent ff84de2 commit 7a8550c

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

wolfcrypt/src/asn.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27618,6 +27618,7 @@ int PemToDer(const unsigned char* buff, long longSz, int type,
2761827618
#ifdef OPENSSL_EXTRA
2761927619
char beginBuf[PEM_LINE_LEN + 1]; /* add 1 for null terminator */
2762027620
char endBuf[PEM_LINE_LEN + 1]; /* add 1 for null terminator */
27621+
int origType = type;
2762127622
#endif
2762227623
#ifdef WOLFSSL_ENCRYPTED_KEYS
2762327624
int hashType = WC_HASH_TYPE_NONE;
@@ -27740,9 +27741,9 @@ int PemToDer(const unsigned char* buff, long longSz, int type,
2774027741

2774127742
if (!headerEnd) {
2774227743
#ifdef OPENSSL_EXTRA
27743-
if (type == PRIVATEKEY_TYPE
27744+
if (origType == PRIVATEKEY_TYPE
2774427745
#ifdef WOLFSSL_DUAL_ALG_CERTS
27745-
|| type == ALT_PRIVATEKEY_TYPE
27746+
|| origType == ALT_PRIVATEKEY_TYPE
2774627747
#endif
2774727748
) {
2774827749
/* see if there is a -----BEGIN * PRIVATE KEY----- header */

0 commit comments

Comments
 (0)