[xmlsec] fix openssl 1.0.0 crash



commit 427774cbf7e260c11ea5fc7870456fb300aae58c
Author: Aleksey Sanin <aleksey aleksey com>
Date:   Thu Aug 6 16:58:33 2009 -0700

    fix openssl 1.0.0 crash

 src/openssl/app.c |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)
---
diff --git a/src/openssl/app.c b/src/openssl/app.c
index 6e3aa81..ee80028 100644
--- a/src/openssl/app.c
+++ b/src/openssl/app.c
@@ -729,6 +729,22 @@ xmlSecOpenSSLAppPkcs12LoadBIO(BIO* bio, const char *pwd,
 		    xmlSecErrorsSafeString(xmlSecKeyDataGetName(x509Data)));
 	goto done;	
     }
+
+    /* starting from openssl 1.0.0 the PKCS12_parse() call will not create certs 
+       chain object if there is no certificates in the pkcs12 file and it will be null
+     */
+    if(chain == NULL) {
+	chain = sk_X509_new_null();
+	if(chain == NULL) {
+	    xmlSecError(XMLSEC_ERRORS_HERE,
+			NULL,
+			"sk_X509_new_null",
+			XMLSEC_ERRORS_R_CRYPTO_FAILED,
+			XMLSEC_ERRORS_NO_MESSAGE);
+	    return(-1);
+	}    
+    } 
+        
     ret = sk_X509_push(chain, tmpcert);
     if(ret < 1) {
 	xmlSecError(XMLSEC_ERRORS_HERE,



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]