Lines Matching refs:Ri
328 BIGNUM *Ri,*R;
331 if((Ri = BN_CTX_get(ctx)) == NULL) goto err;
351 /* Ri = R^-1 mod N*/
352 if ((BN_mod_inverse(Ri,R,&tmod,ctx)) == NULL)
354 if (!BN_lshift(Ri,Ri,BN_BITS2)) goto err; /* R*Ri */
355 if (!BN_is_zero(Ri))
357 if (!BN_sub_word(Ri,1)) goto err;
361 if (!BN_set_word(Ri,BN_MASK2)) goto err; /* Ri-- (mod word size) */
363 if (!BN_div(Ri,NULL,Ri,&tmod,ctx)) goto err;
364 /* Ni = (R*Ri-1)/N,
366 mont->n0 = (Ri->top > 0) ? Ri->d[0] : 0;
373 /* Ri = R^-1 mod N*/
374 if ((BN_mod_inverse(Ri,R,&mont->N,ctx)) == NULL)
376 if (!BN_lshift(Ri,Ri,mont->ri)) goto err; /* R*Ri */
377 if (!BN_sub_word(Ri,1)) goto err;
378 /* Ni = (R*Ri-1) / N */
379 if (!BN_div(&(mont->Ni),NULL,Ri,&mont->N,ctx)) goto err;