summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormiod <miod@openbsd.org>2014-07-12 14:58:32 +0000
committermiod <miod@openbsd.org>2014-07-12 14:58:32 +0000
commit68a272ff45d44b26bcfbf7aac61d5a3b1746d781 (patch)
treea6df70ac4261fab5b3d93bad9ab09dbd6782ccf8
parentFix the sentence in the BUGS section. Colon is usable for password. (diff)
downloadwireguard-openbsd-68a272ff45d44b26bcfbf7aac61d5a3b1746d781.tar.xz
wireguard-openbsd-68a272ff45d44b26bcfbf7aac61d5a3b1746d781.zip
Principle of least surprise: make CMAC_CTX_free(), OCSP_REQ_CTX_free() and
X509_STORE_CTX_free() accept NULL pointers as input without dereferencing them, like all the other well-behaved *_CTX_free() functions do.
-rw-r--r--lib/libcrypto/cmac/cmac.c5
-rw-r--r--lib/libcrypto/ocsp/ocsp_ht.c5
-rw-r--r--lib/libcrypto/x509/x509_vfy.c5
-rw-r--r--lib/libssl/src/crypto/cmac/cmac.c5
-rw-r--r--lib/libssl/src/crypto/ocsp/ocsp_ht.c5
-rw-r--r--lib/libssl/src/crypto/x509/x509_vfy.c5
6 files changed, 24 insertions, 6 deletions
diff --git a/lib/libcrypto/cmac/cmac.c b/lib/libcrypto/cmac/cmac.c
index baba674ec1d..18635b942a8 100644
--- a/lib/libcrypto/cmac/cmac.c
+++ b/lib/libcrypto/cmac/cmac.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmac.c,v 1.8 2014/07/11 08:44:48 jsing Exp $ */
+/* $OpenBSD: cmac.c,v 1.9 2014/07/12 14:58:32 miod Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
* project.
*/
@@ -123,6 +123,9 @@ CMAC_CTX_get0_cipher_ctx(CMAC_CTX *ctx)
void
CMAC_CTX_free(CMAC_CTX *ctx)
{
+ if (ctx == NULL)
+ return;
+
CMAC_CTX_cleanup(ctx);
free(ctx);
}
diff --git a/lib/libcrypto/ocsp/ocsp_ht.c b/lib/libcrypto/ocsp/ocsp_ht.c
index bc3c957b0cb..c895e9df4db 100644
--- a/lib/libcrypto/ocsp/ocsp_ht.c
+++ b/lib/libcrypto/ocsp/ocsp_ht.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ocsp_ht.c,v 1.19 2014/06/12 15:49:30 deraadt Exp $ */
+/* $OpenBSD: ocsp_ht.c,v 1.20 2014/07/12 14:58:32 miod Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
* project 2006.
*/
@@ -108,6 +108,9 @@ static int parse_http_line1(char *line);
void
OCSP_REQ_CTX_free(OCSP_REQ_CTX *rctx)
{
+ if (rctx == NULL)
+ return;
+
if (rctx->mem)
BIO_free(rctx->mem);
free(rctx->iobuf);
diff --git a/lib/libcrypto/x509/x509_vfy.c b/lib/libcrypto/x509/x509_vfy.c
index 9d7a7d12289..d894facd473 100644
--- a/lib/libcrypto/x509/x509_vfy.c
+++ b/lib/libcrypto/x509/x509_vfy.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: x509_vfy.c,v 1.34 2014/07/11 12:52:41 miod Exp $ */
+/* $OpenBSD: x509_vfy.c,v 1.35 2014/07/12 14:58:32 miod Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
@@ -1979,6 +1979,9 @@ X509_STORE_CTX_new(void)
void
X509_STORE_CTX_free(X509_STORE_CTX *ctx)
{
+ if (ctx == NULL)
+ return;
+
X509_STORE_CTX_cleanup(ctx);
free(ctx);
}
diff --git a/lib/libssl/src/crypto/cmac/cmac.c b/lib/libssl/src/crypto/cmac/cmac.c
index baba674ec1d..18635b942a8 100644
--- a/lib/libssl/src/crypto/cmac/cmac.c
+++ b/lib/libssl/src/crypto/cmac/cmac.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmac.c,v 1.8 2014/07/11 08:44:48 jsing Exp $ */
+/* $OpenBSD: cmac.c,v 1.9 2014/07/12 14:58:32 miod Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
* project.
*/
@@ -123,6 +123,9 @@ CMAC_CTX_get0_cipher_ctx(CMAC_CTX *ctx)
void
CMAC_CTX_free(CMAC_CTX *ctx)
{
+ if (ctx == NULL)
+ return;
+
CMAC_CTX_cleanup(ctx);
free(ctx);
}
diff --git a/lib/libssl/src/crypto/ocsp/ocsp_ht.c b/lib/libssl/src/crypto/ocsp/ocsp_ht.c
index bc3c957b0cb..c895e9df4db 100644
--- a/lib/libssl/src/crypto/ocsp/ocsp_ht.c
+++ b/lib/libssl/src/crypto/ocsp/ocsp_ht.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ocsp_ht.c,v 1.19 2014/06/12 15:49:30 deraadt Exp $ */
+/* $OpenBSD: ocsp_ht.c,v 1.20 2014/07/12 14:58:32 miod Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
* project 2006.
*/
@@ -108,6 +108,9 @@ static int parse_http_line1(char *line);
void
OCSP_REQ_CTX_free(OCSP_REQ_CTX *rctx)
{
+ if (rctx == NULL)
+ return;
+
if (rctx->mem)
BIO_free(rctx->mem);
free(rctx->iobuf);
diff --git a/lib/libssl/src/crypto/x509/x509_vfy.c b/lib/libssl/src/crypto/x509/x509_vfy.c
index 9d7a7d12289..d894facd473 100644
--- a/lib/libssl/src/crypto/x509/x509_vfy.c
+++ b/lib/libssl/src/crypto/x509/x509_vfy.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: x509_vfy.c,v 1.34 2014/07/11 12:52:41 miod Exp $ */
+/* $OpenBSD: x509_vfy.c,v 1.35 2014/07/12 14:58:32 miod Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
@@ -1979,6 +1979,9 @@ X509_STORE_CTX_new(void)
void
X509_STORE_CTX_free(X509_STORE_CTX *ctx)
{
+ if (ctx == NULL)
+ return;
+
X509_STORE_CTX_cleanup(ctx);
free(ctx);
}