From b80856cdf1ff0da4b4909345ccafb52b83cd6fed Mon Sep 17 00:00:00 2001 From: beck Date: Wed, 10 Apr 2024 14:53:01 +0000 Subject: [PATCH] Finish hiding symbols in rand.h This removes the LIBRESSL_INTERNAL guards and marks the functions within as LCRYPTO_UNUSED --- lib/libcrypto/Symbols.namespace | 10 ++++++++++ lib/libcrypto/hidden/openssl/rand.h | 12 +++++++++++- lib/libcrypto/rand/rand.h | 4 +--- lib/libcrypto/rand/rand_lib.c | 9 ++++++++- lib/libcrypto/rand/randfile.c | 5 ++++- 5 files changed, 34 insertions(+), 6 deletions(-) diff --git a/lib/libcrypto/Symbols.namespace b/lib/libcrypto/Symbols.namespace index 0f44808bbc0..b1be9dcc14c 100644 --- a/lib/libcrypto/Symbols.namespace +++ b/lib/libcrypto/Symbols.namespace @@ -3179,3 +3179,13 @@ _libre_FIPS_mode _libre_FIPS_mode_set _libre_OPENSSL_init _libre_CRYPTO_memcmp +_libre_RAND_cleanup +_libre_RAND_bytes +_libre_RAND_pseudo_bytes +_libre_RAND_seed +_libre_RAND_add +_libre_RAND_load_file +_libre_RAND_write_file +_libre_RAND_file_name +_libre_RAND_status +_libre_RAND_poll diff --git a/lib/libcrypto/hidden/openssl/rand.h b/lib/libcrypto/hidden/openssl/rand.h index 978d10f70b5..d06442acdbe 100644 --- a/lib/libcrypto/hidden/openssl/rand.h +++ b/lib/libcrypto/hidden/openssl/rand.h @@ -1,4 +1,4 @@ -/* $OpenBSD: rand.h,v 1.3 2023/07/28 09:53:55 tb Exp $ */ +/* $OpenBSD: rand.h,v 1.4 2024/04/10 14:53:01 beck Exp $ */ /* * Copyright (c) 2023 Bob Beck * @@ -29,5 +29,15 @@ LCRYPTO_USED(RAND_set_rand_method); LCRYPTO_USED(RAND_get_rand_method); LCRYPTO_USED(RAND_SSLeay); LCRYPTO_USED(ERR_load_RAND_strings); +LCRYPTO_UNUSED(RAND_cleanup); +LCRYPTO_UNUSED(RAND_bytes); +LCRYPTO_UNUSED(RAND_pseudo_bytes); +LCRYPTO_UNUSED(RAND_seed); +LCRYPTO_UNUSED(RAND_add); +LCRYPTO_UNUSED(RAND_load_file); +LCRYPTO_UNUSED(RAND_write_file); +LCRYPTO_UNUSED(RAND_file_name); +LCRYPTO_UNUSED(RAND_status); +LCRYPTO_UNUSED(RAND_poll); #endif /* _LIBCRYPTO_RAND_H */ diff --git a/lib/libcrypto/rand/rand.h b/lib/libcrypto/rand/rand.h index d66d71579c3..1a2c8f715f9 100644 --- a/lib/libcrypto/rand/rand.h +++ b/lib/libcrypto/rand/rand.h @@ -1,4 +1,4 @@ -/* $OpenBSD: rand.h,v 1.24 2023/11/19 15:46:10 tb Exp $ */ +/* $OpenBSD: rand.h,v 1.25 2024/04/10 14:53:01 beck Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -85,7 +85,6 @@ int RAND_set_rand_method(const RAND_METHOD *meth); const RAND_METHOD *RAND_get_rand_method(void); RAND_METHOD *RAND_SSLeay(void); -#ifndef LIBRESSL_INTERNAL void RAND_cleanup(void ); int RAND_bytes(unsigned char *buf, int num); int RAND_pseudo_bytes(unsigned char *buf, int num); @@ -96,7 +95,6 @@ int RAND_write_file(const char *file); const char *RAND_file_name(char *file, size_t num); int RAND_status(void); int RAND_poll(void); -#endif void ERR_load_RAND_strings(void); diff --git a/lib/libcrypto/rand/rand_lib.c b/lib/libcrypto/rand/rand_lib.c index b9ef0deebe5..0c9810f8488 100644 --- a/lib/libcrypto/rand/rand_lib.c +++ b/lib/libcrypto/rand/rand_lib.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rand_lib.c,v 1.23 2023/11/19 15:46:10 tb Exp $ */ +/* $OpenBSD: rand_lib.c,v 1.24 2024/04/10 14:53:01 beck Exp $ */ /* * Copyright (c) 2014 Ted Unangst * @@ -50,30 +50,35 @@ RAND_cleanup(void) { } +LCRYPTO_ALIAS(RAND_cleanup); void RAND_seed(const void *buf, int num) { } +LCRYPTO_ALIAS(RAND_seed); void RAND_add(const void *buf, int num, double entropy) { } +LCRYPTO_ALIAS(RAND_add); int RAND_status(void) { return 1; } +LCRYPTO_ALIAS(RAND_status); int RAND_poll(void) { return 1; } +LCRYPTO_ALIAS(RAND_poll); /* * Hurray. You've made it to the good parts. @@ -85,6 +90,7 @@ RAND_bytes(unsigned char *buf, int num) arc4random_buf(buf, num); return 1; } +LCRYPTO_ALIAS(RAND_bytes); int RAND_pseudo_bytes(unsigned char *buf, int num) @@ -93,3 +99,4 @@ RAND_pseudo_bytes(unsigned char *buf, int num) arc4random_buf(buf, num); return 1; } +LCRYPTO_ALIAS(RAND_pseudo_bytes); diff --git a/lib/libcrypto/rand/randfile.c b/lib/libcrypto/rand/randfile.c index 00008af7554..5fdfcb8dd37 100644 --- a/lib/libcrypto/rand/randfile.c +++ b/lib/libcrypto/rand/randfile.c @@ -1,4 +1,4 @@ -/* $OpenBSD: randfile.c,v 1.44 2023/07/07 19:37:54 beck Exp $ */ +/* $OpenBSD: randfile.c,v 1.45 2024/04/10 14:53:01 beck Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -85,6 +85,7 @@ RAND_load_file(const char *file, long bytes) else return bytes; } +LCRYPTO_ALIAS(RAND_load_file); int RAND_write_file(const char *file) @@ -133,6 +134,7 @@ RAND_write_file(const char *file) explicit_bzero(buf, BUFSIZE); return ret; } +LCRYPTO_ALIAS(RAND_write_file); const char * RAND_file_name(char * buf, size_t size) @@ -141,3 +143,4 @@ RAND_file_name(char * buf, size_t size) return (NULL); return buf; } +LCRYPTO_ALIAS(RAND_file_name); -- 2.20.1