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


ssl/t1_lib.c:4270:1: start of procedure ssl_get_auto_dh()
4268.   
4269.   #ifndef OPENSSL_NO_DH
4270. > DH *ssl_get_auto_dh(SSL *s)
4271.   {
4272.       int dh_secbits = 80;

ssl/t1_lib.c:4272:5: 
4270.   DH *ssl_get_auto_dh(SSL *s)
4271.   {
4272. >     int dh_secbits = 80;
4273.       if (s->cert->dh_tmp_auto == 2)
4274.           return DH_get_1024_160();

ssl/t1_lib.c:4273:9: Taking false branch
4271.   {
4272.       int dh_secbits = 80;
4273.       if (s->cert->dh_tmp_auto == 2)
                ^
4274.           return DH_get_1024_160();
4275.       if (s->s3->tmp.new_cipher->algorithm_auth & (SSL_aNULL | SSL_aPSK)) {

ssl/t1_lib.c:4275:9: Taking false branch
4273.       if (s->cert->dh_tmp_auto == 2)
4274.           return DH_get_1024_160();
4275.       if (s->s3->tmp.new_cipher->algorithm_auth & (SSL_aNULL | SSL_aPSK)) {
                ^
4276.           if (s->s3->tmp.new_cipher->strength_bits == 256)
4277.               dh_secbits = 128;

ssl/t1_lib.c:4281:9: 
4279.               dh_secbits = 80;
4280.       } else {
4281. >         CERT_PKEY *cpk = ssl_get_server_send_pkey(s);
4282.           dh_secbits = EVP_PKEY_security_bits(cpk->privatekey);
4283.       }

ssl/ssl_lib.c:2283:1: start of procedure ssl_get_server_send_pkey()
  2281.   }
  2282.   
  2283. > CERT_PKEY *ssl_get_server_send_pkey(SSL *s)
  2284.   {
  2285.       CERT *c;

ssl/ssl_lib.c:2288:5: 
  2286.       int i;
  2287.   
  2288. >     c = s->cert;
  2289.       if (!s->s3 || !s->s3->tmp.new_cipher)
  2290.           return NULL;

ssl/ssl_lib.c:2289:10: Taking false branch
  2287.   
  2288.       c = s->cert;
  2289.       if (!s->s3 || !s->s3->tmp.new_cipher)
                   ^
  2290.           return NULL;
  2291.       ssl_set_masks(s, s->s3->tmp.new_cipher);

ssl/ssl_lib.c:2289:20: Taking false branch
  2287.   
  2288.       c = s->cert;
  2289.       if (!s->s3 || !s->s3->tmp.new_cipher)
                             ^
  2290.           return NULL;
  2291.       ssl_set_masks(s, s->s3->tmp.new_cipher);

ssl/ssl_lib.c:2291:5: Skipping ssl_set_masks(): empty list of specs
  2289.       if (!s->s3 || !s->s3->tmp.new_cipher)
  2290.           return NULL;
  2291.       ssl_set_masks(s, s->s3->tmp.new_cipher);
              ^
  2292.   
  2293.   #ifdef OPENSSL_SSL_DEBUG_BROKEN_PROTOCOL

ssl/ssl_lib.c:2302:5: 
  2300.   #endif
  2301.   
  2302. >     i = ssl_get_server_cert_index(s);
  2303.   
  2304.       /* This may or may not be an error. */

ssl/ssl_lib.c:2262:1: start of procedure ssl_get_server_cert_index()
    2260.   #endif
    2261.   
    2262. > static int ssl_get_server_cert_index(const SSL *s)
    2263.   {
    2264.       int idx;

ssl/ssl_lib.c:2265:5: 
    2263.   {
    2264.       int idx;
    2265. >     idx = ssl_cipher_get_cert_index(s->s3->tmp.new_cipher);
    2266.       if (idx == SSL_PKEY_RSA_ENC && !s->cert->pkeys[SSL_PKEY_RSA_ENC].x509)
    2267.           idx = SSL_PKEY_RSA_SIGN;

ssl/ssl_ciph.c:2014:1: start of procedure ssl_cipher_get_cert_index()
      2012.   
      2013.   /* For a cipher return the index corresponding to the certificate type */
      2014. > int ssl_cipher_get_cert_index(const SSL_CIPHER *c)
      2015.   {
      2016.       uint32_t alg_k, alg_a;

ssl/ssl_ciph.c:2018:5: 
      2016.       uint32_t alg_k, alg_a;
      2017.   
      2018. >     alg_k = c->algorithm_mkey;
      2019.       alg_a = c->algorithm_auth;
      2020.   

ssl/ssl_ciph.c:2019:5: 
      2017.   
      2018.       alg_k = c->algorithm_mkey;
      2019. >     alg_a = c->algorithm_auth;
      2020.   
      2021.       if (alg_k & (SSL_kECDHr | SSL_kECDHe)) {

ssl/ssl_ciph.c:2021:9: Taking false branch
      2019.       alg_a = c->algorithm_auth;
      2020.   
      2021.       if (alg_k & (SSL_kECDHr | SSL_kECDHe)) {
                      ^
      2022.           /*
      2023.            * we don't need to look at SSL_kECDHE since no certificate is needed

ssl/ssl_ciph.c:2031:16: Taking false branch
      2029.            */
      2030.           return SSL_PKEY_ECC;
      2031.       } else if (alg_a & SSL_aECDSA)
                             ^
      2032.           return SSL_PKEY_ECC;
      2033.       else if (alg_k & SSL_kDHr)

ssl/ssl_ciph.c:2033:14: Taking false branch
      2031.       } else if (alg_a & SSL_aECDSA)
      2032.           return SSL_PKEY_ECC;
      2033.       else if (alg_k & SSL_kDHr)
                           ^
      2034.           return SSL_PKEY_DH_RSA;
      2035.       else if (alg_k & SSL_kDHd)

ssl/ssl_ciph.c:2035:14: Taking false branch
      2033.       else if (alg_k & SSL_kDHr)
      2034.           return SSL_PKEY_DH_RSA;
      2035.       else if (alg_k & SSL_kDHd)
                           ^
      2036.           return SSL_PKEY_DH_DSA;
      2037.       else if (alg_a & SSL_aDSS)

ssl/ssl_ciph.c:2037:14: Taking false branch
      2035.       else if (alg_k & SSL_kDHd)
      2036.           return SSL_PKEY_DH_DSA;
      2037.       else if (alg_a & SSL_aDSS)
                           ^
      2038.           return SSL_PKEY_DSA_SIGN;
      2039.       else if (alg_a & SSL_aRSA)

ssl/ssl_ciph.c:2039:14: Taking true branch
      2037.       else if (alg_a & SSL_aDSS)
      2038.           return SSL_PKEY_DSA_SIGN;
      2039.       else if (alg_a & SSL_aRSA)
                           ^
      2040.           return SSL_PKEY_RSA_ENC;
      2041.       else if (alg_a & SSL_aGOST12)

ssl/ssl_ciph.c:2040:9: 
      2038.           return SSL_PKEY_DSA_SIGN;
      2039.       else if (alg_a & SSL_aRSA)
      2040. >         return SSL_PKEY_RSA_ENC;
      2041.       else if (alg_a & SSL_aGOST12)
      2042.           return SSL_PKEY_GOST_EC;

ssl/ssl_ciph.c:2047:1: return from a call to ssl_cipher_get_cert_index
      2045.   
      2046.       return -1;
      2047. > }
      2048.   
      2049.   const SSL_CIPHER *ssl_get_cipher_by_char(SSL *ssl, const unsigned char *ptr)

ssl/ssl_lib.c:2266:9: Taking true branch
    2264.       int idx;
    2265.       idx = ssl_cipher_get_cert_index(s->s3->tmp.new_cipher);
    2266.       if (idx == SSL_PKEY_RSA_ENC && !s->cert->pkeys[SSL_PKEY_RSA_ENC].x509)
                    ^
    2267.           idx = SSL_PKEY_RSA_SIGN;
    2268.       if (idx == SSL_PKEY_GOST_EC) {

ssl/ssl_lib.c:2266:37: Taking false branch
    2264.       int idx;
    2265.       idx = ssl_cipher_get_cert_index(s->s3->tmp.new_cipher);
    2266.       if (idx == SSL_PKEY_RSA_ENC && !s->cert->pkeys[SSL_PKEY_RSA_ENC].x509)
                                                ^
    2267.           idx = SSL_PKEY_RSA_SIGN;
    2268.       if (idx == SSL_PKEY_GOST_EC) {

ssl/ssl_lib.c:2268:9: Taking false branch
    2266.       if (idx == SSL_PKEY_RSA_ENC && !s->cert->pkeys[SSL_PKEY_RSA_ENC].x509)
    2267.           idx = SSL_PKEY_RSA_SIGN;
    2268.       if (idx == SSL_PKEY_GOST_EC) {
                    ^
    2269.           if (s->cert->pkeys[SSL_PKEY_GOST12_512].x509)
    2270.               idx = SSL_PKEY_GOST12_512;

ssl/ssl_lib.c:2278:9: Taking false branch
    2276.               idx = -1;
    2277.       }
    2278.       if (idx == -1)
                    ^
    2279.           SSLerr(SSL_F_SSL_GET_SERVER_CERT_INDEX, ERR_R_INTERNAL_ERROR);
    2280.       return idx;

ssl/ssl_lib.c:2280:5: 
    2278.       if (idx == -1)
    2279.           SSLerr(SSL_F_SSL_GET_SERVER_CERT_INDEX, ERR_R_INTERNAL_ERROR);
    2280. >     return idx;
    2281.   }
    2282.   

ssl/ssl_lib.c:2281:1: return from a call to ssl_get_server_cert_index
    2279.           SSLerr(SSL_F_SSL_GET_SERVER_CERT_INDEX, ERR_R_INTERNAL_ERROR);
    2280.       return idx;
    2281. > }
    2282.   
    2283.   CERT_PKEY *ssl_get_server_send_pkey(SSL *s)

ssl/ssl_lib.c:2305:9: Taking true branch
  2303.   
  2304.       /* This may or may not be an error. */
  2305.       if (i < 0)
                  ^
  2306.           return NULL;
  2307.   

ssl/ssl_lib.c:2306:9: 
  2304.       /* This may or may not be an error. */
  2305.       if (i < 0)
  2306. >         return NULL;
  2307.   
  2308.       /* May be NULL. */

ssl/ssl_lib.c:2310:1: return from a call to ssl_get_server_send_pkey
  2308.       /* May be NULL. */
  2309.       return &c->pkeys[i];
  2310. > }
  2311.   
  2312.   EVP_PKEY *ssl_get_sign_pkey(SSL *s, const SSL_CIPHER *cipher,

ssl/t1_lib.c:4282:9: 
4280.       } else {
4281.           CERT_PKEY *cpk = ssl_get_server_send_pkey(s);
4282. >         dh_secbits = EVP_PKEY_security_bits(cpk->privatekey);
4283.       }
4284.   
