Home | History | Annotate | Download | only in bn

Lines Matching refs:n2

382 /* r is 2*n2 words in size,
383 * a and b are both n2 words in size.
384 * n2 must be a power of 2.
386 * t must be 2*n2 words in size
392 /* dnX may not be positive, but n2/2+dnX has to be */
393 void bn_mul_recursive(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b, int n2,
396 int n=n2/2,c1,c2;
402 fprintf(stderr," bn_mul_recursive %d%+d * %d%+d\n",n2,dna,n2,dnb);
406 if (n2 == 4)
412 /* Only call bn_mul_comba 8 if n2 == 8 and the
415 if (n2 == 8 && dna == 0 && dnb == 0)
422 if (n2 < BN_MUL_RECURSIVE_SIZE_NORMAL)
424 bn_mul_normal(r,a,n2+dna,b,n2+dnb);
426 memset(&r[2*n2 + dna + dnb], 0,
472 bn_mul_comba4(&(t[n2]),t,&(t[n]));
474 memset(&(t[n2]),0,8*sizeof(BN_ULONG));
477 bn_mul_comba4(&(r[n2]),&(a[n]),&(b[n]));
484 bn_mul_comba8(&(t[n2]),t,&(t[n]));
486 memset(&(t[n2]),0,16*sizeof(BN_ULONG));
489 bn_mul_comba8(&(r[n2]),&(a[n]),&(b[n]));
494 p= &(t[n2*2]);
496 bn_mul_recursive(&(t[n2]),t,&(t[n]),n,0,0,p);
498 memset(&(t[n2]),0,n2*sizeof(BN_ULONG));
500 bn_mul_recursive(&(r[n2]),&(a[n]),&(b[n]),n,dna,dnb,p);
508 c1=(int)(bn_add_words(t,r,&(r[n2]),n2));
512 c1-=(int)(bn_sub_words(&(t[n2]),t,&(t[n2]),n2));
517 c1+=(int)(bn_add_words(&(t[n2]),&(t[n2]),t,n2));
525 c1+=(int)(bn_add_words(&(r[n]),&(r[n]),&(t[n2]),n2));
528 p= &(r[n+n2]);
553 int i,j,n2=n*2;
608 bn_mul_comba4(&(t[n2]),t,&(t[n]));
610 bn_mul_normal(&(r[n2]),&(a[n]),tn,&(b[n]),tn);
611 memset(&(r[n2+tn*2]),0,sizeof(BN_ULONG)*(n2-tn*2));
617 bn_mul_comba8(&(t[n2]),t,&(t[n]));
619 bn_mul_normal(&(r[n2]),&(a[n]),tna,&(b[n]),tnb);
620 memset(&(r[n2+tna+tnb]),0,sizeof(BN_ULONG)*(n2-tna-tnb));
624 p= &(t[n2*2]);
625 bn_mul_recursive(&(t[n2]),t,&(t[n]),n,0,0,p);
636 bn_mul_recursive(&(r[n2]),&(a[n]),&(b[n]),
638 memset(&(r[n2+i*2]),0,sizeof(BN_ULONG)*(n2-i*2));
642 bn_mul_part_recursive(&(r[n2]),&(a[n]),&(b[n]),
644 memset(&(r[n2+tna+tnb]),0,
645 sizeof(BN_ULONG)*(n2-tna-tnb));
649 memset(&(r[n2]),0,sizeof(BN_ULONG)*n2);
653 bn_mul_normal(&(r[n2]),&(a[n]),tna,&(b[n]),tnb);
665 bn_mul_part_recursive(&(r[n2]),
672 bn_mul_recursive(&(r[n2]),
687 c1=(int)(bn_add_words(t,r,&(r[n2]),n2));
691 c1-=(int)(bn_sub_words(&(t[n2]),t,&(t[n2]),n2));
696 c1+=(int)(bn_add_words(&(t[n2]),&(t[n2]),t,n2));
704 c1+=(int)(bn_add_words(&(r[n]),&(r[n]),&(t[n2]),n2));
707 n2]);
726 /* a and b must be the same size, which is n2.
727 * r needs to be n2 words and t needs to be n2*2
729 void bn_mul_low_recursive(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b, int n2,
732 int n=n2/2;
735 fprintf(stderr," bn_mul_low_recursive %d * %d\n",n2,n2);
741 bn_mul_low_recursive(&(t[0]),&(a[0]),&(b[n]),n,&(t[n2]));
743 bn_mul_low_recursive(&(t[0]),&(a[n]),&(b[0]),n,&(t[n2]));
755 /* a and b must be the same size, which is n2.
756 * r needs to be n2 words and t needs to be n2*2
758 * t needs to be n2*3
760 void bn_mul_high(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b, BN_ULONG *l, int n2,
769 fprintf(stderr," bn_mul_high %d * %d\n",n2,n2);
771 n=n2/2;
822 bn_mul_recursive(&(t[0]),&(r[0]),&(r[n]),n,0,0,&(t[n2]));
823 bn_mul_recursive(r,&(a[n]),&(b[n]),n,0,0,&(t[n2]));
834 lp= &(t[n2+n]);
844 neg=(int)(bn_sub_words(&(t[n2]),lp,&(t[0]),n));
847 bn_add_words(&(t[n2]),lp,&(t[0]),n);
853 bn_sub_words(&(t[n2+n]),&(l[n]),&(t[n2]),n);
857 lp= &(t[n2+n]);
858 mp= &(t[n2]);
878 lp= &(t[n2]);
879 c1= (int)(bn_add_words(lp,&(t[n2+n]),&(l[0]),n));
883 lp= &(t[n2+n]);
886 c1+=(int)(bn_add_words(&(t[n2]),lp, &(r[0]),n));
888 c1-=(int)(bn_sub_words(&(t[n2]),&(t[n2]),&(t[0]),n));
890 c1+=(int)(bn_add_words(&(t[n2]),&(t[n2]),&(t[0]),n));
892 c2 =(int)(bn_add_words(&(r[0]),&(r[0]),&(t[n2+n]),n));