crypto/ec/ec_25519.c:73: error: NULL_DEREFERENCE
  pointer `eckey->custom_data` last assigned on line 70 could be null and is dereferenced by call to `BN_bn2lebinpad()` at line 73, column 9.
Showing all 47 steps of the trace


crypto/ec/ec_25519.c:66:1: start of procedure x25519_set_private()
64.   }
65.   
66. > static int x25519_set_private(EC_KEY *eckey, const BIGNUM *priv_key)
67.   {
68.       if (BN_num_bytes(priv_key) > EC_X25519_KEYLEN)

crypto/ec/ec_25519.c:68:9: 
66.   static int x25519_set_private(EC_KEY *eckey, const BIGNUM *priv_key)
67.   {
68. >     if (BN_num_bytes(priv_key) > EC_X25519_KEYLEN)
69.           return 0;
70.       if (x25519_init_private(eckey, NULL))

crypto/bn/bn_lib.c:161:1: start of procedure BN_num_bits()
  159.   }
  160.   
  161. > int BN_num_bits(const BIGNUM *a)
  162.   {
  163.       int i = a->top - 1;

crypto/bn/bn_lib.c:163:5: 
  161.   int BN_num_bits(const BIGNUM *a)
  162.   {
  163. >     int i = a->top - 1;
  164.       bn_check_top(a);
  165.   

crypto/bn/bn_lib.c:166:9: 
  164.       bn_check_top(a);
  165.   
  166. >     if (BN_is_zero(a))
  167.           return 0;
  168.       return ((i * BN_BITS2) + BN_num_bits_word(a->d[i]));

crypto/bn/bn_lib.c:918:1: start of procedure BN_is_zero()
    916.   }
    917.   
    918. > int BN_is_zero(const BIGNUM *a)
    919.   {
    920.       return a->top == 0;

crypto/bn/bn_lib.c:920:12: Condition is false
    918.   int BN_is_zero(const BIGNUM *a)
    919.   {
    920.       return a->top == 0;
                      ^
    921.   }
    922.   

crypto/bn/bn_lib.c:920:5: 
    918.   int BN_is_zero(const BIGNUM *a)
    919.   {
    920. >     return a->top == 0;
    921.   }
    922.   

crypto/bn/bn_lib.c:921:1: return from a call to BN_is_zero
    919.   {
    920.       return a->top == 0;
    921. > }
    922.   
    923.   int BN_is_one(const BIGNUM *a)

crypto/bn/bn_lib.c:166:9: Taking false branch
  164.       bn_check_top(a);
  165.   
  166.       if (BN_is_zero(a))
                 ^
  167.           return 0;
  168.       return ((i * BN_BITS2) + BN_num_bits_word(a->d[i]));

crypto/bn/bn_lib.c:168:5: Skipping BN_num_bits_word(): empty list of specs
  166.       if (BN_is_zero(a))
  167.           return 0;
  168.       return ((i * BN_BITS2) + BN_num_bits_word(a->d[i]));
             ^
  169.   }
  170.   

crypto/bn/bn_lib.c:169:1: return from a call to BN_num_bits
  167.           return 0;
  168.       return ((i * BN_BITS2) + BN_num_bits_word(a->d[i]));
  169. > }
  170.   
  171.   static void bn_free_d(BIGNUM *a)

crypto/ec/ec_25519.c:68:9: Taking false branch
66.   static int x25519_set_private(EC_KEY *eckey, const BIGNUM *priv_key)
67.   {
68.       if (BN_num_bytes(priv_key) > EC_X25519_KEYLEN)
              ^
69.           return 0;
70.       if (x25519_init_private(eckey, NULL))

crypto/ec/ec_25519.c:70:9: 
68.       if (BN_num_bytes(priv_key) > EC_X25519_KEYLEN)
69.           return 0;
70. >     if (x25519_init_private(eckey, NULL))
71.           return 0;
72.       /* Convert BIGNUM form private key to internal format */

crypto/ec/ec_25519.c:34:1: start of procedure x25519_init_private()
  32.   
  33.   /* Copy Curve25519 private key buffer, allocating is necessary */
  34. > static int x25519_init_private(EC_KEY *dst, const void *src)
  35.   {
  36.       if (dst->custom_data == NULL) {

crypto/ec/ec_25519.c:36:9: Taking true branch
  34.   static int x25519_init_private(EC_KEY *dst, const void *src)
  35.   {
  36.       if (dst->custom_data == NULL) {
                ^
  37.           dst->custom_data = OPENSSL_secure_malloc(EC_X25519_KEYLEN);
  38.           if (dst->custom_data == NULL)

crypto/ec/ec_25519.c:37:9: 
  35.   {
  36.       if (dst->custom_data == NULL) {
  37. >         dst->custom_data = OPENSSL_secure_malloc(EC_X25519_KEYLEN);
  38.           if (dst->custom_data == NULL)
  39.               return 0;

crypto/mem_sec.c:103:1: start of procedure CRYPTO_secure_malloc()
    101.   }
    102.   
    103. > void *CRYPTO_secure_malloc(size_t num, const char *file, int line)
    104.   {
    105.   #ifdef IMPLEMENTED

crypto/mem_sec.c:109:10: Taking true branch
    107.       size_t actual_size;
    108.   
    109.       if (!secure_mem_initialized) {
                    ^
    110.           return CRYPTO_malloc(num, file, line);
    111.       }

crypto/mem_sec.c:110:9: 
    108.   
    109.       if (!secure_mem_initialized) {
    110. >         return CRYPTO_malloc(num, file, line);
    111.       }
    112.       CRYPTO_THREAD_write_lock(sec_malloc_lock);

crypto/mem.c:71:1: start of procedure CRYPTO_malloc()
      69.   }
      70.   
      71. > void *CRYPTO_malloc(size_t num, const char *file, int line)
      72.   {
      73.       void *ret = NULL;

crypto/mem.c:73:5: 
      71.   void *CRYPTO_malloc(size_t num, const char *file, int line)
      72.   {
      73. >     void *ret = NULL;
      74.   
      75.       if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)

crypto/mem.c:75:9: Taking true branch
      73.       void *ret = NULL;
      74.   
      75.       if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)
                    ^
      76.           return malloc_impl(num, file, line);
      77.   

crypto/mem.c:75:32: Taking true branch
      73.       void *ret = NULL;
      74.   
      75.       if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)
                                           ^
      76.           return malloc_impl(num, file, line);
      77.   

crypto/mem.c:76:9: Skipping __function_pointer__(): unresolved function pointer
      74.   
      75.       if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)
      76.           return malloc_impl(num, file, line);
                    ^
      77.   
      78.       if (num <= 0)

crypto/mem.c:96:1: return from a call to CRYPTO_malloc
      94.   
      95.       return ret;
      96. > }
      97.   
      98.   void *CRYPTO_zalloc(size_t num, const char *file, int line)

crypto/mem_sec.c:121:1: return from a call to CRYPTO_secure_malloc
    119.       return CRYPTO_malloc(num, file, line);
    120.   #endif /* IMPLEMENTED */
    121. > }
    122.   
    123.   void *CRYPTO_secure_zalloc(size_t num, const char *file, int line)

crypto/ec/ec_25519.c:38:13: Taking true branch
  36.       if (dst->custom_data == NULL) {
  37.           dst->custom_data = OPENSSL_secure_malloc(EC_X25519_KEYLEN);
  38.           if (dst->custom_data == NULL)
                    ^
  39.               return 0;
  40.       }

crypto/ec/ec_25519.c:39:13: 
  37.           dst->custom_data = OPENSSL_secure_malloc(EC_X25519_KEYLEN);
  38.           if (dst->custom_data == NULL)
  39. >             return 0;
  40.       }
  41.       if (src != NULL)

crypto/ec/ec_25519.c:44:1: return from a call to x25519_init_private
  42.           memcpy(dst->custom_data, src, EC_X25519_KEYLEN);
  43.       return 1;
  44. > }
  45.   
  46.   static int x25519_group_init(EC_GROUP *grp)

crypto/ec/ec_25519.c:70:9: Taking false branch
68.       if (BN_num_bytes(priv_key) > EC_X25519_KEYLEN)
69.           return 0;
70.       if (x25519_init_private(eckey, NULL))
              ^
71.           return 0;
72.       /* Convert BIGNUM form private key to internal format */

crypto/ec/ec_25519.c:73:9: 
71.           return 0;
72.       /* Convert BIGNUM form private key to internal format */
73. >     if (BN_bn2lebinpad(priv_key, eckey->custom_data, EC_X25519_KEYLEN)
74.           != EC_X25519_KEYLEN)
75.           return 0;

crypto/bn/bn_lib.c:602:1: start of procedure BN_bn2lebinpad()
  600.   }
  601.   
  602. > int BN_bn2lebinpad(const BIGNUM *a, unsigned char *to, int tolen)
  603.   {
  604.       int i;

crypto/bn/bn_lib.c:607:5: 
  605.       BN_ULONG l;
  606.       bn_check_top(a);
  607. >     i = BN_num_bytes(a);
  608.       if (tolen < i)
  609.           return -1;

crypto/bn/bn_lib.c:161:1: start of procedure BN_num_bits()
    159.   }
    160.   
    161. > int BN_num_bits(const BIGNUM *a)
    162.   {
    163.       int i = a->top - 1;

crypto/bn/bn_lib.c:163:5: 
    161.   int BN_num_bits(const BIGNUM *a)
    162.   {
    163. >     int i = a->top - 1;
    164.       bn_check_top(a);
    165.   

crypto/bn/bn_lib.c:166:9: 
    164.       bn_check_top(a);
    165.   
    166. >     if (BN_is_zero(a))
    167.           return 0;
    168.       return ((i * BN_BITS2) + BN_num_bits_word(a->d[i]));

crypto/bn/bn_lib.c:918:1: start of procedure BN_is_zero()
      916.   }
      917.   
      918. > int BN_is_zero(const BIGNUM *a)
      919.   {
      920.       return a->top == 0;

crypto/bn/bn_lib.c:920:12: Condition is false
      918.   int BN_is_zero(const BIGNUM *a)
      919.   {
      920.       return a->top == 0;
                        ^
      921.   }
      922.   

crypto/bn/bn_lib.c:920:5: 
      918.   int BN_is_zero(const BIGNUM *a)
      919.   {
      920. >     return a->top == 0;
      921.   }
      922.   

crypto/bn/bn_lib.c:921:1: return from a call to BN_is_zero
      919.   {
      920.       return a->top == 0;
      921. > }
      922.   
      923.   int BN_is_one(const BIGNUM *a)

crypto/bn/bn_lib.c:166:9: Taking false branch
    164.       bn_check_top(a);
    165.   
    166.       if (BN_is_zero(a))
                   ^
    167.           return 0;
    168.       return ((i * BN_BITS2) + BN_num_bits_word(a->d[i]));

crypto/bn/bn_lib.c:168:5: Skipping BN_num_bits_word(): empty list of specs
    166.       if (BN_is_zero(a))
    167.           return 0;
    168.       return ((i * BN_BITS2) + BN_num_bits_word(a->d[i]));
               ^
    169.   }
    170.   

crypto/bn/bn_lib.c:169:1: return from a call to BN_num_bits
    167.           return 0;
    168.       return ((i * BN_BITS2) + BN_num_bits_word(a->d[i]));
    169. > }
    170.   
    171.   static void bn_free_d(BIGNUM *a)

crypto/bn/bn_lib.c:608:9: Taking true branch
  606.       bn_check_top(a);
  607.       i = BN_num_bytes(a);
  608.       if (tolen < i)
                 ^
  609.           return -1;
  610.       /* Add trailing zeroes if necessary */

crypto/bn/bn_lib.c:609:9: 
  607.       i = BN_num_bytes(a);
  608.       if (tolen < i)
  609. >         return -1;
  610.       /* Add trailing zeroes if necessary */
  611.       if (tolen > i)

crypto/bn/bn_lib.c:619:1: return from a call to BN_bn2lebinpad
  617.       }
  618.       return tolen;
  619. > }
  620.   
  621.   int BN_ucmp(const BIGNUM *a, const BIGNUM *b)
