From 213a2d0a7d4905e862c920c6f6726061826ac4a1 Mon Sep 17 00:00:00 2001 From: Jacob Barthelmeh Date: Fri, 19 Jan 2018 15:41:52 -0700 Subject: [PATCH] reverse order that certificates are compared with private key when parsing PKCS12 --- wolfcrypt/src/pkcs12.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/wolfcrypt/src/pkcs12.c b/wolfcrypt/src/pkcs12.c index dde77ef62..681994757 100644 --- a/wolfcrypt/src/pkcs12.c +++ b/wolfcrypt/src/pkcs12.c @@ -768,6 +768,7 @@ int wc_PKCS12_parse(WC_PKCS12* pkcs12, const char* psw, { ContentInfo* ci = NULL; WC_DerCertList* certList = NULL; + WC_DerCertList* tailList = NULL; byte* buf = NULL; word32 i, oid; int ret, pswSz; @@ -1067,12 +1068,13 @@ int wc_PKCS12_parse(WC_PKCS12* pkcs12, const char* psw, /* put the new node into the list */ if (certList != NULL) { - WOLFSSL_MSG("Pushing new cert onto stack"); - node->next = certList; - certList = node; + WOLFSSL_MSG("Pushing new cert onto queue"); + tailList->next = node; + tailList = node; } else { certList = node; + tailList = node; } /* on to next */