crypto/evp/exchange.c:151: error: NULL_DEREFERENCE
  pointer `keyexch` last assigned on line 144 could be null and is dereferenced at line 151, column 9.
Showing all 36 steps of the trace


crypto/evp/exchange.c:137:1: start of procedure EVP_KEYEXCH_fetch()
135.   }
136.   
137. > EVP_KEYEXCH *EVP_KEYEXCH_fetch(OPENSSL_CTX *ctx, const char *algorithm,
138.                                  const char *properties)
139.   {

crypto/evp/exchange.c:144:5: 
142.        * from the same provider to manage its keys.
143.        */
144. >     EVP_KEYEXCH *keyexch =
145.           evp_generic_fetch(ctx, OSSL_OP_KEYEXCH, algorithm, properties,
146.                             evp_keyexch_from_dispatch,

crypto/evp/evp_fetch.c:155:1: start of procedure evp_generic_fetch()
  153.   }
  154.   
  155. > void *evp_generic_fetch(OPENSSL_CTX *libctx, int operation_id,
  156.                           const char *name, const char *properties,
  157.                           void *(*new_method)(const char *name,

crypto/evp/evp_fetch.c:163:5: 
  161.                           void (*free_method)(void *))
  162.   {
  163. >     OSSL_METHOD_STORE *store = get_default_method_store(libctx);
  164.       OSSL_NAMEMAP *namemap = ossl_namemap_stored(libctx);
  165.       int nameid = 0;

crypto/evp/evp_fetch.c:63:1: start of procedure get_default_method_store()
    61.   }
    62.   
    63. > static OSSL_METHOD_STORE *get_default_method_store(OPENSSL_CTX *libctx)
    64.   {
    65.       return openssl_ctx_get_data(libctx, OPENSSL_CTX_DEFAULT_METHOD_STORE_INDEX,

crypto/evp/evp_fetch.c:65:5: 
    63.   static OSSL_METHOD_STORE *get_default_method_store(OPENSSL_CTX *libctx)
    64.   {
    65. >     return openssl_ctx_get_data(libctx, OPENSSL_CTX_DEFAULT_METHOD_STORE_INDEX,
    66.                                   &default_method_store_method);
    67.   }

crypto/context.c:207:1: start of procedure openssl_ctx_get_data()
      205.   }
      206.   
      207. > void *openssl_ctx_get_data(OPENSSL_CTX *ctx, int index,
      208.                              const OPENSSL_CTX_METHOD *meth)
      209.   {

crypto/context.c:210:5: 
      208.                              const OPENSSL_CTX_METHOD *meth)
      209.   {
      210. >     void *data = NULL;
      211.       int dynidx;
      212.   

crypto/context.c:213:5: 
      211.       int dynidx;
      212.   
      213. >     ctx = openssl_ctx_get_concrete(ctx);
      214.       if (ctx == NULL)
      215.           return NULL;

crypto/context.c:155:1: start of procedure openssl_ctx_get_concrete()
        153.   }
        154.   
        155. > OPENSSL_CTX *openssl_ctx_get_concrete(OPENSSL_CTX *ctx)
        156.   {
        157.   #ifndef FIPS_MODE

crypto/context.c:164:5: 
        162.       }
        163.   #endif
        164. >     return ctx;
        165.   }
        166.   

crypto/context.c:165:1: return from a call to openssl_ctx_get_concrete
        163.   #endif
        164.       return ctx;
        165. > }
        166.   
        167.   static void openssl_ctx_generic_new(void *parent_ign, void *ptr_ign,

crypto/context.c:214:9: Taking true branch
      212.   
      213.       ctx = openssl_ctx_get_concrete(ctx);
      214.       if (ctx == NULL)
                     ^
      215.           return NULL;
      216.   

crypto/context.c:215:9: 
      213.       ctx = openssl_ctx_get_concrete(ctx);
      214.       if (ctx == NULL)
      215. >         return NULL;
      216.   
      217.       CRYPTO_THREAD_read_lock(ctx->lock);

crypto/context.c:255:1: return from a call to openssl_ctx_get_data
      253.   
      254.       return data;
      255. > }
      256.   
      257.   OSSL_EX_DATA_GLOBAL *openssl_ctx_get_ex_data_global(OPENSSL_CTX *ctx)

crypto/evp/evp_fetch.c:67:1: return from a call to get_default_method_store
    65.       return openssl_ctx_get_data(libctx, OPENSSL_CTX_DEFAULT_METHOD_STORE_INDEX,
    66.                                   &default_method_store_method);
    67. > }
    68.   
    69.   /*

crypto/evp/evp_fetch.c:164:5: 
  162.   {
  163.       OSSL_METHOD_STORE *store = get_default_method_store(libctx);
  164. >     OSSL_NAMEMAP *namemap = ossl_namemap_stored(libctx);
  165.       int nameid = 0;
  166.       uint32_t methid = 0;

crypto/core_namemap.c:90:1: start of procedure ossl_namemap_stored()
    88.    */
    89.   
    90. > OSSL_NAMEMAP *ossl_namemap_stored(OPENSSL_CTX *libctx)
    91.   {
    92.       return openssl_ctx_get_data(libctx, OPENSSL_CTX_NAMEMAP_INDEX,

crypto/core_namemap.c:92:5: 
    90.   OSSL_NAMEMAP *ossl_namemap_stored(OPENSSL_CTX *libctx)
    91.   {
    92. >     return openssl_ctx_get_data(libctx, OPENSSL_CTX_NAMEMAP_INDEX,
    93.                                   &stored_namemap_method);
    94.   }

crypto/context.c:207:1: start of procedure openssl_ctx_get_data()
      205.   }
      206.   
      207. > void *openssl_ctx_get_data(OPENSSL_CTX *ctx, int index,
      208.                              const OPENSSL_CTX_METHOD *meth)
      209.   {

crypto/context.c:210:5: 
      208.                              const OPENSSL_CTX_METHOD *meth)
      209.   {
      210. >     void *data = NULL;
      211.       int dynidx;
      212.   

crypto/context.c:213:5: 
      211.       int dynidx;
      212.   
      213. >     ctx = openssl_ctx_get_concrete(ctx);
      214.       if (ctx == NULL)
      215.           return NULL;

crypto/context.c:155:1: start of procedure openssl_ctx_get_concrete()
        153.   }
        154.   
        155. > OPENSSL_CTX *openssl_ctx_get_concrete(OPENSSL_CTX *ctx)
        156.   {
        157.   #ifndef FIPS_MODE

crypto/context.c:164:5: 
        162.       }
        163.   #endif
        164. >     return ctx;
        165.   }
        166.   

