• Home
  • Raw
  • Download

Lines Matching refs:r

127 int BN_nnmod(BIGNUM *r, const BIGNUM *m, const BIGNUM *d, BN_CTX *ctx)  in BN_nnmod()  argument
132 if (!(BN_mod(r,m,d,ctx))) in BN_nnmod()
134 if (!r->neg) in BN_nnmod()
137 return (d->neg ? BN_sub : BN_add)(r, r, d); in BN_nnmod()
141 int BN_mod_add(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m, BN_CTX *ctx) in BN_mod_add() argument
143 if (!BN_add(r, a, b)) return 0; in BN_mod_add()
144 return BN_nnmod(r, r, m, ctx); in BN_mod_add()
150 int BN_mod_add_quick(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m) in BN_mod_add_quick() argument
152 if (!BN_uadd(r, a, b)) return 0; in BN_mod_add_quick()
153 if (BN_ucmp(r, m) >= 0) in BN_mod_add_quick()
154 return BN_usub(r, r, m); in BN_mod_add_quick()
159 int BN_mod_sub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m, BN_CTX *ctx) in BN_mod_sub() argument
161 if (!BN_sub(r, a, b)) return 0; in BN_mod_sub()
162 return BN_nnmod(r, r, m, ctx); in BN_mod_sub()
168 int BN_mod_sub_quick(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m) in BN_mod_sub_quick() argument
170 if (!BN_sub(r, a, b)) return 0; in BN_mod_sub_quick()
171 if (r->neg) in BN_mod_sub_quick()
172 return BN_add(r, r, m); in BN_mod_sub_quick()
178 int BN_mod_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m, in BN_mod_mul() argument
194 if (!BN_nnmod(r,t,m,ctx)) goto err; in BN_mod_mul()
195 bn_check_top(r); in BN_mod_mul()
203 int BN_mod_sqr(BIGNUM *r, const BIGNUM *a, const BIGNUM *m, BN_CTX *ctx) in BN_mod_sqr() argument
205 if (!BN_sqr(r, a, ctx)) return 0; in BN_mod_sqr()
207 return BN_mod(r, r, m, ctx); in BN_mod_sqr()
211 int BN_mod_lshift1(BIGNUM *r, const BIGNUM *a, const BIGNUM *m, BN_CTX *ctx) in BN_mod_lshift1() argument
213 if (!BN_lshift1(r, a)) return 0; in BN_mod_lshift1()
214 bn_check_top(r); in BN_mod_lshift1()
215 return BN_nnmod(r, r, m, ctx); in BN_mod_lshift1()
221 int BN_mod_lshift1_quick(BIGNUM *r, const BIGNUM *a, const BIGNUM *m) in BN_mod_lshift1_quick() argument
223 if (!BN_lshift1(r, a)) return 0; in BN_mod_lshift1_quick()
224 bn_check_top(r); in BN_mod_lshift1_quick()
225 if (BN_cmp(r, m) >= 0) in BN_mod_lshift1_quick()
226 return BN_sub(r, r, m); in BN_mod_lshift1_quick()
231 int BN_mod_lshift(BIGNUM *r, const BIGNUM *a, int n, const BIGNUM *m, BN_CTX *ctx) in BN_mod_lshift() argument
236 if (!BN_nnmod(r, a, m, ctx)) return 0; in BN_mod_lshift()
245 ret = BN_mod_lshift_quick(r, r, n, (abs_m ? abs_m : m)); in BN_mod_lshift()
246 bn_check_top(r); in BN_mod_lshift()
256 int BN_mod_lshift_quick(BIGNUM *r, const BIGNUM *a, int n, const BIGNUM *m) in BN_mod_lshift_quick() argument
258 if (r != a) in BN_mod_lshift_quick()
260 if (BN_copy(r, a) == NULL) return 0; in BN_mod_lshift_quick()
268 max_shift = BN_num_bits(m) - BN_num_bits(r); in BN_mod_lshift_quick()
282 if (!BN_lshift(r, r, max_shift)) return 0; in BN_mod_lshift_quick()
287 if (!BN_lshift1(r, r)) return 0; in BN_mod_lshift_quick()
293 if (BN_cmp(r, m) >= 0) in BN_mod_lshift_quick()
295 if (!BN_sub(r, r, m)) return 0; in BN_mod_lshift_quick()
298 bn_check_top(r); in BN_mod_lshift_quick()