crypto/dsa/dsa_gen.c:676: error: MEMORY_LEAK
  memory dynamically allocated by call to `BN_MONT_CTX_new()` at line 663, column 17 is not reachable after line 676, column 5.
Showing all 116 steps of the trace


crypto/dsa/dsa_gen.c:646:1: start of procedure dsa_paramgen_check_g()
644.   }
645.   
646. > int dsa_paramgen_check_g(DSA *dsa)
647.   {
648.       BN_CTX *ctx;

crypto/dsa/dsa_gen.c:650:5: 
648.       BN_CTX *ctx;
649.       BIGNUM *tmp;
650. >     BN_MONT_CTX *mont = NULL;
651.       int rv = -1;
652.       ctx = BN_CTX_new();

crypto/dsa/dsa_gen.c:651:5: 
649.       BIGNUM *tmp;
650.       BN_MONT_CTX *mont = NULL;
651. >     int rv = -1;
652.       ctx = BN_CTX_new();
653.       if (ctx == NULL)

crypto/dsa/dsa_gen.c:652:5: 
650.       BN_MONT_CTX *mont = NULL;
651.       int rv = -1;
652. >     ctx = BN_CTX_new();
653.       if (ctx == NULL)
654.           return -1;

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)

crypto/dsa/dsa_gen.c:653:9: Taking false branch
651.       int rv = -1;
652.       ctx = BN_CTX_new();
653.       if (ctx == NULL)
               ^
654.           return -1;
655.       BN_CTX_start(ctx);

crypto/dsa/dsa_gen.c:655:5: 
653.       if (ctx == NULL)
654.           return -1;
655. >     BN_CTX_start(ctx);
656.       if (BN_cmp(dsa->g, BN_value_one()) <= 0)
657.           return 0;

crypto/bn/bn_ctx.c:235:1: start of procedure BN_CTX_start()
  233.   }
  234.   
  235. > void BN_CTX_start(BN_CTX *ctx)
  236.   {
  237.       CTXDBG_ENTRY("BN_CTX_start", ctx);

crypto/bn/bn_ctx.c:239:9: Taking true branch
  237.       CTXDBG_ENTRY("BN_CTX_start", ctx);
  238.       /* If we're already overflowing ... */
  239.       if (ctx->err_stack || ctx->too_many)
                 ^
  240.           ctx->err_stack++;
  241.       /* (Try to) get a new frame pointer */

crypto/bn/bn_ctx.c:240:9: 
  238.       /* If we're already overflowing ... */
  239.       if (ctx->err_stack || ctx->too_many)
  240. >         ctx->err_stack++;
  241.       /* (Try to) get a new frame pointer */
  242.       else if (!BN_STACK_push(&ctx->stack, ctx->used)) {

crypto/bn/bn_ctx.c:239:5: 
  237.       CTXDBG_ENTRY("BN_CTX_start", ctx);
  238.       /* If we're already overflowing ... */
  239. >     if (ctx->err_stack || ctx->too_many)
  240.           ctx->err_stack++;
  241.       /* (Try to) get a new frame pointer */

crypto/bn/bn_ctx.c:247:1: return from a call to BN_CTX_start
  245.       }
  246.       CTXDBG_EXIT(ctx);
  247. > }
  248.   
  249.   void BN_CTX_end(BN_CTX *ctx)

crypto/dsa/dsa_gen.c:656:9: 
654.           return -1;
655.       BN_CTX_start(ctx);
656. >     if (BN_cmp(dsa->g, BN_value_one()) <= 0)
657.           return 0;
658.       if (BN_cmp(dsa->g, dsa->p) >= 0)