crypto/context.c:165:1: return from a call to openssl_ctx_get_concrete
        163.   #endif
        164.       return ctx;
        165. > }
        166.   
        167.   static void openssl_ctx_generic_new(void *parent_ign, void *ptr_ign,

crypto/context.c:214:9: Taking true branch
      212.   
      213.       ctx = openssl_ctx_get_concrete(ctx);
      214.       if (ctx == NULL)
                     ^
      215.           return NULL;
      216.   

crypto/context.c:215:9: 
      213.       ctx = openssl_ctx_get_concrete(ctx);
      214.       if (ctx == NULL)
      215. >         return NULL;
      216.   
      217.       CRYPTO_THREAD_read_lock(ctx->lock);

crypto/context.c:255:1: return from a call to openssl_ctx_get_data
      253.   
      254.       return data;
      255. > }
      256.   
      257.   OSSL_EX_DATA_GLOBAL *openssl_ctx_get_ex_data_global(OPENSSL_CTX *ctx)

crypto/core_namemap.c:94:1: return from a call to ossl_namemap_stored
    92.       return openssl_ctx_get_data(libctx, OPENSSL_CTX_NAMEMAP_INDEX,
    93.                                   &stored_namemap_method);
    94. > }
    95.   
    96.   OSSL_NAMEMAP *ossl_namemap_new(void)

crypto/evp/evp_fetch.c:165:5: 
  163.       OSSL_METHOD_STORE *store = get_default_method_store(libctx);
  164.       OSSL_NAMEMAP *namemap = ossl_namemap_stored(libctx);
  165. >     int nameid = 0;
  166.       uint32_t methid = 0;
  167.       void *method = NULL;

crypto/evp/evp_fetch.c:166:5: 
  164.       OSSL_NAMEMAP *namemap = ossl_namemap_stored(libctx);
  165.       int nameid = 0;
  166. >     uint32_t methid = 0;
  167.       void *method = NULL;
  168.   

crypto/evp/evp_fetch.c:167:5: 
  165.       int nameid = 0;
  166.       uint32_t methid = 0;
  167. >     void *method = NULL;
  168.   
  169.       if (store == NULL || namemap == NULL)

crypto/evp/evp_fetch.c:169:9: Taking true branch
  167.       void *method = NULL;
  168.   
  169.       if (store == NULL || namemap == NULL)
                 ^
  170.           return NULL;
  171.   

crypto/evp/evp_fetch.c:170:9: 
  168.   
  169.       if (store == NULL || namemap == NULL)
  170. >         return NULL;
  171.   
  172.       /*

crypto/evp/evp_fetch.c:226:1: return from a call to evp_generic_fetch
  224.   
  225.       return method;
  226. > }
  227.   
  228.   int EVP_set_default_properties(OPENSSL_CTX *libctx, const char *propq)

crypto/evp/exchange.c:151:9: 
149.   
150.       /* If the method is newly created, there's no keymgmt attached */
151. >     if (keyexch->keymgmt == NULL) {
152.           EVP_KEYMGMT *keymgmt = EVP_KEYMGMT_fetch(ctx, algorithm, properties);
153.   
