From 9df1065fe2a02f0f84a83479bacfe55e4f6eb64f Mon Sep 17 00:00:00 2001 From: joshua Date: Fri, 29 Mar 2024 02:37:20 +0000 Subject: [PATCH] Hide symbols in Blowfish ok jsing tb --- lib/libcrypto/Symbols.namespace | 7 +++++ lib/libcrypto/bf/blowfish.c | 9 ++++++- lib/libcrypto/hidden/openssl/blowfish.h | 36 +++++++++++++++++++++++++ 3 files changed, 51 insertions(+), 1 deletion(-) create mode 100644 lib/libcrypto/hidden/openssl/blowfish.h diff --git a/lib/libcrypto/Symbols.namespace b/lib/libcrypto/Symbols.namespace index 336989e983e..511cd626ba6 100644 --- a/lib/libcrypto/Symbols.namespace +++ b/lib/libcrypto/Symbols.namespace @@ -2584,3 +2584,10 @@ _libre_DES_string_to_key _libre_DES_string_to_2keys _libre_DES_cfb64_encrypt _libre_DES_ofb64_encrypt +_libre_BF_set_key +_libre_BF_encrypt +_libre_BF_decrypt +_libre_BF_ecb_encrypt +_libre_BF_cbc_encrypt +_libre_BF_cfb64_encrypt +_libre_BF_ofb64_encrypt diff --git a/lib/libcrypto/bf/blowfish.c b/lib/libcrypto/bf/blowfish.c index fa6d66fcea6..330d7a8e07f 100644 --- a/lib/libcrypto/bf/blowfish.c +++ b/lib/libcrypto/bf/blowfish.c @@ -1,4 +1,4 @@ -/* $OpenBSD: blowfish.c,v 1.2 2024/03/27 11:54:29 jsing Exp $ */ +/* $OpenBSD: blowfish.c,v 1.3 2024/03/29 02:37:20 joshua Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -380,6 +380,7 @@ BF_encrypt(BF_LONG *data, const BF_KEY *key) data[1] = l&0xffffffffL; data[0] = r&0xffffffffL; } +LCRYPTO_ALIAS(BF_encrypt); #ifndef BF_DEFAULT_OPTIONS @@ -422,6 +423,7 @@ BF_decrypt(BF_LONG *data, const BF_KEY *key) data[1] = l&0xffffffffL; data[0] = r&0xffffffffL; } +LCRYPTO_ALIAS(BF_decrypt); void BF_cbc_encrypt(const unsigned char *in, unsigned char *out, long length, @@ -498,6 +500,7 @@ BF_cbc_encrypt(const unsigned char *in, unsigned char *out, long length, tin0 = tin1 = tout0 = tout1 = xor0 = xor1 = 0; tin[0] = tin[1] = 0; } +LCRYPTO_ALIAS(BF_cbc_encrypt); /* * The input and output encrypted as though 64bit cfb mode is being @@ -561,6 +564,7 @@ BF_cfb64_encrypt(const unsigned char *in, unsigned char *out, long length, v0 = v1 = ti[0] = ti[1] = t=c = cc = 0; *num = n; } +LCRYPTO_ALIAS(BF_cfb64_encrypt); void BF_ecb_encrypt(const unsigned char *in, unsigned char *out, @@ -582,6 +586,7 @@ BF_ecb_encrypt(const unsigned char *in, unsigned char *out, l2n(l, out); l = d[0] = d[1] = 0; } +LCRYPTO_ALIAS(BF_ecb_encrypt); /* * The input and output encrypted as though 64bit ofb mode is being @@ -632,6 +637,7 @@ BF_ofb64_encrypt(const unsigned char *in, unsigned char *out, long length, t = v0 = v1 = ti[0] = ti[1] = 0; *num = n; } +LCRYPTO_ALIAS(BF_ofb64_encrypt); void BF_set_key(BF_KEY *key, int len, const unsigned char *data) @@ -686,4 +692,5 @@ BF_set_key(BF_KEY *key, int len, const unsigned char *data) p[i + 1] = in[1]; } } +LCRYPTO_ALIAS(BF_set_key); #endif diff --git a/lib/libcrypto/hidden/openssl/blowfish.h b/lib/libcrypto/hidden/openssl/blowfish.h new file mode 100644 index 00000000000..e9a0d98fe85 --- /dev/null +++ b/lib/libcrypto/hidden/openssl/blowfish.h @@ -0,0 +1,36 @@ +/* $OpenBSD: blowfish.h,v 1.1 2024/03/29 02:37:20 joshua Exp $ */ +/* + * Copyright (c) 2024 Joshua Sing + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#ifndef _LIBCRYPTO_BLOWFISH_H +#define _LIBCRYPTO_BLOWFISH_H + +#ifndef _MSC_VER +#include_next +#else +#include "../include/openssl/blowfish.h" +#endif +#include "crypto_namespace.h" + +LCRYPTO_USED(BF_set_key); +LCRYPTO_USED(BF_encrypt); +LCRYPTO_USED(BF_decrypt); +LCRYPTO_USED(BF_ecb_encrypt); +LCRYPTO_USED(BF_cbc_encrypt); +LCRYPTO_USED(BF_cfb64_encrypt); +LCRYPTO_USED(BF_ofb64_encrypt); + +#endif /* _LIBCRYPTO_BLOWFISH_H */ -- 2.20.1