test/exptest.c:177: error: MEMORY_LEAK
  memory dynamically allocated by call to `BN_new()` at line 120, column 9 is not reachable after line 177, column 5.
Showing all 253 steps of the trace


test/exptest.c:97:1: start of procedure test_exp_mod_zero()
95.    * test_exp_mod_zero tests that x**0 mod 1 == 0. It returns zero on success.
96.    */
97. > static int test_exp_mod_zero()
98.   {
99.       BIGNUM *a = NULL, *p = NULL, *m = NULL;

test/exptest.c:99:5: 
97.   static int test_exp_mod_zero()
98.   {
99. >     BIGNUM *a = NULL, *p = NULL, *m = NULL;
100.       BIGNUM *r = NULL;
101.       BN_ULONG one_word = 1;

test/exptest.c:100:5: 
98.   {
99.       BIGNUM *a = NULL, *p = NULL, *m = NULL;
100. >     BIGNUM *r = NULL;
101.       BN_ULONG one_word = 1;
102.       BN_CTX *ctx = BN_CTX_new();

test/exptest.c:101:5: 
99.       BIGNUM *a = NULL, *p = NULL, *m = NULL;
100.       BIGNUM *r = NULL;
101. >     BN_ULONG one_word = 1;
102.       BN_CTX *ctx = BN_CTX_new();
103.       int ret = 1, failed = 0;

test/exptest.c:102:5: 
100.       BIGNUM *r = NULL;
101.       BN_ULONG one_word = 1;
102. >     BN_CTX *ctx = BN_CTX_new();
103.       int ret = 1, failed = 0;
104.   

crypto/bn/bn_ctx.c:189:1: start of procedure BN_CTX_new()
  187.   
  188.   
  189. > BN_CTX *BN_CTX_new(void)
  190.   {
  191.       BN_CTX *ret;

crypto/bn/bn_ctx.c:193:9: 
  191.       BN_CTX *ret;
  192.   
  193. >     if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) {
  194.           BNerr(BN_F_BN_CTX_NEW, ERR_R_MALLOC_FAILURE);
  195.           return NULL;

crypto/mem.c:157:1: start of procedure CRYPTO_zalloc()
    155.   }
    156.   
    157. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
    158.   {
    159.       void *ret = CRYPTO_malloc(num, file, line);

crypto/mem.c:159:5: 
    157.   void *CRYPTO_zalloc(size_t num, const char *file, int line)
    158.   {
    159. >     void *ret = CRYPTO_malloc(num, file, line);
    160.   
    161.       if (ret != NULL)

crypto/mem.c:120:1: start of procedure CRYPTO_malloc()
      118.   }
      119.   
      120. > void *CRYPTO_malloc(size_t num, const char *file, int line)
      121.   {
      122.       void *ret = NULL;

crypto/mem.c:122:5: 
      120.   void *CRYPTO_malloc(size_t num, const char *file, int line)
      121.   {
      122. >     void *ret = NULL;
      123.   
      124.       if (num <= 0)

crypto/mem.c:124:9: Taking false branch
      122.       void *ret = NULL;
      123.   
      124.       if (num <= 0)
                     ^
      125.           return NULL;
      126.   

crypto/mem.c:127:5: 
      125.           return NULL;
      126.   
      127. >     allow_customize = 0;
      128.   #ifndef OPENSSL_NO_CRYPTO_MDEBUG
      129.       if (call_malloc_debug) {

crypto/mem.c:137:5: 
      135.       }
      136.   #else
      137. >     (void)file;
      138.       (void)line;
      139.       ret = malloc(num);

crypto/mem.c:138:5: 
      136.   #else
      137.       (void)file;
      138. >     (void)line;
      139.       ret = malloc(num);
      140.   #endif

crypto/mem.c:139:5: 
      137.       (void)file;
      138.       (void)line;
      139. >     ret = malloc(num);
      140.   #endif
      141.   

crypto/mem.c:154:5: 
      152.   #endif
      153.   
      154. >     return ret;
      155.   }
      156.   

crypto/mem.c:155:1: return from a call to CRYPTO_malloc
      153.   
      154.       return ret;
      155. > }
      156.   
      157.   void *CRYPTO_zalloc(size_t num, const char *file, int line)

crypto/mem.c:161:9: Taking true branch
    159.       void *ret = CRYPTO_malloc(num, file, line);
    160.   
    161.       if (ret != NULL)
                   ^
    162.           memset(ret, 0, num);
    163.       return ret;

crypto/mem.c:162:9: 
    160.   
    161.       if (ret != NULL)
    162. >         memset(ret, 0, num);
    163.       return ret;
    164.   }

crypto/mem.c:163:5: 
    161.       if (ret != NULL)
    162.           memset(ret, 0, num);
    163. >     return ret;
    164.   }
    165.   

crypto/mem.c:164:1: return from a call to CRYPTO_zalloc
    162.           memset(ret, 0, num);
    163.       return ret;
    164. > }
    165.   
    166.   void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)

crypto/bn/bn_ctx.c:193:9: Taking false branch
  191.       BN_CTX *ret;
  192.   
  193.       if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) {
                 ^
  194.           BNerr(BN_F_BN_CTX_NEW, ERR_R_MALLOC_FAILURE);
  195.           return NULL;

crypto/bn/bn_ctx.c:198:5: 
  196.       }
  197.       /* Initialise the structure */
  198. >     BN_POOL_init(&ret->pool);
  199.       BN_STACK_init(&ret->stack);
  200.       return ret;

crypto/bn/bn_ctx.c:335:1: start of procedure BN_POOL_init()
    333.   /***********/
    334.   
    335. > static void BN_POOL_init(BN_POOL *p)
    336.   {
    337.       p->head = p->current = p->tail = NULL;

crypto/bn/bn_ctx.c:337:5: 
    335.   static void BN_POOL_init(BN_POOL *p)
    336.   {
    337. >     p->head = p->current = p->tail = NULL;
    338.       p->used = p->size = 0;
    339.   }

crypto/bn/bn_ctx.c:338:5: 
    336.   {
    337.       p->head = p->current = p->tail = NULL;
    338. >     p->used = p->size = 0;
    339.   }
    340.   

crypto/bn/bn_ctx.c:339:1: return from a call to BN_POOL_init
    337.       p->head = p->current = p->tail = NULL;
    338.       p->used = p->size = 0;
    339. > }
    340.   
    341.   static void BN_POOL_finish(BN_POOL *p)

crypto/bn/bn_ctx.c:199:5: 
  197.       /* Initialise the structure */
  198.       BN_POOL_init(&ret->pool);
  199. >     BN_STACK_init(&ret->stack);
  200.       return ret;
  201.   }

crypto/bn/bn_ctx.c:294:1: start of procedure BN_STACK_init()
    292.   /************/
    293.   
    294. > static void BN_STACK_init(BN_STACK *st)
    295.   {
    296.       st->indexes = NULL;

crypto/bn/bn_ctx.c:296:5: 
    294.   static void BN_STACK_init(BN_STACK *st)
    295.   {
    296. >     st->indexes = NULL;
    297.       st->depth = st->size = 0;
    298.   }

crypto/bn/bn_ctx.c:297:5: 
    295.   {
    296.       st->indexes = NULL;
    297. >     st->depth = st->size = 0;
    298.   }
    299.   

crypto/bn/bn_ctx.c:298:1: return from a call to BN_STACK_init
    296.       st->indexes = NULL;
    297.       st->depth = st->size = 0;
    298. > }
    299.   
    300.   static void BN_STACK_finish(BN_STACK *st)

crypto/bn/bn_ctx.c:200:5: 
  198.       BN_POOL_init(&ret->pool);
  199.       BN_STACK_init(&ret->stack);
  200. >     return ret;
  201.   }
  202.   

crypto/bn/bn_ctx.c:201:1: return from a call to BN_CTX_new
  199.       BN_STACK_init(&ret->stack);
  200.       return ret;
  201. > }
  202.   
  203.   BN_CTX *BN_CTX_secure_new(void)

test/exptest.c:103:5: 
101.       BN_ULONG one_word = 1;
102.       BN_CTX *ctx = BN_CTX_new();
103. >     int ret = 1, failed = 0;
104.   
105.       m = BN_new();

test/exptest.c:105:5: 
103.       int ret = 1, failed = 0;
104.   
105. >     m = BN_new();
106.       if (!m)
107.           goto err;

crypto/bn/bn_lib.c:277:1: start of procedure BN_new()
  275.   }
  276.   
  277. > BIGNUM *BN_new(void)
  278.   {
  279.       BIGNUM *ret;

crypto/bn/bn_lib.c:281:9: 
  279.       BIGNUM *ret;
  280.   
  281. >     if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) {
  282.           BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE);
  283.           return (NULL);

