test/bntest.c:1050: error: MEMORY_LEAK
  memory dynamically allocated to `b` by call to `BN_new()` at line 985, column 9 is not reachable after line 1050, column 1.
Showing all 145 steps of the trace


test/bntest.c:979:1: start of procedure test_mod_exp()
977.   }
978.   
979. > int test_mod_exp(BIO *bp, BN_CTX *ctx)
980.   {
981.       BIGNUM *a, *b, *c, *d, *e;

test/bntest.c:984:5: 
982.       int i;
983.   
984. >     a = BN_new();
985.       b = BN_new();
986.       c = BN_new();

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

test/bntest.c:985:5: 
983.   
984.       a = BN_new();
985. >     b = BN_new();
986.       c = BN_new();
987.       d = BN_new();

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

test/bntest.c:986:5: 
984.       a = BN_new();
985.       b = BN_new();
986. >     c = BN_new();
987.       d = BN_new();
988.       e = BN_new();

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

test/bntest.c:987:5: 
985.       b = BN_new();
986.       c = BN_new();
987. >     d = BN_new();
988.       e = BN_new();
989.   

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

test/bntest.c:988:5: 
986.       c = BN_new();
987.       d = BN_new();
988. >     e = BN_new();
989.   
990.       BN_one(a);

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

test/bntest.c:990:5: 
988.       e = BN_new();
989.   
990. >     BN_one(a);
991.       BN_one(b);
992.       BN_zero(c);

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

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

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

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

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

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

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

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

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

test/bntest.c:991:5: 
989.   
990.       BN_one(a);
991. >     BN_one(b);
992.       BN_zero(c);
993.       if (BN_mod_exp(d, a, b, c, ctx)) {

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

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

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

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

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

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

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

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

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

test/bntest.c:992:5: 
990.       BN_one(a);
991.       BN_one(b);
992. >     BN_zero(c);
993.       if (BN_mod_exp(d, a, b, c, ctx)) {
994.           fprintf(stderr, "BN_mod_exp with zero modulus succeeded!\n");

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

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

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

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

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

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

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

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

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

test/bntest.c:993:9: Taking true branch
991.       BN_one(b);
992.       BN_zero(c);
993.       if (BN_mod_exp(d, a, b, c, ctx)) {
               ^
994.           fprintf(stderr, "BN_mod_exp with zero modulus succeeded!\n");
995.           return 0;

test/bntest.c:994:9: 
992.       BN_zero(c);
993.       if (BN_mod_exp(d, a, b, c, ctx)) {
994. >         fprintf(stderr, "BN_mod_exp with zero modulus succeeded!\n");
995.           return 0;
996.       }

test/bntest.c:995:9: 
993.       if (BN_mod_exp(d, a, b, c, ctx)) {
994.           fprintf(stderr, "BN_mod_exp with zero modulus succeeded!\n");
995. >         return 0;
996.       }
997.   

test/bntest.c:1050:1: return from a call to test_mod_exp
1048.       BN_free(e);
1049.       return (1);
1050. > }
1051.   
1052.   int test_mod_exp_mont_consttime(BIO *bp, BN_CTX *ctx)

int test_mod_exp(BIO *bp, BN_CTX *ctx)
{
    BIGNUM *a, *b, *c, *d, *e;
    int i;
    a = BN_new();
    b = BN_new();
    c = BN_new();
    d = BN_new();
    e = BN_new();
    BN_one(a);
    BN_one(b);
    BN_zero(c);
    if (BN_mod_exp(d, a, b, c, ctx)) {
        fprintf(stderr, "BN_mod_exp with zero modulus succeeded!\n");
        return 0;
    }
    BN_bntest_rand(c, 30, 0, 1);
    for (i = 0; i < num2; i++) {
        BN_bntest_rand(a, 20 + i * 5, 0, 0);
        BN_bntest_rand(b, 2 + i, 0, 0);
        if (!BN_mod_exp(d, a, b, c, ctx))
            return (0);
        if (bp != NULL) {
            if (!results) {
                BN_print(bp, a);
                BIO_puts(bp, " ^ ");
                BN_print(bp, b);
                BIO_puts(bp, " % ");
                BN_print(bp, c);
                BIO_puts(bp, " - ");
            }
            BN_print(bp, d);
            BIO_puts(bp, "\n");
        }
        BN_exp(e, a, b, ctx);
        BN_sub(e, e, d);
        BN_div(a, b, e, c, ctx);
        if (!BN_is_zero(b)) {
            fprintf(stderr, "Modulo exponentiation test failed!\n");
            return 0;
        }
    }
    BN_hex2bn(&a, "050505050505");
    BN_hex2bn(&b, "02");
    BN_hex2bn(&c,
        "4141414141414141414141274141414141414141414141414141414141414141"
        "4141414141414141414141414141414141414141414141414141414141414141"
        "4141414141414141414141800000000000000000000000000000000000000000"
        "0000000000000000000000000000000000000000000000000000000000000000"
        "0000000000000000000000000000000000000000000000000000000000000000"
        "0000000000000000000000000000000000000000000000000000000001");
    BN_mod_exp(d, a, b, c, ctx);
    BN_mul(e, a, a, ctx);
    if (BN_cmp(d, e)) {
        fprintf(stderr, "BN_mod_exp and BN_mul produce different results!\n");
        return 0;
    }
    BN_free(a);
    BN_free(b);
    BN_free(c);
    BN_free(d);
    BN_free(e);
    return (1);
}
['int test_mod_exp(BIO *bp, BN_CTX *ctx)\n{\n    BIGNUM *a, *b, *c, *d, *e;\n    int i;\n    a = BN_new();\n    b = BN_new();\n    c = BN_new();\n    d = BN_new();\n    e = BN_new();\n    BN_one(a);\n    BN_one(b);\n    BN_zero(c);\n    if (BN_mod_exp(d, a, b, c, ctx)) {\n        fprintf(stderr, "BN_mod_exp with zero modulus succeeded!\\n");\n        return 0;\n    }\n    BN_bntest_rand(c, 30, 0, 1);\n    for (i = 0; i < num2; i++) {\n        BN_bntest_rand(a, 20 + i * 5, 0, 0);\n        BN_bntest_rand(b, 2 + i, 0, 0);\n        if (!BN_mod_exp(d, a, b, c, ctx))\n            return (0);\n        if (bp != NULL) {\n            if (!results) {\n                BN_print(bp, a);\n                BIO_puts(bp, " ^ ");\n                BN_print(bp, b);\n                BIO_puts(bp, " % ");\n                BN_print(bp, c);\n                BIO_puts(bp, " - ");\n            }\n            BN_print(bp, d);\n            BIO_puts(bp, "\\n");\n        }\n        BN_exp(e, a, b, ctx);\n        BN_sub(e, e, d);\n        BN_div(a, b, e, c, ctx);\n        if (!BN_is_zero(b)) {\n            fprintf(stderr, "Modulo exponentiation test failed!\\n");\n            return 0;\n        }\n    }\n    BN_hex2bn(&a, "050505050505");\n    BN_hex2bn(&b, "02");\n    BN_hex2bn(&c,\n        "4141414141414141414141274141414141414141414141414141414141414141"\n        "4141414141414141414141414141414141414141414141414141414141414141"\n        "4141414141414141414141800000000000000000000000000000000000000000"\n        "0000000000000000000000000000000000000000000000000000000000000000"\n        "0000000000000000000000000000000000000000000000000000000000000000"\n        "0000000000000000000000000000000000000000000000000000000001");\n    BN_mod_exp(d, a, b, c, ctx);\n    BN_mul(e, a, a, ctx);\n    if (BN_cmp(d, e)) {\n        fprintf(stderr, "BN_mod_exp and BN_mul produce different results!\\n");\n        return 0;\n    }\n    BN_free(a);\n    BN_free(b);\n    BN_free(c);\n    BN_free(d);\n    BN_free(e);\n    return (1);\n}', 'BIGNUM *BN_new(void)\n{\n    BIGNUM *ret;\n    if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) {\n        BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE);\n        return (NULL);\n    }\n    ret->flags = BN_FLG_MALLOCED;\n    bn_check_top(ret);\n    return (ret);\n}', '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}', '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}']