ssl/statem/statem_clnt.c:2979: error: NULL_DEREFERENCE
  pointer `pkey` last assigned on line 2978 could be null and is dereferenced by call to `EVP_PKEY_get0_RSA()` at line 2979, column 9.
Showing all 21 steps of the trace


ssl/statem/statem_clnt.c:2959:1: start of procedure tls_construct_cke_rsa()
2957.   }
2958.   
2959. > static int tls_construct_cke_rsa(SSL *s, WPACKET *pkt)
2960.   {
2961.   #ifndef OPENSSL_NO_RSA

ssl/statem/statem_clnt.c:2962:5: 
2960.   {
2961.   #ifndef OPENSSL_NO_RSA
2962. >     unsigned char *encdata = NULL;
2963.       EVP_PKEY *pkey = NULL;
2964.       EVP_PKEY_CTX *pctx = NULL;

ssl/statem/statem_clnt.c:2963:5: 
2961.   #ifndef OPENSSL_NO_RSA
2962.       unsigned char *encdata = NULL;
2963. >     EVP_PKEY *pkey = NULL;
2964.       EVP_PKEY_CTX *pctx = NULL;
2965.       size_t enclen;

ssl/statem/statem_clnt.c:2964:5: 
2962.       unsigned char *encdata = NULL;
2963.       EVP_PKEY *pkey = NULL;
2964. >     EVP_PKEY_CTX *pctx = NULL;
2965.       size_t enclen;
2966.       unsigned char *pms = NULL;

ssl/statem/statem_clnt.c:2966:5: 
2964.       EVP_PKEY_CTX *pctx = NULL;
2965.       size_t enclen;
2966. >     unsigned char *pms = NULL;
2967.       size_t pmslen = 0;
2968.   

ssl/statem/statem_clnt.c:2967:5: 
2965.       size_t enclen;
2966.       unsigned char *pms = NULL;
2967. >     size_t pmslen = 0;
2968.   
2969.       if (s->session->peer == NULL) {

ssl/statem/statem_clnt.c:2969:9: Taking false branch
2967.       size_t pmslen = 0;
2968.   
2969.       if (s->session->peer == NULL) {
                ^
2970.           /*
2971.            * We should always have a server certificate with SSL_kRSA.

ssl/statem/statem_clnt.c:2978:5: 
2976.       }
2977.   
2978. >     pkey = X509_get0_pubkey(s->session->peer);
2979.       if (EVP_PKEY_get0_RSA(pkey) == NULL) {
2980.           SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_TLS_CONSTRUCT_CKE_RSA,

crypto/x509/x509_cmp.c:264:1: start of procedure X509_get0_pubkey()
  262.   }
  263.   
  264. > EVP_PKEY *X509_get0_pubkey(const X509 *x)
  265.   {
  266.       if (x == NULL)

crypto/x509/x509_cmp.c:266:9: Taking false branch
  264.   EVP_PKEY *X509_get0_pubkey(const X509 *x)
  265.   {
  266.       if (x == NULL)
                 ^
  267.           return NULL;
  268.       return X509_PUBKEY_get0(x->cert_info.key);

crypto/x509/x509_cmp.c:268:5: 
  266.       if (x == NULL)
  267.           return NULL;
  268. >     return X509_PUBKEY_get0(x->cert_info.key);
  269.   }
  270.   

crypto/x509/x_pubkey.c:142:1: start of procedure X509_PUBKEY_get0()
    140.   }
    141.   
    142. > EVP_PKEY *X509_PUBKEY_get0(X509_PUBKEY *key)
    143.   {
    144.       EVP_PKEY *ret = NULL;

crypto/x509/x_pubkey.c:144:5: 
    142.   EVP_PKEY *X509_PUBKEY_get0(X509_PUBKEY *key)
    143.   {
    144. >     EVP_PKEY *ret = NULL;
    145.   
    146.       if (key == NULL || key->public_key == NULL)

crypto/x509/x_pubkey.c:146:9: Taking false branch
    144.       EVP_PKEY *ret = NULL;
    145.   
    146.       if (key == NULL || key->public_key == NULL)
                   ^
    147.           return NULL;
    148.   

crypto/x509/x_pubkey.c:146:24: Taking true branch
    144.       EVP_PKEY *ret = NULL;
    145.   
    146.       if (key == NULL || key->public_key == NULL)
                                  ^
    147.           return NULL;
    148.   

crypto/x509/x_pubkey.c:147:9: 
    145.   
    146.       if (key == NULL || key->public_key == NULL)
    147. >         return NULL;
    148.   
    149.       if (key->pkey != NULL)

crypto/x509/x_pubkey.c:168:1: return from a call to X509_PUBKEY_get0
    166.   
    167.       return NULL;
    168. > }
    169.   
    170.   EVP_PKEY *X509_PUBKEY_get(X509_PUBKEY *key)

crypto/x509/x509_cmp.c:269:1: return from a call to X509_get0_pubkey
  267.           return NULL;
  268.       return X509_PUBKEY_get0(x->cert_info.key);
  269. > }
  270.   
  271.   EVP_PKEY *X509_get_pubkey(X509 *x)

ssl/statem/statem_clnt.c:2979:9: 
2977.   
2978.       pkey = X509_get0_pubkey(s->session->peer);
2979. >     if (EVP_PKEY_get0_RSA(pkey) == NULL) {
2980.           SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_TLS_CONSTRUCT_CKE_RSA,
2981.                    ERR_R_INTERNAL_ERROR);

crypto/evp/p_lib.c:468:1: start of procedure EVP_PKEY_get0_RSA()
  466.   }
  467.   
  468. > RSA *EVP_PKEY_get0_RSA(const EVP_PKEY *pkey)
  469.   {
  470.       if (pkey->type != EVP_PKEY_RSA) {

crypto/evp/p_lib.c:470:9: 
  468.   RSA *EVP_PKEY_get0_RSA(const EVP_PKEY *pkey)
  469.   {
  470. >     if (pkey->type != EVP_PKEY_RSA) {
  471.           EVPerr(EVP_F_EVP_PKEY_GET0_RSA, EVP_R_EXPECTING_AN_RSA_KEY);
  472.           return NULL;