crypto/mem.c:157:1: start of procedure CRYPTO_zalloc()
    155.   }
    156.   
    157. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
    158.   {
    159.       void *ret = CRYPTO_malloc(num, file, line);

crypto/mem.c:159:5: 
    157.   void *CRYPTO_zalloc(size_t num, const char *file, int line)
    158.   {
    159. >     void *ret = CRYPTO_malloc(num, file, line);
    160.   
    161.       if (ret != NULL)

crypto/mem.c:120:1: start of procedure CRYPTO_malloc()
      118.   }
      119.   
      120. > void *CRYPTO_malloc(size_t num, const char *file, int line)
      121.   {
      122.       void *ret = NULL;

crypto/mem.c:122:5: 
      120.   void *CRYPTO_malloc(size_t num, const char *file, int line)
      121.   {
      122. >     void *ret = NULL;
      123.   
      124.       if (num <= 0)

crypto/mem.c:124:9: Taking false branch
      122.       void *ret = NULL;
      123.   
      124.       if (num <= 0)
                     ^
      125.           return NULL;
      126.   

crypto/mem.c:127:5: 
      125.           return NULL;
      126.   
      127. >     allow_customize = 0;
      128.   #ifndef OPENSSL_NO_CRYPTO_MDEBUG
      129.       if (call_malloc_debug) {

crypto/mem.c:137:5: 
      135.       }
      136.   #else
      137. >     (void)file;
      138.       (void)line;
      139.       ret = malloc(num);

crypto/mem.c:138:5: 
      136.   #else
      137.       (void)file;
      138. >     (void)line;
      139.       ret = malloc(num);
      140.   #endif

crypto/mem.c:139:5: 
      137.       (void)file;
      138.       (void)line;
      139. >     ret = malloc(num);
      140.   #endif
      141.   

crypto/mem.c:154:5: 
      152.   #endif
      153.   
      154. >     return ret;
      155.   }
      156.   

crypto/mem.c:155:1: return from a call to CRYPTO_malloc
      153.   
      154.       return ret;
      155. > }
      156.   
      157.   void *CRYPTO_zalloc(size_t num, const char *file, int line)

crypto/mem.c:161:9: Taking true branch
    159.       void *ret = CRYPTO_malloc(num, file, line);
    160.   
    161.       if (ret != NULL)
                   ^
    162.           memset(ret, 0, num);
    163.       return ret;

crypto/mem.c:162:9: 
    160.   
    161.       if (ret != NULL)
    162. >         memset(ret, 0, num);
    163.       return ret;
    164.   }

crypto/mem.c:163:5: 
    161.       if (ret != NULL)
    162.           memset(ret, 0, num);
    163. >     return ret;
    164.   }
    165.   

crypto/mem.c:164:1: return from a call to CRYPTO_zalloc
    162.           memset(ret, 0, num);
    163.       return ret;
    164. > }
    165.   
    166.   void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)

crypto/bn/bn_lib.c:281:9: Taking false branch
  279.       BIGNUM *ret;
  280.   
  281.       if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) {
                 ^
  282.           BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE);
  283.           return (NULL);

crypto/bn/bn_lib.c:285:5: 
  283.           return (NULL);
  284.       }
  285. >     ret->flags = BN_FLG_MALLOCED;
  286.       bn_check_top(ret);
  287.       return (ret);

crypto/bn/bn_lib.c:287:5: 
  285.       ret->flags = BN_FLG_MALLOCED;
  286.       bn_check_top(ret);
  287. >     return (ret);
  288.   }
  289.   

crypto/bn/bn_lib.c:288:1: return from a call to BN_new
  286.       bn_check_top(ret);
  287.       return (ret);
  288. > }
  289.   
  290.    BIGNUM *BN_secure_new(void)

test/exptest.c:106:10: Taking false branch
104.   
105.       m = BN_new();
106.       if (!m)
                ^
107.           goto err;
108.       BN_one(m);

test/exptest.c:108:5: 
106.       if (!m)
107.           goto err;
108. >     BN_one(m);
109.   
110.       a = BN_new();

crypto/bn/bn_lib.c:530:1: start of procedure BN_set_word()
  528.   }
  529.   
  530. > int BN_set_word(BIGNUM *a, BN_ULONG w)
  531.   {
  532.       bn_check_top(a);

crypto/bn/bn_lib.c:533:9: Condition is true
  531.   {
  532.       bn_check_top(a);
  533.       if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL)
                 ^
  534.           return (0);
  535.       a->neg = 0;

crypto/bn/bn_lib.c:533:9: Taking false branch
  531.   {
  532.       bn_check_top(a);
  533.       if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL)
                 ^
  534.           return (0);
  535.       a->neg = 0;

crypto/bn/bn_lib.c:535:5: 
  533.       if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL)
  534.           return (0);
  535. >     a->neg = 0;
  536.       a->d[0] = w;
  537.       a->top = (w ? 1 : 0);

crypto/bn/bn_lib.c:536:5: 
  534.           return (0);
  535.       a->neg = 0;
  536. >     a->d[0] = w;
  537.       a->top = (w ? 1 : 0);
  538.       bn_check_top(a);

crypto/bn/bn_lib.c:537:15: Condition is true
  535.       a->neg = 0;
  536.       a->d[0] = w;
  537.       a->top = (w ? 1 : 0);
                       ^
  538.       bn_check_top(a);
  539.       return (1);

crypto/bn/bn_lib.c:537:5: 
  535.       a->neg = 0;
  536.       a->d[0] = w;
  537. >     a->top = (w ? 1 : 0);
  538.       bn_check_top(a);
  539.       return (1);

crypto/bn/bn_lib.c:539:5: 
  537.       a->top = (w ? 1 : 0);
  538.       bn_check_top(a);
  539. >     return (1);
  540.   }
  541.   

crypto/bn/bn_lib.c:540:1: return from a call to BN_set_word
  538.       bn_check_top(a);
  539.       return (1);
  540. > }
  541.   
  542.   BIGNUM *BN_bin2bn(const unsigned char *s, int len, BIGNUM *ret)

test/exptest.c:110:5: 
108.       BN_one(m);
109.   
110. >     a = BN_new();
111.       if (!a)
112.           goto err;

crypto/bn/bn_lib.c:277:1: start of procedure BN_new()
  275.   }
  276.   
  277. > BIGNUM *BN_new(void)
  278.   {
  279.       BIGNUM *ret;

crypto/bn/bn_lib.c:281:9: 
  279.       BIGNUM *ret;
  280.   
  281. >     if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) {
  282.           BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE);
  283.           return (NULL);

crypto/mem.c:157:1: start of procedure CRYPTO_zalloc()
    155.   }
    156.   
    157. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
    158.   {
    159.       void *ret = CRYPTO_malloc(num, file, line);

crypto/mem.c:159:5: 
    157.   void *CRYPTO_zalloc(size_t num, const char *file, int line)
    158.   {
    159. >     void *ret = CRYPTO_malloc(num, file, line);
    160.   
    161.       if (ret != NULL)

crypto/mem.c:120:1: start of procedure CRYPTO_malloc()
      118.   }
      119.   
      120. > void *CRYPTO_malloc(size_t num, const char *file, int line)
      121.   {
      122.       void *ret = NULL;

crypto/mem.c:122:5: 
      120.   void *CRYPTO_malloc(size_t num, const char *file, int line)
      121.   {
      122. >     void *ret = NULL;
      123.   
      124.       if (num <= 0)

crypto/mem.c:124:9: Taking false branch
      122.       void *ret = NULL;
      123.   
      124.       if (num <= 0)
                     ^
      125.           return NULL;
      126.   

crypto/mem.c:127:5: 
      125.           return NULL;
      126.   
      127. >     allow_customize = 0;
      128.   #ifndef OPENSSL_NO_CRYPTO_MDEBUG
      129.       if (call_malloc_debug) {

crypto/mem.c:137:5: 
      135.       }
      136.   #else
      137. >     (void)file;
      138.       (void)line;
      139.       ret = malloc(num);

crypto/mem.c:138:5: 
      136.   #else
      137.       (void)file;
      138. >     (void)line;
      139.       ret = malloc(num);
      140.   #endif

crypto/mem.c:139:5: 
      137.       (void)file;
      138.       (void)line;
      139. >     ret = malloc(num);
      140.   #endif
      141.   

crypto/mem.c:154:5: 
      152.   #endif
      153.   
      154. >     return ret;
      155.   }
      156.   

crypto/mem.c:155:1: return from a call to CRYPTO_malloc
      153.   
      154.       return ret;
      155. > }
      156.   
      157.   void *CRYPTO_zalloc(size_t num, const char *file, int line)

crypto/mem.c:161:9: Taking true branch
    159.       void *ret = CRYPTO_malloc(num, file, line);
    160.   
    161.       if (ret != NULL)
                   ^
    162.           memset(ret, 0, num);
    163.       return ret;

crypto/mem.c:162:9: 
    160.   
    161.       if (ret != NULL)
    162. >         memset(ret, 0, num);
    163.       return ret;
    164.   }

