test/bntest.c:480: error: MEMORY_LEAK
  memory dynamically allocated by call to `BN_MONT_CTX_new()` at line 327, column 17 is not reachable after line 480, column 5.
Showing all 136 steps of the trace


test/bntest.c:312:1: start of procedure test_modexp_mont5()
310.    * x86_64 cause a different code branch to be taken.
311.    */
312. > static int test_modexp_mont5(void)
313.   {
314.       BIGNUM *a = NULL, *p = NULL, *m = NULL, *d = NULL, *e = NULL;

test/bntest.c:314:5: 
312.   static int test_modexp_mont5(void)
313.   {
314. >     BIGNUM *a = NULL, *p = NULL, *m = NULL, *d = NULL, *e = NULL;
315.       BIGNUM *b = NULL, *n = NULL, *c = NULL;
316.       BN_MONT_CTX *mont = NULL;

test/bntest.c:315:5: 
313.   {
314.       BIGNUM *a = NULL, *p = NULL, *m = NULL, *d = NULL, *e = NULL;
315. >     BIGNUM *b = NULL, *n = NULL, *c = NULL;
316.       BN_MONT_CTX *mont = NULL;
317.       int st = 0;

test/bntest.c:316:5: 
314.       BIGNUM *a = NULL, *p = NULL, *m = NULL, *d = NULL, *e = NULL;
315.       BIGNUM *b = NULL, *n = NULL, *c = NULL;
316. >     BN_MONT_CTX *mont = NULL;
317.       int st = 0;
318.   

test/bntest.c:317:5: 
315.       BIGNUM *b = NULL, *n = NULL, *c = NULL;
316.       BN_MONT_CTX *mont = NULL;
317. >     int st = 0;
318.   
319.       if (!TEST_ptr(a = BN_new())

test/bntest.c:319:10: Skipping BN_new(): empty list of specs
317.       int st = 0;
318.   
319.       if (!TEST_ptr(a = BN_new())
                ^
320.               || !TEST_ptr(p = BN_new())
321.               || !TEST_ptr(m = BN_new())

test/testutil/tests.c:228:1: start of procedure test_ptr()
  226.   }
  227.   
  228. > int test_ptr(const char *file, int line, const char *s, const void *p)
  229.   {
  230.       if (p != NULL)

test/testutil/tests.c:230:9: Taking true branch
  228.   int test_ptr(const char *file, int line, const char *s, const void *p)
  229.   {
  230.       if (p != NULL)
                 ^
  231.           return 1;
  232.       test_fail_message(NULL, file, line, "ptr", s, "NULL", "!=", "%p", p);

test/testutil/tests.c:231:9: 
  229.   {
  230.       if (p != NULL)
  231. >         return 1;
  232.       test_fail_message(NULL, file, line, "ptr", s, "NULL", "!=", "%p", p);
  233.       return 0;

test/testutil/tests.c:234:1: return from a call to test_ptr
  232.       test_fail_message(NULL, file, line, "ptr", s, "NULL", "!=", "%p", p);
  233.       return 0;
  234. > }
  235.   
  236.   int test_true(const char *file, int line, const char *s, int b)

test/bntest.c:319:10: Taking false branch
317.       int st = 0;
318.   
319.       if (!TEST_ptr(a = BN_new())
                ^
320.               || !TEST_ptr(p = BN_new())
321.               || !TEST_ptr(m = BN_new())

test/bntest.c:320:17: Skipping BN_new(): empty list of specs
318.   
319.       if (!TEST_ptr(a = BN_new())
320.               || !TEST_ptr(p = BN_new())
                       ^
321.               || !TEST_ptr(m = BN_new())
322.               || !TEST_ptr(d = BN_new())

test/testutil/tests.c:228:1: start of procedure test_ptr()
  226.   }
  227.   
  228. > int test_ptr(const char *file, int line, const char *s, const void *p)
  229.   {
  230.       if (p != NULL)

test/testutil/tests.c:230:9: Taking true branch
  228.   int test_ptr(const char *file, int line, const char *s, const void *p)
  229.   {
  230.       if (p != NULL)
                 ^
  231.           return 1;
  232.       test_fail_message(NULL, file, line, "ptr", s, "NULL", "!=", "%p", p);

test/testutil/tests.c:231:9: 
  229.   {
  230.       if (p != NULL)
  231. >         return 1;
  232.       test_fail_message(NULL, file, line, "ptr", s, "NULL", "!=", "%p", p);
  233.       return 0;

test/testutil/tests.c:234:1: return from a call to test_ptr
  232.       test_fail_message(NULL, file, line, "ptr", s, "NULL", "!=", "%p", p);
  233.       return 0;
  234. > }
  235.   
  236.   int test_true(const char *file, int line, const char *s, int b)

test/bntest.c:320:17: Taking false branch
318.   
319.       if (!TEST_ptr(a = BN_new())
320.               || !TEST_ptr(p = BN_new())
                       ^
321.               || !TEST_ptr(m = BN_new())
322.               || !TEST_ptr(d = BN_new())

test/bntest.c:321:17: Skipping BN_new(): empty list of specs
319.       if (!TEST_ptr(a = BN_new())
320.               || !TEST_ptr(p = BN_new())
321.               || !TEST_ptr(m = BN_new())
                       ^
322.               || !TEST_ptr(d = BN_new())
323.               || !TEST_ptr(e = BN_new())

test/testutil/tests.c:228:1: start of procedure test_ptr()
  226.   }
  227.   
  228. > int test_ptr(const char *file, int line, const char *s, const void *p)
  229.   {
  230.       if (p != NULL)

test/testutil/tests.c:230:9: Taking true branch
  228.   int test_ptr(const char *file, int line, const char *s, const void *p)
  229.   {
  230.       if (p != NULL)
                 ^
  231.           return 1;
  232.       test_fail_message(NULL, file, line, "ptr", s, "NULL", "!=", "%p", p);

test/testutil/tests.c:231:9: 
  229.   {
  230.       if (p != NULL)
  231. >         return 1;
  232.       test_fail_message(NULL, file, line, "ptr", s, "NULL", "!=", "%p", p);
  233.       return 0;

test/testutil/tests.c:234:1: return from a call to test_ptr
  232.       test_fail_message(NULL, file, line, "ptr", s, "NULL", "!=", "%p", p);
  233.       return 0;
  234. > }
  235.   
  236.   int test_true(const char *file, int line, const char *s, int b)

test/bntest.c:321:17: Taking false branch
319.       if (!TEST_ptr(a = BN_new())
320.               || !TEST_ptr(p = BN_new())
321.               || !TEST_ptr(m = BN_new())
                       ^
322.               || !TEST_ptr(d = BN_new())
323.               || !TEST_ptr(e = BN_new())

test/bntest.c:322:17: Skipping BN_new(): empty list of specs
320.               || !TEST_ptr(p = BN_new())
321.               || !TEST_ptr(m = BN_new())
322.               || !TEST_ptr(d = BN_new())
                       ^
323.               || !TEST_ptr(e = BN_new())
324.               || !TEST_ptr(b = BN_new())

test/testutil/tests.c:228:1: start of procedure test_ptr()
  226.   }
  227.   
  228. > int test_ptr(const char *file, int line, const char *s, const void *p)
  229.   {
  230.       if (p != NULL)

test/testutil/tests.c:230:9: Taking true branch
  228.   int test_ptr(const char *file, int line, const char *s, const void *p)
  229.   {
  230.       if (p != NULL)
                 ^
  231.           return 1;
  232.       test_fail_message(NULL, file, line, "ptr", s, "NULL", "!=", "%p", p);

test/testutil/tests.c:231:9: 
  229.   {
  230.       if (p != NULL)
  231. >         return 1;
  232.       test_fail_message(NULL, file, line, "ptr", s, "NULL", "!=", "%p", p);
  233.       return 0;

test/testutil/tests.c:234:1: return from a call to test_ptr
  232.       test_fail_message(NULL, file, line, "ptr", s, "NULL", "!=", "%p", p);
  233.       return 0;
  234. > }
  235.   
  236.   int test_true(const char *file, int line, const char *s, int b)

test/bntest.c:322:17: Taking false branch
320.               || !TEST_ptr(p = BN_new())
321.               || !TEST_ptr(m = BN_new())
322.               || !TEST_ptr(d = BN_new())
                       ^
323.               || !TEST_ptr(e = BN_new())
324.               || !TEST_ptr(b = BN_new())

test/bntest.c:323:17: Skipping BN_new(): empty list of specs
321.               || !TEST_ptr(m = BN_new())
322.               || !TEST_ptr(d = BN_new())
323.               || !TEST_ptr(e = BN_new())
                       ^
324.               || !TEST_ptr(b = BN_new())
325.               || !TEST_ptr(n = BN_new())

test/testutil/tests.c:228:1: start of procedure test_ptr()
  226.   }
  227.   
  228. > int test_ptr(const char *file, int line, const char *s, const void *p)
  229.   {
  230.       if (p != NULL)

test/testutil/tests.c:230:9: Taking true branch
  228.   int test_ptr(const char *file, int line, const char *s, const void *p)
  229.   {
  230.       if (p != NULL)
                 ^
  231.           return 1;
  232.       test_fail_message(NULL, file, line, "ptr", s, "NULL", "!=", "%p", p);

test/testutil/tests.c:231:9: 
  229.   {
  230.       if (p != NULL)
  231. >         return 1;
  232.       test_fail_message(NULL, file, line, "ptr", s, "NULL", "!=", "%p", p);
  233.       return 0;

test/testutil/tests.c:234:1: return from a call to test_ptr
  232.       test_fail_message(NULL, file, line, "ptr", s, "NULL", "!=", "%p", p);
  233.       return 0;
  234. > }
  235.   
  236.   int test_true(const char *file, int line, const char *s, int b)

test/bntest.c:323:17: Taking false branch
321.               || !TEST_ptr(m = BN_new())
322.               || !TEST_ptr(d = BN_new())
323.               || !TEST_ptr(e = BN_new())
                       ^
324.               || !TEST_ptr(b = BN_new())
325.               || !TEST_ptr(n = BN_new())

test/bntest.c:324:17: Skipping BN_new(): empty list of specs
322.               || !TEST_ptr(d = BN_new())
323.               || !TEST_ptr(e = BN_new())
324.               || !TEST_ptr(b = BN_new())
                       ^
325.               || !TEST_ptr(n = BN_new())
326.               || !TEST_ptr(c = BN_new())

test/testutil/tests.c:228:1: start of procedure test_ptr()
  226.   }
  227.   
  228. > int test_ptr(const char *file, int line, const char *s, const void *p)
  229.   {
  230.       if (p != NULL)

test/testutil/tests.c:230:9: Taking true branch
  228.   int test_ptr(const char *file, int line, const char *s, const void *p)
  229.   {
  230.       if (p != NULL)
                 ^
  231.           return 1;
  232.       test_fail_message(NULL, file, line, "ptr", s, "NULL", "!=", "%p", p);

test/testutil/tests.c:231:9: 
  229.   {
  230.       if (p != NULL)
  231. >         return 1;
  232.       test_fail_message(NULL, file, line, "ptr", s, "NULL", "!=", "%p", p);
  233.       return 0;

test/testutil/tests.c:234:1: return from a call to test_ptr
  232.       test_fail_message(NULL, file, line, "ptr", s, "NULL", "!=", "%p", p);
  233.       return 0;
  234. > }
  235.   
  236.   int test_true(const char *file, int line, const char *s, int b)

test/bntest.c:324:17: Taking false branch
322.               || !TEST_ptr(d = BN_new())
323.               || !TEST_ptr(e = BN_new())
324.               || !TEST_ptr(b = BN_new())
                       ^
325.               || !TEST_ptr(n = BN_new())
326.               || !TEST_ptr(c = BN_new())

test/bntest.c:325:17: Skipping BN_new(): empty list of specs
323.               || !TEST_ptr(e = BN_new())
324.               || !TEST_ptr(b = BN_new())
325.               || !TEST_ptr(n = BN_new())
                       ^
326.               || !TEST_ptr(c = BN_new())
327.               || !TEST_ptr(mont = BN_MONT_CTX_new()))

test/testutil/tests.c:228:1: start of procedure test_ptr()
  226.   }
  227.   
  228. > int test_ptr(const char *file, int line, const char *s, const void *p)
  229.   {
  230.       if (p != NULL)

test/testutil/tests.c:230:9: Taking true branch
  228.   int test_ptr(const char *file, int line, const char *s, const void *p)
  229.   {
  230.       if (p != NULL)
                 ^
  231.           return 1;
  232.       test_fail_message(NULL, file, line, "ptr", s, "NULL", "!=", "%p", p);

test/testutil/tests.c:231:9: 
  229.   {
  230.       if (p != NULL)
  231. >         return 1;
  232.       test_fail_message(NULL, file, line, "ptr", s, "NULL", "!=", "%p", p);
  233.       return 0;

test/testutil/tests.c:234:1: return from a call to test_ptr
  232.       test_fail_message(NULL, file, line, "ptr", s, "NULL", "!=", "%p", p);
  233.       return 0;
  234. > }
  235.   
  236.   int test_true(const char *file, int line, const char *s, int b)

test/bntest.c:325:17: Taking false branch
323.               || !TEST_ptr(e = BN_new())
324.               || !TEST_ptr(b = BN_new())
325.               || !TEST_ptr(n = BN_new())
                       ^
326.               || !TEST_ptr(c = BN_new())
327.               || !TEST_ptr(mont = BN_MONT_CTX_new()))

test/bntest.c:326:17: Skipping BN_new(): empty list of specs
324.               || !TEST_ptr(b = BN_new())
325.               || !TEST_ptr(n = BN_new())
326.               || !TEST_ptr(c = BN_new())
                       ^
327.               || !TEST_ptr(mont = BN_MONT_CTX_new()))
328.           goto err;

test/testutil/tests.c:228:1: start of procedure test_ptr()
  226.   }
  227.   
  228. > int test_ptr(const char *file, int line, const char *s, const void *p)
  229.   {
  230.       if (p != NULL)

test/testutil/tests.c:230:9: Taking true branch
  228.   int test_ptr(const char *file, int line, const char *s, const void *p)
  229.   {
  230.       if (p != NULL)
                 ^
  231.           return 1;
  232.       test_fail_message(NULL, file, line, "ptr", s, "NULL", "!=", "%p", p);

test/testutil/tests.c:231:9: 
  229.   {
  230.       if (p != NULL)
  231. >         return 1;
  232.       test_fail_message(NULL, file, line, "ptr", s, "NULL", "!=", "%p", p);
  233.       return 0;

test/testutil/tests.c:234:1: return from a call to test_ptr
  232.       test_fail_message(NULL, file, line, "ptr", s, "NULL", "!=", "%p", p);
  233.       return 0;
  234. > }
  235.   
  236.   int test_true(const char *file, int line, const char *s, int b)

test/bntest.c:326:17: Taking false branch
324.               || !TEST_ptr(b = BN_new())
325.               || !TEST_ptr(n = BN_new())
326.               || !TEST_ptr(c = BN_new())
                       ^
327.               || !TEST_ptr(mont = BN_MONT_CTX_new()))
328.           goto err;

test/bntest.c:327:17: 
325.               || !TEST_ptr(n = BN_new())
326.               || !TEST_ptr(c = BN_new())
327. >             || !TEST_ptr(mont = BN_MONT_CTX_new()))
328.           goto err;
329.   

crypto/bn/bn_mont.c:198:1: start of procedure BN_MONT_CTX_new()
  196.   }
  197.   
  198. > BN_MONT_CTX *BN_MONT_CTX_new(void)
  199.   {
  200.       BN_MONT_CTX *ret;

crypto/bn/bn_mont.c:202:9: 
  200.       BN_MONT_CTX *ret;
  201.   
  202. >     if ((ret = OPENSSL_malloc(sizeof(*ret))) == NULL) {
  203.           BNerr(BN_F_BN_MONT_CTX_NEW, ERR_R_MALLOC_FAILURE);
  204.           return NULL;

crypto/mem.c:192:1: start of procedure CRYPTO_malloc()
    190.   #endif
    191.   
    192. > void *CRYPTO_malloc(size_t num, const char *file, int line)
    193.   {
    194.       void *ret = NULL;

crypto/mem.c:194:5: 
    192.   void *CRYPTO_malloc(size_t num, const char *file, int line)
    193.   {
    194. >     void *ret = NULL;
    195.   
    196.       INCREMENT(malloc_count);

crypto/mem.c:197:9: Taking false branch
    195.   
    196.       INCREMENT(malloc_count);
    197.       if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)
                   ^
    198.           return malloc_impl(num, file, line);
    199.   

crypto/mem.c:200:9: Taking false branch
    198.           return malloc_impl(num, file, line);
    199.   
    200.       if (num == 0)
                   ^
    201.           return NULL;
    202.   

crypto/mem.c:204:9: Taking true branch
    202.   
    203.       FAILTEST();
    204.       if (allow_customize) {
                   ^
    205.           /*
    206.            * Disallow customization after the first allocation. We only set this

crypto/mem.c:210:9: 
    208.            * allocation.
    209.            */
    210. >         allow_customize = 0;
    211.       }
    212.   #ifndef OPENSSL_NO_CRYPTO_MDEBUG

crypto/mem.c:221:5: 
    219.       }
    220.   #else
    221. >     (void)(file); (void)(line);
    222.       ret = malloc(num);
    223.   #endif

crypto/mem.c:221:19: 
    219.       }
    220.   #else
    221. >     (void)(file); (void)(line);
    222.       ret = malloc(num);
    223.   #endif

crypto/mem.c:222:5: 
    220.   #else
    221.       (void)(file); (void)(line);
    222. >     ret = malloc(num);
    223.   #endif
    224.   

crypto/mem.c:225:5: 
    223.   #endif
    224.   
    225. >     return ret;
    226.   }
    227.   

crypto/mem.c:226:1: return from a call to CRYPTO_malloc
    224.   
    225.       return ret;
    226. > }
    227.   
    228.   void *CRYPTO_zalloc(size_t num, const char *file, int line)

crypto/bn/bn_mont.c:202:9: Taking false branch
  200.       BN_MONT_CTX *ret;
  201.   
  202.       if ((ret = OPENSSL_malloc(sizeof(*ret))) == NULL) {
                 ^
  203.           BNerr(BN_F_BN_MONT_CTX_NEW, ERR_R_MALLOC_FAILURE);
  204.           return NULL;

crypto/bn/bn_mont.c:207:5: 
  205.       }
  206.   
  207. >     BN_MONT_CTX_init(ret);
  208.       ret->flags = BN_FLG_MALLOCED;
  209.       return ret;

crypto/bn/bn_mont.c:212:1: start of procedure BN_MONT_CTX_init()
    210.   }
    211.   
    212. > void BN_MONT_CTX_init(BN_MONT_CTX *ctx)
    213.   {
    214.       ctx->ri = 0;

crypto/bn/bn_mont.c:214:5: 
    212.   void BN_MONT_CTX_init(BN_MONT_CTX *ctx)
    213.   {
    214. >     ctx->ri = 0;
    215.       bn_init(&ctx->RR);
    216.       bn_init(&ctx->N);

crypto/bn/bn_mont.c:215:5: Skipping bn_init(): empty list of specs
    213.   {
    214.       ctx->ri = 0;
    215.       bn_init(&ctx->RR);
               ^
    216.       bn_init(&ctx->N);
    217.       bn_init(&ctx->Ni);

crypto/bn/bn_mont.c:216:5: Skipping bn_init(): empty list of specs
    214.       ctx->ri = 0;
    215.       bn_init(&ctx->RR);
    216.       bn_init(&ctx->N);
               ^
    217.       bn_init(&ctx->Ni);
    218.       ctx->n0[0] = ctx->n0[1] = 0;

crypto/bn/bn_mont.c:217:5: Skipping bn_init(): empty list of specs
    215.       bn_init(&ctx->RR);
    216.       bn_init(&ctx->N);
    217.       bn_init(&ctx->Ni);
               ^
    218.       ctx->n0[0] = ctx->n0[1] = 0;
    219.       ctx->flags = 0;

crypto/bn/bn_mont.c:218:5: 
    216.       bn_init(&ctx->N);
    217.       bn_init(&ctx->Ni);
    218. >     ctx->n0[0] = ctx->n0[1] = 0;
    219.       ctx->flags = 0;
    220.   }

crypto/bn/bn_mont.c:219:5: 
    217.       bn_init(&ctx->Ni);
    218.       ctx->n0[0] = ctx->n0[1] = 0;
    219. >     ctx->flags = 0;
    220.   }
    221.   

crypto/bn/bn_mont.c:220:1: return from a call to BN_MONT_CTX_init
    218.       ctx->n0[0] = ctx->n0[1] = 0;
    219.       ctx->flags = 0;
    220. > }
    221.   
    222.   void BN_MONT_CTX_free(BN_MONT_CTX *mont)

crypto/bn/bn_mont.c:208:5: 
  206.   
  207.       BN_MONT_CTX_init(ret);
  208. >     ret->flags = BN_FLG_MALLOCED;
  209.       return ret;
  210.   }

crypto/bn/bn_mont.c:209:5: 
  207.       BN_MONT_CTX_init(ret);
  208.       ret->flags = BN_FLG_MALLOCED;
  209. >     return ret;
  210.   }
  211.   

crypto/bn/bn_mont.c:210:1: return from a call to BN_MONT_CTX_new
  208.       ret->flags = BN_FLG_MALLOCED;
  209.       return ret;
  210. > }
  211.   
  212.   void BN_MONT_CTX_init(BN_MONT_CTX *ctx)

test/testutil/tests.c:228:1: start of procedure test_ptr()
  226.   }
  227.   
  228. > int test_ptr(const char *file, int line, const char *s, const void *p)
  229.   {
  230.       if (p != NULL)

test/testutil/tests.c:230:9: Taking true branch
  228.   int test_ptr(const char *file, int line, const char *s, const void *p)
  229.   {
  230.       if (p != NULL)
                 ^
  231.           return 1;
  232.       test_fail_message(NULL, file, line, "ptr", s, "NULL", "!=", "%p", p);

test/testutil/tests.c:231:9: 
  229.   {
  230.       if (p != NULL)
  231. >         return 1;
  232.       test_fail_message(NULL, file, line, "ptr", s, "NULL", "!=", "%p", p);
  233.       return 0;

test/testutil/tests.c:234:1: return from a call to test_ptr
  232.       test_fail_message(NULL, file, line, "ptr", s, "NULL", "!=", "%p", p);
  233.       return 0;
  234. > }
  235.   
  236.   int test_true(const char *file, int line, const char *s, int b)

test/bntest.c:327:17: Taking false branch
325.               || !TEST_ptr(n = BN_new())
326.               || !TEST_ptr(c = BN_new())
327.               || !TEST_ptr(mont = BN_MONT_CTX_new()))
                       ^
328.           goto err;
329.   

test/bntest.c:330:5: 
328.           goto err;
329.   
330. >     BN_bntest_rand(m, 1024, 0, 1); /* must be odd for montgomery */
331.       /* Zero exponent */
332.       BN_bntest_rand(a, 1024, 0, 0);

crypto/bn/bn_rand.c:102:1: start of procedure BN_bntest_rand()
  100.   }
  101.   
  102. > int BN_bntest_rand(BIGNUM *rnd, int bits, int top, int bottom)
  103.   {
  104.       return bnrand(TESTING, rnd, bits, top, bottom);

crypto/bn/bn_rand.c:104:5: Skipping bnrand(): empty list of specs
  102.   int BN_bntest_rand(BIGNUM *rnd, int bits, int top, int bottom)
  103.   {
  104.       return bnrand(TESTING, rnd, bits, top, bottom);
             ^
  105.   }
  106.   

crypto/bn/bn_rand.c:105:1: return from a call to BN_bntest_rand
  103.   {
  104.       return bnrand(TESTING, rnd, bits, top, bottom);
  105. > }
  106.   
  107.   int BN_priv_rand(BIGNUM *rnd, int bits, int top, int bottom)

test/bntest.c:332:5: 
330.       BN_bntest_rand(m, 1024, 0, 1); /* must be odd for montgomery */
331.       /* Zero exponent */
332. >     BN_bntest_rand(a, 1024, 0, 0);
333.       BN_zero(p);
334.       if (!TEST_true(BN_mod_exp_mont_consttime(d, a, p, m, ctx, NULL)))

crypto/bn/bn_rand.c:102:1: start of procedure BN_bntest_rand()
  100.   }
  101.   
  102. > int BN_bntest_rand(BIGNUM *rnd, int bits, int top, int bottom)
  103.   {
  104.       return bnrand(TESTING, rnd, bits, top, bottom);

crypto/bn/bn_rand.c:104:5: Skipping bnrand(): empty list of specs
  102.   int BN_bntest_rand(BIGNUM *rnd, int bits, int top, int bottom)
  103.   {
  104.       return bnrand(TESTING, rnd, bits, top, bottom);
             ^
  105.   }
  106.   

crypto/bn/bn_rand.c:105:1: return from a call to BN_bntest_rand
  103.   {
  104.       return bnrand(TESTING, rnd, bits, top, bottom);
  105. > }
  106.   
  107.   int BN_priv_rand(BIGNUM *rnd, int bits, int top, int bottom)

test/bntest.c:333:5: Skipping BN_set_word(): empty list of specs
331.       /* Zero exponent */
332.       BN_bntest_rand(a, 1024, 0, 0);
333.       BN_zero(p);
           ^
334.       if (!TEST_true(BN_mod_exp_mont_consttime(d, a, p, m, ctx, NULL)))
335.           goto err;

test/bntest.c:334:10: Condition is true
332.       BN_bntest_rand(a, 1024, 0, 0);
333.       BN_zero(p);
334.       if (!TEST_true(BN_mod_exp_mont_consttime(d, a, p, m, ctx, NULL)))
                ^
335.           goto err;
336.       if (!TEST_BN_eq_one(d))

test/testutil/tests.c:236:1: start of procedure test_true()
  234.   }
  235.   
  236. > int test_true(const char *file, int line, const char *s, int b)
  237.   {
  238.       if (b)

test/testutil/tests.c:238:9: Taking true branch
  236.   int test_true(const char *file, int line, const char *s, int b)
  237.   {
  238.       if (b)
                 ^
  239.           return 1;
  240.       test_fail_message(NULL, file, line, "bool", s, "true", "==", "false");

test/testutil/tests.c:239:9: 
  237.   {
  238.       if (b)
  239. >         return 1;
  240.       test_fail_message(NULL, file, line, "bool", s, "true", "==", "false");
  241.       return 0;

test/testutil/tests.c:242:1: return from a call to test_true
  240.       test_fail_message(NULL, file, line, "bool", s, "true", "==", "false");
  241.       return 0;
  242. > }
  243.   
  244.   int test_false(const char *file, int line, const char *s, int b)

test/bntest.c:334:10: Taking false branch
332.       BN_bntest_rand(a, 1024, 0, 0);
333.       BN_zero(p);
334.       if (!TEST_true(BN_mod_exp_mont_consttime(d, a, p, m, ctx, NULL)))
                ^
335.           goto err;
336.       if (!TEST_BN_eq_one(d))

test/bntest.c:336:10: 
334.       if (!TEST_true(BN_mod_exp_mont_consttime(d, a, p, m, ctx, NULL)))
335.           goto err;
336. >     if (!TEST_BN_eq_one(d))
337.           goto err;
338.   

test/testutil/tests.c:364:1: start of procedure test_BN_eq_one()
  362.   DEFINE_BN_COMPARISONS(le, <=, BN_is_negative(a) || BN_is_zero(a))
  363.   
  364. > int test_BN_eq_one(const char *file, int line, const char *s, const BIGNUM *a)
  365.   {
  366.       if (a != NULL && BN_is_one(a))

test/testutil/tests.c:366:9: Taking true branch
  364.   int test_BN_eq_one(const char *file, int line, const char *s, const BIGNUM *a)
  365.   {
  366.       if (a != NULL && BN_is_one(a))
                 ^
  367.           return 1;
  368.       test_fail_bignum_mono_message(NULL, file, line, "BIGNUM", s, "1", "==", a);

test/testutil/tests.c:366:22: 
  364.   int test_BN_eq_one(const char *file, int line, const char *s, const BIGNUM *a)
  365.   {
  366. >     if (a != NULL && BN_is_one(a))
  367.           return 1;
  368.       test_fail_bignum_mono_message(NULL, file, line, "BIGNUM", s, "1", "==", a);

crypto/bn/bn_lib.c:847:1: start of procedure BN_is_one()
    845.   }
    846.   
    847. > int BN_is_one(const BIGNUM *a)
    848.   {
    849.       return BN_abs_is_word(a, 1) && !a->neg;

crypto/bn/bn_lib.c:849:12: 
    847.   int BN_is_one(const BIGNUM *a)
    848.   {
    849. >     return BN_abs_is_word(a, 1) && !a->neg;
    850.   }
    851.   

crypto/bn/bn_lib.c:837:1: start of procedure BN_abs_is_word()
      835.   }
      836.   
      837. > int BN_abs_is_word(const BIGNUM *a, const BN_ULONG w)
      838.   {
      839.       return ((a->top == 1) && (a->d[0] == w)) || ((w == 0) && (a->top == 0));

crypto/bn/bn_lib.c:839:14: Condition is true
      837.   int BN_abs_is_word(const BIGNUM *a, const BN_ULONG w)
      838.   {
      839.       return ((a->top == 1) && (a->d[0] == w)) || ((w == 0) && (a->top == 0));
                          ^
      840.   }
      841.   

crypto/bn/bn_lib.c:839:31: Condition is true
      837.   int BN_abs_is_word(const BIGNUM *a, const BN_ULONG w)
      838.   {
      839.       return ((a->top == 1) && (a->d[0] == w)) || ((w == 0) && (a->top == 0));
                                           ^
      840.   }
      841.   

crypto/bn/bn_lib.c:839:12: 
      837.   int BN_abs_is_word(const BIGNUM *a, const BN_ULONG w)
      838.   {
      839. >     return ((a->top == 1) && (a->d[0] == w)) || ((w == 0) && (a->top == 0));
      840.   }
      841.   

crypto/bn/bn_lib.c:839:5: 
      837.   int BN_abs_is_word(const BIGNUM *a, const BN_ULONG w)
      838.   {
      839. >     return ((a->top == 1) && (a->d[0] == w)) || ((w == 0) && (a->top == 0));
      840.   }
      841.   

crypto/bn/bn_lib.c:840:1: return from a call to BN_abs_is_word
      838.   {
      839.       return ((a->top == 1) && (a->d[0] == w)) || ((w == 0) && (a->top == 0));
      840. > }
      841.   
      842.   int BN_is_zero(const BIGNUM *a)

crypto/bn/bn_lib.c:849:12: Condition is true
    847.   int BN_is_one(const BIGNUM *a)
    848.   {
    849.       return BN_abs_is_word(a, 1) && !a->neg;
                      ^
    850.   }
    851.   

crypto/bn/bn_lib.c:849:37: Condition is false
    847.   int BN_is_one(const BIGNUM *a)
    848.   {
    849.       return BN_abs_is_word(a, 1) && !a->neg;
                                               ^
    850.   }
    851.   

crypto/bn/bn_lib.c:849:12: 
    847.   int BN_is_one(const BIGNUM *a)
    848.   {
    849. >     return BN_abs_is_word(a, 1) && !a->neg;
    850.   }
    851.   

crypto/bn/bn_lib.c:849:5: 
    847.   int BN_is_one(const BIGNUM *a)
    848.   {
    849. >     return BN_abs_is_word(a, 1) && !a->neg;
    850.   }
    851.   

crypto/bn/bn_lib.c:850:1: return from a call to BN_is_one
    848.   {
    849.       return BN_abs_is_word(a, 1) && !a->neg;
    850. > }
    851.   
    852.   int BN_is_word(const BIGNUM *a, const BN_ULONG w)

test/testutil/tests.c:366:22: Taking false branch
  364.   int test_BN_eq_one(const char *file, int line, const char *s, const BIGNUM *a)
  365.   {
  366.       if (a != NULL && BN_is_one(a))
                              ^
  367.           return 1;
  368.       test_fail_bignum_mono_message(NULL, file, line, "BIGNUM", s, "1", "==", a);

test/testutil/tests.c:368:5: 
  366.       if (a != NULL && BN_is_one(a))
  367.           return 1;
  368. >     test_fail_bignum_mono_message(NULL, file, line, "BIGNUM", s, "1", "==", a);
  369.       return 0;
  370.   }

test/testutil/format_output.c:373:1: start of procedure test_fail_bignum_mono_message()
    371.   }
    372.   
    373. > void test_fail_bignum_mono_message(const char *prefix, const char *file,
    374.                                      int line, const char *type,
    375.                                      const char *left, const char *right,

test/testutil/format_output.c:378:5: Skipping test_fail_bignum_common(): empty list of specs
    376.                                      const char *op, const BIGNUM *bn)
    377.   {
    378.       test_fail_bignum_common(prefix, file, line, type, left, right, op, bn, bn);
               ^
    379.       test_printf_stderr("\n");
    380.   }

test/testutil/format_output.c:379:5: Skipping test_printf_stderr(): empty list of specs
    377.   {
    378.       test_fail_bignum_common(prefix, file, line, type, left, right, op, bn, bn);
    379.       test_printf_stderr("\n");
               ^
    380.   }
    381.   

test/testutil/format_output.c:380:1: return from a call to test_fail_bignum_mono_message
    378.       test_fail_bignum_common(prefix, file, line, type, left, right, op, bn, bn);
    379.       test_printf_stderr("\n");
    380. > }
    381.   
    382.   void test_output_bignum(const char *name, const BIGNUM *bn)

test/testutil/tests.c:369:5: 
  367.           return 1;
  368.       test_fail_bignum_mono_message(NULL, file, line, "BIGNUM", s, "1", "==", a);
  369. >     return 0;
  370.   }
  371.   

test/testutil/tests.c:370:1: return from a call to test_BN_eq_one
  368.       test_fail_bignum_mono_message(NULL, file, line, "BIGNUM", s, "1", "==", a);
  369.       return 0;
  370. > }
  371.   
  372.   int test_BN_odd(const char *file, int line, const char *s, const BIGNUM *a)

test/bntest.c:336:10: Taking true branch
334.       if (!TEST_true(BN_mod_exp_mont_consttime(d, a, p, m, ctx, NULL)))
335.           goto err;
336.       if (!TEST_BN_eq_one(d))
                ^
337.           goto err;
338.   

test/bntest.c:479:1: 
477.       st = 1;
478.   
479. > err:
480.       BN_MONT_CTX_free(mont);
481.       BN_free(a);

test/bntest.c:480:5: 
478.   
479.   err:
480. >     BN_MONT_CTX_free(mont);
481.       BN_free(a);
482.       BN_free(p);

crypto/bn/bn_mont.c:222:1: start of procedure BN_MONT_CTX_free()
  220.   }
  221.   
  222. > void BN_MONT_CTX_free(BN_MONT_CTX *mont)
  223.   {
  224.       if (mont == NULL)

crypto/bn/bn_mont.c:224:9: Taking false branch
  222.   void BN_MONT_CTX_free(BN_MONT_CTX *mont)
  223.   {
  224.       if (mont == NULL)
                 ^
  225.           return;
  226.       BN_clear_free(&mont->RR);

crypto/bn/bn_mont.c:226:5: Skipping BN_clear_free(): empty list of specs
  224.       if (mont == NULL)
  225.           return;
  226.       BN_clear_free(&mont->RR);
             ^
  227.       BN_clear_free(&mont->N);
  228.       BN_clear_free(&mont->Ni);

crypto/bn/bn_mont.c:227:5: Skipping BN_clear_free(): empty list of specs
  225.           return;
  226.       BN_clear_free(&mont->RR);
  227.       BN_clear_free(&mont->N);
             ^
  228.       BN_clear_free(&mont->Ni);
  229.       if (mont->flags & BN_FLG_MALLOCED)

crypto/bn/bn_mont.c:228:5: Skipping BN_clear_free(): empty list of specs
  226.       BN_clear_free(&mont->RR);
  227.       BN_clear_free(&mont->N);
  228.       BN_clear_free(&mont->Ni);
             ^
  229.       if (mont->flags & BN_FLG_MALLOCED)
  230.           OPENSSL_free(mont);

crypto/bn/bn_mont.c:229:9: Taking false branch
  227.       BN_clear_free(&mont->N);
  228.       BN_clear_free(&mont->Ni);
  229.       if (mont->flags & BN_FLG_MALLOCED)
                 ^
  230.           OPENSSL_free(mont);
  231.   }

crypto/bn/bn_mont.c:229:5: 
  227.       BN_clear_free(&mont->N);
  228.       BN_clear_free(&mont->Ni);
  229. >     if (mont->flags & BN_FLG_MALLOCED)
  230.           OPENSSL_free(mont);
  231.   }

crypto/bn/bn_mont.c:231:1: return from a call to BN_MONT_CTX_free
  229.       if (mont->flags & BN_FLG_MALLOCED)
  230.           OPENSSL_free(mont);
  231. > }
  232.   
  233.   int BN_MONT_CTX_set(BN_MONT_CTX *mont, const BIGNUM *mod, BN_CTX *ctx)

static int test_modexp_mont5(void)
{
    BIGNUM *a = NULL, *p = NULL, *m = NULL, *d = NULL, *e = NULL;
    BIGNUM *b = NULL, *n = NULL, *c = NULL;
    BN_MONT_CTX *mont = NULL;
    int st = 0;
    if (!TEST_ptr(a = BN_new())
            || !TEST_ptr(p = BN_new())
            || !TEST_ptr(m = BN_new())
            || !TEST_ptr(d = BN_new())
            || !TEST_ptr(e = BN_new())
            || !TEST_ptr(b = BN_new())
            || !TEST_ptr(n = BN_new())
            || !TEST_ptr(c = BN_new())
            || !TEST_ptr(mont = BN_MONT_CTX_new()))
        goto err;
    BN_bntest_rand(m, 1024, 0, 1);
    BN_bntest_rand(a, 1024, 0, 0);
    BN_zero(p);
    if (!TEST_true(BN_mod_exp_mont_consttime(d, a, p, m, ctx, NULL)))
        goto err;
    if (!TEST_BN_eq_one(d))
        goto err;
    BN_hex2bn(&a,
        "7878787878787878787878787878787878787878787878787878787878787878"
        "7878787878787878787878787878787878787878787878787878787878787878"
        "7878787878787878787878787878787878787878787878787878787878787878"
        "7878787878787878787878787878787878787878787878787878787878787878");
    BN_hex2bn(&b,
        "095D72C08C097BA488C5E439C655A192EAFB6380073D8C2664668EDDB4060744"
        "E16E57FB4EDB9AE10A0CEFCDC28A894F689A128379DB279D48A2E20849D68593"
        "9B7803BCF46CEBF5C533FB0DD35B080593DE5472E3FE5DB951B8BFF9B4CB8F03"
        "9CC638A5EE8CDD703719F8000E6A9F63BEED5F2FCD52FF293EA05A251BB4AB81");
    BN_hex2bn(&n,
        "D78AF684E71DB0C39CFF4E64FB9DB567132CB9C50CC98009FEB820B26F2DED9B"
        "91B9B5E2B83AE0AE4EB4E0523CA726BFBE969B89FD754F674CE99118C3F2D1C5"
        "D81FDC7C54E02B60262B241D53C040E99E45826ECA37A804668E690E1AFC1CA4"
        "2C9A15D84D4954425F0B7642FC0BD9D7B24E2618D2DCC9B729D944BADACFDDAF");
    BN_MONT_CTX_set(mont, n, ctx);
    BN_mod_mul_montgomery(c, a, b, mont, ctx);
    BN_mod_mul_montgomery(d, b, a, mont, ctx);
    if (!TEST_BN_eq(c, d))
        goto err;
    parse_bigBN(&n, bn1strings);
    parse_bigBN(&a, bn2strings);
    BN_free(b);
    b = BN_dup(a);
    BN_MONT_CTX_set(mont, n, ctx);
    BN_mod_mul_montgomery(c, a, a, mont, ctx);
    BN_mod_mul_montgomery(d, a, b, mont, ctx);
    if (!TEST_BN_eq(c, d))
        goto err;
    {
        static const char *ahex[] = {
                      "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF",
            "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF",
            "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF",
            "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF",
            "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF8FFEADBCFC4DAE7FFF908E92820306B",
            "9544D954000000006C0000000000000000000000000000000000000000000000",
            "00000000000000000000FF030202FFFFF8FFEBDBCFC4DAE7FFF908E92820306B",
            "9544D954000000006C000000FF0302030000000000FFFFFFFFFFFFFFFFFFFFFF",
            "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF01FC00FF02FFFFFFFF",
            "00FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00FCFD",
            "FCFFFFFFFFFF000000000000000000FF0302030000000000FFFFFFFFFFFFFFFF",
            "FF00FCFDFDFF030202FF00000000FFFFFFFFFFFFFFFFFF00FCFDFCFFFFFFFFFF",
            NULL
        };
        static const char *nhex[] = {
                      "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF",
            "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF",
            "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF",
            "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF",
            "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF8F8F8F8000000",
            "00000010000000006C0000000000000000000000000000000000000000000000",
            "00000000000000000000000000000000000000FFFFFFFFFFFFF8F8F8F8000000",
            "00000010000000006C000000000000000000000000FFFFFFFFFFFFFFFFFFFFFF",
            "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF",
            "00FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF",
            "FFFFFFFFFFFF000000000000000000000000000000000000FFFFFFFFFFFFFFFF",
            "FFFFFFFFFFFFFFFFFFFF00000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF",
            NULL
        };
        parse_bigBN(&a, ahex);
        parse_bigBN(&n, nhex);
    }
    BN_free(b);
    b = BN_dup(a);
    BN_MONT_CTX_set(mont, n, ctx);
    if (!TEST_true(BN_mod_mul_montgomery(c, a, a, mont, ctx))
            || !TEST_true(BN_mod_mul_montgomery(d, a, b, mont, ctx))
            || !TEST_BN_eq(c, d))
        goto err;
    BN_hex2bn(&a,
        "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
        "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
        "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF");
    BN_hex2bn(&n,
        "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
        "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF");
    BN_MONT_CTX_set(mont, n, ctx);
    if (!TEST_false(BN_mod_mul_montgomery(d, a, a, mont, ctx)))
        goto err;
    BN_hex2bn(&a,
        "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
        "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
        "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
        "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF2020202020DF");
    BN_hex2bn(&b,
        "2020202020202020202020202020202020202020202020202020202020202020"
        "2020202020202020202020202020202020202020202020202020202020202020"
        "20202020202020FF202020202020202020202020202020202020202020202020"
        "2020202020202020202020202020202020202020202020202020202020202020");
    BN_hex2bn(&n,
        "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
        "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
        "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
        "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF2020202020FF");
    BN_MONT_CTX_set(mont, n, ctx);
    BN_mod_exp_mont_consttime(c, a, b, n, ctx, mont);
    BN_mod_exp_mont(d, a, b, n, ctx, mont);
    if (!TEST_BN_eq(c, d))
        goto err;
    BN_bntest_rand(p, 1024, 0, 0);
    BN_zero(a);
    if (!TEST_true(BN_mod_exp_mont_consttime(d, a, p, m, ctx, NULL))
            || !TEST_BN_eq_zero(d))
        goto err;
    BN_one(a);
    BN_MONT_CTX_set(mont, m, ctx);
    if (!TEST_true(BN_from_montgomery(e, a, mont, ctx))
            || !TEST_true(BN_mod_exp_mont_consttime(d, e, p, m, ctx, NULL))
            || !TEST_true(BN_mod_exp_simple(a, e, p, m, ctx))
            || !TEST_BN_eq(a, d))
        goto err;
    BN_bntest_rand(e, 1024, 0, 0);
    if (!TEST_true(BN_mod_exp_mont_consttime(d, e, p, m, ctx, NULL))
            || !TEST_true(BN_mod_exp_simple(a, e, p, m, ctx))
            || !TEST_BN_eq(a, d))
        goto err;
    st = 1;
err:
    BN_MONT_CTX_free(mont);
    BN_free(a);
    BN_free(p);
    BN_free(m);
    BN_free(d);
    BN_free(e);
    BN_free(b);
    BN_free(n);
    BN_free(c);
    return st;
}
['static int test_modexp_mont5(void)\n{\n    BIGNUM *a = NULL, *p = NULL, *m = NULL, *d = NULL, *e = NULL;\n    BIGNUM *b = NULL, *n = NULL, *c = NULL;\n    BN_MONT_CTX *mont = NULL;\n    int st = 0;\n    if (!TEST_ptr(a = BN_new())\n            || !TEST_ptr(p = BN_new())\n            || !TEST_ptr(m = BN_new())\n            || !TEST_ptr(d = BN_new())\n            || !TEST_ptr(e = BN_new())\n            || !TEST_ptr(b = BN_new())\n            || !TEST_ptr(n = BN_new())\n            || !TEST_ptr(c = BN_new())\n            || !TEST_ptr(mont = BN_MONT_CTX_new()))\n        goto err;\n    BN_bntest_rand(m, 1024, 0, 1);\n    BN_bntest_rand(a, 1024, 0, 0);\n    BN_zero(p);\n    if (!TEST_true(BN_mod_exp_mont_consttime(d, a, p, m, ctx, NULL)))\n        goto err;\n    if (!TEST_BN_eq_one(d))\n        goto err;\n    BN_hex2bn(&a,\n        "7878787878787878787878787878787878787878787878787878787878787878"\n        "7878787878787878787878787878787878787878787878787878787878787878"\n        "7878787878787878787878787878787878787878787878787878787878787878"\n        "7878787878787878787878787878787878787878787878787878787878787878");\n    BN_hex2bn(&b,\n        "095D72C08C097BA488C5E439C655A192EAFB6380073D8C2664668EDDB4060744"\n        "E16E57FB4EDB9AE10A0CEFCDC28A894F689A128379DB279D48A2E20849D68593"\n        "9B7803BCF46CEBF5C533FB0DD35B080593DE5472E3FE5DB951B8BFF9B4CB8F03"\n        "9CC638A5EE8CDD703719F8000E6A9F63BEED5F2FCD52FF293EA05A251BB4AB81");\n    BN_hex2bn(&n,\n        "D78AF684E71DB0C39CFF4E64FB9DB567132CB9C50CC98009FEB820B26F2DED9B"\n        "91B9B5E2B83AE0AE4EB4E0523CA726BFBE969B89FD754F674CE99118C3F2D1C5"\n        "D81FDC7C54E02B60262B241D53C040E99E45826ECA37A804668E690E1AFC1CA4"\n        "2C9A15D84D4954425F0B7642FC0BD9D7B24E2618D2DCC9B729D944BADACFDDAF");\n    BN_MONT_CTX_set(mont, n, ctx);\n    BN_mod_mul_montgomery(c, a, b, mont, ctx);\n    BN_mod_mul_montgomery(d, b, a, mont, ctx);\n    if (!TEST_BN_eq(c, d))\n        goto err;\n    parse_bigBN(&n, bn1strings);\n    parse_bigBN(&a, bn2strings);\n    BN_free(b);\n    b = BN_dup(a);\n    BN_MONT_CTX_set(mont, n, ctx);\n    BN_mod_mul_montgomery(c, a, a, mont, ctx);\n    BN_mod_mul_montgomery(d, a, b, mont, ctx);\n    if (!TEST_BN_eq(c, d))\n        goto err;\n    {\n        static const char *ahex[] = {\n                      "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF",\n            "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF",\n            "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF",\n            "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF",\n            "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF8FFEADBCFC4DAE7FFF908E92820306B",\n            "9544D954000000006C0000000000000000000000000000000000000000000000",\n            "00000000000000000000FF030202FFFFF8FFEBDBCFC4DAE7FFF908E92820306B",\n            "9544D954000000006C000000FF0302030000000000FFFFFFFFFFFFFFFFFFFFFF",\n            "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF01FC00FF02FFFFFFFF",\n            "00FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00FCFD",\n            "FCFFFFFFFFFF000000000000000000FF0302030000000000FFFFFFFFFFFFFFFF",\n            "FF00FCFDFDFF030202FF00000000FFFFFFFFFFFFFFFFFF00FCFDFCFFFFFFFFFF",\n            NULL\n        };\n        static const char *nhex[] = {\n                      "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF",\n            "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF",\n            "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF",\n            "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF",\n            "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF8F8F8F8000000",\n            "00000010000000006C0000000000000000000000000000000000000000000000",\n            "00000000000000000000000000000000000000FFFFFFFFFFFFF8F8F8F8000000",\n            "00000010000000006C000000000000000000000000FFFFFFFFFFFFFFFFFFFFFF",\n            "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF",\n            "00FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF",\n            "FFFFFFFFFFFF000000000000000000000000000000000000FFFFFFFFFFFFFFFF",\n            "FFFFFFFFFFFFFFFFFFFF00000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF",\n            NULL\n        };\n        parse_bigBN(&a, ahex);\n        parse_bigBN(&n, nhex);\n    }\n    BN_free(b);\n    b = BN_dup(a);\n    BN_MONT_CTX_set(mont, n, ctx);\n    if (!TEST_true(BN_mod_mul_montgomery(c, a, a, mont, ctx))\n            || !TEST_true(BN_mod_mul_montgomery(d, a, b, mont, ctx))\n            || !TEST_BN_eq(c, d))\n        goto err;\n    BN_hex2bn(&a,\n        "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"\n        "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"\n        "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF");\n    BN_hex2bn(&n,\n        "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"\n        "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF");\n    BN_MONT_CTX_set(mont, n, ctx);\n    if (!TEST_false(BN_mod_mul_montgomery(d, a, a, mont, ctx)))\n        goto err;\n    BN_hex2bn(&a,\n        "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"\n        "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"\n        "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"\n        "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF2020202020DF");\n    BN_hex2bn(&b,\n        "2020202020202020202020202020202020202020202020202020202020202020"\n        "2020202020202020202020202020202020202020202020202020202020202020"\n        "20202020202020FF202020202020202020202020202020202020202020202020"\n        "2020202020202020202020202020202020202020202020202020202020202020");\n    BN_hex2bn(&n,\n        "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"\n        "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"\n        "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"\n        "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF2020202020FF");\n    BN_MONT_CTX_set(mont, n, ctx);\n    BN_mod_exp_mont_consttime(c, a, b, n, ctx, mont);\n    BN_mod_exp_mont(d, a, b, n, ctx, mont);\n    if (!TEST_BN_eq(c, d))\n        goto err;\n    BN_bntest_rand(p, 1024, 0, 0);\n    BN_zero(a);\n    if (!TEST_true(BN_mod_exp_mont_consttime(d, a, p, m, ctx, NULL))\n            || !TEST_BN_eq_zero(d))\n        goto err;\n    BN_one(a);\n    BN_MONT_CTX_set(mont, m, ctx);\n    if (!TEST_true(BN_from_montgomery(e, a, mont, ctx))\n            || !TEST_true(BN_mod_exp_mont_consttime(d, e, p, m, ctx, NULL))\n            || !TEST_true(BN_mod_exp_simple(a, e, p, m, ctx))\n            || !TEST_BN_eq(a, d))\n        goto err;\n    BN_bntest_rand(e, 1024, 0, 0);\n    if (!TEST_true(BN_mod_exp_mont_consttime(d, e, p, m, ctx, NULL))\n            || !TEST_true(BN_mod_exp_simple(a, e, p, m, ctx))\n            || !TEST_BN_eq(a, d))\n        goto err;\n    st = 1;\nerr:\n    BN_MONT_CTX_free(mont);\n    BN_free(a);\n    BN_free(p);\n    BN_free(m);\n    BN_free(d);\n    BN_free(e);\n    BN_free(b);\n    BN_free(n);\n    BN_free(c);\n    return st;\n}', 'int test_ptr(const char *file, int line, const char *s, const void *p)\n{\n    if (p != NULL)\n        return 1;\n    test_fail_message(NULL, file, line, "ptr", s, "NULL", "!=", "%p", p);\n    return 0;\n}', 'BN_MONT_CTX *BN_MONT_CTX_new(void)\n{\n    BN_MONT_CTX *ret;\n    if ((ret = OPENSSL_malloc(sizeof(*ret))) == NULL) {\n        BNerr(BN_F_BN_MONT_CTX_NEW, ERR_R_MALLOC_FAILURE);\n        return NULL;\n    }\n    BN_MONT_CTX_init(ret);\n    ret->flags = BN_FLG_MALLOCED;\n    return ret;\n}', 'void *CRYPTO_malloc(size_t num, const char *file, int line)\n{\n    void *ret = NULL;\n    INCREMENT(malloc_count);\n    if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)\n        return malloc_impl(num, file, line);\n    if (num == 0)\n        return NULL;\n    FAILTEST();\n    if (allow_customize) {\n        allow_customize = 0;\n    }\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); (void)(line);\n    ret = malloc(num);\n#endif\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_bntest_rand(BIGNUM *rnd, int bits, int top, int bottom)\n{\n    return bnrand(TESTING, rnd, bits, top, bottom);\n}', 'int test_true(const char *file, int line, const char *s, int b)\n{\n    if (b)\n        return 1;\n    test_fail_message(NULL, file, line, "bool", s, "true", "==", "false");\n    return 0;\n}', 'int test_BN_eq_one(const char *file, int line, const char *s, const BIGNUM *a)\n{\n    if (a != NULL && BN_is_one(a))\n        return 1;\n    test_fail_bignum_mono_message(NULL, file, line, "BIGNUM", s, "1", "==", a);\n    return 0;\n}', 'int BN_is_one(const BIGNUM *a)\n{\n    return BN_abs_is_word(a, 1) && !a->neg;\n}', 'int BN_abs_is_word(const BIGNUM *a, const BN_ULONG w)\n{\n    return ((a->top == 1) && (a->d[0] == w)) || ((w == 0) && (a->top == 0));\n}', 'void test_fail_bignum_mono_message(const char *prefix, const char *file,\n                                   int line, const char *type,\n                                   const char *left, const char *right,\n                                   const char *op, const BIGNUM *bn)\n{\n    test_fail_bignum_common(prefix, file, line, type, left, right, op, bn, bn);\n    test_printf_stderr("\\n");\n}', 'void BN_MONT_CTX_free(BN_MONT_CTX *mont)\n{\n    if (mont == NULL)\n        return;\n    BN_clear_free(&mont->RR);\n    BN_clear_free(&mont->N);\n    BN_clear_free(&mont->Ni);\n    if (mont->flags & BN_FLG_MALLOCED)\n        OPENSSL_free(mont);\n}']