BN_RECURSION causes the stuff in bn_mont.c to fall over for large keys. For
[oweals/openssl.git] / ssl / ssl_cert.c
index 1bff91eaa8d2f89063ad06baeb57d3b83dd6877d..e5e1b9998e2098be2475d29c15cabbc4119ffeeb 100644 (file)
@@ -105,6 +105,9 @@ CERT *c;
        {
        int i;
 
+       if(c == NULL)
+           return;
+
        i=CRYPTO_add(&c->references,-1,CRYPTO_LOCK_SSL_CERT);
 #ifdef REF_PRINT
        REF_PRINT("CERT",c);
@@ -141,6 +144,27 @@ CERT *c;
        Free(c);
        }
 
+int ssl_cert_instantiate(CERT **o, CERT *d)
+       {
+       CERT *n;
+       if (o == NULL) 
+               {
+               SSLerr(SSL_F_SSL_CERT_INSTANTIATE, ERR_R_PASSED_NULL_PARAMETER);
+               return(0);
+               }
+       if (*o != NULL && d != NULL && *o != d)
+           return(1);
+       if ((n = ssl_cert_new()) == NULL) 
+               {
+               SSLerr(SSL_F_SSL_CERT_INSTANTIATE, ERR_R_MALLOC_FAILURE);
+               return(0);
+               }
+       if (*o != NULL) 
+               ssl_cert_free(*o);
+       *o = n;
+       return(1);
+       }
+
 int ssl_set_cert_type(c, type)
 CERT *c;
 int type;