crypto/mem.c:163:5: 
    161.       if (ret != NULL)
    162.           memset(ret, 0, num);
    163. >     return ret;
    164.   }
    165.   

crypto/mem.c:164:1: return from a call to CRYPTO_zalloc
    162.           memset(ret, 0, num);
    163.       return ret;
    164. > }
    165.   
    166.   void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)

crypto/bn/bn_lib.c:281:9: Taking false branch
  279.       BIGNUM *ret;
  280.   
  281.       if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) {
                 ^
  282.           BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE);
  283.           return (NULL);

crypto/bn/bn_lib.c:285:5: 
  283.           return (NULL);
  284.       }
  285. >     ret->flags = BN_FLG_MALLOCED;
  286.       bn_check_top(ret);
  287.       return (ret);

crypto/bn/bn_lib.c:287:5: 
  285.       ret->flags = BN_FLG_MALLOCED;
  286.       bn_check_top(ret);
  287. >     return (ret);
  288.   }
  289.   

crypto/bn/bn_lib.c:288:1: return from a call to BN_new
  286.       bn_check_top(ret);
  287.       return (ret);
  288. > }
  289.   
  290.    BIGNUM *BN_secure_new(void)

test/exptest.c:111:10: Taking false branch
109.   
110.       a = BN_new();
111.       if (!a)
                ^
112.           goto err;
113.       BN_one(a);

test/exptest.c:113:5: 
111.       if (!a)
112.           goto err;
113. >     BN_one(a);
114.   
115.       p = BN_new();

crypto/bn/bn_lib.c:530:1: start of procedure BN_set_word()
  528.   }
  529.   
  530. > int BN_set_word(BIGNUM *a, BN_ULONG w)
  531.   {
  532.       bn_check_top(a);

crypto/bn/bn_lib.c:533:9: Condition is true
  531.   {
  532.       bn_check_top(a);
  533.       if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL)
                 ^
  534.           return (0);
  535.       a->neg = 0;

crypto/bn/bn_lib.c:533:9: Taking false branch
  531.   {
  532.       bn_check_top(a);
  533.       if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL)
                 ^
  534.           return (0);
  535.       a->neg = 0;

crypto/bn/bn_lib.c:535:5: 
  533.       if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL)
  534.           return (0);
  535. >     a->neg = 0;
  536.       a->d[0] = w;
  537.       a->top = (w ? 1 : 0);

crypto/bn/bn_lib.c:536:5: 
  534.           return (0);
  535.       a->neg = 0;
  536. >     a->d[0] = w;
  537.       a->top = (w ? 1 : 0);
  538.       bn_check_top(a);

crypto/bn/bn_lib.c:537:15: Condition is true
  535.       a->neg = 0;
  536.       a->d[0] = w;
  537.       a->top = (w ? 1 : 0);
                       ^
  538.       bn_check_top(a);
  539.       return (1);

crypto/bn/bn_lib.c:537:5: 
  535.       a->neg = 0;
  536.       a->d[0] = w;
  537. >     a->top = (w ? 1 : 0);
  538.       bn_check_top(a);
  539.       return (1);

crypto/bn/bn_lib.c:539:5: 
  537.       a->top = (w ? 1 : 0);
  538.       bn_check_top(a);
  539. >     return (1);
  540.   }
  541.   

crypto/bn/bn_lib.c:540:1: return from a call to BN_set_word
  538.       bn_check_top(a);
  539.       return (1);
  540. > }
  541.   
  542.   BIGNUM *BN_bin2bn(const unsigned char *s, int len, BIGNUM *ret)

test/exptest.c:115:5: 
113.       BN_one(a);
114.   
115. >     p = BN_new();
116.       if (!p)
117.           goto err;

crypto/bn/bn_lib.c:277:1: start of procedure BN_new()
  275.   }
  276.   
  277. > BIGNUM *BN_new(void)
  278.   {
  279.       BIGNUM *ret;

crypto/bn/bn_lib.c:281:9: 
  279.       BIGNUM *ret;
  280.   
  281. >     if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) {
  282.           BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE);
  283.           return (NULL);

crypto/mem.c:157:1: start of procedure CRYPTO_zalloc()
    155.   }
    156.   
    157. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
    158.   {
    159.       void *ret = CRYPTO_malloc(num, file, line);

crypto/mem.c:159:5: 
    157.   void *CRYPTO_zalloc(size_t num, const char *file, int line)
    158.   {
    159. >     void *ret = CRYPTO_malloc(num, file, line);
    160.   
    161.       if (ret != NULL)

crypto/mem.c:120:1: start of procedure CRYPTO_malloc()
      118.   }
      119.   
      120. > void *CRYPTO_malloc(size_t num, const char *file, int line)
      121.   {
      122.       void *ret = NULL;

crypto/mem.c:122:5: 
      120.   void *CRYPTO_malloc(size_t num, const char *file, int line)
      121.   {
      122. >     void *ret = NULL;
      123.   
      124.       if (num <= 0)

crypto/mem.c:124:9: Taking false branch
      122.       void *ret = NULL;
      123.   
      124.       if (num <= 0)
                     ^
      125.           return NULL;
      126.   

crypto/mem.c:127:5: 
      125.           return NULL;
      126.   
      127. >     allow_customize = 0;
      128.   #ifndef OPENSSL_NO_CRYPTO_MDEBUG
      129.       if (call_malloc_debug) {

crypto/mem.c:137:5: 
      135.       }
      136.   #else
      137. >     (void)file;
      138.       (void)line;
      139.       ret = malloc(num);

crypto/mem.c:138:5: 
      136.   #else
      137.       (void)file;
      138. >     (void)line;
      139.       ret = malloc(num);
      140.   #endif

crypto/mem.c:139:5: 
      137.       (void)file;
      138.       (void)line;
      139. >     ret = malloc(num);
      140.   #endif
      141.   

crypto/mem.c:154:5: 
      152.   #endif
      153.   
      154. >     return ret;
      155.   }
      156.   

crypto/mem.c:155:1: return from a call to CRYPTO_malloc
      153.   
      154.       return ret;
      155. > }
      156.   
      157.   void *CRYPTO_zalloc(size_t num, const char *file, int line)

crypto/mem.c:161:9: Taking true branch
    159.       void *ret = CRYPTO_malloc(num, file, line);
    160.   
    161.       if (ret != NULL)
                   ^
    162.           memset(ret, 0, num);
    163.       return ret;

crypto/mem.c:162:9: 
    160.   
    161.       if (ret != NULL)
    162. >         memset(ret, 0, num);
    163.       return ret;
    164.   }

crypto/mem.c:163:5: 
    161.       if (ret != NULL)
    162.           memset(ret, 0, num);
    163. >     return ret;
    164.   }
    165.   

crypto/mem.c:164:1: return from a call to CRYPTO_zalloc
    162.           memset(ret, 0, num);
    163.       return ret;
    164. > }
    165.   
    166.   void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)

crypto/bn/bn_lib.c:281:9: Taking false branch
  279.       BIGNUM *ret;
  280.   
  281.       if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) {
                 ^
  282.           BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE);
  283.           return (NULL);

crypto/bn/bn_lib.c:285:5: 
  283.           return (NULL);
  284.       }
  285. >     ret->flags = BN_FLG_MALLOCED;
  286.       bn_check_top(ret);
  287.       return (ret);

crypto/bn/bn_lib.c:287:5: 
  285.       ret->flags = BN_FLG_MALLOCED;
  286.       bn_check_top(ret);
  287. >     return (ret);
  288.   }
  289.   

crypto/bn/bn_lib.c:288:1: return from a call to BN_new
  286.       bn_check_top(ret);
  287.       return (ret);
  288. > }
  289.   
  290.    BIGNUM *BN_secure_new(void)

test/exptest.c:116:10: Taking false branch
114.   
115.       p = BN_new();
116.       if (!p)
                ^
117.           goto err;
118.       BN_zero(p);

test/exptest.c:118:5: 
116.       if (!p)
117.           goto err;
118. >     BN_zero(p);
119.   
120.       r = BN_new();

crypto/bn/bn_lib.c:530:1: start of procedure BN_set_word()
  528.   }
  529.   
  530. > int BN_set_word(BIGNUM *a, BN_ULONG w)
  531.   {
  532.       bn_check_top(a);

crypto/bn/bn_lib.c:533:9: Condition is true
  531.   {
  532.       bn_check_top(a);
  533.       if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL)
                 ^
  534.           return (0);
  535.       a->neg = 0;

crypto/bn/bn_lib.c:533:9: Taking false branch
  531.   {
  532.       bn_check_top(a);
  533.       if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL)
                 ^
  534.           return (0);
  535.       a->neg = 0;

crypto/bn/bn_lib.c:535:5: 
  533.       if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL)
  534.           return (0);
  535. >     a->neg = 0;
  536.       a->d[0] = w;
  537.       a->top = (w ? 1 : 0);

