ssl/t1_lib.c:3962: error: NULL_DEREFERENCE
  pointer `cpk` last assigned on line 3961 could be null and is dereferenced at line 3962, column 45.
Showing all 30 steps of the trace


ssl/t1_lib.c:3950:1: start of procedure ssl_get_auto_dh()
3948.   
3949.   #ifndef OPENSSL_NO_DH
3950. > DH *ssl_get_auto_dh(SSL *s)
3951.   {
3952.       int dh_secbits = 80;

ssl/t1_lib.c:3952:5: 
3950.   DH *ssl_get_auto_dh(SSL *s)
3951.   {
3952. >     int dh_secbits = 80;
3953.       if (s->cert->dh_tmp_auto == 2)
3954.           return DH_get_1024_160();

ssl/t1_lib.c:3953:9: Taking false branch
3951.   {
3952.       int dh_secbits = 80;
3953.       if (s->cert->dh_tmp_auto == 2)
                ^
3954.           return DH_get_1024_160();
3955.       if (s->s3->tmp.new_cipher->algorithm_auth & (SSL_aNULL | SSL_aPSK)) {

ssl/t1_lib.c:3955:9: Taking false branch
3953.       if (s->cert->dh_tmp_auto == 2)
3954.           return DH_get_1024_160();
3955.       if (s->s3->tmp.new_cipher->algorithm_auth & (SSL_aNULL | SSL_aPSK)) {
                ^
3956.           if (s->s3->tmp.new_cipher->strength_bits == 256)
3957.               dh_secbits = 128;

ssl/t1_lib.c:3961:9: 
3959.               dh_secbits = 80;
3960.       } else {
3961. >         CERT_PKEY *cpk = ssl_get_server_send_pkey(s);
3962.           dh_secbits = EVP_PKEY_security_bits(cpk->privatekey);
3963.       }

ssl/ssl_lib.c:2775:1: start of procedure ssl_get_server_send_pkey()
  2773.   }
  2774.   
  2775. > CERT_PKEY *ssl_get_server_send_pkey(SSL *s)
  2776.   {
  2777.       CERT *c;

ssl/ssl_lib.c:2780:5: 
  2778.       int i;
  2779.   
  2780. >     c = s->cert;
  2781.       if (!s->s3 || !s->s3->tmp.new_cipher)
  2782.           return NULL;

ssl/ssl_lib.c:2781:10: Taking false branch
  2779.   
  2780.       c = s->cert;
  2781.       if (!s->s3 || !s->s3->tmp.new_cipher)
                   ^
  2782.           return NULL;
  2783.       ssl_set_masks(s);

ssl/ssl_lib.c:2781:20: Taking false branch
  2779.   
  2780.       c = s->cert;
  2781.       if (!s->s3 || !s->s3->tmp.new_cipher)
                             ^
  2782.           return NULL;
  2783.       ssl_set_masks(s);

ssl/ssl_lib.c:2783:5: Skipping ssl_set_masks(): empty list of specs
  2781.       if (!s->s3 || !s->s3->tmp.new_cipher)
  2782.           return NULL;
  2783.       ssl_set_masks(s);
              ^
  2784.   
  2785.       i = ssl_get_server_cert_index(s);

ssl/ssl_lib.c:2785:5: 
  2783.       ssl_set_masks(s);
  2784.   
  2785. >     i = ssl_get_server_cert_index(s);
  2786.   
  2787.       /* This may or may not be an error. */

ssl/ssl_lib.c:2754:1: start of procedure ssl_get_server_cert_index()
    2752.   #endif
    2753.   
    2754. > static int ssl_get_server_cert_index(const SSL *s)
    2755.   {
    2756.       int idx;

ssl/ssl_lib.c:2757:5: 
    2755.   {
    2756.       int idx;
    2757. >     idx = ssl_cipher_get_cert_index(s->s3->tmp.new_cipher);
    2758.       if (idx == SSL_PKEY_RSA_ENC && !s->cert->pkeys[SSL_PKEY_RSA_ENC].x509)
    2759.           idx = SSL_PKEY_RSA_SIGN;

ssl/ssl_ciph.c:1886:1: start of procedure ssl_cipher_get_cert_index()
      1884.   
      1885.   /* For a cipher return the index corresponding to the certificate type */
      1886. > int ssl_cipher_get_cert_index(const SSL_CIPHER *c)
      1887.   {
      1888.       uint32_t alg_a;

ssl/ssl_ciph.c:1890:5: 
      1888.       uint32_t alg_a;
      1889.   
      1890. >     alg_a = c->algorithm_auth;
      1891.   
      1892.       if (alg_a & SSL_aECDSA)

ssl/ssl_ciph.c:1892:9: Taking false branch
      1890.       alg_a = c->algorithm_auth;
      1891.   
      1892.       if (alg_a & SSL_aECDSA)
                      ^
      1893.           return SSL_PKEY_ECC;
      1894.       else if (alg_a & SSL_aDSS)

ssl/ssl_ciph.c:1894:14: Taking false branch
      1892.       if (alg_a & SSL_aECDSA)
      1893.           return SSL_PKEY_ECC;
      1894.       else if (alg_a & SSL_aDSS)
                           ^
      1895.           return SSL_PKEY_DSA_SIGN;
      1896.       else if (alg_a & SSL_aRSA)

ssl/ssl_ciph.c:1896:14: Taking true branch
      1894.       else if (alg_a & SSL_aDSS)
      1895.           return SSL_PKEY_DSA_SIGN;
      1896.       else if (alg_a & SSL_aRSA)
                           ^
      1897.           return SSL_PKEY_RSA_ENC;
      1898.       else if (alg_a & SSL_aGOST12)

ssl/ssl_ciph.c:1897:9: 
      1895.           return SSL_PKEY_DSA_SIGN;
      1896.       else if (alg_a & SSL_aRSA)
      1897. >         return SSL_PKEY_RSA_ENC;
      1898.       else if (alg_a & SSL_aGOST12)
      1899.           return SSL_PKEY_GOST_EC;

ssl/ssl_ciph.c:1904:1: return from a call to ssl_cipher_get_cert_index
      1902.   
      1903.       return -1;
      1904. > }
      1905.   
      1906.   const SSL_CIPHER *ssl_get_cipher_by_char(SSL *ssl, const unsigned char *ptr)

ssl/ssl_lib.c:2758:9: Taking true branch
    2756.       int idx;
    2757.       idx = ssl_cipher_get_cert_index(s->s3->tmp.new_cipher);
    2758.       if (idx == SSL_PKEY_RSA_ENC && !s->cert->pkeys[SSL_PKEY_RSA_ENC].x509)
                    ^
    2759.           idx = SSL_PKEY_RSA_SIGN;
    2760.       if (idx == SSL_PKEY_GOST_EC) {

ssl/ssl_lib.c:2758:37: Taking false branch
    2756.       int idx;
    2757.       idx = ssl_cipher_get_cert_index(s->s3->tmp.new_cipher);
    2758.       if (idx == SSL_PKEY_RSA_ENC && !s->cert->pkeys[SSL_PKEY_RSA_ENC].x509)
                                                ^
    2759.           idx = SSL_PKEY_RSA_SIGN;
    2760.       if (idx == SSL_PKEY_GOST_EC) {

ssl/ssl_lib.c:2760:9: Taking false branch
    2758.       if (idx == SSL_PKEY_RSA_ENC && !s->cert->pkeys[SSL_PKEY_RSA_ENC].x509)
    2759.           idx = SSL_PKEY_RSA_SIGN;
    2760.       if (idx == SSL_PKEY_GOST_EC) {
                    ^
    2761.           if (s->cert->pkeys[SSL_PKEY_GOST12_512].x509)
    2762.               idx = SSL_PKEY_GOST12_512;

ssl/ssl_lib.c:2770:9: Taking false branch
    2768.               idx = -1;
    2769.       }
    2770.       if (idx == -1)
                    ^
    2771.           SSLerr(SSL_F_SSL_GET_SERVER_CERT_INDEX, ERR_R_INTERNAL_ERROR);
    2772.       return idx;

ssl/ssl_lib.c:2772:5: 
    2770.       if (idx == -1)
    2771.           SSLerr(SSL_F_SSL_GET_SERVER_CERT_INDEX, ERR_R_INTERNAL_ERROR);
    2772. >     return idx;
    2773.   }
    2774.   

ssl/ssl_lib.c:2773:1: return from a call to ssl_get_server_cert_index
    2771.           SSLerr(SSL_F_SSL_GET_SERVER_CERT_INDEX, ERR_R_INTERNAL_ERROR);
    2772.       return idx;
    2773. > }
    2774.   
    2775.   CERT_PKEY *ssl_get_server_send_pkey(SSL *s)

ssl/ssl_lib.c:2788:9: Taking true branch
  2786.   
  2787.       /* This may or may not be an error. */
  2788.       if (i < 0)
                  ^
  2789.           return NULL;
  2790.   

ssl/ssl_lib.c:2789:9: 
  2787.       /* This may or may not be an error. */
  2788.       if (i < 0)
  2789. >         return NULL;
  2790.   
  2791.       /* May be NULL. */

ssl/ssl_lib.c:2793:1: return from a call to ssl_get_server_send_pkey
  2791.       /* May be NULL. */
  2792.       return &c->pkeys[i];
  2793. > }
  2794.   
  2795.   EVP_PKEY *ssl_get_sign_pkey(SSL *s, const SSL_CIPHER *cipher,

ssl/t1_lib.c:3962:9: 
3960.       } else {
3961.           CERT_PKEY *cpk = ssl_get_server_send_pkey(s);
3962. >         dh_secbits = EVP_PKEY_security_bits(cpk->privatekey);
3963.       }
3964.   
