crypto/kdf/tls1_prf.c:256: error: NULL_DEREFERENCE
  pointer `mdname` last assigned on line 244 could be null and is dereferenced by call to `strlen()` at line 256, column 50.
Showing all 62 steps of the trace


crypto/kdf/tls1_prf.c:231:1: start of procedure tls1_prf_P_hash()
229.    *     A(i) = HMAC_<hash>(secret, A(i-1))
230.    */
231. > static int tls1_prf_P_hash(const EVP_MD *md,
232.                              const unsigned char *sec, size_t sec_len,
233.                              const unsigned char *seed, size_t seed_len,

crypto/kdf/tls1_prf.c:237:5: 
235.   {
236.       size_t chunk;
237. >     EVP_MAC *mac = NULL;
238.       EVP_MAC_CTX *ctx = NULL, *ctx_Ai = NULL, *ctx_init = NULL;
239.       unsigned char Ai[EVP_MAX_MD_SIZE];

crypto/kdf/tls1_prf.c:238:5: 
236.       size_t chunk;
237.       EVP_MAC *mac = NULL;
238. >     EVP_MAC_CTX *ctx = NULL, *ctx_Ai = NULL, *ctx_init = NULL;
239.       unsigned char Ai[EVP_MAX_MD_SIZE];
240.       size_t Ai_len;

crypto/kdf/tls1_prf.c:241:5: 
239.       unsigned char Ai[EVP_MAX_MD_SIZE];
240.       size_t Ai_len;
241. >     int ret = 0;
242.       OSSL_PARAM params[4];
243.       int mac_flags;

crypto/kdf/tls1_prf.c:244:5: 
242.       OSSL_PARAM params[4];
243.       int mac_flags;
244. >     const char *mdname = EVP_MD_name(md);
245.   
246.       mac = EVP_MAC_fetch(NULL, OSSL_MAC_NAME_HMAC, NULL); /* Implicit fetch */

crypto/evp/evp_lib.c:460:1: start of procedure EVP_MD_name()
  458.   }
  459.   
  460. > const char *EVP_MD_name(const EVP_MD *md)
  461.   {
  462.       if (md->prov != NULL)

crypto/evp/evp_lib.c:462:9: Taking false branch
  460.   const char *EVP_MD_name(const EVP_MD *md)
  461.   {
  462.       if (md->prov != NULL)
                 ^
  463.           return md->name;
  464.   #ifndef FIPS_MODE

crypto/evp/evp_lib.c:467:5: 
  465.       return OBJ_nid2sn(EVP_MD_nid(md));
  466.   #else
  467. >     return NULL;
  468.   #endif
  469.   }

crypto/evp/evp_lib.c:469:1: return from a call to EVP_MD_name
  467.       return NULL;
  468.   #endif
  469. > }
  470.   
  471.   const OSSL_PROVIDER *EVP_MD_provider(const EVP_MD *md)

crypto/kdf/tls1_prf.c:246:5: 
244.       const char *mdname = EVP_MD_name(md);
245.   
246. >     mac = EVP_MAC_fetch(NULL, OSSL_MAC_NAME_HMAC, NULL); /* Implicit fetch */
247.       ctx_init = EVP_MAC_CTX_new(mac);
248.       if (ctx_init == NULL)

crypto/evp/mac_meth.c:153:1: start of procedure EVP_MAC_fetch()
  151.   }
  152.   
  153. > EVP_MAC *EVP_MAC_fetch(OPENSSL_CTX *libctx, const char *algorithm,
  154.                          const char *properties)
  155.   {

crypto/evp/mac_meth.c:156:5: 
  154.                          const char *properties)
  155.   {
  156. >     return evp_generic_fetch(libctx, OSSL_OP_MAC, algorithm, properties,
  157.                                evp_mac_from_dispatch, evp_mac_up_ref,
  158.                                evp_mac_free);

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: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: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: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: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/mac_meth.c:159:1: return from a call to EVP_MAC_fetch
  157.                                evp_mac_from_dispatch, evp_mac_up_ref,
  158.                                evp_mac_free);
  159. > }
  160.   
  161.   int EVP_MAC_up_ref(EVP_MAC *mac)

crypto/kdf/tls1_prf.c:247:5: Skipping EVP_MAC_CTX_new(): empty list of specs
245.   
246.       mac = EVP_MAC_fetch(NULL, OSSL_MAC_NAME_HMAC, NULL); /* Implicit fetch */
247.       ctx_init = EVP_MAC_CTX_new(mac);
           ^