crypto/bn/bn_lib.c:536:5: 
  534.           return (0);
  535.       a->neg = 0;
  536. >     a->d[0] = w;
  537.       a->top = (w ? 1 : 0);
  538.       bn_check_top(a);

crypto/bn/bn_lib.c:537:15: Condition is false
  535.       a->neg = 0;
  536.       a->d[0] = w;
  537.       a->top = (w ? 1 : 0);
                       ^
  538.       bn_check_top(a);
  539.       return (1);

crypto/bn/bn_lib.c:537:5: 
  535.       a->neg = 0;
  536.       a->d[0] = w;
  537. >     a->top = (w ? 1 : 0);
  538.       bn_check_top(a);
  539.       return (1);

crypto/bn/bn_lib.c:539:5: 
  537.       a->top = (w ? 1 : 0);
  538.       bn_check_top(a);
  539. >     return (1);
  540.   }
  541.   

crypto/bn/bn_lib.c:540:1: return from a call to BN_set_word
  538.       bn_check_top(a);
  539.       return (1);
  540. > }
  541.   
  542.   BIGNUM *BN_bin2bn(const unsigned char *s, int len, BIGNUM *ret)

test/exptest.c:120:5: 
118.       BN_zero(p);
119.   
120. >     r = BN_new();
121.       if (!r)
122.           goto err;

crypto/bn/bn_lib.c:277:1: start of procedure BN_new()
  275.   }
  276.   
  277. > BIGNUM *BN_new(void)
  278.   {
  279.       BIGNUM *ret;

crypto/bn/bn_lib.c:281:9: 
  279.       BIGNUM *ret;
  280.   
  281. >     if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) {
  282.           BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE);
  283.           return (NULL);

crypto/mem.c:157:1: start of procedure CRYPTO_zalloc()
    155.   }
    156.   
    157. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
    158.   {
    159.       void *ret = CRYPTO_malloc(num, file, line);

crypto/mem.c:159:5: 
    157.   void *CRYPTO_zalloc(size_t num, const char *file, int line)
    158.   {
    159. >     void *ret = CRYPTO_malloc(num, file, line);
    160.   
    161.       if (ret != NULL)

crypto/mem.c:120:1: start of procedure CRYPTO_malloc()
      118.   }
      119.   
      120. > void *CRYPTO_malloc(size_t num, const char *file, int line)
      121.   {
      122.       void *ret = NULL;

crypto/mem.c:122:5: 
      120.   void *CRYPTO_malloc(size_t num, const char *file, int line)
      121.   {
      122. >     void *ret = NULL;
      123.   
      124.       if (num <= 0)

crypto/mem.c:124:9: Taking false branch
      122.       void *ret = NULL;
      123.   
      124.       if (num <= 0)
                     ^
      125.           return NULL;
      126.   

crypto/mem.c:127:5: 
      125.           return NULL;
      126.   
      127. >     allow_customize = 0;
      128.   #ifndef OPENSSL_NO_CRYPTO_MDEBUG
      129.       if (call_malloc_debug) {

crypto/mem.c:137:5: 
      135.       }
      136.   #else
      137. >     (void)file;
      138.       (void)line;
      139.       ret = malloc(num);

crypto/mem.c:138:5: 
      136.   #else
      137.       (void)file;
      138. >     (void)line;
      139.       ret = malloc(num);
      140.   #endif

crypto/mem.c:139:5: 
      137.       (void)file;
      138.       (void)line;
      139. >     ret = malloc(num);
      140.   #endif
      141.   

crypto/mem.c:154:5: 
      152.   #endif
      153.   
      154. >     return ret;
      155.   }
      156.   

crypto/mem.c:155:1: return from a call to CRYPTO_malloc
      153.   
      154.       return ret;
      155. > }
      156.   
      157.   void *CRYPTO_zalloc(size_t num, const char *file, int line)

crypto/mem.c:161:9: Taking true branch
    159.       void *ret = CRYPTO_malloc(num, file, line);
    160.   
    161.       if (ret != NULL)
                   ^
    162.           memset(ret, 0, num);
    163.       return ret;

crypto/mem.c:162:9: 
    160.   
    161.       if (ret != NULL)
    162. >         memset(ret, 0, num);
    163.       return ret;
    164.   }

crypto/mem.c:163:5: 
    161.       if (ret != NULL)
    162.           memset(ret, 0, num);
    163. >     return ret;
    164.   }
    165.   

crypto/mem.c:164:1: return from a call to CRYPTO_zalloc
    162.           memset(ret, 0, num);
    163.       return ret;
    164. > }
    165.   
    166.   void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)

crypto/bn/bn_lib.c:281:9: Taking false branch
  279.       BIGNUM *ret;
  280.   
  281.       if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) {
                 ^
  282.           BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE);
  283.           return (NULL);

crypto/bn/bn_lib.c:285:5: 
  283.           return (NULL);
  284.       }
  285. >     ret->flags = BN_FLG_MALLOCED;
  286.       bn_check_top(ret);
  287.       return (ret);

crypto/bn/bn_lib.c:287:5: 
  285.       ret->flags = BN_FLG_MALLOCED;
  286.       bn_check_top(ret);
  287. >     return (ret);
  288.   }
  289.   

crypto/bn/bn_lib.c:288:1: return from a call to BN_new
  286.       bn_check_top(ret);
  287.       return (ret);
  288. > }
  289.   
  290.    BIGNUM *BN_secure_new(void)

test/exptest.c:121:10: Taking false branch
119.   
120.       r = BN_new();
121.       if (!r)
                ^
122.           goto err;
123.   

test/exptest.c:124:10: 
122.           goto err;
123.   
124. >     if (!BN_rand(a, 1024, 0, 0))
125.           goto err;
126.   

