summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorjsing <>2023-01-16 16:53:19 +0000
committerjsing <>2023-01-16 16:53:19 +0000
commitc697a4ee90cf2e8daab7bbb471d2afd609aff929 (patch)
tree2fba392ca42fc701c65fa73738d30a12096ad361 /src
parent2994748fbb9da0ea1469bb730a4125d8341972a9 (diff)
downloadopenbsd-c697a4ee90cf2e8daab7bbb471d2afd609aff929.tar.gz
openbsd-c697a4ee90cf2e8daab7bbb471d2afd609aff929.tar.bz2
openbsd-c697a4ee90cf2e8daab7bbb471d2afd609aff929.zip
Mop up debug code that escaped previously.
This is the result of `unifdef -m -U BN_COUNT'.
Diffstat (limited to 'src')
-rw-r--r--src/lib/libcrypto/bn/bn_mont.c5
-rw-r--r--src/lib/libcrypto/bn/bn_mul.c72
-rw-r--r--src/lib/libcrypto/bn/bn_sqr.c8
3 files changed, 3 insertions, 82 deletions
diff --git a/src/lib/libcrypto/bn/bn_mont.c b/src/lib/libcrypto/bn/bn_mont.c
index d4de5c2cc5..f8b870266c 100644
--- a/src/lib/libcrypto/bn/bn_mont.c
+++ b/src/lib/libcrypto/bn/bn_mont.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: bn_mont.c,v 1.32 2022/11/26 16:08:51 tb Exp $ */ 1/* $OpenBSD: bn_mont.c,v 1.33 2023/01/16 16:53:19 jsing Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -213,9 +213,6 @@ BN_from_montgomery_word(BIGNUM *ret, BIGNUM *r, BN_MONT_CTX *mont)
213 r->top = max; 213 r->top = max;
214 n0 = mont->n0[0]; 214 n0 = mont->n0[0];
215 215
216#ifdef BN_COUNT
217 fprintf(stderr, "word BN_from_montgomery_word %d * %d\n", nl, nl);
218#endif
219 for (carry = 0, i = 0; i < nl; i++, rp++) { 216 for (carry = 0, i = 0; i < nl; i++, rp++) {
220 v = bn_mul_add_words(rp, np, nl, (rp[0] * n0) & BN_MASK2); 217 v = bn_mul_add_words(rp, np, nl, (rp[0] * n0) & BN_MASK2);
221 v = (v + carry + rp[nl]) & BN_MASK2; 218 v = (v + carry + rp[nl]) & BN_MASK2;
diff --git a/src/lib/libcrypto/bn/bn_mul.c b/src/lib/libcrypto/bn/bn_mul.c
index 9fc06e33f1..f6e6e9bf65 100644
--- a/src/lib/libcrypto/bn/bn_mul.c
+++ b/src/lib/libcrypto/bn/bn_mul.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: bn_mul.c,v 1.24 2022/11/30 01:47:19 jsing Exp $ */ 1/* $OpenBSD: bn_mul.c,v 1.25 2023/01/16 16:53:19 jsing Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -92,11 +92,6 @@ bn_sub_part_words(BN_ULONG *r, const BN_ULONG *a, const BN_ULONG *b, int cl,
92 b += cl; 92 b += cl;
93 93
94 if (dl < 0) { 94 if (dl < 0) {
95#ifdef BN_COUNT
96 fprintf(stderr,
97 " bn_sub_part_words %d + %d (dl < 0, c = %d)\n",
98 cl, dl, c);
99#endif
100 for (;;) { 95 for (;;) {
101 t = b[0]; 96 t = b[0];
102 r[0] = (0 - t - c) & BN_MASK2; 97 r[0] = (0 - t - c) & BN_MASK2;
@@ -131,11 +126,6 @@ bn_sub_part_words(BN_ULONG *r, const BN_ULONG *a, const BN_ULONG *b, int cl,
131 } 126 }
132 } else { 127 } else {
133 int save_dl = dl; 128 int save_dl = dl;
134#ifdef BN_COUNT
135 fprintf(stderr,
136 " bn_sub_part_words %d + %d (dl > 0, c = %d)\n",
137 cl, dl, c);
138#endif
139 while (c) { 129 while (c) {
140 t = a[0]; 130 t = a[0];
141 r[0] = (t - c) & BN_MASK2; 131 r[0] = (t - c) & BN_MASK2;
@@ -170,11 +160,6 @@ bn_sub_part_words(BN_ULONG *r, const BN_ULONG *a, const BN_ULONG *b, int cl,
170 r += 4; 160 r += 4;
171 } 161 }
172 if (dl > 0) { 162 if (dl > 0) {
173#ifdef BN_COUNT
174 fprintf(stderr,
175 " bn_sub_part_words %d + %d (dl > 0, c == 0)\n",
176 cl, dl);
177#endif
178 if (save_dl > dl) { 163 if (save_dl > dl) {
179 switch (save_dl - dl) { 164 switch (save_dl - dl) {
180 case 1: 165 case 1:
@@ -195,11 +180,6 @@ bn_sub_part_words(BN_ULONG *r, const BN_ULONG *a, const BN_ULONG *b, int cl,
195 } 180 }
196 } 181 }
197 if (dl > 0) { 182 if (dl > 0) {
198#ifdef BN_COUNT
199 fprintf(stderr,
200 " bn_sub_part_words %d + %d (dl > 0, copy)\n",
201 cl, dl);
202#endif
203 for (;;) { 183 for (;;) {
204 r[0] = a[0]; 184 r[0] = a[0];
205 if (--dl <= 0) 185 if (--dl <= 0)
@@ -241,11 +221,6 @@ bn_add_part_words(BN_ULONG *r, const BN_ULONG *a, const BN_ULONG *b, int cl,
241 221
242 if (dl < 0) { 222 if (dl < 0) {
243 int save_dl = dl; 223 int save_dl = dl;
244#ifdef BN_COUNT
245 fprintf(stderr,
246 " bn_add_part_words %d + %d (dl < 0, c = %d)\n",
247 cl, dl, c);
248#endif
249 while (c) { 224 while (c) {
250 l = (c + b[0]) & BN_MASK2; 225 l = (c + b[0]) & BN_MASK2;
251 c = (l < c); 226 c = (l < c);
@@ -276,11 +251,6 @@ bn_add_part_words(BN_ULONG *r, const BN_ULONG *a, const BN_ULONG *b, int cl,
276 r += 4; 251 r += 4;
277 } 252 }
278 if (dl < 0) { 253 if (dl < 0) {
279#ifdef BN_COUNT
280 fprintf(stderr,
281 " bn_add_part_words %d + %d (dl < 0, c == 0)\n",
282 cl, dl);
283#endif
284 if (save_dl < dl) { 254 if (save_dl < dl) {
285 switch (dl - save_dl) { 255 switch (dl - save_dl) {
286 case 1: 256 case 1:
@@ -301,11 +271,6 @@ bn_add_part_words(BN_ULONG *r, const BN_ULONG *a, const BN_ULONG *b, int cl,
301 } 271 }
302 } 272 }
303 if (dl < 0) { 273 if (dl < 0) {
304#ifdef BN_COUNT
305 fprintf(stderr,
306 " bn_add_part_words %d + %d (dl < 0, copy)\n",
307 cl, dl);
308#endif
309 for (;;) { 274 for (;;) {
310 r[0] = b[0]; 275 r[0] = b[0];
311 if (++dl >= 0) 276 if (++dl >= 0)
@@ -326,10 +291,6 @@ bn_add_part_words(BN_ULONG *r, const BN_ULONG *a, const BN_ULONG *b, int cl,
326 } 291 }
327 } else { 292 } else {
328 int save_dl = dl; 293 int save_dl = dl;
329#ifdef BN_COUNT
330 fprintf(stderr,
331 " bn_add_part_words %d + %d (dl > 0)\n", cl, dl);
332#endif
333 while (c) { 294 while (c) {
334 t = (a[0] + c) & BN_MASK2; 295 t = (a[0] + c) & BN_MASK2;
335 c = (t < c); 296 c = (t < c);
@@ -359,10 +320,6 @@ bn_add_part_words(BN_ULONG *r, const BN_ULONG *a, const BN_ULONG *b, int cl,
359 a += 4; 320 a += 4;
360 r += 4; 321 r += 4;
361 } 322 }
362#ifdef BN_COUNT
363 fprintf(stderr,
364 " bn_add_part_words %d + %d (dl > 0, c == 0)\n", cl, dl);
365#endif
366 if (dl > 0) { 323 if (dl > 0) {
367 if (save_dl > dl) { 324 if (save_dl > dl) {
368 switch (save_dl - dl) { 325 switch (save_dl - dl) {
@@ -384,11 +341,6 @@ bn_add_part_words(BN_ULONG *r, const BN_ULONG *a, const BN_ULONG *b, int cl,
384 } 341 }
385 } 342 }
386 if (dl > 0) { 343 if (dl > 0) {
387#ifdef BN_COUNT
388 fprintf(stderr,
389 " bn_add_part_words %d + %d (dl > 0, copy)\n",
390 cl, dl);
391#endif
392 for (;;) { 344 for (;;) {
393 r[0] = a[0]; 345 r[0] = a[0];
394 if (--dl <= 0) 346 if (--dl <= 0)
@@ -435,9 +387,6 @@ bn_mul_recursive(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b, int n2, int dna,
435 unsigned int neg, zero; 387 unsigned int neg, zero;
436 BN_ULONG ln, lo, *p; 388 BN_ULONG ln, lo, *p;
437 389
438# ifdef BN_COUNT
439 fprintf(stderr, " bn_mul_recursive %d%+d * %d%+d\n",n2,dna,n2,dnb);
440# endif
441# ifdef BN_MUL_COMBA 390# ifdef BN_MUL_COMBA
442# if 0 391# if 0
443 if (n2 == 4) { 392 if (n2 == 4) {
@@ -582,10 +531,6 @@ bn_mul_part_recursive(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b, int n, int tna,
582 int c1, c2, neg; 531 int c1, c2, neg;
583 BN_ULONG ln, lo, *p; 532 BN_ULONG ln, lo, *p;
584 533
585# ifdef BN_COUNT
586 fprintf(stderr, " bn_mul_part_recursive (%d%+d) * (%d%+d)\n",
587 n, tna, n, tnb);
588# endif
589 if (n < 8) { 534 if (n < 8) {
590 bn_mul_normal(r, a, n + tna, b, n + tnb); 535 bn_mul_normal(r, a, n + tna, b, n + tnb);
591 return; 536 return;
@@ -740,9 +685,6 @@ bn_mul_low_recursive(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b, int n2, BN_ULONG *t)
740{ 685{
741 int n = n2 / 2; 686 int n = n2 / 2;
742 687
743# ifdef BN_COUNT
744 fprintf(stderr, " bn_mul_low_recursive %d * %d\n",n2,n2);
745# endif
746 688
747 bn_mul_recursive(r, a, b, n, 0, 0, &(t[0])); 689 bn_mul_recursive(r, a, b, n, 0, 0, &(t[0]));
748 if (n >= BN_MUL_LOW_RECURSIVE_SIZE_NORMAL) { 690 if (n >= BN_MUL_LOW_RECURSIVE_SIZE_NORMAL) {
@@ -772,9 +714,6 @@ bn_mul_high(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b, BN_ULONG *l, int n2,
772 int neg, oneg, zero; 714 int neg, oneg, zero;
773 BN_ULONG ll, lc, *lp, *mp; 715 BN_ULONG ll, lc, *lp, *mp;
774 716
775# ifdef BN_COUNT
776 fprintf(stderr, " bn_mul_high %d * %d\n",n2,n2);
777# endif
778 n = n2 / 2; 717 n = n2 / 2;
779 718
780 /* Calculate (al-ah)*(bh-bl) */ 719 /* Calculate (al-ah)*(bh-bl) */
@@ -945,9 +884,6 @@ BN_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx)
945 int j = 0, k; 884 int j = 0, k;
946#endif 885#endif
947 886
948#ifdef BN_COUNT
949 fprintf(stderr, "BN_mul %d * %d\n",a->top,b->top);
950#endif
951 887
952 888
953 al = a->top; 889 al = a->top;
@@ -1093,9 +1029,6 @@ bn_mul_normal(BN_ULONG *r, BN_ULONG *a, int na, BN_ULONG *b, int nb)
1093{ 1029{
1094 BN_ULONG *rr; 1030 BN_ULONG *rr;
1095 1031
1096#ifdef BN_COUNT
1097 fprintf(stderr, " bn_mul_normal %d * %d\n", na, nb);
1098#endif
1099 1032
1100 if (na < nb) { 1033 if (na < nb) {
1101 int itmp; 1034 int itmp;
@@ -1138,9 +1071,6 @@ bn_mul_normal(BN_ULONG *r, BN_ULONG *a, int na, BN_ULONG *b, int nb)
1138void 1071void
1139bn_mul_low_normal(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b, int n) 1072bn_mul_low_normal(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b, int n)
1140{ 1073{
1141#ifdef BN_COUNT
1142 fprintf(stderr, " bn_mul_low_normal %d * %d\n", n, n);
1143#endif
1144 bn_mul_words(r, a, n, b[0]); 1074 bn_mul_words(r, a, n, b[0]);
1145 1075
1146 for (;;) { 1076 for (;;) {
diff --git a/src/lib/libcrypto/bn/bn_sqr.c b/src/lib/libcrypto/bn/bn_sqr.c
index 1104c0f2c2..e150191fa1 100644
--- a/src/lib/libcrypto/bn/bn_sqr.c
+++ b/src/lib/libcrypto/bn/bn_sqr.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: bn_sqr.c,v 1.16 2022/11/26 16:08:51 tb Exp $ */ 1/* $OpenBSD: bn_sqr.c,v 1.17 2023/01/16 16:53:19 jsing Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -69,9 +69,6 @@ BN_sqr(BIGNUM *r, const BIGNUM *a, BN_CTX *ctx)
69 int ret = 0; 69 int ret = 0;
70 BIGNUM *tmp, *rr; 70 BIGNUM *tmp, *rr;
71 71
72#ifdef BN_COUNT
73 fprintf(stderr, "BN_sqr %d * %d\n", a->top, a->top);
74#endif
75 72
76 al = a->top; 73 al = a->top;
77 if (al <= 0) { 74 if (al <= 0) {
@@ -203,9 +200,6 @@ bn_sqr_recursive(BN_ULONG *r, const BN_ULONG *a, int n2, BN_ULONG *t)
203 int zero, c1; 200 int zero, c1;
204 BN_ULONG ln, lo, *p; 201 BN_ULONG ln, lo, *p;
205 202
206#ifdef BN_COUNT
207 fprintf(stderr, " bn_sqr_recursive %d * %d\n", n2, n2);
208#endif
209 if (n2 == 4) { 203 if (n2 == 4) {
210#ifndef BN_SQR_COMBA 204#ifndef BN_SQR_COMBA
211 bn_sqr_normal(r, a, 4, t); 205 bn_sqr_normal(r, a, 4, t);