From 4569778023d8d4ec0159e09baa48f5f397ff8847 Mon Sep 17 00:00:00 2001 From: schwarze <> Date: Tue, 20 Aug 2019 10:59:09 +0000 Subject: make BN_CTX_end(NULL) a NOOP for compatibility with documented behaviour in OpenSSL 1.1.1 even though in general, letting random functions accept NULL is not advisable because it can hide programming errors; "yes please" tb@ "unfortunately I suspect you're right" jsing@ "oh well" deraadt@ --- src/lib/libcrypto/bn/bn_ctx.c | 5 ++++- src/lib/libcrypto/man/BN_CTX_start.3 | 11 ++++++++--- 2 files changed, 12 insertions(+), 4 deletions(-) (limited to 'src/lib') diff --git a/src/lib/libcrypto/bn/bn_ctx.c b/src/lib/libcrypto/bn/bn_ctx.c index 1237ac1365..0d64ccab93 100644 --- a/src/lib/libcrypto/bn/bn_ctx.c +++ b/src/lib/libcrypto/bn/bn_ctx.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bn_ctx.c,v 1.15 2017/01/29 17:49:22 beck Exp $ */ +/* $OpenBSD: bn_ctx.c,v 1.16 2019/08/20 10:59:09 schwarze Exp $ */ /* Written by Ulf Moeller for the OpenSSL project. */ /* ==================================================================== * Copyright (c) 1998-2004 The OpenSSL Project. All rights reserved. @@ -283,6 +283,9 @@ BN_CTX_start(BN_CTX *ctx) void BN_CTX_end(BN_CTX *ctx) { + if (ctx == NULL) + return; + CTXDBG_ENTRY("BN_CTX_end", ctx); if (ctx->err_stack) diff --git a/src/lib/libcrypto/man/BN_CTX_start.3 b/src/lib/libcrypto/man/BN_CTX_start.3 index f4f10b8b0c..a2b62eff5c 100644 --- a/src/lib/libcrypto/man/BN_CTX_start.3 +++ b/src/lib/libcrypto/man/BN_CTX_start.3 @@ -1,5 +1,5 @@ -.\" $OpenBSD: BN_CTX_start.3,v 1.7 2018/03/22 16:06:33 schwarze Exp $ -.\" OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400 +.\" $OpenBSD: BN_CTX_start.3,v 1.8 2019/08/20 10:59:09 schwarze Exp $ +.\" full merge up to: OpenSSL 35fd9953 May 28 14:49:38 2019 +0200 .\" .\" This file was written by Ulf Moeller . .\" Copyright (c) 2000 The OpenSSL Project. All rights reserved. @@ -48,7 +48,7 @@ .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED .\" OF THE POSSIBILITY OF SUCH DAMAGE. .\" -.Dd $Mdocdate: March 22 2018 $ +.Dd $Mdocdate: August 20 2019 $ .Dt BN_CTX_START 3 .Os .Sh NAME @@ -104,6 +104,11 @@ is called, the pointers obtained from .Fn BN_CTX_get become invalid. +If +.Fa ctx +is +.Dv NULL , +no action occurs. .Sh RETURN VALUES .Fn BN_CTX_get returns a pointer to the -- cgit v1.2.3-55-g6feb