Rename recently introduced functions for improved code clarity:
[openssl.git] / ssl / ssl_cert.c
index 605e97e966d845375845d0b11b8c3cd67a2b5625..6895f6216653f0325d4475af0cfc82e32d1555e0 100644 (file)
@@ -190,8 +190,8 @@ CERT *ssl_cert_dup(CERT *cert)
 #ifndef OPENSSL_NO_RSA
        if (cert->rsa_tmp != NULL)
                {
+               RSA_up_ref(cert->rsa_tmp);
                ret->rsa_tmp = cert->rsa_tmp;
-               CRYPTO_add(&ret->rsa_tmp->references, 1, CRYPTO_LOCK_RSA);
                }
        ret->rsa_tmp_cb = cert->rsa_tmp_cb;
 #endif
@@ -455,7 +455,11 @@ int ssl_verify_cert_chain(SSL *s,STACK_OF(X509) *sk)
                return(0);
 
        x=sk_X509_value(sk,0);
-       X509_STORE_CTX_init(&ctx,s->ctx->cert_store,x,sk);
+       if(!X509_STORE_CTX_init(&ctx,s->ctx->cert_store,x,sk))
+               {
+               SSLerr(SSL_F_SSL_VERIFY_CERT_CHAIN,ERR_R_X509_LIB);
+               return(0);
+               }
        if (SSL_get_verify_depth(s) >= 0)
                X509_STORE_CTX_set_depth(&ctx, SSL_get_verify_depth(s));
        X509_STORE_CTX_set_ex_data(&ctx,SSL_get_ex_data_X509_STORE_CTX_idx(),s);
@@ -471,6 +475,9 @@ int ssl_verify_cert_chain(SSL *s,STACK_OF(X509) *sk)
 
        X509_STORE_CTX_purpose_inherit(&ctx, i, s->purpose, s->trust);
 
+       if (s->verify_callback)
+               X509_STORE_CTX_set_verify_cb(&ctx, s->verify_callback);
+
        if (s->ctx->app_verify_callback != NULL)
                i=s->ctx->app_verify_callback(&ctx); /* should pass app_verify_arg */
        else