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


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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

crypto/bn/bn_lib.c:520:1: start of procedure BN_set_word()
  518.   }
  519.   
  520. > int BN_set_word(BIGNUM *a, BN_ULONG w)
  521.   {
  522.       bn_check_top(a);

crypto/bn/bn_lib.c:523:9: Condition is true
  521.   {
  522.       bn_check_top(a);
  523.       if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL)
                 ^
  524.           return (0);
  525.       a->neg = 0;

crypto/bn/bn_lib.c:523:9: Taking false branch
  521.   {
  522.       bn_check_top(a);
  523.       if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL)
                 ^
  524.           return (0);
  525.       a->neg = 0;

crypto/bn/bn_lib.c:525:5: 
  523.       if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL)
  524.           return (0);
  525. >     a->neg = 0;
  526.       a->d[0] = w;
  527.       a->top = (w ? 1 : 0);

crypto/bn/bn_lib.c:526:5: 
  524.           return (0);
  525.       a->neg = 0;
  526. >     a->d[0] = w;
  527.       a->top = (w ? 1 : 0);
  528.       bn_check_top(a);

crypto/bn/bn_lib.c:527:15: Condition is true
  525.       a->neg = 0;
  526.       a->d[0] = w;
  527.       a->top = (w ? 1 : 0);
                       ^
  528.       bn_check_top(a);
  529.       return (1);

crypto/bn/bn_lib.c:527:5: 
  525.       a->neg = 0;
  526.       a->d[0] = w;
  527. >     a->top = (w ? 1 : 0);
  528.       bn_check_top(a);
  529.       return (1);

crypto/bn/bn_lib.c:529:5: 
  527.       a->top = (w ? 1 : 0);
  528.       bn_check_top(a);
  529. >     return (1);
  530.   }
  531.   

crypto/bn/bn_lib.c:530:1: return from a call to BN_set_word
  528.       bn_check_top(a);
  529.       return (1);
  530. > }
  531.   
  532.   BIGNUM *BN_bin2bn(const unsigned char *s, int len, BIGNUM *ret)

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

crypto/bn/bn_lib.c:520:1: start of procedure BN_set_word()
  518.   }
  519.   
  520. > int BN_set_word(BIGNUM *a, BN_ULONG w)
  521.   {
  522.       bn_check_top(a);

crypto/bn/bn_lib.c:523:9: Condition is true
  521.   {
  522.       bn_check_top(a);
  523.       if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL)
                 ^
  524.           return (0);
  525.       a->neg = 0;

crypto/bn/bn_lib.c:523:9: Taking false branch
  521.   {
  522.       bn_check_top(a);
  523.       if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL)
                 ^
  524.           return (0);
  525.       a->neg = 0;

crypto/bn/bn_lib.c:525:5: 
  523.       if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL)
  524.           return (0);
  525. >     a->neg = 0;
  526.       a->d[0] = w;
  527.       a->top = (w ? 1 : 0);

crypto/bn/bn_lib.c:526:5: 
  524.           return (0);
  525.       a->neg = 0;
  526. >     a->d[0] = w;
  527.       a->top = (w ? 1 : 0);
  528.       bn_check_top(a);

crypto/bn/bn_lib.c:527:15: Condition is true
  525.       a->neg = 0;
  526.       a->d[0] = w;
  527.       a->top = (w ? 1 : 0);
                       ^
  528.       bn_check_top(a);
  529.       return (1);

crypto/bn/bn_lib.c:527:5: 
  525.       a->neg = 0;
  526.       a->d[0] = w;
  527. >     a->top = (w ? 1 : 0);
  528.       bn_check_top(a);
  529.       return (1);

crypto/bn/bn_lib.c:529:5: 
  527.       a->top = (w ? 1 : 0);
  528.       bn_check_top(a);
  529. >     return (1);
  530.   }
  531.   

