summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorjsing <>2022-11-30 01:47:19 +0000
committerjsing <>2022-11-30 01:47:19 +0000
commit5be663738480cf475e92563959075b4d94fe3f3d (patch)
treed6b04bda189d39719fceb5f6f2067aab189bf13d /src
parent0d626c3d57e499336b58c4ff58366583fd67d286 (diff)
downloadopenbsd-5be663738480cf475e92563959075b4d94fe3f3d.tar.gz
openbsd-5be663738480cf475e92563959075b4d94fe3f3d.tar.bz2
openbsd-5be663738480cf475e92563959075b4d94fe3f3d.zip
Mop up more BN_DEBUG related code.
Diffstat (limited to 'src')
-rw-r--r--src/lib/libcrypto/bn/bn.h14
-rw-r--r--src/lib/libcrypto/bn/bn_asm.c7
-rw-r--r--src/lib/libcrypto/bn/bn_ctx.c8
-rw-r--r--src/lib/libcrypto/bn/bn_gf2m.c7
-rw-r--r--src/lib/libcrypto/bn/bn_lib.c7
-rw-r--r--src/lib/libcrypto/bn/bn_mul.c7
-rw-r--r--src/lib/libcrypto/bn/bn_nist.c5
7 files changed, 7 insertions, 48 deletions
diff --git a/src/lib/libcrypto/bn/bn.h b/src/lib/libcrypto/bn/bn.h
index 5ac41438eb..bef0a878e2 100644
--- a/src/lib/libcrypto/bn/bn.h
+++ b/src/lib/libcrypto/bn/bn.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: bn.h,v 1.55 2022/07/12 14:42:48 kn Exp $ */ 1/* $OpenBSD: bn.h,v 1.56 2022/11/30 01:47:19 jsing Exp $ */
2/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -138,18 +138,6 @@
138extern "C" { 138extern "C" {
139#endif 139#endif
140 140
141/* These preprocessor symbols control various aspects of the bignum headers and
142 * library code. They're not defined by any "normal" configuration, as they are
143 * intended for development and testing purposes. NB: defining all three can be
144 * useful for debugging application code as well as openssl itself.
145 *
146 * BN_DEBUG - turn on various debugging alterations to the bignum code
147 * BN_DEBUG_RAND - uses random poisoning of unused words to trip up
148 * mismanagement of bignum internals. You must also define BN_DEBUG.
149 */
150/* #define BN_DEBUG */
151/* #define BN_DEBUG_RAND */
152
153#ifndef OPENSSL_SMALL_FOOTPRINT 141#ifndef OPENSSL_SMALL_FOOTPRINT
154#define BN_MUL_COMBA 142#define BN_MUL_COMBA
155#define BN_SQR_COMBA 143#define BN_SQR_COMBA
diff --git a/src/lib/libcrypto/bn/bn_asm.c b/src/lib/libcrypto/bn/bn_asm.c
index fd1990e5ed..e5627cf6de 100644
--- a/src/lib/libcrypto/bn/bn_asm.c
+++ b/src/lib/libcrypto/bn/bn_asm.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: bn_asm.c,v 1.16 2022/11/26 16:08:51 tb Exp $ */ 1/* $OpenBSD: bn_asm.c,v 1.17 2022/11/30 01:47: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 *
@@ -56,11 +56,6 @@
56 * [including the GNU Public Licence.] 56 * [including the GNU Public Licence.]
57 */ 57 */
58 58
59#ifndef BN_DEBUG
60# undef NDEBUG /* avoid conflicting definitions */
61# define NDEBUG
62#endif
63
64#include <assert.h> 59#include <assert.h>
65#include <stdio.h> 60#include <stdio.h>
66 61
diff --git a/src/lib/libcrypto/bn/bn_ctx.c b/src/lib/libcrypto/bn/bn_ctx.c
index 606db82f24..d2f5558b89 100644
--- a/src/lib/libcrypto/bn/bn_ctx.c
+++ b/src/lib/libcrypto/bn/bn_ctx.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: bn_ctx.c,v 1.18 2022/11/26 16:08:51 tb Exp $ */ 1/* $OpenBSD: bn_ctx.c,v 1.19 2022/11/30 01:47:19 jsing Exp $ */
2/* Written by Ulf Moeller for the OpenSSL project. */ 2/* Written by Ulf Moeller for the OpenSSL project. */
3/* ==================================================================== 3/* ====================================================================
4 * Copyright (c) 1998-2004 The OpenSSL Project. All rights reserved. 4 * Copyright (c) 1998-2004 The OpenSSL Project. All rights reserved.
@@ -54,12 +54,6 @@
54 * 54 *
55 */ 55 */
56 56
57#if !defined(BN_CTX_DEBUG) && !defined(BN_DEBUG)
58#ifndef NDEBUG
59#define NDEBUG
60#endif
61#endif
62
63#include <stdio.h> 57#include <stdio.h>
64#include <string.h> 58#include <string.h>
65 59
diff --git a/src/lib/libcrypto/bn/bn_gf2m.c b/src/lib/libcrypto/bn/bn_gf2m.c
index e5818ca18d..5ee353087d 100644
--- a/src/lib/libcrypto/bn/bn_gf2m.c
+++ b/src/lib/libcrypto/bn/bn_gf2m.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: bn_gf2m.c,v 1.28 2022/11/26 16:08:51 tb Exp $ */ 1/* $OpenBSD: bn_gf2m.c,v 1.29 2022/11/30 01:47:19 jsing Exp $ */
2/* ==================================================================== 2/* ====================================================================
3 * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED. 3 * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED.
4 * 4 *
@@ -778,11 +778,6 @@ BN_GF2m_mod_inv(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx)
778 ret = 1; 778 ret = 1;
779 779
780err: 780err:
781#ifdef BN_DEBUG /* BN_CTX_end would complain about the expanded form */
782 bn_correct_top(c);
783 bn_correct_top(u);
784 bn_correct_top(v);
785#endif
786 BN_CTX_end(ctx); 781 BN_CTX_end(ctx);
787 return ret; 782 return ret;
788} 783}
diff --git a/src/lib/libcrypto/bn/bn_lib.c b/src/lib/libcrypto/bn/bn_lib.c
index 97e8f27043..0ac3977c19 100644
--- a/src/lib/libcrypto/bn/bn_lib.c
+++ b/src/lib/libcrypto/bn/bn_lib.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: bn_lib.c,v 1.63 2022/11/26 16:08:51 tb Exp $ */ 1/* $OpenBSD: bn_lib.c,v 1.64 2022/11/30 01:47: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 *
@@ -56,11 +56,6 @@
56 * [including the GNU Public Licence.] 56 * [including the GNU Public Licence.]
57 */ 57 */
58 58
59#ifndef BN_DEBUG
60# undef NDEBUG /* avoid conflicting definitions */
61# define NDEBUG
62#endif
63
64#include <assert.h> 59#include <assert.h>
65#include <limits.h> 60#include <limits.h>
66#include <stdio.h> 61#include <stdio.h>
diff --git a/src/lib/libcrypto/bn/bn_mul.c b/src/lib/libcrypto/bn/bn_mul.c
index fea5bb32d0..9fc06e33f1 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.23 2022/11/26 16:08:51 tb Exp $ */ 1/* $OpenBSD: bn_mul.c,v 1.24 2022/11/30 01:47: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 *
@@ -56,11 +56,6 @@
56 * [including the GNU Public Licence.] 56 * [including the GNU Public Licence.]
57 */ 57 */
58 58
59#ifndef BN_DEBUG
60# undef NDEBUG /* avoid conflicting definitions */
61# define NDEBUG
62#endif
63
64#include <assert.h> 59#include <assert.h>
65#include <stdio.h> 60#include <stdio.h>
66#include <string.h> 61#include <string.h>
diff --git a/src/lib/libcrypto/bn/bn_nist.c b/src/lib/libcrypto/bn/bn_nist.c
index 227ff008ba..bad59ee30f 100644
--- a/src/lib/libcrypto/bn/bn_nist.c
+++ b/src/lib/libcrypto/bn/bn_nist.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: bn_nist.c,v 1.23 2022/11/26 16:08:51 tb Exp $ */ 1/* $OpenBSD: bn_nist.c,v 1.24 2022/11/30 01:47:19 jsing Exp $ */
2/* 2/*
3 * Written by Nils Larsch for the OpenSSL project 3 * Written by Nils Larsch for the OpenSSL project
4 */ 4 */
@@ -401,9 +401,6 @@ nist_cp_bn_0(BN_ULONG *dst, const BN_ULONG *src, int top, int max)
401{ 401{
402 int i; 402 int i;
403 403
404#ifdef BN_DEBUG
405 OPENSSL_assert(top <= max);
406#endif
407 for (i = 0; i < top; i++) 404 for (i = 0; i < top; i++)
408 dst[i] = src[i]; 405 dst[i] = src[i];
409 for (; i < max; i++) 406 for (; i < max; i++)