• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /netgear-R7000-V1.0.7.12_1.2.5/ap/gpl/timemachine/openssl-0.9.8e/crypto/bn/

Lines Matching refs:mont

126 			  BN_MONT_CTX *mont, BN_CTX *ctx)
145 if (!BN_from_montgomery(r,tmp,mont,ctx)) goto err;
153 int BN_from_montgomery(BIGNUM *ret, const BIGNUM *a, BN_MONT_CTX *mont,
167 n= &(mont->N);
170 /* mont->ri is the size of mont->N in bits (rounded up
172 al=ri=mont->ri/BN_BITS2;
195 n0=mont->n0;
231 /* mont->ri will be a multiple of the word size */
233 BN_rshift(ret,r,mont->ri);
271 BN_mask_bits(t1,mont->ri);
273 if (!BN_mul(t2,t1,&mont->Ni,ctx)) goto err;
274 BN_mask_bits(t2,mont->ri);
276 if (!BN_mul(t1,t2,&mont->N,ctx)) goto err;
278 if (!BN_rshift(ret,t2,mont->ri)) goto err;
281 if (BN_ucmp(ret, &(mont->N)) >= 0)
283 if (!BN_usub(ret,ret,&(mont->N))) goto err;
313 void BN_MONT_CTX_free(BN_MONT_CTX *mont)
315 if(mont == NULL)
318 BN_free(&(mont->RR));
319 BN_free(&(mont->N));
320 BN_free(&(mont->Ni));
321 if (mont->flags & BN_FLG_MALLOCED)
322 OPENSSL_free(mont);
325 int BN_MONT_CTX_set(BN_MONT_CTX *mont, const BIGNUM *mod, BN_CTX *ctx)
332 R= &(mont->RR); /* grab RR as a temp */
333 if (!BN_copy(&(mont->N),mod)) goto err; /* Set N */
334 mont->N.neg = 0;
341 mont->ri=(BN_num_bits(mod)+(BN_BITS2-1))/BN_BITS2*BN_BITS2;
366 mont->n0 = (Ri->top > 0) ? Ri->d[0] : 0;
370 mont->ri=BN_num_bits(&mont->N);
372 if (!BN_set_bit(R,mont->ri)) goto err; /* R = 2^ri */
374 if ((BN_mod_inverse(Ri,R,&mont->N,ctx)) == NULL)
376 if (!BN_lshift(Ri,Ri,mont->ri)) goto err; /* R*Ri */
379 if (!BN_div(&(mont->Ni),NULL,Ri,&mont->N,ctx)) goto err;
384 BN_zero(&(mont->RR));
385 if (!BN_set_bit(&(mont->RR),mont->ri*2)) goto err;
386 if (!BN_mod(&(mont->RR),&(mont->RR),&(mont->N),ctx)) goto err;