crypto/bn/bn_rand.c:200:1: start of procedure BN_rand()
  198.   }
  199.   
  200. > int BN_rand(BIGNUM *rnd, int bits, int top, int bottom)
  201.   {
  202.       return bnrand(0, rnd, bits, top, bottom);

crypto/bn/bn_rand.c:202:5: 
  200.   int BN_rand(BIGNUM *rnd, int bits, int top, int bottom)
  201.   {
  202. >     return bnrand(0, rnd, bits, top, bottom);
  203.   }
  204.   

crypto/bn/bn_rand.c:119:1: start of procedure bnrand()
    117.   #include <openssl/sha.h>
    118.   
    119. > static int bnrand(int pseudorand, BIGNUM *rnd, int bits, int top, int bottom)
    120.   {
    121.       unsigned char *buf = NULL;

crypto/bn/bn_rand.c:121:5: 
    119.   static int bnrand(int pseudorand, BIGNUM *rnd, int bits, int top, int bottom)
    120.   {
    121. >     unsigned char *buf = NULL;
    122.       int ret = 0, bit, bytes, mask;
    123.       time_t tim;

crypto/bn/bn_rand.c:122:5: 
    120.   {
    121.       unsigned char *buf = NULL;
    122. >     int ret = 0, bit, bytes, mask;
    123.       time_t tim;
    124.   

crypto/bn/bn_rand.c:125:9: Taking false branch
    123.       time_t tim;
    124.   
    125.       if (bits < 0 || (bits == 1 && top > 0)) {
                   ^
    126.           BNerr(BN_F_BNRAND, BN_R_BITS_TOO_SMALL);
    127.           return 0;

crypto/bn/bn_rand.c:125:22: Taking false branch
    123.       time_t tim;
    124.   
    125.       if (bits < 0 || (bits == 1 && top > 0)) {
                                ^
    126.           BNerr(BN_F_BNRAND, BN_R_BITS_TOO_SMALL);
    127.           return 0;

crypto/bn/bn_rand.c:130:9: Taking false branch
    128.       }
    129.   
    130.       if (bits == 0) {
                   ^
    131.           BN_zero(rnd);
    132.           return 1;

crypto/bn/bn_rand.c:135:5: 
    133.       }
    134.   
    135. >     bytes = (bits + 7) / 8;
    136.       bit = (bits - 1) % 8;
    137.       mask = 0xff << (bit + 1);

crypto/bn/bn_rand.c:136:5: 
    134.   
    135.       bytes = (bits + 7) / 8;
    136. >     bit = (bits - 1) % 8;
    137.       mask = 0xff << (bit + 1);
    138.   

crypto/bn/bn_rand.c:137:5: 
    135.       bytes = (bits + 7) / 8;
    136.       bit = (bits - 1) % 8;
    137. >     mask = 0xff << (bit + 1);
    138.   
    139.       buf = OPENSSL_malloc(bytes);

crypto/bn/bn_rand.c:139:5: 
    137.       mask = 0xff << (bit + 1);
    138.   
    139. >     buf = OPENSSL_malloc(bytes);
    140.       if (buf == NULL) {
    141.           BNerr(BN_F_BNRAND, ERR_R_MALLOC_FAILURE);

crypto/mem.c:120:1: start of procedure CRYPTO_malloc()
      118.   }
      119.   
      120. > void *CRYPTO_malloc(size_t num, const char *file, int line)
      121.   {
      122.       void *ret = NULL;

crypto/mem.c:122:5: 
      120.   void *CRYPTO_malloc(size_t num, const char *file, int line)
      121.   {
      122. >     void *ret = NULL;
      123.   
      124.       if (num <= 0)

crypto/mem.c:124:9: Taking false branch
      122.       void *ret = NULL;
      123.   
      124.       if (num <= 0)
                     ^
      125.           return NULL;
      126.   

crypto/mem.c:127:5: 
      125.           return NULL;
      126.   
      127. >     allow_customize = 0;
      128.   #ifndef OPENSSL_NO_CRYPTO_MDEBUG
      129.       if (call_malloc_debug) {

crypto/mem.c:137:5: 
      135.       }
      136.   #else
      137. >     (void)file;
      138.       (void)line;
      139.       ret = malloc(num);

crypto/mem.c:138:5: 
      136.   #else
      137.       (void)file;
      138. >     (void)line;
      139.       ret = malloc(num);
      140.   #endif

crypto/mem.c:139:5: 
      137.       (void)file;
      138.       (void)line;
      139. >     ret = malloc(num);
      140.   #endif
      141.   

crypto/mem.c:154:5: 
      152.   #endif
      153.   
      154. >     return ret;
      155.   }
      156.   

crypto/mem.c:155:1: return from a call to CRYPTO_malloc
      153.   
      154.       return ret;
      155. > }
      156.   
      157.   void *CRYPTO_zalloc(size_t num, const char *file, int line)

crypto/bn/bn_rand.c:140:9: Taking false branch
    138.   
    139.       buf = OPENSSL_malloc(bytes);
    140.       if (buf == NULL) {
                   ^
    141.           BNerr(BN_F_BNRAND, ERR_R_MALLOC_FAILURE);
    142.           goto err;

crypto/bn/bn_rand.c:146:5: 
    144.   
    145.       /* make a random number and set the top and bottom bits */
    146. >     time(&tim);
    147.       RAND_add(&tim, sizeof(tim), 0.0);
    148.   

crypto/bn/bn_rand.c:147:5: 
    145.       /* make a random number and set the top and bottom bits */
    146.       time(&tim);
    147. >     RAND_add(&tim, sizeof(tim), 0.0);
    148.   
    149.       if (pseudorand) {

crypto/rand/rand_lib.c:148:1: start of procedure RAND_add()
      146.   }
      147.   
      148. > void RAND_add(const void *buf, int num, double entropy)
      149.   {
      150.       const RAND_METHOD *meth = RAND_get_rand_method();

crypto/rand/rand_lib.c:150:5: 
      148.   void RAND_add(const void *buf, int num, double entropy)
      149.   {
      150. >     const RAND_METHOD *meth = RAND_get_rand_method();
      151.       if (meth && meth->add)
      152.           meth->add(buf, num, entropy);

crypto/rand/rand_lib.c:92:1: start of procedure RAND_get_rand_method()
        90.   }
        91.   
        92. > const RAND_METHOD *RAND_get_rand_method(void)
        93.   {
        94.       if (!default_RAND_meth) {

crypto/rand/rand_lib.c:94:10: Taking true branch
        92.   const RAND_METHOD *RAND_get_rand_method(void)
        93.   {
        94.       if (!default_RAND_meth) {
                       ^
        95.   #ifndef OPENSSL_NO_ENGINE
        96.           ENGINE *e = ENGINE_get_default_RAND();

crypto/rand/rand_lib.c:96:9: 
        94.       if (!default_RAND_meth) {
        95.   #ifndef OPENSSL_NO_ENGINE
        96. >         ENGINE *e = ENGINE_get_default_RAND();
        97.           if (e) {
        98.               default_RAND_meth = ENGINE_get_RAND(e);

crypto/engine/tb_rand.c:108:1: start of procedure ENGINE_get_default_RAND()
          106.    * references).
          107.    */
          108. > ENGINE *ENGINE_get_default_RAND(void)
          109.   {
          110.       return engine_table_select(&rand_table, dummy_nid);

crypto/engine/tb_rand.c:110:5: 
          108.   ENGINE *ENGINE_get_default_RAND(void)
          109.   {
          110. >     return engine_table_select(&rand_table, dummy_nid);
          111.   }
          112.   

crypto/engine/eng_table.c:243:1: start of procedure engine_table_select()
            241.   /* return a functional reference for a given 'nid' */
            242.   #ifndef ENGINE_TABLE_DEBUG
            243. > ENGINE *engine_table_select(ENGINE_TABLE **table, int nid)
            244.   #else
            245.   ENGINE *engine_table_select_tmp(ENGINE_TABLE **table, int nid, const char *f,

crypto/engine/eng_table.c:249:5: 
            247.   #endif
            248.   {
            249. >     ENGINE *ret = NULL;
            250.       ENGINE_PILE tmplate, *fnd = NULL;
            251.       int initres, loop = 0;

crypto/engine/eng_table.c:250:5: 
            248.   {
            249.       ENGINE *ret = NULL;
            250. >     ENGINE_PILE tmplate, *fnd = NULL;
            251.       int initres, loop = 0;
            252.   

crypto/engine/eng_table.c:251:5: 
            249.       ENGINE *ret = NULL;
            250.       ENGINE_PILE tmplate, *fnd = NULL;
            251. >     int initres, loop = 0;
            252.   
            253.       if (!(*table)) {

crypto/engine/eng_table.c:253:11: 
            251.       int initres, loop = 0;
            252.   
            253. >     if (!(*table)) {
            254.   #ifdef ENGINE_TABLE_DEBUG
            255.           fprintf(stderr, "engine_table_dbg: %s:%d, nid=%d, nothing "

crypto/engine/eng_table.c:253:10: Taking true branch
            251.       int initres, loop = 0;
            252.   
            253.       if (!(*table)) {
                            ^
            254.   #ifdef ENGINE_TABLE_DEBUG
            255.           fprintf(stderr, "engine_table_dbg: %s:%d, nid=%d, nothing "

crypto/engine/eng_table.c:258:9: 
            256.                   "registered!\n", f, l, nid);
            257.   #endif
            258. >         return NULL;
            259.       }
            260.       ERR_set_mark();

crypto/engine/eng_table.c:339:1: return from a call to engine_table_select
            337.       ERR_pop_to_mark();
            338.       return ret;
            339. > }
            340.   
            341.   /* Table enumeration */

crypto/engine/tb_rand.c:111:1: return from a call to ENGINE_get_default_RAND
          109.   {
          110.       return engine_table_select(&rand_table, dummy_nid);
          111. > }
          112.   
          113.   /* Obtains an RAND implementation from an ENGINE functional reference */

crypto/rand/rand_lib.c:97:13: Taking false branch
        95.   #ifndef OPENSSL_NO_ENGINE
        96.           ENGINE *e = ENGINE_get_default_RAND();
        97.           if (e) {
                           ^
        98.               default_RAND_meth = ENGINE_get_RAND(e);
        99.               if (!default_RAND_meth) {

crypto/rand/rand_lib.c:104:13: Taking false branch
        102.               }
        103.           }
        104.           if (e)
                           ^
        105.               funct_ref = e;
        106.           else

crypto/rand/rand_lib.c:108:13: 
        106.           else
        107.   #endif
        108. >             default_RAND_meth = RAND_OpenSSL();
        109.       }
        110.       return default_RAND_meth;

crypto/rand/md_rand.c:194:1: start of procedure RAND_OpenSSL()
          192.   };
          193.   
          194. > RAND_METHOD *RAND_OpenSSL(void)
          195.   {
          196.       return (&rand_meth);

crypto/rand/md_rand.c:196:5: 
          194.   RAND_METHOD *RAND_OpenSSL(void)
          195.   {
          196. >     return (&rand_meth);
          197.   }
          198.   

crypto/rand/md_rand.c:197:1: return from a call to RAND_OpenSSL
          195.   {
          196.       return (&rand_meth);
          197. > }
          198.   
          199.   static void rand_cleanup(void)

crypto/rand/rand_lib.c:110:5: 
        108.               default_RAND_meth = RAND_OpenSSL();
        109.       }
        110. >     return default_RAND_meth;
        111.   }
        112.   

crypto/rand/rand_lib.c:111:1: return from a call to RAND_get_rand_method
        109.       }
        110.       return default_RAND_meth;
        111. > }
        112.   
        113.   #ifndef OPENSSL_NO_ENGINE

crypto/rand/rand_lib.c:151:9: Taking true branch
      149.   {
      150.       const RAND_METHOD *meth = RAND_get_rand_method();
      151.       if (meth && meth->add)
                     ^
      152.           meth->add(buf, num, entropy);
      153.   }

crypto/rand/rand_lib.c:151:17: Taking false branch
      149.   {
      150.       const RAND_METHOD *meth = RAND_get_rand_method();
      151.       if (meth && meth->add)
                             ^
      152.           meth->add(buf, num, entropy);
      153.   }

crypto/rand/rand_lib.c:151:5: 
      149.   {
      150.       const RAND_METHOD *meth = RAND_get_rand_method();
      151. >     if (meth && meth->add)
      152.           meth->add(buf, num, entropy);
      153.   }

crypto/rand/rand_lib.c:153:1: return from a call to RAND_add
      151.       if (meth && meth->add)
      152.           meth->add(buf, num, entropy);
      153. > }
      154.   
      155.   int RAND_bytes(unsigned char *buf, int num)

crypto/bn/bn_rand.c:149:9: Taking false branch
    147.       RAND_add(&tim, sizeof(tim), 0.0);
    148.   
    149.       if (pseudorand) {
                   ^
    150.           if (RAND_bytes(buf, bytes) <= 0)
    151.               goto err;

crypto/bn/bn_rand.c:153:13: 
    151.               goto err;
    152.       } else {
    153. >         if (RAND_bytes(buf, bytes) <= 0)
    154.               goto err;
    155.       }

crypto/rand/rand_lib.c:155:1: start of procedure RAND_bytes()
      153.   }
      154.   
      155. > int RAND_bytes(unsigned char *buf, int num)
      156.   {
      157.       const RAND_METHOD *meth = RAND_get_rand_method();

crypto/rand/rand_lib.c:157:5: 
      155.   int RAND_bytes(unsigned char *buf, int num)
      156.   {
      157. >     const RAND_METHOD *meth = RAND_get_rand_method();
      158.       if (meth && meth->bytes)
      159.           return meth->bytes(buf, num);

crypto/rand/rand_lib.c:92:1: start of procedure RAND_get_rand_method()
        90.   }
        91.   
        92. > const RAND_METHOD *RAND_get_rand_method(void)
        93.   {
        94.       if (!default_RAND_meth) {

crypto/rand/rand_lib.c:94:10: Taking false branch
        92.   const RAND_METHOD *RAND_get_rand_method(void)
        93.   {
        94.       if (!default_RAND_meth) {
                       ^
        95.   #ifndef OPENSSL_NO_ENGINE
        96.           ENGINE *e = ENGINE_get_default_RAND();

crypto/rand/rand_lib.c:110:5: 
        108.               default_RAND_meth = RAND_OpenSSL();
        109.       }
        110. >     return default_RAND_meth;
        111.   }
        112.   

crypto/rand/rand_lib.c:111:1: return from a call to RAND_get_rand_method
        109.       }
        110.       return default_RAND_meth;
        111. > }
        112.   
        113.   #ifndef OPENSSL_NO_ENGINE

crypto/rand/rand_lib.c:158:9: Taking true branch
      156.   {
      157.       const RAND_METHOD *meth = RAND_get_rand_method();
      158.       if (meth && meth->bytes)
                     ^
      159.           return meth->bytes(buf, num);
      160.       return (-1);

crypto/rand/rand_lib.c:158:17: Taking false branch
      156.   {
      157.       const RAND_METHOD *meth = RAND_get_rand_method();
      158.       if (meth && meth->bytes)
                             ^
      159.           return meth->bytes(buf, num);
      160.       return (-1);

crypto/rand/rand_lib.c:160:5: 
      158.       if (meth && meth->bytes)
      159.           return meth->bytes(buf, num);
      160. >     return (-1);
      161.   }
      162.   

crypto/rand/rand_lib.c:161:1: return from a call to RAND_bytes
      159.           return meth->bytes(buf, num);
      160.       return (-1);
      161. > }
      162.   
      163.   #if OPENSSL_API_COMPAT < 0x10100000L

crypto/bn/bn_rand.c:153:13: Taking true branch
    151.               goto err;
    152.       } else {
    153.           if (RAND_bytes(buf, bytes) <= 0)
                       ^
    154.               goto err;
    155.       }

crypto/bn/bn_rand.c:194:2: 
    192.           goto err;
    193.       ret = 1;
    194. >  err:
    195.       OPENSSL_clear_free(buf, bytes);
    196.       bn_check_top(rnd);

crypto/bn/bn_rand.c:195:5: 
    193.       ret = 1;
    194.    err:
    195. >     OPENSSL_clear_free(buf, bytes);
    196.       bn_check_top(rnd);
    197.       return (ret);

crypto/mem.c:249:1: start of procedure CRYPTO_clear_free()
      247.   }
      248.   
      249. > void CRYPTO_clear_free(void *str, size_t num)
      250.   {
      251.       if (str == NULL)

crypto/mem.c:251:9: Taking false branch
      249.   void CRYPTO_clear_free(void *str, size_t num)
      250.   {
      251.       if (str == NULL)
                     ^
      252.           return;
      253.       if (num)

crypto/mem.c:253:9: Taking true branch
      251.       if (str == NULL)
      252.           return;
      253.       if (num)
                     ^
      254.           OPENSSL_cleanse(str, num);
      255.       CRYPTO_free(str);

crypto/mem.c:254:9: Skipping OPENSSL_cleanse(): method has no implementation
      252.           return;
      253.       if (num)
      254.           OPENSSL_cleanse(str, num);
                     ^
      255.       CRYPTO_free(str);
      256.   }

crypto/mem.c:255:5: 
      253.       if (num)
      254.           OPENSSL_cleanse(str, num);
      255. >     CRYPTO_free(str);
      256.   }

crypto/mem.c:234:1: start of procedure CRYPTO_free()
        232.   }
        233.   
        234. > void CRYPTO_free(void *str)
        235.   {
        236.   #ifndef OPENSSL_NO_CRYPTO_MDEBUG

crypto/mem.c:245:5: 
        243.       }
        244.   #else
        245. >     free(str);
        246.   #endif
        247.   }

crypto/mem.c:247:1: return from a call to CRYPTO_free
        245.       free(str);
        246.   #endif
        247. > }
        248.   
        249.   void CRYPTO_clear_free(void *str, size_t num)

crypto/mem.c:256:1: return from a call to CRYPTO_clear_free
      254.           OPENSSL_cleanse(str, num);
      255.       CRYPTO_free(str);
      256. > }

crypto/bn/bn_rand.c:197:5: 
    195.       OPENSSL_clear_free(buf, bytes);
    196.       bn_check_top(rnd);
    197. >     return (ret);
    198.   }
    199.   

crypto/bn/bn_rand.c:198:1: return from a call to bnrand
    196.       bn_check_top(rnd);
    197.       return (ret);
    198. > }
    199.   
    200.   int BN_rand(BIGNUM *rnd, int bits, int top, int bottom)

crypto/bn/bn_rand.c:203:1: return from a call to BN_rand
  201.   {
  202.       return bnrand(0, rnd, bits, top, bottom);
  203. > }
  204.   
  205.   int BN_pseudo_rand(BIGNUM *rnd, int bits, int top, int bottom)

test/exptest.c:124:10: Taking true branch
122.           goto err;
123.   
124.       if (!BN_rand(a, 1024, 0, 0))
                ^
125.           goto err;
126.   

test/exptest.c:176:2: 
174.       ret = failed;
175.   
176. >  err:
177.       BN_free(r);
178.       BN_free(a);

test/exptest.c:177:5: 
175.   
176.    err:
177. >     BN_free(r);
178.       BN_free(a);
179.       BN_free(p);

crypto/bn/bn_lib.c:252:1: start of procedure BN_free()
  250.   }
  251.   
  252. > void BN_free(BIGNUM *a)
  253.   {
  254.       if (a == NULL)

crypto/bn/bn_lib.c:254:9: Taking false branch
  252.   void BN_free(BIGNUM *a)
  253.   {
  254.       if (a == NULL)
                 ^
  255.           return;
  256.       bn_check_top(a);

crypto/bn/bn_lib.c:257:10: 
  255.           return;
  256.       bn_check_top(a);
  257. >     if (!BN_get_flags(a, BN_FLG_STATIC_DATA))
  258.           bn_free_d(a);
  259.       if (a->flags & BN_FLG_MALLOCED)

crypto/bn/bn_lib.c:965:1: start of procedure BN_get_flags()
    963.   }
    964.   
    965. > int BN_get_flags(const BIGNUM *b, int n)
    966.   {
    967.       return b->flags & n;

crypto/bn/bn_lib.c:967:5: 
    965.   int BN_get_flags(const BIGNUM *b, int n)
    966.   {
    967. >     return b->flags & n;
    968.   }
    969.   

crypto/bn/bn_lib.c:968:1: return from a call to BN_get_flags
    966.   {
    967.       return b->flags & n;
    968. > }
    969.   
    970.   /* Populate a BN_GENCB structure with an "old"-style callback */

crypto/bn/bn_lib.c:257:10: Taking false branch
  255.           return;
  256.       bn_check_top(a);
  257.       if (!BN_get_flags(a, BN_FLG_STATIC_DATA))
                  ^
  258.           bn_free_d(a);
  259.       if (a->flags & BN_FLG_MALLOCED)

crypto/bn/bn_lib.c:259:9: Taking false branch
  257.       if (!BN_get_flags(a, BN_FLG_STATIC_DATA))
  258.           bn_free_d(a);
  259.       if (a->flags & BN_FLG_MALLOCED)
                 ^
  260.           OPENSSL_free(a);
  261.       else {

crypto/bn/bn_lib.c:263:9: 
  261.       else {
  262.   #if OPENSSL_API_COMPAT < 0x00908000L
  263. >         a->flags |= BN_FLG_FREE;
  264.   #endif
  265.           a->d = NULL;

crypto/bn/bn_lib.c:265:9: 
  263.           a->flags |= BN_FLG_FREE;
  264.   #endif
  265. >         a->d = NULL;
  266.       }
  267.   }

crypto/bn/bn_lib.c:259:5: 
  257.       if (!BN_get_flags(a, BN_FLG_STATIC_DATA))
  258.           bn_free_d(a);
  259. >     if (a->flags & BN_FLG_MALLOCED)
  260.           OPENSSL_free(a);
  261.       else {

crypto/bn/bn_lib.c:267:1: return from a call to BN_free
  265.           a->d = NULL;
  266.       }
  267. > }
  268.   
  269.   void bn_init(BIGNUM *a)

static int test_exp_mod_zero()
{
    BIGNUM *a = NULL, *p = NULL, *m = NULL;
    BIGNUM *r = NULL;
    BN_ULONG one_word = 1;
    BN_CTX *ctx = BN_CTX_new();
    int ret = 1, failed = 0;
    m = BN_new();
    if (!m)
        goto err;
    BN_one(m);
    a = BN_new();
    if (!a)
        goto err;
    BN_one(a);
    p = BN_new();
    if (!p)
        goto err;
    BN_zero(p);
    r = BN_new();
    if (!r)
        goto err;
    if (!BN_rand(a, 1024, 0, 0))
        goto err;
    if (!BN_mod_exp(r, a, p, m, ctx))
        goto err;
    if (!a_is_zero_mod_one("BN_mod_exp", r, a))
        failed = 1;
    if (!BN_mod_exp_recp(r, a, p, m, ctx))
        goto err;
    if (!a_is_zero_mod_one("BN_mod_exp_recp", r, a))
        failed = 1;
    if (!BN_mod_exp_simple(r, a, p, m, ctx))
        goto err;
    if (!a_is_zero_mod_one("BN_mod_exp_simple", r, a))
        failed = 1;
    if (!BN_mod_exp_mont(r, a, p, m, ctx, NULL))
        goto err;
    if (!a_is_zero_mod_one("BN_mod_exp_mont", r, a))
        failed = 1;
    if (!BN_mod_exp_mont_consttime(r, a, p, m, ctx, NULL)) {
        goto err;
    }
    if (!a_is_zero_mod_one("BN_mod_exp_mont_consttime", r, a))
        failed = 1;
    if (!BN_mod_exp_mont_word(r, one_word, p, m, ctx, NULL))
        goto err;
    if (!BN_is_zero(r)) {
        fprintf(stderr, "BN_mod_exp_mont_word failed:\n");
        fprintf(stderr, "1 ** 0 mod 1 = r (should be 0)\n");
        fprintf(stderr, "r = ");
        BN_print_fp(stderr, r);
        fprintf(stderr, "\n");
        return 0;
    }
    ret = failed;
 err:
    BN_free(r);
    BN_free(a);
    BN_free(p);
    BN_free(m);
    BN_CTX_free(ctx);
    return ret;
}
['static int test_exp_mod_zero()\n{\n    BIGNUM *a = NULL, *p = NULL, *m = NULL;\n    BIGNUM *r = NULL;\n    BN_ULONG one_word = 1;\n    BN_CTX *ctx = BN_CTX_new();\n    int ret = 1, failed = 0;\n    m = BN_new();\n    if (!m)\n        goto err;\n    BN_one(m);\n    a = BN_new();\n    if (!a)\n        goto err;\n    BN_one(a);\n    p = BN_new();\n    if (!p)\n        goto err;\n    BN_zero(p);\n    r = BN_new();\n    if (!r)\n        goto err;\n    if (!BN_rand(a, 1024, 0, 0))\n        goto err;\n    if (!BN_mod_exp(r, a, p, m, ctx))\n        goto err;\n    if (!a_is_zero_mod_one("BN_mod_exp", r, a))\n        failed = 1;\n    if (!BN_mod_exp_recp(r, a, p, m, ctx))\n        goto err;\n    if (!a_is_zero_mod_one("BN_mod_exp_recp", r, a))\n        failed = 1;\n    if (!BN_mod_exp_simple(r, a, p, m, ctx))\n        goto err;\n    if (!a_is_zero_mod_one("BN_mod_exp_simple", r, a))\n        failed = 1;\n    if (!BN_mod_exp_mont(r, a, p, m, ctx, NULL))\n        goto err;\n    if (!a_is_zero_mod_one("BN_mod_exp_mont", r, a))\n        failed = 1;\n    if (!BN_mod_exp_mont_consttime(r, a, p, m, ctx, NULL)) {\n        goto err;\n    }\n    if (!a_is_zero_mod_one("BN_mod_exp_mont_consttime", r, a))\n        failed = 1;\n    if (!BN_mod_exp_mont_word(r, one_word, p, m, ctx, NULL))\n        goto err;\n    if (!BN_is_zero(r)) {\n        fprintf(stderr, "BN_mod_exp_mont_word failed:\\n");\n        fprintf(stderr, "1 ** 0 mod 1 = r (should be 0)\\n");\n        fprintf(stderr, "r = ");\n        BN_print_fp(stderr, r);\n        fprintf(stderr, "\\n");\n        return 0;\n    }\n    ret = failed;\n err:\n    BN_free(r);\n    BN_free(a);\n    BN_free(p);\n    BN_free(m);\n    BN_CTX_free(ctx);\n    return ret;\n}', 'BN_CTX *BN_CTX_new(void)\n{\n    BN_CTX *ret;\n    if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) {\n        BNerr(BN_F_BN_CTX_NEW, ERR_R_MALLOC_FAILURE);\n        return NULL;\n    }\n    BN_POOL_init(&ret->pool);\n    BN_STACK_init(&ret->stack);\n    return ret;\n}', 'void *CRYPTO_zalloc(size_t num, const char *file, int line)\n{\n    void *ret = CRYPTO_malloc(num, file, line);\n    if (ret != NULL)\n        memset(ret, 0, num);\n    return ret;\n}', 'void *CRYPTO_malloc(size_t num, const char *file, int line)\n{\n    void *ret = NULL;\n    if (num <= 0)\n        return NULL;\n    allow_customize = 0;\n#ifndef OPENSSL_NO_CRYPTO_MDEBUG\n    if (call_malloc_debug) {\n        CRYPTO_mem_debug_malloc(NULL, num, 0, file, line);\n        ret = malloc(num);\n        CRYPTO_mem_debug_malloc(ret, num, 1, file, line);\n    } else {\n        ret = malloc(num);\n    }\n#else\n    (void)file;\n    (void)line;\n    ret = malloc(num);\n#endif\n#ifndef OPENSSL_CPUID_OBJ\n    if (ret && (num > 2048)) {\n        extern unsigned char cleanse_ctr;\n        ((unsigned char *)ret)[0] = cleanse_ctr;\n    }\n#endif\n    return ret;\n}', 'static void BN_POOL_init(BN_POOL *p)\n{\n    p->head = p->current = p->tail = NULL;\n    p->used = p->size = 0;\n}', 'static void BN_STACK_init(BN_STACK *st)\n{\n    st->indexes = NULL;\n    st->depth = st->size = 0;\n}', 'BIGNUM *BN_new(void)\n{\n    BIGNUM *ret;\n    if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) {\n        BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE);\n        return (NULL);\n    }\n    ret->flags = BN_FLG_MALLOCED;\n    bn_check_top(ret);\n    return (ret);\n}', 'int BN_set_word(BIGNUM *a, BN_ULONG w)\n{\n    bn_check_top(a);\n    if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL)\n        return (0);\n    a->neg = 0;\n    a->d[0] = w;\n    a->top = (w ? 1 : 0);\n    bn_check_top(a);\n    return (1);\n}', 'int BN_rand(BIGNUM *rnd, int bits, int top, int bottom)\n{\n    return bnrand(0, rnd, bits, top, bottom);\n}', 'static int bnrand(int pseudorand, BIGNUM *rnd, int bits, int top, int bottom)\n{\n    unsigned char *buf = NULL;\n    int ret = 0, bit, bytes, mask;\n    time_t tim;\n    if (bits < 0 || (bits == 1 && top > 0)) {\n        BNerr(BN_F_BNRAND, BN_R_BITS_TOO_SMALL);\n        return 0;\n    }\n    if (bits == 0) {\n        BN_zero(rnd);\n        return 1;\n    }\n    bytes = (bits + 7) / 8;\n    bit = (bits - 1) % 8;\n    mask = 0xff << (bit + 1);\n    buf = OPENSSL_malloc(bytes);\n    if (buf == NULL) {\n        BNerr(BN_F_BNRAND, ERR_R_MALLOC_FAILURE);\n        goto err;\n    }\n    time(&tim);\n    RAND_add(&tim, sizeof(tim), 0.0);\n    if (pseudorand) {\n        if (RAND_bytes(buf, bytes) <= 0)\n            goto err;\n    } else {\n        if (RAND_bytes(buf, bytes) <= 0)\n            goto err;\n    }\n    if (pseudorand == 2) {\n        int i;\n        unsigned char c;\n        for (i = 0; i < bytes; i++) {\n            if (RAND_bytes(&c, 1) <= 0)\n                goto err;\n            if (c >= 128 && i > 0)\n                buf[i] = buf[i - 1];\n            else if (c < 42)\n                buf[i] = 0;\n            else if (c < 84)\n                buf[i] = 255;\n        }\n    }\n    if (top >= 0) {\n        if (top) {\n            if (bit == 0) {\n                buf[0] = 1;\n                buf[1] |= 0x80;\n            } else {\n                buf[0] |= (3 << (bit - 1));\n            }\n        } else {\n            buf[0] |= (1 << bit);\n        }\n    }\n    buf[0] &= ~mask;\n    if (bottom)\n        buf[bytes - 1] |= 1;\n    if (!BN_bin2bn(buf, bytes, rnd))\n        goto err;\n    ret = 1;\n err:\n    OPENSSL_clear_free(buf, bytes);\n    bn_check_top(rnd);\n    return (ret);\n}', 'void RAND_add(const void *buf, int num, double entropy)\n{\n    const RAND_METHOD *meth = RAND_get_rand_method();\n    if (meth && meth->add)\n        meth->add(buf, num, entropy);\n}', 'const RAND_METHOD *RAND_get_rand_method(void)\n{\n    if (!default_RAND_meth) {\n#ifndef OPENSSL_NO_ENGINE\n        ENGINE *e = ENGINE_get_default_RAND();\n        if (e) {\n            default_RAND_meth = ENGINE_get_RAND(e);\n            if (!default_RAND_meth) {\n                ENGINE_finish(e);\n                e = NULL;\n            }\n        }\n        if (e)\n            funct_ref = e;\n        else\n#endif\n            default_RAND_meth = RAND_OpenSSL();\n    }\n    return default_RAND_meth;\n}', 'ENGINE *ENGINE_get_default_RAND(void)\n{\n    return engine_table_select(&rand_table, dummy_nid);\n}', 'ENGINE *engine_table_select(ENGINE_TABLE **table, int nid)\n#else\nENGINE *engine_table_select_tmp(ENGINE_TABLE **table, int nid, const char *f,\n                                int l)\n#endif\n{\n    ENGINE *ret = NULL;\n    ENGINE_PILE tmplate, *fnd = NULL;\n    int initres, loop = 0;\n    if (!(*table)) {\n#ifdef ENGINE_TABLE_DEBUG\n        fprintf(stderr, "engine_table_dbg: %s:%d, nid=%d, nothing "\n                "registered!\\n", f, l, nid);\n#endif\n        return NULL;\n    }\n    ERR_set_mark();\n    CRYPTO_w_lock(CRYPTO_LOCK_ENGINE);\n    if (!int_table_check(table, 0))\n        goto end;\n    tmplate.nid = nid;\n    fnd = lh_ENGINE_PILE_retrieve(&(*table)->piles, &tmplate);\n    if (!fnd)\n        goto end;\n    if (fnd->funct && engine_unlocked_init(fnd->funct)) {\n#ifdef ENGINE_TABLE_DEBUG\n        fprintf(stderr, "engine_table_dbg: %s:%d, nid=%d, using "\n                "ENGINE \'%s\' cached\\n", f, l, nid, fnd->funct->id);\n#endif\n        ret = fnd->funct;\n        goto end;\n    }\n    if (fnd->uptodate) {\n        ret = fnd->funct;\n        goto end;\n    }\n trynext:\n    ret = sk_ENGINE_value(fnd->sk, loop++);\n    if (!ret) {\n#ifdef ENGINE_TABLE_DEBUG\n        fprintf(stderr, "engine_table_dbg: %s:%d, nid=%d, no "\n                "registered implementations would initialise\\n", f, l, nid);\n#endif\n        goto end;\n    }\n    if ((ret->funct_ref > 0) || !(table_flags & ENGINE_TABLE_FLAG_NOINIT))\n        initres = engine_unlocked_init(ret);\n    else\n        initres = 0;\n    if (initres) {\n        if ((fnd->funct != ret) && engine_unlocked_init(ret)) {\n            if (fnd->funct)\n                engine_unlocked_finish(fnd->funct, 0);\n            fnd->funct = ret;\n#ifdef ENGINE_TABLE_DEBUG\n            fprintf(stderr, "engine_table_dbg: %s:%d, nid=%d, "\n                    "setting default to \'%s\'\\n", f, l, nid, ret->id);\n#endif\n        }\n#ifdef ENGINE_TABLE_DEBUG\n        fprintf(stderr, "engine_table_dbg: %s:%d, nid=%d, using "\n                "newly initialised \'%s\'\\n", f, l, nid, ret->id);\n#endif\n        goto end;\n    }\n    goto trynext;\n end:\n    if (fnd)\n        fnd->uptodate = 1;\n#ifdef ENGINE_TABLE_DEBUG\n    if (ret)\n        fprintf(stderr, "engine_table_dbg: %s:%d, nid=%d, caching "\n                "ENGINE \'%s\'\\n", f, l, nid, ret->id);\n    else\n        fprintf(stderr, "engine_table_dbg: %s:%d, nid=%d, caching "\n                "\'no matching ENGINE\'\\n", f, l, nid);\n#endif\n    CRYPTO_w_unlock(CRYPTO_LOCK_ENGINE);\n    ERR_pop_to_mark();\n    return ret;\n}', 'RAND_METHOD *RAND_OpenSSL(void)\n{\n    return (&rand_meth);\n}', 'int RAND_bytes(unsigned char *buf, int num)\n{\n    const RAND_METHOD *meth = RAND_get_rand_method();\n    if (meth && meth->bytes)\n        return meth->bytes(buf, num);\n    return (-1);\n}', 'void CRYPTO_clear_free(void *str, size_t num)\n{\n    if (str == NULL)\n        return;\n    if (num)\n        OPENSSL_cleanse(str, num);\n    CRYPTO_free(str);\n}', 'void CRYPTO_free(void *str)\n{\n#ifndef OPENSSL_NO_CRYPTO_MDEBUG\n    if (call_malloc_debug) {\n        CRYPTO_mem_debug_free(str, 0);\n        free(str);\n        CRYPTO_mem_debug_free(str, 1);\n    } else {\n        free(str);\n    }\n#else\n    free(str);\n#endif\n}', 'void BN_free(BIGNUM *a)\n{\n    if (a == NULL)\n        return;\n    bn_check_top(a);\n    if (!BN_get_flags(a, BN_FLG_STATIC_DATA))\n        bn_free_d(a);\n    if (a->flags & BN_FLG_MALLOCED)\n        OPENSSL_free(a);\n    else {\n#if OPENSSL_API_COMPAT < 0x00908000L\n        a->flags |= BN_FLG_FREE;\n#endif\n        a->d = NULL;\n    }\n}', 'int BN_get_flags(const BIGNUM *b, int n)\n{\n    return b->flags & n;\n}']