crypto/bn/bn_lib.c:133:1: start of procedure BN_value_one()
  131.   #endif
  132.   
  133. > const BIGNUM *BN_value_one(void)
  134.   {
  135.       static const BN_ULONG data_one = 1L;

crypto/bn/bn_lib.c:135:5: 
  133.   const BIGNUM *BN_value_one(void)
  134.   {
  135. >     static const BN_ULONG data_one = 1L;
  136.       static const BIGNUM const_one =
  137.           { (BN_ULONG *)&data_one, 1, 1, 0, BN_FLG_STATIC_DATA };

crypto/bn/bn_lib.c:136:5: 
  134.   {
  135.       static const BN_ULONG data_one = 1L;
  136. >     static const BIGNUM const_one =
  137.           { (BN_ULONG *)&data_one, 1, 1, 0, BN_FLG_STATIC_DATA };
  138.   

crypto/bn/bn_lib.c:139:5: 
  137.           { (BN_ULONG *)&data_one, 1, 1, 0, BN_FLG_STATIC_DATA };
  138.   
  139. >     return (&const_one);
  140.   }
  141.   

crypto/bn/bn_lib.c:140:1: return from a call to BN_value_one
  138.   
  139.       return (&const_one);
  140. > }
  141.   
  142.   int BN_num_bits_word(BN_ULONG l)

crypto/dsa/dsa_gen.c:656:9: Taking false branch
654.           return -1;
655.       BN_CTX_start(ctx);
656.       if (BN_cmp(dsa->g, BN_value_one()) <= 0)
               ^
657.           return 0;
658.       if (BN_cmp(dsa->g, dsa->p) >= 0)

crypto/dsa/dsa_gen.c:658:9: Taking false branch
656.       if (BN_cmp(dsa->g, BN_value_one()) <= 0)
657.           return 0;
658.       if (BN_cmp(dsa->g, dsa->p) >= 0)
               ^
659.           return 0;
660.       tmp = BN_CTX_get(ctx);

crypto/dsa/dsa_gen.c:660:5: 
658.       if (BN_cmp(dsa->g, dsa->p) >= 0)
659.           return 0;
660. >     tmp = BN_CTX_get(ctx);
661.       if (!tmp)
662.           goto err;

crypto/bn/bn_ctx.c:266:1: start of procedure BN_CTX_get()
  264.   }
  265.   
  266. > BIGNUM *BN_CTX_get(BN_CTX *ctx)
  267.   {
  268.       BIGNUM *ret;

crypto/bn/bn_ctx.c:271:9: Taking false branch
  269.   
  270.       CTXDBG_ENTRY("BN_CTX_get", ctx);
  271.       if (ctx->err_stack || ctx->too_many)
                 ^
  272.           return NULL;
  273.       if ((ret = BN_POOL_get(&ctx->pool, ctx->flags)) == NULL) {

crypto/bn/bn_ctx.c:271:27: Taking false branch
  269.   
  270.       CTXDBG_ENTRY("BN_CTX_get", ctx);
  271.       if (ctx->err_stack || ctx->too_many)
                                   ^
  272.           return NULL;
  273.       if ((ret = BN_POOL_get(&ctx->pool, ctx->flags)) == NULL) {

crypto/bn/bn_ctx.c:273:9: Taking false branch
  271.       if (ctx->err_stack || ctx->too_many)
  272.           return NULL;
  273.       if ((ret = BN_POOL_get(&ctx->pool, ctx->flags)) == NULL) {
                 ^
  274.           /*
  275.            * Setting too_many prevents repeated "get" attempts from cluttering

crypto/bn/bn_ctx.c:283:5: 
  281.       }
  282.       /* OK, make sure the returned bignum is "zero" */
  283. >     BN_zero(ret);
  284.       ctx->used++;
  285.       CTXDBG_RET(ctx, ret);

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

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

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

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

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

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

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

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

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

crypto/bn/bn_ctx.c:284:5: 
  282.       /* OK, make sure the returned bignum is "zero" */
  283.       BN_zero(ret);
  284. >     ctx->used++;
  285.       CTXDBG_RET(ctx, ret);
  286.       return ret;

crypto/bn/bn_ctx.c:286:5: 
  284.       ctx->used++;
  285.       CTXDBG_RET(ctx, ret);
  286. >     return ret;
  287.   }
  288.   

crypto/bn/bn_ctx.c:287:1: return from a call to BN_CTX_get
  285.       CTXDBG_RET(ctx, ret);
  286.       return ret;
  287. > }
  288.   
  289.   /************/

crypto/dsa/dsa_gen.c:661:10: Taking false branch
659.           return 0;
660.       tmp = BN_CTX_get(ctx);
661.       if (!tmp)
                ^
662.           goto err;
663.       if ((mont = BN_MONT_CTX_new()) == NULL)

crypto/dsa/dsa_gen.c:663:9: 
661.       if (!tmp)
662.           goto err;
663. >     if ((mont = BN_MONT_CTX_new()) == NULL)
664.           goto err;
665.       if (!BN_MONT_CTX_set(mont, dsa->p, ctx))

crypto/bn/bn_mont.c:314:1: start of procedure BN_MONT_CTX_new()
  312.   }
  313.   
  314. > BN_MONT_CTX *BN_MONT_CTX_new(void)
  315.   {
  316.       BN_MONT_CTX *ret;

crypto/bn/bn_mont.c:318:9: 
  316.       BN_MONT_CTX *ret;
  317.   
  318. >     if ((ret = OPENSSL_malloc(sizeof(*ret))) == NULL)
  319.           return (NULL);
  320.   

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/bn/bn_mont.c:318:9: Taking false branch
  316.       BN_MONT_CTX *ret;
  317.   
  318.       if ((ret = OPENSSL_malloc(sizeof(*ret))) == NULL)
                 ^
  319.           return (NULL);
  320.   

crypto/bn/bn_mont.c:321:5: 
  319.           return (NULL);
  320.   
  321. >     BN_MONT_CTX_init(ret);
  322.       ret->flags = BN_FLG_MALLOCED;
  323.       return (ret);

crypto/bn/bn_mont.c:326:1: start of procedure BN_MONT_CTX_init()
    324.   }
    325.   
    326. > void BN_MONT_CTX_init(BN_MONT_CTX *ctx)
    327.   {
    328.       ctx->ri = 0;

crypto/bn/bn_mont.c:328:5: 
    326.   void BN_MONT_CTX_init(BN_MONT_CTX *ctx)
    327.   {
    328. >     ctx->ri = 0;
    329.       bn_init(&(ctx->RR));
    330.       bn_init(&(ctx->N));

crypto/bn/bn_mont.c:329:5: Skipping bn_init(): empty list of specs
    327.   {
    328.       ctx->ri = 0;
    329.       bn_init(&(ctx->RR));
               ^
    330.       bn_init(&(ctx->N));
    331.       bn_init(&(ctx->Ni));

crypto/bn/bn_mont.c:330:5: Skipping bn_init(): empty list of specs
    328.       ctx->ri = 0;
    329.       bn_init(&(ctx->RR));
    330.       bn_init(&(ctx->N));
               ^
    331.       bn_init(&(ctx->Ni));
    332.       ctx->n0[0] = ctx->n0[1] = 0;

crypto/bn/bn_mont.c:331:5: Skipping bn_init(): empty list of specs
    329.       bn_init(&(ctx->RR));
    330.       bn_init(&(ctx->N));
    331.       bn_init(&(ctx->Ni));
               ^
    332.       ctx->n0[0] = ctx->n0[1] = 0;
    333.       ctx->flags = 0;

crypto/bn/bn_mont.c:332:5: 
    330.       bn_init(&(ctx->N));
    331.       bn_init(&(ctx->Ni));
    332. >     ctx->n0[0] = ctx->n0[1] = 0;
    333.       ctx->flags = 0;
    334.   }

crypto/bn/bn_mont.c:333:5: 
    331.       bn_init(&(ctx->Ni));
    332.       ctx->n0[0] = ctx->n0[1] = 0;
    333. >     ctx->flags = 0;
    334.   }
    335.   

crypto/bn/bn_mont.c:334:1: return from a call to BN_MONT_CTX_init
    332.       ctx->n0[0] = ctx->n0[1] = 0;
    333.       ctx->flags = 0;
    334. > }
    335.   
    336.   void BN_MONT_CTX_free(BN_MONT_CTX *mont)

crypto/bn/bn_mont.c:322:5: 
  320.   
  321.       BN_MONT_CTX_init(ret);
  322. >     ret->flags = BN_FLG_MALLOCED;
  323.       return (ret);
  324.   }

