ssl/s3_srvr.c:2922: error: NULL_DEREFERENCE
  pointer `pkey` last assigned on line 2901 could be null and is dereferenced at line 2922, column 20.
Showing all 34 steps of the trace


ssl/s3_srvr.c:2864:1: start of procedure ssl3_get_cert_verify()
2862.   }
2863.   
2864. > int ssl3_get_cert_verify(SSL *s)
2865.   {
2866.       EVP_PKEY *pkey = NULL;

ssl/s3_srvr.c:2866:5: 
2864.   int ssl3_get_cert_verify(SSL *s)
2865.   {
2866. >     EVP_PKEY *pkey = NULL;
2867.       unsigned char *sig, *data;
2868.       int al, ok, ret = 0;

ssl/s3_srvr.c:2868:5: 
2866.       EVP_PKEY *pkey = NULL;
2867.       unsigned char *sig, *data;
2868. >     int al, ok, ret = 0;
2869.       long n;
2870.       int type = 0, i, j;

ssl/s3_srvr.c:2870:5: 
2868.       int al, ok, ret = 0;
2869.       long n;
2870. >     int type = 0, i, j;
2871.       unsigned int len;
2872.       X509 *peer;

ssl/s3_srvr.c:2873:5: 
2871.       unsigned int len;
2872.       X509 *peer;
2873. >     const EVP_MD *md = NULL;
2874.       EVP_MD_CTX mctx;
2875.       PACKET pkt;

ssl/s3_srvr.c:2876:5: 
2874.       EVP_MD_CTX mctx;
2875.       PACKET pkt;
2876. >     EVP_MD_CTX_init(&mctx);
2877.   
2878.       /*

crypto/evp/digest.c:120:1: start of procedure EVP_MD_CTX_init()
  118.   #endif
  119.   
  120. > void EVP_MD_CTX_init(EVP_MD_CTX *ctx)
  121.   {
  122.       memset(ctx, 0, sizeof(*ctx));

crypto/evp/digest.c:122:5: 
  120.   void EVP_MD_CTX_init(EVP_MD_CTX *ctx)
  121.   {
  122. >     memset(ctx, 0, sizeof(*ctx));
  123.   }
  124.   

crypto/evp/digest.c:123:1: return from a call to EVP_MD_CTX_init
  121.   {
  122.       memset(ctx, 0, sizeof(*ctx));
  123. > }
  124.   
  125.   EVP_MD_CTX *EVP_MD_CTX_create(void)

ssl/s3_srvr.c:2886:9: Taking false branch
2884.        * CertificateVerify state so we should not arrive here.
2885.        */
2886.       if (s->session->peer == NULL) {
                ^
2887.           ret = 1;
2888.           goto end;

ssl/s3_srvr.c:2891:5: Skipping __function_pointer__(): unresolved function pointer
2889.       }
2890.   
2891.       n = s->method->ssl_get_message(s,
            ^
2892.                                      SSL3_ST_SR_CERT_VRFY_A,
2893.                                      SSL3_ST_SR_CERT_VRFY_B,

ssl/s3_srvr.c:2897:10: Taking false branch
2895.                                      SSL3_RT_MAX_PLAIN_LENGTH, &ok);
2896.   
2897.       if (!ok)
                 ^
2898.           return ((int)n);
2899.   

ssl/s3_srvr.c:2900:5: 
2898.           return ((int)n);
2899.   
2900. >     peer = s->session->peer;
2901.       pkey = X509_get_pubkey(peer);
2902.       type = X509_certificate_type(peer, pkey);

ssl/s3_srvr.c:2901:5: 
2899.   
2900.       peer = s->session->peer;
2901. >     pkey = X509_get_pubkey(peer);
2902.       type = X509_certificate_type(peer, pkey);
2903.   

crypto/x509/x509_cmp.c:307:1: start of procedure X509_get_pubkey()
  305.   }
  306.   
  307. > EVP_PKEY *X509_get_pubkey(X509 *x)
  308.   {
  309.       if ((x == NULL) || (x->cert_info == NULL))

crypto/x509/x509_cmp.c:309:10: Taking false branch
  307.   EVP_PKEY *X509_get_pubkey(X509 *x)
  308.   {
  309.       if ((x == NULL) || (x->cert_info == NULL))
                  ^
  310.           return (NULL);
  311.       return (X509_PUBKEY_get(x->cert_info->key));

crypto/x509/x509_cmp.c:309:25: Taking true branch
  307.   EVP_PKEY *X509_get_pubkey(X509 *x)
  308.   {
  309.       if ((x == NULL) || (x->cert_info == NULL))
                                 ^
  310.           return (NULL);
  311.       return (X509_PUBKEY_get(x->cert_info->key));

crypto/x509/x509_cmp.c:310:9: 
  308.   {
  309.       if ((x == NULL) || (x->cert_info == NULL))
  310. >         return (NULL);
  311.       return (X509_PUBKEY_get(x->cert_info->key));
  312.   }

crypto/x509/x509_cmp.c:312:1: return from a call to X509_get_pubkey
  310.           return (NULL);
  311.       return (X509_PUBKEY_get(x->cert_info->key));
  312. > }
  313.   
  314.   ASN1_BIT_STRING *X509_get0_pubkey_bitstr(const X509 *x)

ssl/s3_srvr.c:2902:5: Skipping X509_certificate_type(): empty list of specs
2900.       peer = s->session->peer;
2901.       pkey = X509_get_pubkey(peer);
2902.       type = X509_certificate_type(peer, pkey);
            ^
2903.   
2904.       if (!(type & EVP_PKT_SIGN)) {

ssl/s3_srvr.c:2904:11: Taking false branch
2902.       type = X509_certificate_type(peer, pkey);
2903.   
2904.       if (!(type & EVP_PKT_SIGN)) {
                  ^
2905.           SSLerr(SSL_F_SSL3_GET_CERT_VERIFY,
2906.                  SSL_R_SIGNATURE_FOR_NON_SIGNING_CERTIFICATE);

ssl/s3_srvr.c:2912:10: 
2910.   
2911.       /* we now have a signature that we need to verify */
2912. >     if (!PACKET_buf_init(&pkt, s->init_msg, n)) {
2913.           SSLerr(SSL_F_SSL3_GET_CERT_VERIFY, ERR_R_INTERNAL_ERROR);
2914.           al = SSL_AD_INTERNAL_ERROR;

ssl/packet_locl.h:106:1: start of procedure PACKET_buf_init()
  104.    * is being used.
  105.    */
  106. > static inline int PACKET_buf_init(PACKET *pkt, unsigned char *buf, size_t len)
  107.   {
  108.       pkt->start = pkt->curr = buf;

ssl/packet_locl.h:108:5: 
  106.   static inline int PACKET_buf_init(PACKET *pkt, unsigned char *buf, size_t len)
  107.   {
  108. >     pkt->start = pkt->curr = buf;
  109.       pkt->end = pkt->start + len;
  110.   

ssl/packet_locl.h:109:5: 
  107.   {
  108.       pkt->start = pkt->curr = buf;
  109. >     pkt->end = pkt->start + len;
  110.   
  111.       /* Sanity checks */

ssl/packet_locl.h:112:9: Taking false branch
  110.   
  111.       /* Sanity checks */
  112.       if (pkt->start > pkt->end
                 ^
  113.               || pkt->curr < pkt->start
  114.               || pkt->curr > pkt->end

ssl/packet_locl.h:113:16: Taking false branch
  111.       /* Sanity checks */
  112.       if (pkt->start > pkt->end
  113.               || pkt->curr < pkt->start
                        ^
  114.               || pkt->curr > pkt->end
  115.               || len != (size_t)(pkt->end - pkt->start)) {

ssl/packet_locl.h:114:16: Taking false branch
  112.       if (pkt->start > pkt->end
  113.               || pkt->curr < pkt->start
  114.               || pkt->curr > pkt->end
                        ^
  115.               || len != (size_t)(pkt->end - pkt->start)) {
  116.           return 0;

ssl/packet_locl.h:115:16: Taking false branch
  113.               || pkt->curr < pkt->start
  114.               || pkt->curr > pkt->end
  115.               || len != (size_t)(pkt->end - pkt->start)) {
                        ^
  116.           return 0;
  117.       }

ssl/packet_locl.h:119:5: 
  117.       }
  118.   
  119. >     return 1;
  120.   }
  121.   

ssl/packet_locl.h:120:1: return from a call to PACKET_buf_init
  118.   
  119.       return 1;
  120. > }
  121.   
  122.   /*

ssl/s3_srvr.c:2912:10: Taking false branch
2910.   
2911.       /* we now have a signature that we need to verify */
2912.       if (!PACKET_buf_init(&pkt, s->init_msg, n)) {
                 ^
2913.           SSLerr(SSL_F_SSL3_GET_CERT_VERIFY, ERR_R_INTERNAL_ERROR);
2914.           al = SSL_AD_INTERNAL_ERROR;

ssl/s3_srvr.c:2922:9: Taking true branch
2920.        * length field
2921.        */
2922.       if (n == 64 && pkey->type == NID_id_GostR3410_2001) {
                ^
2923.           len = 64;
2924.       } else {

ssl/s3_srvr.c:2922:20: 
2920.        * length field
2921.        */
2922. >     if (n == 64 && pkey->type == NID_id_GostR3410_2001) {
2923.           len = 64;
2924.       } else {

int ssl3_get_cert_verify(SSL *s)
{
    EVP_PKEY *pkey = NULL;
    unsigned char *sig, *data;
    int al, ok, ret = 0;
    long n;
    int type = 0, i, j;
    unsigned int len;
    X509 *peer;
    const EVP_MD *md = NULL;
    EVP_MD_CTX mctx;
    PACKET pkt;
    EVP_MD_CTX_init(&mctx);
    if (s->session->peer == NULL) {
        ret = 1;
        goto end;
    }
    n = s->method->ssl_get_message(s,
                                   SSL3_ST_SR_CERT_VRFY_A,
                                   SSL3_ST_SR_CERT_VRFY_B,
                                   SSL3_MT_CERTIFICATE_VERIFY,
                                   SSL3_RT_MAX_PLAIN_LENGTH, &ok);
    if (!ok)
        return ((int)n);
    peer = s->session->peer;
    pkey = X509_get_pubkey(peer);
    type = X509_certificate_type(peer, pkey);
    if (!(type & EVP_PKT_SIGN)) {
        SSLerr(SSL_F_SSL3_GET_CERT_VERIFY,
               SSL_R_SIGNATURE_FOR_NON_SIGNING_CERTIFICATE);
        al = SSL_AD_ILLEGAL_PARAMETER;
        goto f_err;
    }
    if (!PACKET_buf_init(&pkt, s->init_msg, n)) {
        SSLerr(SSL_F_SSL3_GET_CERT_VERIFY, ERR_R_INTERNAL_ERROR);
        al = SSL_AD_INTERNAL_ERROR;
        goto f_err;
    }
    if (n == 64 && pkey->type == NID_id_GostR3410_2001) {
        len = 64;
    } else {
        if (SSL_USE_SIGALGS(s)) {
            int rv;
            if (!PACKET_get_bytes(&pkt, &sig, 2)) {
                al = SSL_AD_DECODE_ERROR;
                goto f_err;
            }
            rv = tls12_check_peer_sigalg(&md, s, sig, pkey);
            if (rv == -1) {
                al = SSL_AD_INTERNAL_ERROR;
                goto f_err;
            } else if (rv == 0) {
                al = SSL_AD_DECODE_ERROR;
                goto f_err;
            }
#ifdef SSL_DEBUG
            fprintf(stderr, "USING TLSv1.2 HASH %s\n", EVP_MD_name(md));
#endif
        }
        if (!PACKET_get_net_2(&pkt, &len)) {
            SSLerr(SSL_F_SSL3_GET_CERT_VERIFY, SSL_R_LENGTH_MISMATCH);
            al = SSL_AD_DECODE_ERROR;
            goto f_err;
        }
    }
    j = EVP_PKEY_size(pkey);
    if (((int)len > j) || ((int)PACKET_remaining(&pkt) > j) || (n <= 0)) {
        SSLerr(SSL_F_SSL3_GET_CERT_VERIFY, SSL_R_WRONG_SIGNATURE_SIZE);
        al = SSL_AD_DECODE_ERROR;
        goto f_err;
    }
    if (!PACKET_get_bytes(&pkt, &data, len)) {
        SSLerr(SSL_F_SSL3_GET_CERT_VERIFY, SSL_R_LENGTH_MISMATCH);
        al = SSL_AD_DECODE_ERROR;
        goto f_err;
    }
    if (SSL_USE_SIGALGS(s)) {
        long hdatalen = 0;
        void *hdata;
        hdatalen = BIO_get_mem_data(s->s3->handshake_buffer, &hdata);
        if (hdatalen <= 0) {
            SSLerr(SSL_F_SSL3_GET_CERT_VERIFY, ERR_R_INTERNAL_ERROR);
            al = SSL_AD_INTERNAL_ERROR;
            goto f_err;
        }
#ifdef SSL_DEBUG
        fprintf(stderr, "Using TLS 1.2 with client verify alg %s\n",
                EVP_MD_name(md));
#endif
        if (!EVP_VerifyInit_ex(&mctx, md, NULL)
            || !EVP_VerifyUpdate(&mctx, hdata, hdatalen)) {
            SSLerr(SSL_F_SSL3_GET_CERT_VERIFY, ERR_R_EVP_LIB);
            al = SSL_AD_INTERNAL_ERROR;
            goto f_err;
        }
        if (EVP_VerifyFinal(&mctx, data, len, pkey) <= 0) {
            al = SSL_AD_DECRYPT_ERROR;
            SSLerr(SSL_F_SSL3_GET_CERT_VERIFY, SSL_R_BAD_SIGNATURE);
            goto f_err;
        }
    } else
#ifndef OPENSSL_NO_RSA
    if (pkey->type == EVP_PKEY_RSA) {
        i = RSA_verify(NID_md5_sha1, s->s3->tmp.cert_verify_md,
                       MD5_DIGEST_LENGTH + SHA_DIGEST_LENGTH, data, len,
                       pkey->pkey.rsa);
        if (i < 0) {
            al = SSL_AD_DECRYPT_ERROR;
            SSLerr(SSL_F_SSL3_GET_CERT_VERIFY, SSL_R_BAD_RSA_DECRYPT);
            goto f_err;
        }
        if (i == 0) {
            al = SSL_AD_DECRYPT_ERROR;
            SSLerr(SSL_F_SSL3_GET_CERT_VERIFY, SSL_R_BAD_RSA_SIGNATURE);
            goto f_err;
        }
    } else
#endif
#ifndef OPENSSL_NO_DSA
    if (pkey->type == EVP_PKEY_DSA) {
        j = DSA_verify(pkey->save_type,
                       &(s->s3->tmp.cert_verify_md[MD5_DIGEST_LENGTH]),
                       SHA_DIGEST_LENGTH, data, len, pkey->pkey.dsa);
        if (j <= 0) {
            al = SSL_AD_DECRYPT_ERROR;
            SSLerr(SSL_F_SSL3_GET_CERT_VERIFY, SSL_R_BAD_DSA_SIGNATURE);
            goto f_err;
        }
    } else
#endif
#ifndef OPENSSL_NO_EC
    if (pkey->type == EVP_PKEY_EC) {
        j = ECDSA_verify(pkey->save_type,
                         &(s->s3->tmp.cert_verify_md[MD5_DIGEST_LENGTH]),
                         SHA_DIGEST_LENGTH, data, len, pkey->pkey.ec);
        if (j <= 0) {
            al = SSL_AD_DECRYPT_ERROR;
            SSLerr(SSL_F_SSL3_GET_CERT_VERIFY, SSL_R_BAD_ECDSA_SIGNATURE);
            goto f_err;
        }
    } else
#endif
    if (pkey->type == NID_id_GostR3410_2001) {
        unsigned char signature[64];
        int idx;
        EVP_PKEY_CTX *pctx = EVP_PKEY_CTX_new(pkey, NULL);
        EVP_PKEY_verify_init(pctx);
        if (len != 64) {
            fprintf(stderr, "GOST signature length is %d", len);
        }
        for (idx = 0; idx < 64; idx++) {
            signature[63 - idx] = data[idx];
        }
        j = EVP_PKEY_verify(pctx, signature, 64, s->s3->tmp.cert_verify_md,
                            32);
        EVP_PKEY_CTX_free(pctx);
        if (j <= 0) {
            al = SSL_AD_DECRYPT_ERROR;
            SSLerr(SSL_F_SSL3_GET_CERT_VERIFY, SSL_R_BAD_ECDSA_SIGNATURE);
            goto f_err;
        }
    } else {
        SSLerr(SSL_F_SSL3_GET_CERT_VERIFY, ERR_R_INTERNAL_ERROR);
        al = SSL_AD_UNSUPPORTED_CERTIFICATE;
        goto f_err;
    }
    ret = 1;
    if (0) {
 f_err:
        ssl3_send_alert(s, SSL3_AL_FATAL, al);
        s->state = SSL_ST_ERR;
    }
 end:
    BIO_free(s->s3->handshake_buffer);
    s->s3->handshake_buffer = NULL;
    EVP_MD_CTX_cleanup(&mctx);
    EVP_PKEY_free(pkey);
    return (ret);
}
['int ssl3_get_cert_verify(SSL *s)\n{\n    EVP_PKEY *pkey = NULL;\n    unsigned char *sig, *data;\n    int al, ok, ret = 0;\n    long n;\n    int type = 0, i, j;\n    unsigned int len;\n    X509 *peer;\n    const EVP_MD *md = NULL;\n    EVP_MD_CTX mctx;\n    PACKET pkt;\n    EVP_MD_CTX_init(&mctx);\n    if (s->session->peer == NULL) {\n        ret = 1;\n        goto end;\n    }\n    n = s->method->ssl_get_message(s,\n                                   SSL3_ST_SR_CERT_VRFY_A,\n                                   SSL3_ST_SR_CERT_VRFY_B,\n                                   SSL3_MT_CERTIFICATE_VERIFY,\n                                   SSL3_RT_MAX_PLAIN_LENGTH, &ok);\n    if (!ok)\n        return ((int)n);\n    peer = s->session->peer;\n    pkey = X509_get_pubkey(peer);\n    type = X509_certificate_type(peer, pkey);\n    if (!(type & EVP_PKT_SIGN)) {\n        SSLerr(SSL_F_SSL3_GET_CERT_VERIFY,\n               SSL_R_SIGNATURE_FOR_NON_SIGNING_CERTIFICATE);\n        al = SSL_AD_ILLEGAL_PARAMETER;\n        goto f_err;\n    }\n    if (!PACKET_buf_init(&pkt, s->init_msg, n)) {\n        SSLerr(SSL_F_SSL3_GET_CERT_VERIFY, ERR_R_INTERNAL_ERROR);\n        al = SSL_AD_INTERNAL_ERROR;\n        goto f_err;\n    }\n    if (n == 64 && pkey->type == NID_id_GostR3410_2001) {\n        len = 64;\n    } else {\n        if (SSL_USE_SIGALGS(s)) {\n            int rv;\n            if (!PACKET_get_bytes(&pkt, &sig, 2)) {\n                al = SSL_AD_DECODE_ERROR;\n                goto f_err;\n            }\n            rv = tls12_check_peer_sigalg(&md, s, sig, pkey);\n            if (rv == -1) {\n                al = SSL_AD_INTERNAL_ERROR;\n                goto f_err;\n            } else if (rv == 0) {\n                al = SSL_AD_DECODE_ERROR;\n                goto f_err;\n            }\n#ifdef SSL_DEBUG\n            fprintf(stderr, "USING TLSv1.2 HASH %s\\n", EVP_MD_name(md));\n#endif\n        }\n        if (!PACKET_get_net_2(&pkt, &len)) {\n            SSLerr(SSL_F_SSL3_GET_CERT_VERIFY, SSL_R_LENGTH_MISMATCH);\n            al = SSL_AD_DECODE_ERROR;\n            goto f_err;\n        }\n    }\n    j = EVP_PKEY_size(pkey);\n    if (((int)len > j) || ((int)PACKET_remaining(&pkt) > j) || (n <= 0)) {\n        SSLerr(SSL_F_SSL3_GET_CERT_VERIFY, SSL_R_WRONG_SIGNATURE_SIZE);\n        al = SSL_AD_DECODE_ERROR;\n        goto f_err;\n    }\n    if (!PACKET_get_bytes(&pkt, &data, len)) {\n        SSLerr(SSL_F_SSL3_GET_CERT_VERIFY, SSL_R_LENGTH_MISMATCH);\n        al = SSL_AD_DECODE_ERROR;\n        goto f_err;\n    }\n    if (SSL_USE_SIGALGS(s)) {\n        long hdatalen = 0;\n        void *hdata;\n        hdatalen = BIO_get_mem_data(s->s3->handshake_buffer, &hdata);\n        if (hdatalen <= 0) {\n            SSLerr(SSL_F_SSL3_GET_CERT_VERIFY, ERR_R_INTERNAL_ERROR);\n            al = SSL_AD_INTERNAL_ERROR;\n            goto f_err;\n        }\n#ifdef SSL_DEBUG\n        fprintf(stderr, "Using TLS 1.2 with client verify alg %s\\n",\n                EVP_MD_name(md));\n#endif\n        if (!EVP_VerifyInit_ex(&mctx, md, NULL)\n            || !EVP_VerifyUpdate(&mctx, hdata, hdatalen)) {\n            SSLerr(SSL_F_SSL3_GET_CERT_VERIFY, ERR_R_EVP_LIB);\n            al = SSL_AD_INTERNAL_ERROR;\n            goto f_err;\n        }\n        if (EVP_VerifyFinal(&mctx, data, len, pkey) <= 0) {\n            al = SSL_AD_DECRYPT_ERROR;\n            SSLerr(SSL_F_SSL3_GET_CERT_VERIFY, SSL_R_BAD_SIGNATURE);\n            goto f_err;\n        }\n    } else\n#ifndef OPENSSL_NO_RSA\n    if (pkey->type == EVP_PKEY_RSA) {\n        i = RSA_verify(NID_md5_sha1, s->s3->tmp.cert_verify_md,\n                       MD5_DIGEST_LENGTH + SHA_DIGEST_LENGTH, data, len,\n                       pkey->pkey.rsa);\n        if (i < 0) {\n            al = SSL_AD_DECRYPT_ERROR;\n            SSLerr(SSL_F_SSL3_GET_CERT_VERIFY, SSL_R_BAD_RSA_DECRYPT);\n            goto f_err;\n        }\n        if (i == 0) {\n            al = SSL_AD_DECRYPT_ERROR;\n            SSLerr(SSL_F_SSL3_GET_CERT_VERIFY, SSL_R_BAD_RSA_SIGNATURE);\n            goto f_err;\n        }\n    } else\n#endif\n#ifndef OPENSSL_NO_DSA\n    if (pkey->type == EVP_PKEY_DSA) {\n        j = DSA_verify(pkey->save_type,\n                       &(s->s3->tmp.cert_verify_md[MD5_DIGEST_LENGTH]),\n                       SHA_DIGEST_LENGTH, data, len, pkey->pkey.dsa);\n        if (j <= 0) {\n            al = SSL_AD_DECRYPT_ERROR;\n            SSLerr(SSL_F_SSL3_GET_CERT_VERIFY, SSL_R_BAD_DSA_SIGNATURE);\n            goto f_err;\n        }\n    } else\n#endif\n#ifndef OPENSSL_NO_EC\n    if (pkey->type == EVP_PKEY_EC) {\n        j = ECDSA_verify(pkey->save_type,\n                         &(s->s3->tmp.cert_verify_md[MD5_DIGEST_LENGTH]),\n                         SHA_DIGEST_LENGTH, data, len, pkey->pkey.ec);\n        if (j <= 0) {\n            al = SSL_AD_DECRYPT_ERROR;\n            SSLerr(SSL_F_SSL3_GET_CERT_VERIFY, SSL_R_BAD_ECDSA_SIGNATURE);\n            goto f_err;\n        }\n    } else\n#endif\n    if (pkey->type == NID_id_GostR3410_2001) {\n        unsigned char signature[64];\n        int idx;\n        EVP_PKEY_CTX *pctx = EVP_PKEY_CTX_new(pkey, NULL);\n        EVP_PKEY_verify_init(pctx);\n        if (len != 64) {\n            fprintf(stderr, "GOST signature length is %d", len);\n        }\n        for (idx = 0; idx < 64; idx++) {\n            signature[63 - idx] = data[idx];\n        }\n        j = EVP_PKEY_verify(pctx, signature, 64, s->s3->tmp.cert_verify_md,\n                            32);\n        EVP_PKEY_CTX_free(pctx);\n        if (j <= 0) {\n            al = SSL_AD_DECRYPT_ERROR;\n            SSLerr(SSL_F_SSL3_GET_CERT_VERIFY, SSL_R_BAD_ECDSA_SIGNATURE);\n            goto f_err;\n        }\n    } else {\n        SSLerr(SSL_F_SSL3_GET_CERT_VERIFY, ERR_R_INTERNAL_ERROR);\n        al = SSL_AD_UNSUPPORTED_CERTIFICATE;\n        goto f_err;\n    }\n    ret = 1;\n    if (0) {\n f_err:\n        ssl3_send_alert(s, SSL3_AL_FATAL, al);\n        s->state = SSL_ST_ERR;\n    }\n end:\n    BIO_free(s->s3->handshake_buffer);\n    s->s3->handshake_buffer = NULL;\n    EVP_MD_CTX_cleanup(&mctx);\n    EVP_PKEY_free(pkey);\n    return (ret);\n}', 'void EVP_MD_CTX_init(EVP_MD_CTX *ctx)\n{\n    memset(ctx, 0, sizeof(*ctx));\n}', 'EVP_PKEY *X509_get_pubkey(X509 *x)\n{\n    if ((x == NULL) || (x->cert_info == NULL))\n        return (NULL);\n    return (X509_PUBKEY_get(x->cert_info->key));\n}']