From 3a31e487d7b98dd7e88b5413e04876600998a440 Mon Sep 17 00:00:00 2001 From: tb Date: Fri, 24 Aug 2018 19:16:03 +0000 Subject: [PATCH] Let CRYPTO_mem_leaks{,_fp,_cb}() return -1. These functions are no-ops. Their signature was changed by OpenSSL to allow error checking. This way we return an error and do not indicate the (non-)existence of memory leaks. tested in a bulk by sthen ok jsing --- lib/libcrypto/crypto.h | 10 +++++----- lib/libcrypto/mem_dbg.c | 14 +++++++------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/lib/libcrypto/crypto.h b/lib/libcrypto/crypto.h index be5f92b1a3c..e614c6ad659 100644 --- a/lib/libcrypto/crypto.h +++ b/lib/libcrypto/crypto.h @@ -1,4 +1,4 @@ -/* $OpenBSD: crypto.h,v 1.46 2018/05/13 13:48:08 jsing Exp $ */ +/* $OpenBSD: crypto.h,v 1.47 2018/08/24 19:16:03 tb Exp $ */ /* ==================================================================== * Copyright (c) 1998-2006 The OpenSSL Project. All rights reserved. * @@ -495,11 +495,11 @@ long CRYPTO_dbg_get_options(void) __attribute__ ((deprecated)); -void CRYPTO_mem_leaks_fp(FILE *); -void CRYPTO_mem_leaks(struct bio_st *bio); +int CRYPTO_mem_leaks_fp(FILE *); +int CRYPTO_mem_leaks(struct bio_st *bio); /* unsigned long order, char *file, int line, int num_bytes, char *addr */ -typedef void *CRYPTO_MEM_LEAK_CB(unsigned long, const char *, int, int, void *); -void CRYPTO_mem_leaks_cb(CRYPTO_MEM_LEAK_CB *cb); +typedef int *CRYPTO_MEM_LEAK_CB(unsigned long, const char *, int, int, void *); +int CRYPTO_mem_leaks_cb(CRYPTO_MEM_LEAK_CB *cb); /* die if we have to */ void OpenSSLDie(const char *file, int line, const char *assertion); diff --git a/lib/libcrypto/mem_dbg.c b/lib/libcrypto/mem_dbg.c index cae02a6f219..64bc46a5dc5 100644 --- a/lib/libcrypto/mem_dbg.c +++ b/lib/libcrypto/mem_dbg.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mem_dbg.c,v 1.22 2014/06/12 15:49:27 deraadt Exp $ */ +/* $OpenBSD: mem_dbg.c,v 1.23 2018/08/24 19:16:03 tb Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -181,21 +181,21 @@ CRYPTO_dbg_realloc(void *addr1, void *addr2, int num, abort(); } -void +int CRYPTO_mem_leaks(BIO *b) { - return; + return -1; } -void +int CRYPTO_mem_leaks_fp(FILE *fp) { - return; + return -1; } -void +int CRYPTO_mem_leaks_cb(CRYPTO_MEM_LEAK_CB *cb) { - return; + return -1; } -- 2.20.1