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;
605 bn_mul_comba4(&(t[n2]),t,&(t[n]));
607 bn_mul_normal(&(r[n2]),&(a[n]),tn,&(b[n]),tn);
608 memset(&(r[n2+tn*2]),0,sizeof(BN_ULONG)*(n2-tn*2));
614 bn_mul_comba8(&(t[n2]),t,&(t[n]));
616 bn_mul_normal(&(r[n2]),&(a[n]),tna,&(b[n]),tnb);
617 memset(&(r[n2+tna+tnb]),0,sizeof(BN_ULONG)*(n2-tna-tnb));
621 p= &(t[n2*2]);
622 bn_mul_recursive(&(t[n2]),t,&(t[n]),n,0,0,p);
633 bn_mul_recursive(&(r[n2]),&(a[n]),&(b[n]),
635 memset(&(r[n2+i*2]),0,sizeof(BN_ULONG)*(n2-i*2));
639 bn_mul_part_recursive(&(r[n2]),&(a[n]),&(b[n]),
641 memset(&(r[n2+tna+tnb]),0,
642 sizeof(BN_ULONG)*(n2-tna-tnb));
646 memset(&(r[n2]),0,sizeof(BN_ULONG)*n2);
650 bn_mul_normal(&(r[n2]),&(a[n]),tna,&(b[n]),tnb);
662 bn_mul_part_recursive(&(r[n2]),
669 bn_mul_recursive(&(r[n2]),
684 c1=(int)(bn_add_words(t,r,&(r[n2]),n2));
688 c1-=(int)(bn_sub_words(&(t[n2]),t,&(t[n2]),n2));
693 c1+=(int)(bn_add_words(&(t[n2]),&(t[n2]),t,n2));
701 c1+=(int)(bn_add_words(&(r[n]),&(r[n]),&(t[n2]),n2));
704 p= &(r[n+n2]);
723 /* a and b must be the same size, which is n2.
724 * r needs to be n2 words and t needs to be n2*2
726 void bn_mul_low_recursive(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b, int n2,
729 int n=n2/2;
732 fprintf(stderr," bn_mul_low_recursive %d * %d\n",n2,n2);
738 bn_mul_low_recursive(&(t[0]),&(a[0]),&(b[n]),n,&(t[n2]));
740 bn_mul_low_recursive(&(t[0]),&(a[n]),&(b[0]),n,&(t[n2]));
752 /* a and b must be the same size, which is n2.
753 * r needs to be n2 words and t needs to be n2*2
755 * t needs to be n2*3
757 void bn_mul_high(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b, BN_ULONG *l, int n2,
766 fprintf(stderr," bn_mul_high %d * %d\n",n2,n2);
768 n=n2/2;
819 bn_mul_recursive(&(t[0]),&(r[0]),&(r[n]),n,0,0,&(t[n2]));
820 bn_mul_recursive(r,&(a[n]),&(b[n]),n,0,0,&(t[n2]));
831 lp= &(t[n2+n]);
841 neg=(int)(bn_sub_words(&(t[n2]),lp,&(t[0]),n));
844 bn_add_words(&(t[n2]),lp,&(t[0]),n);
850 bn_sub_words(&(t[n2+n]),&(l[n]),&(t[n2]),n);
854 lp= &(t[n2+n]);
855 mp= &(t[n2]);
875 lp= &(t[n2]);
876 c1= (int)(bn_add_words(lp,&(t[n2+n]),&(l[0]),n));
880 lp= &(t[n2+n]);
883 c1+=(int)(bn_add_words(&(t[n2]),lp, &(r[0]),n));
885 c1-=(int)(bn_sub_words(&(t[n2]),&(t[n2]),&(t[0]),n));
887 c1+=(int)(bn_add_words(&(t[n2]),&(t[n2]),&(t[0]),n));
889 c2 =(int)(bn_add_words(&(r[0]),&(r[0]),&(t[n2+n]),n));