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


ssl/statem/statem_clnt.c:2150:1: start of procedure tls_construct_cke_rsa()
2148.   }
2149.   
2150. > static int tls_construct_cke_rsa(SSL *s, unsigned char **p, int *len, int *al)
2151.   {
2152.   #ifndef OPENSSL_NO_RSA

ssl/statem/statem_clnt.c:2154:5: 
2152.   #ifndef OPENSSL_NO_RSA
2153.       unsigned char *q;
2154. >     EVP_PKEY *pkey = NULL;
2155.       EVP_PKEY_CTX *pctx = NULL;
2156.       size_t enclen;

ssl/statem/statem_clnt.c:2155:5: 
2153.       unsigned char *q;
2154.       EVP_PKEY *pkey = NULL;
2155. >     EVP_PKEY_CTX *pctx = NULL;
2156.       size_t enclen;
2157.       unsigned char *pms = NULL;

ssl/statem/statem_clnt.c:2157:5: 
2155.       EVP_PKEY_CTX *pctx = NULL;
2156.       size_t enclen;
2157. >     unsigned char *pms = NULL;
2158.       size_t pmslen = 0;
2159.   

ssl/statem/statem_clnt.c:2158:5: 
2156.       size_t enclen;
2157.       unsigned char *pms = NULL;
2158. >     size_t pmslen = 0;
2159.   
2160.       if (s->session->peer == NULL) {

ssl/statem/statem_clnt.c:2160:9: Taking false branch
2158.       size_t pmslen = 0;
2159.   
2160.       if (s->session->peer == NULL) {
                ^
2161.           /*
2162.            * We should always have a server certificate with SSL_kRSA.

ssl/statem/statem_clnt.c:2168:5: 
2166.       }
2167.   
2168. >     pkey = X509_get0_pubkey(s->session->peer);
2169.       if (EVP_PKEY_get0_RSA(pkey) == NULL) {
2170.           SSLerr(SSL_F_TLS_CONSTRUCT_CKE_RSA, ERR_R_INTERNAL_ERROR);

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

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

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

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

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

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

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

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

crypto/x509/x_pubkey.c:158:5: Skipping x509_pubkey_decode(): empty list of specs
    156.        * in the queue.
    157.        */
    158.       x509_pubkey_decode(&ret, key);
               ^
    159.       /* If decode doesn't fail something bad happened */
    160.       if (ret != NULL) {

crypto/x509/x_pubkey.c:160:9: Taking false branch
    158.       x509_pubkey_decode(&ret, key);
    159.       /* If decode doesn't fail something bad happened */
    160.       if (ret != NULL) {
                   ^
    161.           X509err(X509_F_X509_PUBKEY_GET0, ERR_R_INTERNAL_ERROR);
    162.           EVP_PKEY_free(ret);

crypto/x509/x_pubkey.c:165:5: 
    163.       }
    164.   
    165. >     return NULL;
    166.   }
    167.   

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

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

ssl/statem/statem_clnt.c:2169:9: 
2167.   
2168.       pkey = X509_get0_pubkey(s->session->peer);
2169. >     if (EVP_PKEY_get0_RSA(pkey) == NULL) {
2170.           SSLerr(SSL_F_TLS_CONSTRUCT_CKE_RSA, ERR_R_INTERNAL_ERROR);
2171.           return 0;

crypto/evp/p_lib.c:261:1: start of procedure EVP_PKEY_get0_RSA()
  259.   }
  260.   
  261. > RSA *EVP_PKEY_get0_RSA(EVP_PKEY *pkey)
  262.   {
  263.       if (pkey->type != EVP_PKEY_RSA) {

crypto/evp/p_lib.c:263:9: 
  261.   RSA *EVP_PKEY_get0_RSA(EVP_PKEY *pkey)
  262.   {
  263. >     if (pkey->type != EVP_PKEY_RSA) {
  264.           EVPerr(EVP_F_EVP_PKEY_GET0_RSA, EVP_R_EXPECTING_AN_RSA_KEY);
  265.           return NULL;
