crypto/rsa/rsa_chk.c:184: error: BUFFER_OVERRUN_L3
  Offset: [1, +oo] Size: [0, 8388607] by call to `BN_mod_inverse`.
Showing all 35 steps of the trace


crypto/rsa/rsa_chk.c:19:1: Parameter `key->p->top`
17.   }
18.   
19. > int RSA_check_key_ex(const RSA *key, BN_GENCB *cb)
20.   {
21.       BIGNUM *i, *j, *k, *l, *m;

crypto/rsa/rsa_chk.c:65:9: Call
63.   
64.       /* p prime? */
65.       if (BN_is_prime_ex(key->p, BN_prime_checks, NULL, cb) != 1) {
              ^
66.           ret = 0;
67.           RSAerr(RSA_F_RSA_CHECK_KEY_EX, RSA_R_P_NOT_PRIME);

crypto/bn/bn_prime.c:145:1: Parameter `a->top`
  143.   }
  144.   
  145. > int BN_is_prime_ex(const BIGNUM *a, int checks, BN_CTX *ctx_passed,
  146.                      BN_GENCB *cb)
  147.   {

crypto/bn/bn_prime.c:148:12: Call
  146.                      BN_GENCB *cb)
  147.   {
  148.       return BN_is_prime_fasttest_ex(a, checks, ctx_passed, 0, cb);
                    ^
  149.   }
  150.   

crypto/bn/bn_prime.c:151:1: Parameter `a->top`
    149.   }
    150.   
    151. > int BN_is_prime_fasttest_ex(const BIGNUM *a, int checks, BN_CTX *ctx_passed,
    152.                               int do_trial_division, BN_GENCB *cb)
    153.   {

crypto/bn/bn_prime.c:160:9: Call
    158.       BN_MONT_CTX *mont = NULL;
    159.   
    160.       if (BN_cmp(a, BN_value_one()) <= 0)
                   ^
    161.           return 0;
    162.   

crypto/bn/bn_lib.c:539:1: Parameter `a->top`
      537.   }
      538.   
      539. > int BN_cmp(const BIGNUM *a, const BIGNUM *b)
      540.   {
      541.       int i;

crypto/rsa/rsa_chk.c:107:10: Call
105.   
106.       /* d*e = 1  mod \lambda(n)? */
107.       if (!BN_sub(i, key->p, BN_value_one())) {
                ^
108.           ret = -1;
109.           goto err;

crypto/bn/bn_add.c:45:1: Parameter `a->top`
  43.   
  44.   /* signed sub of b from a. */
  45. > int BN_sub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b)
  46.   {
  47.       int ret, r_neg, cmp_res;

crypto/rsa/rsa_chk.c:156:14: Call
154.       if (key->dmp1 != NULL && key->dmq1 != NULL && key->iqmp != NULL) {
155.           /* dmp1 = d mod (p-1)? */
156.           if (!BN_sub(i, key->p, BN_value_one())) {
                    ^
157.               ret = -1;
158.               goto err;

crypto/bn/bn_add.c:45:1: Parameter `a->top`
  43.   
  44.   /* signed sub of b from a. */
  45. > int BN_sub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b)
  46.   {
  47.       int ret, r_neg, cmp_res;

crypto/rsa/rsa_chk.c:184:14: Call
182.   
183.           /* iqmp = q^-1 mod p? */
184.           if (!BN_mod_inverse(i, key->q, key->p, ctx)) {
                    ^
185.               ret = -1;
186.               goto err;

crypto/bn/bn_gcd.c:124:1: Parameter `n->top`
  122.                                           BN_CTX *ctx);
  123.   
  124. > BIGNUM *BN_mod_inverse(BIGNUM *in,
  125.                          const BIGNUM *a, const BIGNUM *n, BN_CTX *ctx)
  126.   {

crypto/bn/bn_gcd.c:129:10: Call
  127.       BIGNUM *rv;
  128.       int noinv;
  129.       rv = int_bn_mod_inverse(in, a, n, ctx, &noinv);
                  ^
  130.       if (noinv)
  131.           BNerr(BN_F_BN_MOD_INVERSE, BN_R_NO_INVERSE);

crypto/bn/bn_gcd.c:135:1: Parameter `n->top`
    133.   }
    134.   
    135. > BIGNUM *int_bn_mod_inverse(BIGNUM *in,
    136.                              const BIGNUM *a, const BIGNUM *n, BN_CTX *ctx,
    137.                              int *pnoinv)

crypto/bn/bn_gcd.c:148:16: Call
    146.       if ((BN_get_flags(a, BN_FLG_CONSTTIME) != 0)
    147.           || (BN_get_flags(n, BN_FLG_CONSTTIME) != 0)) {
    148.           return BN_mod_inverse_no_branch(in, a, n, ctx);
                          ^
    149.       }
    150.   

crypto/bn/bn_gcd.c:451:1: Parameter `n->top`
      449.    * not contain branches that may leak sensitive information.
      450.    */
      451. > static BIGNUM *BN_mod_inverse_no_branch(BIGNUM *in,
      452.                                           const BIGNUM *a, const BIGNUM *n,
      453.                                           BN_CTX *ctx)

crypto/bn/bn_gcd.c:484:9: Call
      482.       if (BN_copy(B, a) == NULL)
      483.           goto err;
      484.       if (BN_copy(A, n) == NULL)
                     ^
      485.           goto err;
      486.       A->neg = 0;

crypto/bn/bn_lib.c:285:1: Parameter `b->top`
        283.   }
        284.   
        285. > BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b)
        286.   {
        287.       bn_check_top(b);

crypto/bn/bn_gcd.c:602:18: Call
      600.                   goto err;
      601.           } else {
      602.               if (!BN_nnmod(R, Y, n, ctx))
                              ^
      603.                   goto err;
      604.           }

crypto/bn/bn_mod.c:13:1: Parameter `d->top`
        11.   #include "bn_lcl.h"
        12.   
        13. > int BN_nnmod(BIGNUM *r, const BIGNUM *m, const BIGNUM *d, BN_CTX *ctx)
        14.   {
        15.       /*

crypto/bn/bn_mod.c:20:11: Call
        18.        */
        19.   
        20.       if (!(BN_mod(r, m, d, ctx)))
                        ^
        21.           return 0;
        22.       if (!r->neg)

crypto/bn/bn_div.c:199:31: Call
          197.   
          198.       /* First we normalise the numbers */
          199.       norm_shift = BN_BITS2 - ((BN_num_bits(divisor)) % BN_BITS2);
                                               ^
          200.       if (!(BN_lshift(sdiv, divisor, norm_shift)))
          201.           goto err;

crypto/bn/bn_lib.c:140:9: Assignment
            138.   
            139.       if (BN_is_zero(a))
            140.           return 0;
                           ^
            141.       return ((i * BN_BITS2) + BN_num_bits_word(a->d[i]));
            142.   }

crypto/bn/bn_div.c:199:5: Assignment
          197.   
          198.       /* First we normalise the numbers */
          199.       norm_shift = BN_BITS2 - ((BN_num_bits(divisor)) % BN_BITS2);
                     ^
          200.       if (!(BN_lshift(sdiv, divisor, norm_shift)))
          201.           goto err;

crypto/bn/bn_div.c:200:11: Call
          198.       /* First we normalise the numbers */
          199.       norm_shift = BN_BITS2 - ((BN_num_bits(divisor)) % BN_BITS2);
          200.       if (!(BN_lshift(sdiv, divisor, norm_shift)))
                           ^
          201.           goto err;
          202.       sdiv->neg = 0;

crypto/bn/bn_shift.c:83:1: <Offset trace>
81.   }
82.   
83. > int BN_lshift(BIGNUM *r, const BIGNUM *a, int n)
84.   {
85.       int i, nw, lb, rb;

crypto/bn/bn_shift.c:83:1: Parameter `n`
            81.   }
            82.   
            83. > int BN_lshift(BIGNUM *r, const BIGNUM *a, int n)
            84.   {
            85.       int i, nw, lb, rb;

crypto/bn/bn_shift.c:97:5: Assignment
            95.       }
            96.   
            97.       nw = n / BN_BITS2;
                       ^
            98.       if (bn_wexpand(r, a->top + nw + 1) == NULL)
            99.           return 0;

crypto/bn/bn_shift.c:83:1: <Length trace>
81.   }
82.   
83. > int BN_lshift(BIGNUM *r, const BIGNUM *a, int n)
84.   {
85.       int i, nw, lb, rb;

crypto/bn/bn_shift.c:83:1: Parameter `*r->d`
            81.   }
            82.   
            83. > int BN_lshift(BIGNUM *r, const BIGNUM *a, int n)
            84.   {
            85.       int i, nw, lb, rb;

crypto/bn/bn_shift.c:98:9: Call
            96.   
            97.       nw = n / BN_BITS2;
            98.       if (bn_wexpand(r, a->top + nw + 1) == NULL)
                           ^
            99.           return 0;
            100.       r->neg = a->neg;

crypto/bn/bn_lib.c:910:1: Parameter `*a->d`
              908.   }
              909.   
              910. > BIGNUM *bn_wexpand(BIGNUM *a, int words)
              911.   {
              912.       return (words <= a->dmax) ? a : bn_expand2(a, words);

crypto/bn/bn_shift.c:104:5: Assignment
            102.       rb = BN_BITS2 - lb;
            103.       f = a->d;
            104.       t = r->d;
                       ^
            105.       t[a->top + nw] = 0;
            106.       if (lb == 0)

crypto/bn/bn_shift.c:112:13: Array access: Offset: [1, +oo] Size: [0, 8388607] by call to `BN_mod_inverse` 
            110.           for (i = a->top - 1; i >= 0; i--) {
            111.               l = f[i];
            112.               t[nw + i + 1] |= (l >> rb) & BN_MASK2;
                               ^
            113.               t[nw + i] = (l << lb) & BN_MASK2;
            114.           }
