test/bntest.c:2225: error: NULL_DEREFERENCE
  pointer `null` is dereferenced by call to `BN_mod_exp()` at line 2225, column 14.
Showing all 112 steps of the trace


test/bntest.c:2205:1: start of procedure test_expmodone()
2203.   }
2204.   
2205. > static int test_expmodone(void)
2206.   {
2207.       int ret = 0, i;

test/bntest.c:2207:5: 
2205.   static int test_expmodone(void)
2206.   {
2207. >     int ret = 0, i;
2208.       BIGNUM *r = BN_new();
2209.       BIGNUM *a = BN_new();

test/bntest.c:2208:5: Skipping BN_new(): empty list of specs
2206.   {
2207.       int ret = 0, i;
2208.       BIGNUM *r = BN_new();
            ^
2209.       BIGNUM *a = BN_new();
2210.       BIGNUM *p = BN_new();

test/bntest.c:2209:5: Skipping BN_new(): empty list of specs
2207.       int ret = 0, i;
2208.       BIGNUM *r = BN_new();
2209.       BIGNUM *a = BN_new();
            ^
2210.       BIGNUM *p = BN_new();
2211.       BIGNUM *m = BN_new();

test/bntest.c:2210:5: Skipping BN_new(): empty list of specs
2208.       BIGNUM *r = BN_new();
2209.       BIGNUM *a = BN_new();
2210.       BIGNUM *p = BN_new();
            ^
2211.       BIGNUM *m = BN_new();
2212.   

test/bntest.c:2211:5: Skipping BN_new(): empty list of specs
2209.       BIGNUM *a = BN_new();
2210.       BIGNUM *p = BN_new();
2211.       BIGNUM *m = BN_new();
            ^
2212.   
2213.       if (!TEST_ptr(r)

test/bntest.c:2213:10: 
2211.       BIGNUM *m = BN_new();
2212.   
2213. >     if (!TEST_ptr(r)
2214.               || !TEST_ptr(a)
2215.               || !TEST_ptr(p)

test/testutil/tests.c:252:1: start of procedure test_ptr()
  250.   }
  251.   
  252. > int test_ptr(const char *file, int line, const char *s, const void *p)
  253.   {
  254.       if (p != NULL)

test/testutil/tests.c:254:9: Taking true branch
  252.   int test_ptr(const char *file, int line, const char *s, const void *p)
  253.   {
  254.       if (p != NULL)
                 ^
  255.           return 1;
  256.       test_fail_message(NULL, file, line, "ptr", s, "NULL", "!=", "%p", p);

test/testutil/tests.c:255:9: 
  253.   {
  254.       if (p != NULL)
  255. >         return 1;
  256.       test_fail_message(NULL, file, line, "ptr", s, "NULL", "!=", "%p", p);
  257.       return 0;

test/testutil/tests.c:258:1: return from a call to test_ptr
  256.       test_fail_message(NULL, file, line, "ptr", s, "NULL", "!=", "%p", p);
  257.       return 0;
  258. > }
  259.   
  260.   int test_true(const char *file, int line, const char *s, int b)

test/bntest.c:2213:10: Taking false branch
2211.       BIGNUM *m = BN_new();
2212.   
2213.       if (!TEST_ptr(r)
                 ^
2214.               || !TEST_ptr(a)
2215.               || !TEST_ptr(p)

test/bntest.c:2214:17: 
2212.   
2213.       if (!TEST_ptr(r)
2214. >             || !TEST_ptr(a)
2215.               || !TEST_ptr(p)
2216.               || !TEST_ptr(p)

test/testutil/tests.c:252:1: start of procedure test_ptr()
  250.   }
  251.   
  252. > int test_ptr(const char *file, int line, const char *s, const void *p)
  253.   {
  254.       if (p != NULL)

test/testutil/tests.c:254:9: Taking true branch
  252.   int test_ptr(const char *file, int line, const char *s, const void *p)
  253.   {
  254.       if (p != NULL)
                 ^
  255.           return 1;
  256.       test_fail_message(NULL, file, line, "ptr", s, "NULL", "!=", "%p", p);

test/testutil/tests.c:255:9: 
  253.   {
  254.       if (p != NULL)
  255. >         return 1;
  256.       test_fail_message(NULL, file, line, "ptr", s, "NULL", "!=", "%p", p);
  257.       return 0;

test/testutil/tests.c:258:1: return from a call to test_ptr
  256.       test_fail_message(NULL, file, line, "ptr", s, "NULL", "!=", "%p", p);
  257.       return 0;
  258. > }
  259.   
  260.   int test_true(const char *file, int line, const char *s, int b)

test/bntest.c:2214:17: Taking false branch
2212.   
2213.       if (!TEST_ptr(r)
2214.               || !TEST_ptr(a)
                        ^
2215.               || !TEST_ptr(p)
2216.               || !TEST_ptr(p)

test/bntest.c:2215:17: 
2213.       if (!TEST_ptr(r)
2214.               || !TEST_ptr(a)
2215. >             || !TEST_ptr(p)
2216.               || !TEST_ptr(p)
2217.               || !TEST_ptr(m)

test/testutil/tests.c:252:1: start of procedure test_ptr()
  250.   }
  251.   
  252. > int test_ptr(const char *file, int line, const char *s, const void *p)
  253.   {
  254.       if (p != NULL)

test/testutil/tests.c:254:9: Taking true branch
  252.   int test_ptr(const char *file, int line, const char *s, const void *p)
  253.   {
  254.       if (p != NULL)
                 ^
  255.           return 1;
  256.       test_fail_message(NULL, file, line, "ptr", s, "NULL", "!=", "%p", p);

test/testutil/tests.c:255:9: 
  253.   {
  254.       if (p != NULL)
  255. >         return 1;
  256.       test_fail_message(NULL, file, line, "ptr", s, "NULL", "!=", "%p", p);
  257.       return 0;

test/testutil/tests.c:258:1: return from a call to test_ptr
  256.       test_fail_message(NULL, file, line, "ptr", s, "NULL", "!=", "%p", p);
  257.       return 0;
  258. > }
  259.   
  260.   int test_true(const char *file, int line, const char *s, int b)

test/bntest.c:2215:17: Taking false branch
2213.       if (!TEST_ptr(r)
2214.               || !TEST_ptr(a)
2215.               || !TEST_ptr(p)
                        ^
2216.               || !TEST_ptr(p)
2217.               || !TEST_ptr(m)

test/bntest.c:2216:17: 
2214.               || !TEST_ptr(a)
2215.               || !TEST_ptr(p)
2216. >             || !TEST_ptr(p)
2217.               || !TEST_ptr(m)
2218.               || !TEST_true(BN_set_word(a, 1))

test/testutil/tests.c:252:1: start of procedure test_ptr()
  250.   }
  251.   
  252. > int test_ptr(const char *file, int line, const char *s, const void *p)
  253.   {
  254.       if (p != NULL)

test/testutil/tests.c:254:9: Taking true branch
  252.   int test_ptr(const char *file, int line, const char *s, const void *p)
  253.   {
  254.       if (p != NULL)
                 ^
  255.           return 1;
  256.       test_fail_message(NULL, file, line, "ptr", s, "NULL", "!=", "%p", p);

test/testutil/tests.c:255:9: 
  253.   {
  254.       if (p != NULL)
  255. >         return 1;
  256.       test_fail_message(NULL, file, line, "ptr", s, "NULL", "!=", "%p", p);
  257.       return 0;

test/testutil/tests.c:258:1: return from a call to test_ptr
  256.       test_fail_message(NULL, file, line, "ptr", s, "NULL", "!=", "%p", p);
  257.       return 0;
  258. > }
  259.   
  260.   int test_true(const char *file, int line, const char *s, int b)

test/bntest.c:2216:17: Taking false branch
2214.               || !TEST_ptr(a)
2215.               || !TEST_ptr(p)
2216.               || !TEST_ptr(p)
                        ^
2217.               || !TEST_ptr(m)
2218.               || !TEST_true(BN_set_word(a, 1))

test/bntest.c:2217:17: 
2215.               || !TEST_ptr(p)
2216.               || !TEST_ptr(p)
2217. >             || !TEST_ptr(m)
2218.               || !TEST_true(BN_set_word(a, 1))
2219.               || !TEST_true(BN_set_word(p, 0))

test/testutil/tests.c:252:1: start of procedure test_ptr()
  250.   }
  251.   
  252. > int test_ptr(const char *file, int line, const char *s, const void *p)
  253.   {
  254.       if (p != NULL)

test/testutil/tests.c:254:9: Taking true branch
  252.   int test_ptr(const char *file, int line, const char *s, const void *p)
  253.   {
  254.       if (p != NULL)
                 ^
  255.           return 1;
  256.       test_fail_message(NULL, file, line, "ptr", s, "NULL", "!=", "%p", p);

test/testutil/tests.c:255:9: 
  253.   {
  254.       if (p != NULL)
  255. >         return 1;
  256.       test_fail_message(NULL, file, line, "ptr", s, "NULL", "!=", "%p", p);
  257.       return 0;

test/testutil/tests.c:258:1: return from a call to test_ptr
  256.       test_fail_message(NULL, file, line, "ptr", s, "NULL", "!=", "%p", p);
  257.       return 0;
  258. > }
  259.   
  260.   int test_true(const char *file, int line, const char *s, int b)

test/bntest.c:2217:17: Taking false branch
2215.               || !TEST_ptr(p)
2216.               || !TEST_ptr(p)
2217.               || !TEST_ptr(m)
                        ^
2218.               || !TEST_true(BN_set_word(a, 1))
2219.               || !TEST_true(BN_set_word(p, 0))

test/bntest.c:2218:17: Condition is true
2216.               || !TEST_ptr(p)
2217.               || !TEST_ptr(m)
2218.               || !TEST_true(BN_set_word(a, 1))
                        ^
2219.               || !TEST_true(BN_set_word(p, 0))
2220.               || !TEST_true(BN_set_word(m, 1)))

test/testutil/tests.c:260:1: start of procedure test_true()
  258.   }
  259.   
  260. > int test_true(const char *file, int line, const char *s, int b)
  261.   {
  262.       if (b)

test/testutil/tests.c:262:9: Taking true branch
  260.   int test_true(const char *file, int line, const char *s, int b)
  261.   {
  262.       if (b)
                 ^
  263.           return 1;
  264.       test_fail_message(NULL, file, line, "bool", s, "true", "==", "false");

test/testutil/tests.c:263:9: 
  261.   {
  262.       if (b)
  263. >         return 1;
  264.       test_fail_message(NULL, file, line, "bool", s, "true", "==", "false");
  265.       return 0;

test/testutil/tests.c:266:1: return from a call to test_true
  264.       test_fail_message(NULL, file, line, "bool", s, "true", "==", "false");
  265.       return 0;
  266. > }
  267.   
  268.   int test_false(const char *file, int line, const char *s, int b)

test/bntest.c:2218:17: Taking false branch
2216.               || !TEST_ptr(p)
2217.               || !TEST_ptr(m)
2218.               || !TEST_true(BN_set_word(a, 1))
                        ^
2219.               || !TEST_true(BN_set_word(p, 0))
2220.               || !TEST_true(BN_set_word(m, 1)))

test/bntest.c:2219:17: Condition is true
2217.               || !TEST_ptr(m)
2218.               || !TEST_true(BN_set_word(a, 1))
2219.               || !TEST_true(BN_set_word(p, 0))
                        ^
2220.               || !TEST_true(BN_set_word(m, 1)))
2221.           goto err;

test/testutil/tests.c:260:1: start of procedure test_true()
  258.   }
  259.   
  260. > int test_true(const char *file, int line, const char *s, int b)
  261.   {
  262.       if (b)

test/testutil/tests.c:262:9: Taking true branch
  260.   int test_true(const char *file, int line, const char *s, int b)
  261.   {
  262.       if (b)
                 ^
  263.           return 1;
  264.       test_fail_message(NULL, file, line, "bool", s, "true", "==", "false");

test/testutil/tests.c:263:9: 
  261.   {
  262.       if (b)
  263. >         return 1;
  264.       test_fail_message(NULL, file, line, "bool", s, "true", "==", "false");
  265.       return 0;

test/testutil/tests.c:266:1: return from a call to test_true
  264.       test_fail_message(NULL, file, line, "bool", s, "true", "==", "false");
  265.       return 0;
  266. > }
  267.   
  268.   int test_false(const char *file, int line, const char *s, int b)

test/bntest.c:2219:17: Taking false branch
2217.               || !TEST_ptr(m)
2218.               || !TEST_true(BN_set_word(a, 1))
2219.               || !TEST_true(BN_set_word(p, 0))
                        ^
2220.               || !TEST_true(BN_set_word(m, 1)))
2221.           goto err;

test/bntest.c:2220:17: Condition is true
2218.               || !TEST_true(BN_set_word(a, 1))
2219.               || !TEST_true(BN_set_word(p, 0))
2220.               || !TEST_true(BN_set_word(m, 1)))
                        ^
2221.           goto err;
2222.   

test/testutil/tests.c:260:1: start of procedure test_true()
  258.   }
  259.   
  260. > int test_true(const char *file, int line, const char *s, int b)
  261.   {
  262.       if (b)

test/testutil/tests.c:262:9: Taking true branch
  260.   int test_true(const char *file, int line, const char *s, int b)
  261.   {
  262.       if (b)
                 ^
  263.           return 1;
  264.       test_fail_message(NULL, file, line, "bool", s, "true", "==", "false");

test/testutil/tests.c:263:9: 
  261.   {
  262.       if (b)
  263. >         return 1;
  264.       test_fail_message(NULL, file, line, "bool", s, "true", "==", "false");
  265.       return 0;

test/testutil/tests.c:266:1: return from a call to test_true
  264.       test_fail_message(NULL, file, line, "bool", s, "true", "==", "false");
  265.       return 0;
  266. > }
  267.   
  268.   int test_false(const char *file, int line, const char *s, int b)

test/bntest.c:2220:17: Taking false branch
2218.               || !TEST_true(BN_set_word(a, 1))
2219.               || !TEST_true(BN_set_word(p, 0))
2220.               || !TEST_true(BN_set_word(m, 1)))
                        ^
2221.           goto err;
2222.   

test/bntest.c:2224:10: 
2222.   
2223.       /* Calculate r = 1 ^ 0 mod 1, and check the result is always 0 */
2224. >     for (i = 0; i < 2; i++) {
2225.           if (!TEST_true(BN_mod_exp(r, a, p, m, NULL))
2226.                   || !TEST_BN_eq_zero(r)

test/bntest.c:2224:17: Loop condition is true. Entering loop body
2222.   
2223.       /* Calculate r = 1 ^ 0 mod 1, and check the result is always 0 */
2224.       for (i = 0; i < 2; i++) {
                        ^
2225.           if (!TEST_true(BN_mod_exp(r, a, p, m, NULL))
2226.                   || !TEST_BN_eq_zero(r)

test/bntest.c:2225:14: 
2223.       /* Calculate r = 1 ^ 0 mod 1, and check the result is always 0 */
2224.       for (i = 0; i < 2; i++) {
2225. >         if (!TEST_true(BN_mod_exp(r, a, p, m, NULL))
2226.                   || !TEST_BN_eq_zero(r)
2227.                   || !TEST_true(BN_mod_exp_mont(r, a, p, m, NULL, NULL))

crypto/bn/bn_exp.c:89:1: start of procedure BN_mod_exp()
  87.   }
  88.   
  89. > int BN_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, const BIGNUM *m,
  90.                  BN_CTX *ctx)
  91.   {

crypto/bn/bn_exp.c:134:9: 
  132.   
  133.   #ifdef MONT_MUL_MOD
  134. >     if (BN_is_odd(m)) {
  135.   # ifdef MONT_EXP_WORD
  136.           if (a->top == 1 && !a->neg

crypto/bn/bn_lib.c:920:1: start of procedure BN_is_odd()
    918.   }
    919.   
    920. > int BN_is_odd(const BIGNUM *a)
    921.   {
    922.       return (a->top > 0) && (a->d[0] & 1);

crypto/bn/bn_lib.c:922:13: Condition is true
    920.   int BN_is_odd(const BIGNUM *a)
    921.   {
    922.       return (a->top > 0) && (a->d[0] & 1);
                       ^
    923.   }
    924.   

crypto/bn/bn_lib.c:922:29: Condition is false
    920.   int BN_is_odd(const BIGNUM *a)
    921.   {
    922.       return (a->top > 0) && (a->d[0] & 1);
                                       ^
    923.   }
    924.   

crypto/bn/bn_lib.c:922:12: 
    920.   int BN_is_odd(const BIGNUM *a)
    921.   {
    922. >     return (a->top > 0) && (a->d[0] & 1);
    923.   }
    924.   

crypto/bn/bn_lib.c:922:5: 
    920.   int BN_is_odd(const BIGNUM *a)
    921.   {
    922. >     return (a->top > 0) && (a->d[0] & 1);
    923.   }
    924.   

crypto/bn/bn_lib.c:923:1: return from a call to BN_is_odd
    921.   {
    922.       return (a->top > 0) && (a->d[0] & 1);
    923. > }
    924.   
    925.   int BN_is_negative(const BIGNUM *a)

crypto/bn/bn_exp.c:134:9: Taking false branch
  132.   
  133.   #ifdef MONT_MUL_MOD
  134.       if (BN_is_odd(m)) {
                 ^
  135.   # ifdef MONT_EXP_WORD
  136.           if (a->top == 1 && !a->neg

crypto/bn/bn_exp.c:149:9: 
  147.   #ifdef RECP_MUL_MOD
  148.       {
  149. >         ret = BN_mod_exp_recp(r, a, p, m, ctx);
  150.       }
  151.   #else

crypto/bn/bn_exp.c:161:1: start of procedure BN_mod_exp_recp()
    159.   }
    160.   
    161. > int BN_mod_exp_recp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
    162.                       const BIGNUM *m, BN_CTX *ctx)
    163.   {

crypto/bn/bn_exp.c:164:5: 
    162.                       const BIGNUM *m, BN_CTX *ctx)
    163.   {
    164. >     int i, j, bits, ret = 0, wstart, wend, window, wvalue;
    165.       int start = 1;
    166.       BIGNUM *aa;

crypto/bn/bn_exp.c:165:5: 
    163.   {
    164.       int i, j, bits, ret = 0, wstart, wend, window, wvalue;
    165. >     int start = 1;
    166.       BIGNUM *aa;
    167.       /* Table of variables obtained from 'ctx' */

crypto/bn/bn_exp.c:171:9: 
    169.       BN_RECP_CTX recp;
    170.   
    171. >     if (BN_get_flags(p, BN_FLG_CONSTTIME) != 0
    172.               || BN_get_flags(a, BN_FLG_CONSTTIME) != 0
    173.               || BN_get_flags(m, BN_FLG_CONSTTIME) != 0) {

crypto/bn/bn_lib.c:971:1: start of procedure BN_get_flags()
      969.   }
      970.   
      971. > int BN_get_flags(const BIGNUM *b, int n)
      972.   {
      973.       return b->flags & n;

crypto/bn/bn_lib.c:973:5: 
      971.   int BN_get_flags(const BIGNUM *b, int n)
      972.   {
      973. >     return b->flags & n;
      974.   }
      975.   

crypto/bn/bn_lib.c:974:1: return from a call to BN_get_flags
      972.   {
      973.       return b->flags & n;
      974. > }
      975.   
      976.   /* Populate a BN_GENCB structure with an "old"-style callback */

crypto/bn/bn_exp.c:171:9: Taking false branch
    169.       BN_RECP_CTX recp;
    170.   
    171.       if (BN_get_flags(p, BN_FLG_CONSTTIME) != 0
                   ^
    172.               || BN_get_flags(a, BN_FLG_CONSTTIME) != 0
    173.               || BN_get_flags(m, BN_FLG_CONSTTIME) != 0) {

crypto/bn/bn_exp.c:172:16: 
    170.   
    171.       if (BN_get_flags(p, BN_FLG_CONSTTIME) != 0
    172. >             || BN_get_flags(a, BN_FLG_CONSTTIME) != 0
    173.               || BN_get_flags(m, BN_FLG_CONSTTIME) != 0) {
    174.           /* BN_FLG_CONSTTIME only supported by BN_mod_exp_mont() */

crypto/bn/bn_lib.c:971:1: start of procedure BN_get_flags()
      969.   }
      970.   
      971. > int BN_get_flags(const BIGNUM *b, int n)
      972.   {
      973.       return b->flags & n;

crypto/bn/bn_lib.c:973:5: 
      971.   int BN_get_flags(const BIGNUM *b, int n)
      972.   {
      973. >     return b->flags & n;
      974.   }
      975.   

crypto/bn/bn_lib.c:974:1: return from a call to BN_get_flags
      972.   {
      973.       return b->flags & n;
      974. > }
      975.   
      976.   /* Populate a BN_GENCB structure with an "old"-style callback */

crypto/bn/bn_exp.c:172:16: Taking false branch
    170.   
    171.       if (BN_get_flags(p, BN_FLG_CONSTTIME) != 0
    172.               || BN_get_flags(a, BN_FLG_CONSTTIME) != 0
                          ^
    173.               || BN_get_flags(m, BN_FLG_CONSTTIME) != 0) {
    174.           /* BN_FLG_CONSTTIME only supported by BN_mod_exp_mont() */

crypto/bn/bn_exp.c:173:16: 
    171.       if (BN_get_flags(p, BN_FLG_CONSTTIME) != 0
    172.               || BN_get_flags(a, BN_FLG_CONSTTIME) != 0
    173. >             || BN_get_flags(m, BN_FLG_CONSTTIME) != 0) {
    174.           /* BN_FLG_CONSTTIME only supported by BN_mod_exp_mont() */
    175.           BNerr(BN_F_BN_MOD_EXP_RECP, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);

crypto/bn/bn_lib.c:971:1: start of procedure BN_get_flags()
      969.   }
      970.   
      971. > int BN_get_flags(const BIGNUM *b, int n)
      972.   {
      973.       return b->flags & n;

crypto/bn/bn_lib.c:973:5: 
      971.   int BN_get_flags(const BIGNUM *b, int n)
      972.   {
      973. >     return b->flags & n;
      974.   }
      975.   

crypto/bn/bn_lib.c:974:1: return from a call to BN_get_flags
      972.   {
      973.       return b->flags & n;
      974. > }
      975.   
      976.   /* Populate a BN_GENCB structure with an "old"-style callback */

crypto/bn/bn_exp.c:173:16: Taking false branch
    171.       if (BN_get_flags(p, BN_FLG_CONSTTIME) != 0
    172.               || BN_get_flags(a, BN_FLG_CONSTTIME) != 0
    173.               || BN_get_flags(m, BN_FLG_CONSTTIME) != 0) {
                          ^
    174.           /* BN_FLG_CONSTTIME only supported by BN_mod_exp_mont() */
    175.           BNerr(BN_F_BN_MOD_EXP_RECP, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);

crypto/bn/bn_exp.c:179:5: 
    177.       }
    178.   
    179. >     bits = BN_num_bits(p);
    180.       if (bits == 0) {
    181.           /* x**0 mod 1, or x**0 mod -1 is still zero. */

crypto/bn/bn_lib.c:165:1: start of procedure BN_num_bits()
      163.   }
      164.   
      165. > int BN_num_bits(const BIGNUM *a)
      166.   {
      167.       int i = a->top - 1;

crypto/bn/bn_lib.c:167:5: 
      165.   int BN_num_bits(const BIGNUM *a)
      166.   {
      167. >     int i = a->top - 1;
      168.       bn_check_top(a);
      169.   

crypto/bn/bn_lib.c:170:9: Taking false branch
      168.       bn_check_top(a);
      169.   
      170.       if (a->flags & BN_FLG_CONSTTIME) {
                     ^
      171.           /*
      172.            * We assume that BIGNUMs flagged as CONSTTIME have also been expanded

crypto/bn/bn_lib.c:183:9: 
      181.       }
      182.   
      183. >     if (BN_is_zero(a))
      184.           return 0;
      185.   

crypto/bn/bn_lib.c:905:1: start of procedure BN_is_zero()
        903.   }
        904.   
        905. > int BN_is_zero(const BIGNUM *a)
        906.   {
        907.       return a->top == 0;

crypto/bn/bn_lib.c:907:12: Condition is true
        905.   int BN_is_zero(const BIGNUM *a)
        906.   {
        907.       return a->top == 0;
                          ^
        908.   }
        909.   

crypto/bn/bn_lib.c:907:5: 
        905.   int BN_is_zero(const BIGNUM *a)
        906.   {
        907. >     return a->top == 0;
        908.   }
        909.   

crypto/bn/bn_lib.c:908:1: return from a call to BN_is_zero
        906.   {
        907.       return a->top == 0;
        908. > }
        909.   
        910.   int BN_is_one(const BIGNUM *a)

crypto/bn/bn_lib.c:183:9: Taking true branch
      181.       }
      182.   
      183.       if (BN_is_zero(a))
                     ^
      184.           return 0;
      185.   

crypto/bn/bn_lib.c:184:9: 
      182.   
      183.       if (BN_is_zero(a))
      184. >         return 0;
      185.   
      186.       return ((i * BN_BITS2) + BN_num_bits_word(a->d[i]));

crypto/bn/bn_lib.c:187:1: return from a call to BN_num_bits
      185.   
      186.       return ((i * BN_BITS2) + BN_num_bits_word(a->d[i]));
      187. > }
      188.   
      189.   static void bn_free_d(BIGNUM *a, int clear)

crypto/bn/bn_exp.c:180:9: Taking true branch
    178.   
    179.       bits = BN_num_bits(p);
    180.       if (bits == 0) {
                   ^
    181.           /* x**0 mod 1, or x**0 mod -1 is still zero. */
    182.           if (BN_abs_is_word(m, 1)) {

crypto/bn/bn_exp.c:182:13: 
    180.       if (bits == 0) {
    181.           /* x**0 mod 1, or x**0 mod -1 is still zero. */
    182. >         if (BN_abs_is_word(m, 1)) {
    183.               ret = 1;
    184.               BN_zero(r);

crypto/bn/bn_lib.c:900:1: start of procedure BN_abs_is_word()
      898.   }
      899.   
      900. > int BN_abs_is_word(const BIGNUM *a, const BN_ULONG w)
      901.   {
      902.       return ((a->top == 1) && (a->d[0] == w)) || ((w == 0) && (a->top == 0));

crypto/bn/bn_lib.c:902:14: Condition is true
      900.   int BN_abs_is_word(const BIGNUM *a, const BN_ULONG w)
      901.   {
      902.       return ((a->top == 1) && (a->d[0] == w)) || ((w == 0) && (a->top == 0));
                          ^
      903.   }
      904.   

crypto/bn/bn_lib.c:902:31: Condition is false
      900.   int BN_abs_is_word(const BIGNUM *a, const BN_ULONG w)
      901.   {
      902.       return ((a->top == 1) && (a->d[0] == w)) || ((w == 0) && (a->top == 0));
                                           ^
      903.   }
      904.   

crypto/bn/bn_lib.c:902:51: Condition is false
      900.   int BN_abs_is_word(const BIGNUM *a, const BN_ULONG w)
      901.   {
      902.       return ((a->top == 1) && (a->d[0] == w)) || ((w == 0) && (a->top == 0));
                                                               ^
      903.   }
      904.   

crypto/bn/bn_lib.c:902:12: 
      900.   int BN_abs_is_word(const BIGNUM *a, const BN_ULONG w)
      901.   {
      902. >     return ((a->top == 1) && (a->d[0] == w)) || ((w == 0) && (a->top == 0));
      903.   }
      904.   

crypto/bn/bn_lib.c:902:5: 
      900.   int BN_abs_is_word(const BIGNUM *a, const BN_ULONG w)
      901.   {
      902. >     return ((a->top == 1) && (a->d[0] == w)) || ((w == 0) && (a->top == 0));
      903.   }
      904.   

crypto/bn/bn_lib.c:903:1: return from a call to BN_abs_is_word
      901.   {
      902.       return ((a->top == 1) && (a->d[0] == w)) || ((w == 0) && (a->top == 0));
      903. > }
      904.   
      905.   int BN_is_zero(const BIGNUM *a)

crypto/bn/bn_exp.c:182:13: Taking false branch
    180.       if (bits == 0) {
    181.           /* x**0 mod 1, or x**0 mod -1 is still zero. */
    182.           if (BN_abs_is_word(m, 1)) {
                       ^
    183.               ret = 1;
    184.               BN_zero(r);

crypto/bn/bn_exp.c:186:13: Skipping BN_set_word(): empty list of specs
    184.               BN_zero(r);
    185.           } else {
    186.               ret = BN_one(r);
                       ^
    187.           }
    188.           return ret;

crypto/bn/bn_exp.c:188:9: 
    186.               ret = BN_one(r);
    187.           }
    188. >         return ret;
    189.       }
    190.   

crypto/bn/bn_exp.c:294:1: return from a call to BN_mod_exp_recp
    292.       bn_check_top(r);
    293.       return ret;
    294. > }
    295.   
    296.   int BN_mod_exp_mont(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p,

crypto/bn/bn_exp.c:158:5: 
  156.   
  157.       bn_check_top(r);
  158. >     return ret;
  159.   }
  160.   

crypto/bn/bn_exp.c:159:1: return from a call to BN_mod_exp
  157.       bn_check_top(r);
  158.       return ret;
  159. > }
  160.   
  161.   int BN_mod_exp_recp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,

static int test_expmodone(void)
{
    int ret = 0, i;
    BIGNUM *r = BN_new();
    BIGNUM *a = BN_new();
    BIGNUM *p = BN_new();
    BIGNUM *m = BN_new();
    if (!TEST_ptr(r)
            || !TEST_ptr(a)
            || !TEST_ptr(p)
            || !TEST_ptr(p)
            || !TEST_ptr(m)
            || !TEST_true(BN_set_word(a, 1))
            || !TEST_true(BN_set_word(p, 0))
            || !TEST_true(BN_set_word(m, 1)))
        goto err;
    for (i = 0; i < 2; i++) {
        if (!TEST_true(BN_mod_exp(r, a, p, m, NULL))
                || !TEST_BN_eq_zero(r)
                || !TEST_true(BN_mod_exp_mont(r, a, p, m, NULL, NULL))
                || !TEST_BN_eq_zero(r)
                || !TEST_true(BN_mod_exp_mont_consttime(r, a, p, m, NULL, NULL))
                || !TEST_BN_eq_zero(r)
                || !TEST_true(BN_mod_exp_mont_word(r, 1, p, m, NULL, NULL))
                || !TEST_BN_eq_zero(r)
                || !TEST_true(BN_mod_exp_simple(r, a, p, m, NULL))
                || !TEST_BN_eq_zero(r)
                || !TEST_true(BN_mod_exp_recp(r, a, p, m, NULL))
                || !TEST_BN_eq_zero(r))
            goto err;
        if (i == 0)
            BN_set_negative(m, 1);
    }
    ret = 1;
 err:
    BN_free(r);
    BN_free(a);
    BN_free(p);
    BN_free(m);
    return ret;
}
['static int test_expmodone(void)\n{\n    int ret = 0, i;\n    BIGNUM *r = BN_new();\n    BIGNUM *a = BN_new();\n    BIGNUM *p = BN_new();\n    BIGNUM *m = BN_new();\n    if (!TEST_ptr(r)\n            || !TEST_ptr(a)\n            || !TEST_ptr(p)\n            || !TEST_ptr(p)\n            || !TEST_ptr(m)\n            || !TEST_true(BN_set_word(a, 1))\n            || !TEST_true(BN_set_word(p, 0))\n            || !TEST_true(BN_set_word(m, 1)))\n        goto err;\n    for (i = 0; i < 2; i++) {\n        if (!TEST_true(BN_mod_exp(r, a, p, m, NULL))\n                || !TEST_BN_eq_zero(r)\n                || !TEST_true(BN_mod_exp_mont(r, a, p, m, NULL, NULL))\n                || !TEST_BN_eq_zero(r)\n                || !TEST_true(BN_mod_exp_mont_consttime(r, a, p, m, NULL, NULL))\n                || !TEST_BN_eq_zero(r)\n                || !TEST_true(BN_mod_exp_mont_word(r, 1, p, m, NULL, NULL))\n                || !TEST_BN_eq_zero(r)\n                || !TEST_true(BN_mod_exp_simple(r, a, p, m, NULL))\n                || !TEST_BN_eq_zero(r)\n                || !TEST_true(BN_mod_exp_recp(r, a, p, m, NULL))\n                || !TEST_BN_eq_zero(r))\n            goto err;\n        if (i == 0)\n            BN_set_negative(m, 1);\n    }\n    ret = 1;\n err:\n    BN_free(r);\n    BN_free(a);\n    BN_free(p);\n    BN_free(m);\n    return ret;\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}', '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 BN_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, const BIGNUM *m,\n               BN_CTX *ctx)\n{\n    int ret;\n    bn_check_top(a);\n    bn_check_top(p);\n    bn_check_top(m);\n#define MONT_MUL_MOD\n#define MONT_EXP_WORD\n#define RECP_MUL_MOD\n#ifdef MONT_MUL_MOD\n    if (BN_is_odd(m)) {\n# ifdef MONT_EXP_WORD\n        if (a->top == 1 && !a->neg\n            && (BN_get_flags(p, BN_FLG_CONSTTIME) == 0)\n            && (BN_get_flags(a, BN_FLG_CONSTTIME) == 0)\n            && (BN_get_flags(m, BN_FLG_CONSTTIME) == 0)) {\n            BN_ULONG A = a->d[0];\n            ret = BN_mod_exp_mont_word(r, A, p, m, ctx, NULL);\n        } else\n# endif\n            ret = BN_mod_exp_mont(r, a, p, m, ctx, NULL);\n    } else\n#endif\n#ifdef RECP_MUL_MOD\n    {\n        ret = BN_mod_exp_recp(r, a, p, m, ctx);\n    }\n#else\n    {\n        ret = BN_mod_exp_simple(r, a, p, m, ctx);\n    }\n#endif\n    bn_check_top(r);\n    return ret;\n}', 'int BN_is_odd(const BIGNUM *a)\n{\n    return (a->top > 0) && (a->d[0] & 1);\n}', 'int BN_mod_exp_recp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,\n                    const BIGNUM *m, BN_CTX *ctx)\n{\n    int i, j, bits, ret = 0, wstart, wend, window, wvalue;\n    int start = 1;\n    BIGNUM *aa;\n    BIGNUM *val[TABLE_SIZE];\n    BN_RECP_CTX recp;\n    if (BN_get_flags(p, BN_FLG_CONSTTIME) != 0\n            || BN_get_flags(a, BN_FLG_CONSTTIME) != 0\n            || BN_get_flags(m, BN_FLG_CONSTTIME) != 0) {\n        BNerr(BN_F_BN_MOD_EXP_RECP, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);\n        return 0;\n    }\n    bits = BN_num_bits(p);\n    if (bits == 0) {\n        if (BN_abs_is_word(m, 1)) {\n            ret = 1;\n            BN_zero(r);\n        } else {\n            ret = BN_one(r);\n        }\n        return ret;\n    }\n    BN_CTX_start(ctx);\n    aa = BN_CTX_get(ctx);\n    val[0] = BN_CTX_get(ctx);\n    if (val[0] == NULL)\n        goto err;\n    BN_RECP_CTX_init(&recp);\n    if (m->neg) {\n        if (!BN_copy(aa, m))\n            goto err;\n        aa->neg = 0;\n        if (BN_RECP_CTX_set(&recp, aa, ctx) <= 0)\n            goto err;\n    } else {\n        if (BN_RECP_CTX_set(&recp, m, ctx) <= 0)\n            goto err;\n    }\n    if (!BN_nnmod(val[0], a, m, ctx))\n        goto err;\n    if (BN_is_zero(val[0])) {\n        BN_zero(r);\n        ret = 1;\n        goto err;\n    }\n    window = BN_window_bits_for_exponent_size(bits);\n    if (window > 1) {\n        if (!BN_mod_mul_reciprocal(aa, val[0], val[0], &recp, 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_reciprocal(val[i], val[i - 1], aa, &recp, ctx))\n                goto err;\n        }\n    }\n    start = 1;\n    wvalue = 0;\n    wstart = bits - 1;\n    wend = 0;\n    if (!BN_one(r))\n        goto err;\n    for (;;) {\n        if (BN_is_bit_set(p, wstart) == 0) {\n            if (!start)\n                if (!BN_mod_mul_reciprocal(r, r, r, &recp, ctx))\n                    goto err;\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_reciprocal(r, r, r, &recp, ctx))\n                    goto err;\n            }\n        if (!BN_mod_mul_reciprocal(r, r, val[wvalue >> 1], &recp, ctx))\n            goto err;\n        wstart -= wend + 1;\n        wvalue = 0;\n        start = 0;\n        if (wstart < 0)\n            break;\n    }\n    ret = 1;\n err:\n    BN_CTX_end(ctx);\n    BN_RECP_CTX_free(&recp);\n    bn_check_top(r);\n    return ret;\n}', 'int BN_get_flags(const BIGNUM *b, int n)\n{\n    return b->flags & n;\n}', 'int BN_num_bits(const BIGNUM *a)\n{\n    int i = a->top - 1;\n    bn_check_top(a);\n    if (a->flags & BN_FLG_CONSTTIME) {\n        return bn_num_bits_consttime(a);\n    }\n    if (BN_is_zero(a))\n        return 0;\n    return ((i * BN_BITS2) + BN_num_bits_word(a->d[i]));\n}', 'int BN_is_zero(const BIGNUM *a)\n{\n    return a->top == 0;\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}']