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


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

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

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

crypto/evp/evp_fetch.c:165:5: 
  163.                           void (*free_method)(void *))
  164.   {
  165. >     OSSL_METHOD_STORE *store = get_default_method_store(libctx);
  166.       OSSL_NAMEMAP *namemap = ossl_namemap_stored(libctx);
  167.       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:186:1: start of procedure openssl_ctx_get_data()
      184.   }
      185.   
      186. > void *openssl_ctx_get_data(OPENSSL_CTX *ctx, int index,
      187.                              const OPENSSL_CTX_METHOD *meth)
      188.   {

crypto/context.c:189:5: 
      187.                              const OPENSSL_CTX_METHOD *meth)
      188.   {
      189. >     void *data = NULL;
      190.   
      191.       ctx = openssl_ctx_get_concrete(ctx);

crypto/context.c:191:5: 
      189.       void *data = NULL;
      190.   
      191. >     ctx = openssl_ctx_get_concrete(ctx);
      192.       if (ctx == NULL)
      193.           return NULL;

crypto/context.c:134:1: start of procedure openssl_ctx_get_concrete()
        132.   }
        133.   
        134. > OPENSSL_CTX *openssl_ctx_get_concrete(OPENSSL_CTX *ctx)
        135.   {
        136.   #ifndef FIPS_MODE

crypto/context.c:143:5: 
        141.       }
        142.   #endif
        143. >     return ctx;
        144.   }
        145.   

crypto/context.c:144:1: return from a call to openssl_ctx_get_concrete
        142.   #endif
        143.       return ctx;
        144. > }
        145.   
        146.   static void openssl_ctx_generic_new(void *parent_ign, void *ptr_ign,

crypto/context.c:192:9: Taking true branch
      190.   
      191.       ctx = openssl_ctx_get_concrete(ctx);
      192.       if (ctx == NULL)
                     ^
      193.           return NULL;
      194.   

crypto/context.c:193:9: 
      191.       ctx = openssl_ctx_get_concrete(ctx);
      192.       if (ctx == NULL)
      193. >         return NULL;
      194.   
      195.       CRYPTO_THREAD_read_lock(ctx->lock);

crypto/context.c:211:1: return from a call to openssl_ctx_get_data
      209.   
      210.       return data;
      211. > }
      212.   
      213.   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:166:5: 
  164.   {
  165.       OSSL_METHOD_STORE *store = get_default_method_store(libctx);
  166. >     OSSL_NAMEMAP *namemap = ossl_namemap_stored(libctx);
  167.       int nameid = 0;
  168.       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:186:1: start of procedure openssl_ctx_get_data()
      184.   }
      185.   
      186. > void *openssl_ctx_get_data(OPENSSL_CTX *ctx, int index,
      187.                              const OPENSSL_CTX_METHOD *meth)
      188.   {

crypto/context.c:189:5: 
      187.                              const OPENSSL_CTX_METHOD *meth)
      188.   {
      189. >     void *data = NULL;
      190.   
      191.       ctx = openssl_ctx_get_concrete(ctx);

crypto/context.c:191:5: 
      189.       void *data = NULL;
      190.   
      191. >     ctx = openssl_ctx_get_concrete(ctx);
      192.       if (ctx == NULL)
      193.           return NULL;

crypto/context.c:134:1: start of procedure openssl_ctx_get_concrete()
        132.   }
        133.   
        134. > OPENSSL_CTX *openssl_ctx_get_concrete(OPENSSL_CTX *ctx)
        135.   {
        136.   #ifndef FIPS_MODE

crypto/context.c:143:5: 
        141.       }
        142.   #endif
        143. >     return ctx;
        144.   }
        145.   

crypto/context.c:144:1: return from a call to openssl_ctx_get_concrete
        142.   #endif
        143.       return ctx;
        144. > }
        145.   
        146.   static void openssl_ctx_generic_new(void *parent_ign, void *ptr_ign,

crypto/context.c:192:9: Taking true branch
      190.   
      191.       ctx = openssl_ctx_get_concrete(ctx);
      192.       if (ctx == NULL)
                     ^
      193.           return NULL;
      194.   

crypto/context.c:193:9: 
      191.       ctx = openssl_ctx_get_concrete(ctx);
      192.       if (ctx == NULL)
      193. >         return NULL;
      194.   
      195.       CRYPTO_THREAD_read_lock(ctx->lock);

crypto/context.c:211:1: return from a call to openssl_ctx_get_data
      209.   
      210.       return data;
      211. > }
      212.   
      213.   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:167:5: 
  165.       OSSL_METHOD_STORE *store = get_default_method_store(libctx);
  166.       OSSL_NAMEMAP *namemap = ossl_namemap_stored(libctx);
  167. >     int nameid = 0;
  168.       uint32_t methid = 0;
  169.       void *method = NULL;

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

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

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

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

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

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