69 #if defined(OPENSSL_NO_ASM) || !defined(OPENSSL_BN_ASM_PART_WORDS)
81 const BN_ULONG *
a,
const BN_ULONG *
b,
99 fprintf(stderr,
" bn_sub_part_words %d + %d (dl < 0, c = %d)\n", cl, dl, c);
104 r[0] = (0-t-c)&BN_MASK2;
106 if (++dl >= 0)
break;
109 r[1] = (0-t-c)&BN_MASK2;
111 if (++dl >= 0)
break;
114 r[2] = (0-t-c)&BN_MASK2;
116 if (++dl >= 0)
break;
119 r[3] = (0-t-c)&BN_MASK2;
121 if (++dl >= 0)
break;
131 fprintf(stderr,
" bn_sub_part_words %d + %d (dl > 0, c = %d)\n", cl, dl, c);
136 r[0] = (t-c)&BN_MASK2;
138 if (--dl <= 0)
break;
141 r[1] = (t-c)&BN_MASK2;
143 if (--dl <= 0)
break;
146 r[2] = (t-c)&BN_MASK2;
148 if (--dl <= 0)
break;
151 r[3] = (t-c)&BN_MASK2;
153 if (--dl <= 0)
break;
162 fprintf(stderr,
" bn_sub_part_words %d + %d (dl > 0, c == 0)\n", cl, dl);
166 switch (save_dl - dl)
170 if (--dl <= 0)
break;
173 if (--dl <= 0)
break;
176 if (--dl <= 0)
break;
185 fprintf(stderr,
" bn_sub_part_words %d + %d (dl > 0, copy)\n", cl, dl);
190 if (--dl <= 0)
break;
192 if (--dl <= 0)
break;
194 if (--dl <= 0)
break;
196 if (--dl <= 0)
break;
208 const BN_ULONG *
a,
const BN_ULONG *
b,
227 fprintf(stderr,
" bn_add_part_words %d + %d (dl < 0, c = %d)\n", cl, dl, c);
234 if (++dl >= 0)
break;
239 if (++dl >= 0)
break;
244 if (++dl >= 0)
break;
249 if (++dl >= 0)
break;
258 fprintf(stderr,
" bn_add_part_words %d + %d (dl < 0, c == 0)\n", cl, dl);
262 switch (dl - save_dl)
266 if (++dl >= 0)
break;
269 if (++dl >= 0)
break;
272 if (++dl >= 0)
break;
281 fprintf(stderr,
" bn_add_part_words %d + %d (dl < 0, copy)\n", cl, dl);
286 if (++dl >= 0)
break;
288 if (++dl >= 0)
break;
290 if (++dl >= 0)
break;
292 if (++dl >= 0)
break;
303 fprintf(stderr,
" bn_add_part_words %d + %d (dl > 0)\n", cl, dl);
310 if (--dl <= 0)
break;
315 if (--dl <= 0)
break;
320 if (--dl <= 0)
break;
325 if (--dl <= 0)
break;
332 fprintf(stderr,
" bn_add_part_words %d + %d (dl > 0, c == 0)\n", cl, dl);
338 switch (save_dl - dl)
342 if (--dl <= 0)
break;
345 if (--dl <= 0)
break;
348 if (--dl <= 0)
break;
357 fprintf(stderr,
" bn_add_part_words %d + %d (dl > 0, copy)\n", cl, dl);
362 if (--dl <= 0)
break;
364 if (--dl <= 0)
break;
366 if (--dl <= 0)
break;
368 if (--dl <= 0)
break;
394 int dna,
int dnb, BN_ULONG *
t)
397 int tna=n+dna, tnb=n+dnb;
398 unsigned int neg,zero;
402 fprintf(stderr,
" bn_mul_recursive %d%+d * %d%+d\n",n2,dna,n2,dnb);
415 if (n2 == 8 && dna == 0 && dnb == 0)
426 memset(&r[2*n2 + dna + dnb], 0,
427 sizeof(BN_ULONG) * -(dna + dnb));
468 if (n == 4 && dna == 0 && dnb == 0)
474 memset(&(t[n2]),0,8*
sizeof(BN_ULONG));
479 else if (n == 8 && dna == 0 && dnb == 0)
486 memset(&(t[n2]),0,16*
sizeof(BN_ULONG));
498 memset(&(t[n2]),0,n2*
sizeof(BN_ULONG));
535 if (ln < (BN_ULONG)c1)
551 int tna,
int tnb, BN_ULONG *t)
558 fprintf(stderr,
" bn_mul_part_recursive (%d%+d) * (%d%+d)\n",
608 memset(&(r[n2+tn*2]),0,
sizeof(BN_ULONG)*(n2-tn*2));
617 memset(&(r[n2+tna+tnb]),0,
sizeof(BN_ULONG)*(n2-tna-tnb));
635 memset(&(r[n2+i*2]),0,
sizeof(BN_ULONG)*(n2-i*2));
641 memset(&(r[n2+tna+tnb]),0,
642 sizeof(BN_ULONG)*(n2-tna-tnb));
646 memset(&(r[n2]),0,
sizeof(BN_ULONG)*n2);
660 if (i < tna || i < tnb)
667 else if (i == tna || i == tnb)
711 if (ln < (BN_ULONG)c1)
732 fprintf(stderr,
" bn_mul_low_recursive %d * %d\n",n2,n2);
757 void bn_mul_high(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b, BN_ULONG *l,
int n2,
763 BN_ULONG ll,lc,*lp,*mp;
766 fprintf(stderr,
" bn_mul_high %d * %d\n",n2,n2);
857 lp[i]=((~mp[i])+1)&BN_MASK2;
903 ll=(r[i]+lc)&BN_MASK2;
913 r[i++]=(ll-lc)&BN_MASK2;
925 ll=(r[i]+lc)&BN_MASK2;
935 r[i++]=(ll-lc)&BN_MASK2;
948 #if defined(BN_MUL_COMBA) || defined(BN_RECURSION)
957 fprintf(stderr,
"BN_mul %d * %d\n",a->
top,b->
top);
967 if ((al == 0) || (bl == 0))
975 if ((r == a) || (r == b))
983 #if defined(BN_MUL_COMBA) || defined(BN_RECURSION)
1010 if (i >= -1 && i <= 1)
1023 assert(j <= al || j <= bl);
1028 if (al > j || bl > j)
1092 #if defined(BN_MUL_COMBA) || defined(BN_RECURSION)
1109 fprintf(stderr,
" bn_mul_normal %d * %d\n",na,nb);
1117 itmp=na; na=nb; nb=itmp;
1118 ltmp=
a; a=
b; b=ltmp;
1132 if (--nb <= 0)
return;
1134 if (--nb <= 0)
return;
1136 if (--nb <= 0)
return;
1138 if (--nb <= 0)
return;
1149 fprintf(stderr,
" bn_mul_low_normal %d * %d\n",n,n);
1155 if (--n <= 0)
return;
1157 if (--n <= 0)
return;
1159 if (--n <= 0)
return;
1161 if (--n <= 0)
return;