crypto/bn/bn_mont.c:323:5: 
  321.       BN_MONT_CTX_init(ret);
  322.       ret->flags = BN_FLG_MALLOCED;
  323. >     return (ret);
  324.   }
  325.   

crypto/bn/bn_mont.c:324:1: return from a call to BN_MONT_CTX_new
  322.       ret->flags = BN_FLG_MALLOCED;
  323.       return (ret);
  324. > }
  325.   
  326.   void BN_MONT_CTX_init(BN_MONT_CTX *ctx)

crypto/dsa/dsa_gen.c:663:9: Taking false branch
661.       if (!tmp)
662.           goto err;
663.       if ((mont = BN_MONT_CTX_new()) == NULL)
               ^
664.           goto err;
665.       if (!BN_MONT_CTX_set(mont, dsa->p, ctx))

crypto/dsa/dsa_gen.c:665:10: Taking false branch
663.       if ((mont = BN_MONT_CTX_new()) == NULL)
664.           goto err;
665.       if (!BN_MONT_CTX_set(mont, dsa->p, ctx))
                ^
666.           goto err;
667.       /* Work out g^q mod p */

crypto/dsa/dsa_gen.c:668:10: 
666.           goto err;
667.       /* Work out g^q mod p */
668. >     if (!BN_mod_exp_mont(tmp, dsa->g, dsa->q, dsa->p, ctx, mont))
669.           goto err;
670.       if (!BN_cmp(tmp, BN_value_one()))