crypto/bn/bn_lib.c:530:1: return from a call to BN_set_word
  528.       bn_check_top(a);
  529.       return (1);
  530. > }
  531.   
  532.   BIGNUM *BN_bin2bn(const unsigned char *s, int len, BIGNUM *ret)

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

crypto/bn/bn_lib.c:520:1: start of procedure BN_set_word()
  518.   }
  519.   
  520. > int BN_set_word(BIGNUM *a, BN_ULONG w)
  521.   {
  522.       bn_check_top(a);

crypto/bn/bn_lib.c:523:9: Condition is true
  521.   {
  522.       bn_check_top(a);
  523.       if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL)
                 ^
  524.           return (0);
  525.       a->neg = 0;

crypto/bn/bn_lib.c:523:9: Taking false branch
  521.   {
  522.       bn_check_top(a);
  523.       if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL)
                 ^
  524.           return (0);
  525.       a->neg = 0;

crypto/bn/bn_lib.c:525:5: 
  523.       if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL)
  524.           return (0);
  525. >     a->neg = 0;
  526.       a->d[0] = w;
  527.       a->top = (w ? 1 : 0);

crypto/bn/bn_lib.c:526:5: 
  524.           return (0);
  525.       a->neg = 0;
  526. >     a->d[0] = w;
  527.       a->top = (w ? 1 : 0);
  528.       bn_check_top(a);

crypto/bn/bn_lib.c:527:15: Condition is false
  525.       a->neg = 0;
  526.       a->d[0] = w;
  527.       a->top = (w ? 1 : 0);
                       ^
  528.       bn_check_top(a);
  529.       return (1);

crypto/bn/bn_lib.c:527:5: 
  525.       a->neg = 0;
  526.       a->d[0] = w;
  527. >     a->top = (w ? 1 : 0);
  528.       bn_check_top(a);
  529.       return (1);

crypto/bn/bn_lib.c:529:5: 
  527.       a->top = (w ? 1 : 0);
  528.       bn_check_top(a);
  529. >     return (1);
  530.   }
  531.   

crypto/bn/bn_lib.c:530:1: return from a call to BN_set_word
  528.       bn_check_top(a);
  529.       return (1);
  530. > }
  531.   
  532.   BIGNUM *BN_bin2bn(const unsigned char *s, int len, BIGNUM *ret)

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

crypto/mem.c:124:9: 
      122.   
      123.       if (num <= 0)
      124. >         return NULL;
      125.   
      126.       allow_customize = 0;

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

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

crypto/bn/bn_rand.c:140:9: Skipping ERR_put_error(): empty list of specs
    138.       buf = OPENSSL_malloc(bytes);
    139.       if (buf == NULL) {
    140.           BNerr(BN_F_BNRAND, ERR_R_MALLOC_FAILURE);
                   ^
    141.           goto err;
    142.       }

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

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

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

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

crypto/mem.c:251:9: 
      249.   {
      250.       if (str == NULL)
      251. >         return;
      252.       if (num)
      253.           OPENSSL_cleanse(str, num);

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

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

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

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

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

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

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

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

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

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

crypto/bn/bn_lib.c:1041:1: start of procedure BN_get_flags()
    1039.   }
    1040.   
    1041. > int BN_get_flags(const BIGNUM *b, int n)
    1042.   {
    1043.       return b->flags & n;

crypto/bn/bn_lib.c:1043:5: 
    1041.   int BN_get_flags(const BIGNUM *b, int n)
    1042.   {
    1043. >     return b->flags & n;
    1044.   }
    1045.   

crypto/bn/bn_lib.c:1044:1: return from a call to BN_get_flags
    1042.   {
    1043.       return b->flags & n;
    1044. > }
    1045.   
    1046.   /* Populate a BN_GENCB structure with an "old"-style callback */

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

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

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

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

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

crypto/bn/bn_lib.c:266:1: return from a call to BN_free
  264.           a->d = NULL;
  265.       }
  266. > }
  267.   
  268.   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 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 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}']