248.       if (ctx_init == NULL)
249.           goto err;

crypto/kdf/tls1_prf.c:248:9: Taking false branch
246.       mac = EVP_MAC_fetch(NULL, OSSL_MAC_NAME_HMAC, NULL); /* Implicit fetch */
247.       ctx_init = EVP_MAC_CTX_new(mac);
248.       if (ctx_init == NULL)
               ^
249.           goto err;
250.   

crypto/kdf/tls1_prf.c:252:5: 
250.   
251.       /* TODO(3.0) rethink "flags", also see hmac.c in providers */
252. >     mac_flags = EVP_MD_CTX_FLAG_NON_FIPS_ALLOW;
253.       params[0] = OSSL_PARAM_construct_int(OSSL_MAC_PARAM_FLAGS, &mac_flags);
254.       params[1] = OSSL_PARAM_construct_utf8_string(OSSL_MAC_PARAM_DIGEST,

crypto/kdf/tls1_prf.c:253:5: 
251.       /* TODO(3.0) rethink "flags", also see hmac.c in providers */
252.       mac_flags = EVP_MD_CTX_FLAG_NON_FIPS_ALLOW;
253. >     params[0] = OSSL_PARAM_construct_int(OSSL_MAC_PARAM_FLAGS, &mac_flags);
254.       params[1] = OSSL_PARAM_construct_utf8_string(OSSL_MAC_PARAM_DIGEST,
255.                                                    (char *)mdname,

crypto/params.c:65:1: start of procedure OSSL_PARAM_construct_int()
  63.   }
  64.   
  65. > OSSL_PARAM OSSL_PARAM_construct_int(const char *key, int *buf)
  66.   {
  67.       return ossl_param_construct(key, OSSL_PARAM_INTEGER, buf, sizeof(int));

crypto/params.c:67:5: 
  65.   OSSL_PARAM OSSL_PARAM_construct_int(const char *key, int *buf)
  66.   {
  67. >     return ossl_param_construct(key, OSSL_PARAM_INTEGER, buf, sizeof(int));
  68.   }
  69.   

crypto/params.c:30:1: start of procedure ossl_param_construct()
    28.   }
    29.   
    30. > static OSSL_PARAM ossl_param_construct(const char *key, unsigned int data_type,
    31.                                          void *data, size_t data_size)
    32.   {

crypto/params.c:35:5: 
    33.       OSSL_PARAM res;
    34.   
    35. >     res.key = key;
    36.       res.data_type = data_type;
    37.       res.data = data;

crypto/params.c:36:5: 
    34.   
    35.       res.key = key;
    36. >     res.data_type = data_type;
    37.       res.data = data;
    38.       res.data_size = data_size;

crypto/params.c:37:5: 
    35.       res.key = key;
    36.       res.data_type = data_type;
    37. >     res.data = data;
    38.       res.data_size = data_size;
    39.       res.return_size = 0;

crypto/params.c:38:5: 
    36.       res.data_type = data_type;
    37.       res.data = data;
    38. >     res.data_size = data_size;
    39.       res.return_size = 0;
    40.       return res;

crypto/params.c:39:5: 
    37.       res.data = data;
    38.       res.data_size = data_size;
    39. >     res.return_size = 0;
    40.       return res;
    41.   }

crypto/params.c:40:5: 
    38.       res.data_size = data_size;
    39.       res.return_size = 0;
    40. >     return res;
    41.   }
    42.   

crypto/params.c:41:1: return from a call to ossl_param_construct
    39.       res.return_size = 0;
    40.       return res;
    41. > }
    42.   
    43.   int OSSL_PARAM_get_int(const OSSL_PARAM *p, int *val)

crypto/params.c:68:1: return from a call to OSSL_PARAM_construct_int
  66.   {
  67.       return ossl_param_construct(key, OSSL_PARAM_INTEGER, buf, sizeof(int));
  68. > }
  69.   
  70.   int OSSL_PARAM_get_uint(const OSSL_PARAM *p, unsigned int *val)

crypto/kdf/tls1_prf.c:254:5: 
252.       mac_flags = EVP_MD_CTX_FLAG_NON_FIPS_ALLOW;
253.       params[0] = OSSL_PARAM_construct_int(OSSL_MAC_PARAM_FLAGS, &mac_flags);
254. >     params[1] = OSSL_PARAM_construct_utf8_string(OSSL_MAC_PARAM_DIGEST,
255.                                                    (char *)mdname,
256.                                                    strlen(mdname) + 1);