crypto/bn/bn_exp.c:400:1: start of procedure BN_mod_exp_mont()
  398.   }
  399.   
  400. > int BN_mod_exp_mont(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p,
  401.                       const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *in_mont)
  402.   {

crypto/bn/bn_exp.c:403:5: 
  401.                       const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *in_mont)
  402.   {
  403. >     int i, j, bits, ret = 0, wstart, wend, window, wvalue;
  404.       int start = 1;
  405.       BIGNUM *d, *r;

crypto/bn/bn_exp.c:404:5: 
  402.   {
  403.       int i, j, bits, ret = 0, wstart, wend, window, wvalue;
  404. >     int start = 1;
  405.       BIGNUM *d, *r;
  406.       const BIGNUM *aa;

crypto/bn/bn_exp.c:409:5: 
  407.       /* Table of variables obtained from 'ctx' */
  408.       BIGNUM *val[TABLE_SIZE];
  409. >     BN_MONT_CTX *mont = NULL;
  410.   
  411.       if (BN_get_flags(p, BN_FLG_CONSTTIME) != 0) {

crypto/bn/bn_exp.c:411:9: 
  409.       BN_MONT_CTX *mont = NULL;
  410.   
  411. >     if (BN_get_flags(p, BN_FLG_CONSTTIME) != 0) {
  412.           return BN_mod_exp_mont_consttime(rr, a, p, m, ctx, in_mont);
  413.       }

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

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

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

crypto/bn/bn_exp.c:411:9: Taking true branch
  409.       BN_MONT_CTX *mont = NULL;
  410.   
  411.       if (BN_get_flags(p, BN_FLG_CONSTTIME) != 0) {
                 ^
  412.           return BN_mod_exp_mont_consttime(rr, a, p, m, ctx, in_mont);
  413.       }

crypto/bn/bn_exp.c:412:9: Skipping BN_mod_exp_mont_consttime(): empty list of specs
  410.   
  411.       if (BN_get_flags(p, BN_FLG_CONSTTIME) != 0) {
  412.           return BN_mod_exp_mont_consttime(rr, a, p, m, ctx, in_mont);
                 ^
  413.       }
  414.   

crypto/bn/bn_exp.c:576:1: return from a call to BN_mod_exp_mont
  574.       bn_check_top(rr);
  575.       return (ret);
  576. > }
  577.   
  578.   #if defined(SPARC_T4_MONT)

crypto/dsa/dsa_gen.c:668:10: Taking true branch
666.           goto err;
667.       /* Work out g^q mod p */
668.       if (!BN_mod_exp_mont(tmp, dsa->g, dsa->q, dsa->p, ctx, mont))
                ^
669.           goto err;
670.       if (!BN_cmp(tmp, BN_value_one()))

crypto/dsa/dsa_gen.c:674:2: 
672.       else
673.           rv = 0;
674. >  err:
675.       BN_CTX_end(ctx);
676.       BN_MONT_CTX_free(mont);

crypto/dsa/dsa_gen.c:675:5: 
673.           rv = 0;
674.    err:
675. >     BN_CTX_end(ctx);
676.       BN_MONT_CTX_free(mont);
677.       BN_CTX_free(ctx);

crypto/bn/bn_ctx.c:249:1: start of procedure BN_CTX_end()
  247.   }
  248.   
  249. > void BN_CTX_end(BN_CTX *ctx)
  250.   {
  251.       CTXDBG_ENTRY("BN_CTX_end", ctx);

crypto/bn/bn_ctx.c:252:9: Taking true branch
  250.   {
  251.       CTXDBG_ENTRY("BN_CTX_end", ctx);
  252.       if (ctx->err_stack)
                 ^
  253.           ctx->err_stack--;
  254.       else {

crypto/bn/bn_ctx.c:253:9: 
  251.       CTXDBG_ENTRY("BN_CTX_end", ctx);
  252.       if (ctx->err_stack)
  253. >         ctx->err_stack--;
  254.       else {
  255.           unsigned int fp = BN_STACK_pop(&ctx->stack);

crypto/bn/bn_ctx.c:252:5: 
  250.   {
  251.       CTXDBG_ENTRY("BN_CTX_end", ctx);
  252. >     if (ctx->err_stack)
  253.           ctx->err_stack--;
  254.       else {

crypto/bn/bn_ctx.c:264:1: return from a call to BN_CTX_end
  262.       }
  263.       CTXDBG_EXIT(ctx);
  264. > }
  265.   
  266.   BIGNUM *BN_CTX_get(BN_CTX *ctx)

crypto/dsa/dsa_gen.c:676:5: Skipping BN_MONT_CTX_free(): empty list of specs
674.    err:
675.       BN_CTX_end(ctx);
676.       BN_MONT_CTX_free(mont);
           ^
677.       BN_CTX_free(ctx);
678.       return rv;

int dsa_paramgen_check_g(DSA *dsa)
{
    BN_CTX *ctx;
    BIGNUM *tmp;
    BN_MONT_CTX *mont = NULL;
    int rv = -1;
    ctx = BN_CTX_new();
    if (ctx == NULL)
        return -1;
    BN_CTX_start(ctx);
    if (BN_cmp(dsa->g, BN_value_one()) <= 0)
        return 0;
    if (BN_cmp(dsa->g, dsa->p) >= 0)
        return 0;
    tmp = BN_CTX_get(ctx);
    if (!tmp)
        goto err;
    if ((mont = BN_MONT_CTX_new()) == NULL)
        goto err;
    if (!BN_MONT_CTX_set(mont, dsa->p, ctx))
        goto err;
    if (!BN_mod_exp_mont(tmp, dsa->g, dsa->q, dsa->p, ctx, mont))
        goto err;
    if (!BN_cmp(tmp, BN_value_one()))
        rv = 1;
    else
        rv = 0;
 err:
    BN_CTX_end(ctx);
    BN_MONT_CTX_free(mont);
    BN_CTX_free(ctx);
    return rv;
}
['int dsa_paramgen_check_g(DSA *dsa)\n{\n    BN_CTX *ctx;\n    BIGNUM *tmp;\n    BN_MONT_CTX *mont = NULL;\n    int rv = -1;\n    ctx = BN_CTX_new();\n    if (ctx == NULL)\n        return -1;\n    BN_CTX_start(ctx);\n    if (BN_cmp(dsa->g, BN_value_one()) <= 0)\n        return 0;\n    if (BN_cmp(dsa->g, dsa->p) >= 0)\n        return 0;\n    tmp = BN_CTX_get(ctx);\n    if (!tmp)\n        goto err;\n    if ((mont = BN_MONT_CTX_new()) == NULL)\n        goto err;\n    if (!BN_MONT_CTX_set(mont, dsa->p, ctx))\n        goto err;\n    if (!BN_mod_exp_mont(tmp, dsa->g, dsa->q, dsa->p, ctx, mont))\n        goto err;\n    if (!BN_cmp(tmp, BN_value_one()))\n        rv = 1;\n    else\n        rv = 0;\n err:\n    BN_CTX_end(ctx);\n    BN_MONT_CTX_free(mont);\n    BN_CTX_free(ctx);\n    return rv;\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}', 'void BN_CTX_start(BN_CTX *ctx)\n{\n    CTXDBG_ENTRY("BN_CTX_start", ctx);\n    if (ctx->err_stack || ctx->too_many)\n        ctx->err_stack++;\n    else if (!BN_STACK_push(&ctx->stack, ctx->used)) {\n        BNerr(BN_F_BN_CTX_START, BN_R_TOO_MANY_TEMPORARY_VARIABLES);\n        ctx->err_stack++;\n    }\n    CTXDBG_EXIT(ctx);\n}', 'const BIGNUM *BN_value_one(void)\n{\n    static const BN_ULONG data_one = 1L;\n    static const BIGNUM const_one =\n        { (BN_ULONG *)&data_one, 1, 1, 0, BN_FLG_STATIC_DATA };\n    return (&const_one);\n}', 'BIGNUM *BN_CTX_get(BN_CTX *ctx)\n{\n    BIGNUM *ret;\n    CTXDBG_ENTRY("BN_CTX_get", ctx);\n    if (ctx->err_stack || ctx->too_many)\n        return NULL;\n    if ((ret = BN_POOL_get(&ctx->pool, ctx->flags)) == NULL) {\n        ctx->too_many = 1;\n        BNerr(BN_F_BN_CTX_GET, BN_R_TOO_MANY_TEMPORARY_VARIABLES);\n        return NULL;\n    }\n    BN_zero(ret);\n    ctx->used++;\n    CTXDBG_RET(ctx, 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}', 'BN_MONT_CTX *BN_MONT_CTX_new(void)\n{\n    BN_MONT_CTX *ret;\n    if ((ret = OPENSSL_malloc(sizeof(*ret))) == NULL)\n        return (NULL);\n    BN_MONT_CTX_init(ret);\n    ret->flags = BN_FLG_MALLOCED;\n    return (ret);\n}', 'void BN_MONT_CTX_init(BN_MONT_CTX *ctx)\n{\n    ctx->ri = 0;\n    bn_init(&(ctx->RR));\n    bn_init(&(ctx->N));\n    bn_init(&(ctx->Ni));\n    ctx->n0[0] = ctx->n0[1] = 0;\n    ctx->flags = 0;\n}', 'int BN_mod_exp_mont(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p,\n                    const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *in_mont)\n{\n    int i, j, bits, ret = 0, wstart, wend, window, wvalue;\n    int start = 1;\n    BIGNUM *d, *r;\n    const BIGNUM *aa;\n    BIGNUM *val[TABLE_SIZE];\n    BN_MONT_CTX *mont = NULL;\n    if (BN_get_flags(p, BN_FLG_CONSTTIME) != 0) {\n        return BN_mod_exp_mont_consttime(rr, a, p, m, ctx, in_mont);\n    }\n    bn_check_top(a);\n    bn_check_top(p);\n    bn_check_top(m);\n    if (!BN_is_odd(m)) {\n        BNerr(BN_F_BN_MOD_EXP_MONT, BN_R_CALLED_WITH_EVEN_MODULUS);\n        return (0);\n    }\n    bits = BN_num_bits(p);\n    if (bits == 0) {\n        if (BN_is_one(m)) {\n            ret = 1;\n            BN_zero(rr);\n        } else {\n            ret = BN_one(rr);\n        }\n        return ret;\n    }\n    BN_CTX_start(ctx);\n    d = BN_CTX_get(ctx);\n    r = BN_CTX_get(ctx);\n    val[0] = BN_CTX_get(ctx);\n    if (!d || !r || !val[0])\n        goto err;\n    if (in_mont != NULL)\n        mont = in_mont;\n    else {\n        if ((mont = BN_MONT_CTX_new()) == NULL)\n            goto err;\n        if (!BN_MONT_CTX_set(mont, m, ctx))\n            goto err;\n    }\n    if (a->neg || BN_ucmp(a, m) >= 0) {\n        if (!BN_nnmod(val[0], a, m, ctx))\n            goto err;\n        aa = val[0];\n    } else\n        aa = a;\n    if (BN_is_zero(aa)) {\n        BN_zero(rr);\n        ret = 1;\n        goto err;\n    }\n    if (!BN_to_montgomery(val[0], aa, mont, ctx))\n        goto err;\n    window = BN_window_bits_for_exponent_size(bits);\n    if (window > 1) {\n        if (!BN_mod_mul_montgomery(d, val[0], val[0], mont, ctx))\n            goto err;\n        j = 1 << (window - 1);\n        for (i = 1; i < j; i++) {\n            if (((val[i] = BN_CTX_get(ctx)) == NULL) ||\n                !BN_mod_mul_montgomery(val[i], val[i - 1], d, mont, ctx))\n                goto err;\n        }\n    }\n    start = 1;\n    wvalue = 0;\n    wstart = bits - 1;\n    wend = 0;\n#if 1\n    j = m->top;\n    if (m->d[j - 1] & (((BN_ULONG)1) << (BN_BITS2 - 1))) {\n        if (bn_wexpand(r, j) == NULL)\n            goto err;\n        r->d[0] = (0 - m->d[0]) & BN_MASK2;\n        for (i = 1; i < j; i++)\n            r->d[i] = (~m->d[i]) & BN_MASK2;\n        r->top = j;\n        bn_correct_top(r);\n    } else\n#endif\n    if (!BN_to_montgomery(r, BN_value_one(), mont, ctx))\n        goto err;\n    for (;;) {\n        if (BN_is_bit_set(p, wstart) == 0) {\n            if (!start) {\n                if (!BN_mod_mul_montgomery(r, r, r, mont, ctx))\n                    goto err;\n            }\n            if (wstart == 0)\n                break;\n            wstart--;\n            continue;\n        }\n        j = wstart;\n        wvalue = 1;\n        wend = 0;\n        for (i = 1; i < window; i++) {\n            if (wstart - i < 0)\n                break;\n            if (BN_is_bit_set(p, wstart - i)) {\n                wvalue <<= (i - wend);\n                wvalue |= 1;\n                wend = i;\n            }\n        }\n        j = wend + 1;\n        if (!start)\n            for (i = 0; i < j; i++) {\n                if (!BN_mod_mul_montgomery(r, r, r, mont, ctx))\n                    goto err;\n            }\n        if (!BN_mod_mul_montgomery(r, r, val[wvalue >> 1], mont, ctx))\n            goto err;\n        wstart -= wend + 1;\n        wvalue = 0;\n        start = 0;\n        if (wstart < 0)\n            break;\n    }\n#if defined(SPARC_T4_MONT)\n    if (OPENSSL_sparcv9cap_P[0] & (SPARCV9_VIS3 | SPARCV9_PREFER_FPU)) {\n        j = mont->N.top;\n        val[0]->d[0] = 1;\n        for (i = 1; i < j; i++)\n            val[0]->d[i] = 0;\n        val[0]->top = j;\n        if (!BN_mod_mul_montgomery(rr, r, val[0], mont, ctx))\n            goto err;\n    } else\n#endif\n    if (!BN_from_montgomery(rr, r, mont, ctx))\n        goto err;\n    ret = 1;\n err:\n    if (in_mont == NULL)\n        BN_MONT_CTX_free(mont);\n    BN_CTX_end(ctx);\n    bn_check_top(rr);\n    return (ret);\n}', 'int BN_get_flags(const BIGNUM *b, int n)\n{\n    return b->flags & n;\n}', 'void BN_CTX_end(BN_CTX *ctx)\n{\n    CTXDBG_ENTRY("BN_CTX_end", ctx);\n    if (ctx->err_stack)\n        ctx->err_stack--;\n    else {\n        unsigned int fp = BN_STACK_pop(&ctx->stack);\n        if (fp < ctx->used)\n            BN_POOL_release(&ctx->pool, ctx->used - fp);\n        ctx->used = fp;\n        ctx->too_many = 0;\n    }\n    CTXDBG_EXIT(ctx);\n}']