summaryrefslogtreecommitdiff
path: root/crypto/lhash
diff options
context:
space:
mode:
authorHugo Landau <hlandau@openssl.org>2022-03-22 11:52:27 +0000
committerTomas Mraz <tomas@openssl.org>2022-06-22 09:36:14 +0200
commit5317b6ee1fc3db20de5976fbb46cc49a45c0768a (patch)
treed74e2364f8eec5783f0f22f4b4333a8665a40948 /crypto/lhash
parentbcb52bcc9f9c36a85d037976676fd5ca52f307cd (diff)
downloadopenssl-new-5317b6ee1fc3db20de5976fbb46cc49a45c0768a.tar.gz
Add deprecation macro for 3.1 and deprecate OPENSSL_LH_stats
Reviewed-by: Paul Dale <pauli@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/17937)
Diffstat (limited to 'crypto/lhash')
-rw-r--r--crypto/lhash/lh_stats.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/crypto/lhash/lh_stats.c b/crypto/lhash/lh_stats.c
index ba4d4ea897..ea0a3252a6 100644
--- a/crypto/lhash/lh_stats.c
+++ b/crypto/lhash/lh_stats.c
@@ -7,6 +7,8 @@
* https://www.openssl.org/source/license.html
*/
+#define OPENSSL_SUPPRESS_DEPRECATED
+
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
@@ -21,6 +23,7 @@
#include "lhash_local.h"
# ifndef OPENSSL_NO_STDIO
+# ifndef OPENSSL_NO_DEPRECATED_3_1
void OPENSSL_LH_stats(const OPENSSL_LHASH *lh, FILE *fp)
{
BIO *bp;
@@ -56,9 +59,15 @@ void OPENSSL_LH_node_usage_stats(const OPENSSL_LHASH *lh, FILE *fp)
OPENSSL_LH_node_usage_stats_bio(lh, bp);
BIO_free(bp);
}
-
+# endif
# endif
+# ifndef OPENSSL_NO_DEPRECATED_3_1
+/*
+ * These functions are implemented as separate static functions as they are
+ * called from the stdio functions above and calling deprecated functions will
+ * generate a warning.
+ */
void OPENSSL_LH_stats_bio(const OPENSSL_LHASH *lh, BIO *out)
{
BIO_printf(out, "num_items = %lu\n", lh->num_items);
@@ -115,3 +124,4 @@ void OPENSSL_LH_node_usage_stats_bio(const OPENSSL_LHASH *lh, BIO *out)
(int)((total % lh->num_nodes) * 100 / lh->num_nodes),
(int)(total / n_used), (int)((total % n_used) * 100 / n_used));
}
+# endif