From: beck Date: Sat, 8 Jul 2023 14:56:54 +0000 (+0000) Subject: Hide symbols in modes.h X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=0e3d1220a72f6d7a2e4c964c88af38573ed24367;p=openbsd Hide symbols in modes.h ok tb@ --- diff --git a/lib/libcrypto/Symbols.namespace b/lib/libcrypto/Symbols.namespace index 6e6d27bd4e2..a3aeb7fc757 100644 --- a/lib/libcrypto/Symbols.namespace +++ b/lib/libcrypto/Symbols.namespace @@ -2673,3 +2673,31 @@ _libre_GOST_KEY_get0_public_key _libre_GOST_KEY_set_public_key _libre_GOST_KEY_get_size _libre_ERR_load_GOST_strings +_libre_CRYPTO_cbc128_encrypt +_libre_CRYPTO_cbc128_decrypt +_libre_CRYPTO_ctr128_encrypt +_libre_CRYPTO_ctr128_encrypt_ctr32 +_libre_CRYPTO_ofb128_encrypt +_libre_CRYPTO_cfb128_encrypt +_libre_CRYPTO_cfb128_8_encrypt +_libre_CRYPTO_cfb128_1_encrypt +_libre_CRYPTO_gcm128_new +_libre_CRYPTO_gcm128_init +_libre_CRYPTO_gcm128_setiv +_libre_CRYPTO_gcm128_aad +_libre_CRYPTO_gcm128_encrypt +_libre_CRYPTO_gcm128_decrypt +_libre_CRYPTO_gcm128_encrypt_ctr32 +_libre_CRYPTO_gcm128_decrypt_ctr32 +_libre_CRYPTO_gcm128_finish +_libre_CRYPTO_gcm128_tag +_libre_CRYPTO_gcm128_release +_libre_CRYPTO_ccm128_init +_libre_CRYPTO_ccm128_setiv +_libre_CRYPTO_ccm128_aad +_libre_CRYPTO_ccm128_encrypt +_libre_CRYPTO_ccm128_decrypt +_libre_CRYPTO_ccm128_encrypt_ccm64 +_libre_CRYPTO_ccm128_decrypt_ccm64 +_libre_CRYPTO_ccm128_tag +_libre_CRYPTO_xts128_encrypt diff --git a/lib/libcrypto/hidden/openssl/modes.h b/lib/libcrypto/hidden/openssl/modes.h new file mode 100644 index 00000000000..4162861beb0 --- /dev/null +++ b/lib/libcrypto/hidden/openssl/modes.h @@ -0,0 +1,57 @@ +/* $OpenBSD: modes.h,v 1.1 2023/07/08 14:56:54 beck Exp $ */ +/* + * Copyright (c) 2023 Bob Beck + * + * 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_MODES_H +#define _LIBCRYPTO_MODES_H + +#ifndef _MSC_VER +#include_next +#else +#include "../include/openssl/modes.h" +#endif +#include "crypto_namespace.h" + +LCRYPTO_USED(CRYPTO_cbc128_encrypt); +LCRYPTO_USED(CRYPTO_cbc128_decrypt); +LCRYPTO_USED(CRYPTO_ctr128_encrypt); +LCRYPTO_USED(CRYPTO_ctr128_encrypt_ctr32); +LCRYPTO_USED(CRYPTO_ofb128_encrypt); +LCRYPTO_USED(CRYPTO_cfb128_encrypt); +LCRYPTO_USED(CRYPTO_cfb128_8_encrypt); +LCRYPTO_USED(CRYPTO_cfb128_1_encrypt); +LCRYPTO_USED(CRYPTO_gcm128_new); +LCRYPTO_USED(CRYPTO_gcm128_init); +LCRYPTO_USED(CRYPTO_gcm128_setiv); +LCRYPTO_USED(CRYPTO_gcm128_aad); +LCRYPTO_USED(CRYPTO_gcm128_encrypt); +LCRYPTO_USED(CRYPTO_gcm128_decrypt); +LCRYPTO_USED(CRYPTO_gcm128_encrypt_ctr32); +LCRYPTO_USED(CRYPTO_gcm128_decrypt_ctr32); +LCRYPTO_USED(CRYPTO_gcm128_finish); +LCRYPTO_USED(CRYPTO_gcm128_tag); +LCRYPTO_USED(CRYPTO_gcm128_release); +LCRYPTO_USED(CRYPTO_ccm128_init); +LCRYPTO_USED(CRYPTO_ccm128_setiv); +LCRYPTO_USED(CRYPTO_ccm128_aad); +LCRYPTO_USED(CRYPTO_ccm128_encrypt); +LCRYPTO_USED(CRYPTO_ccm128_decrypt); +LCRYPTO_USED(CRYPTO_ccm128_encrypt_ccm64); +LCRYPTO_USED(CRYPTO_ccm128_decrypt_ccm64); +LCRYPTO_USED(CRYPTO_ccm128_tag); +LCRYPTO_USED(CRYPTO_xts128_encrypt); + +#endif /* _LIBCRYPTO_MODES_H */ diff --git a/lib/libcrypto/modes/cbc128.c b/lib/libcrypto/modes/cbc128.c index 27a2241ad44..f8ebf79a87a 100644 --- a/lib/libcrypto/modes/cbc128.c +++ b/lib/libcrypto/modes/cbc128.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cbc128.c,v 1.7 2023/07/08 14:55:36 beck Exp $ */ +/* $OpenBSD: cbc128.c,v 1.8 2023/07/08 14:56:54 beck Exp $ */ /* ==================================================================== * Copyright (c) 2008 The OpenSSL Project. All rights reserved. * @@ -114,6 +114,7 @@ CRYPTO_cbc128_encrypt(const unsigned char *in, unsigned char *out, } memmove(ivec, iv, 16); } +LCRYPTO_ALIAS(CRYPTO_cbc128_encrypt); void CRYPTO_cbc128_decrypt(const unsigned char *in, unsigned char *out, @@ -210,3 +211,4 @@ CRYPTO_cbc128_decrypt(const unsigned char *in, unsigned char *out, out += 16; } } +LCRYPTO_ALIAS(CRYPTO_cbc128_decrypt); diff --git a/lib/libcrypto/modes/ccm128.c b/lib/libcrypto/modes/ccm128.c index d1471ee2dd7..68c5cce5da9 100644 --- a/lib/libcrypto/modes/ccm128.c +++ b/lib/libcrypto/modes/ccm128.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ccm128.c,v 1.7 2023/07/08 14:55:36 beck Exp $ */ +/* $OpenBSD: ccm128.c,v 1.8 2023/07/08 14:56:54 beck Exp $ */ /* ==================================================================== * Copyright (c) 2011 The OpenSSL Project. All rights reserved. * @@ -70,6 +70,7 @@ CRYPTO_ccm128_init(CCM128_CONTEXT *ctx, ctx->block = block; ctx->key = key; } +LCRYPTO_ALIAS(CRYPTO_ccm128_init); /* !!! Following interfaces are to be called *once* per packet !!! */ @@ -101,6 +102,7 @@ CRYPTO_ccm128_setiv(CCM128_CONTEXT *ctx, return 0; } +LCRYPTO_ALIAS(CRYPTO_ccm128_setiv); /* Then you pass additional authentication data, this is optional */ void @@ -152,6 +154,7 @@ CRYPTO_ccm128_aad(CCM128_CONTEXT *ctx, i = 0; } while (alen); } +LCRYPTO_ALIAS(CRYPTO_ccm128_aad); /* Finally you encrypt or decrypt the message */ @@ -259,6 +262,7 @@ CRYPTO_ccm128_encrypt(CCM128_CONTEXT *ctx, return 0; } +LCRYPTO_ALIAS(CRYPTO_ccm128_encrypt); int CRYPTO_ccm128_decrypt(CCM128_CONTEXT *ctx, @@ -335,6 +339,7 @@ CRYPTO_ccm128_decrypt(CCM128_CONTEXT *ctx, return 0; } +LCRYPTO_ALIAS(CRYPTO_ccm128_decrypt); static void ctr64_add(unsigned char *counter, size_t inc) @@ -416,6 +421,7 @@ CRYPTO_ccm128_encrypt_ccm64(CCM128_CONTEXT *ctx, return 0; } +LCRYPTO_ALIAS(CRYPTO_ccm128_encrypt_ccm64); int CRYPTO_ccm128_decrypt_ccm64(CCM128_CONTEXT *ctx, @@ -475,6 +481,7 @@ CRYPTO_ccm128_decrypt_ccm64(CCM128_CONTEXT *ctx, return 0; } +LCRYPTO_ALIAS(CRYPTO_ccm128_decrypt_ccm64); size_t CRYPTO_ccm128_tag(CCM128_CONTEXT *ctx, unsigned char *tag, size_t len) @@ -488,3 +495,4 @@ CRYPTO_ccm128_tag(CCM128_CONTEXT *ctx, unsigned char *tag, size_t len) memcpy(tag, ctx->cmac.c, M); return M; } +LCRYPTO_ALIAS(CRYPTO_ccm128_tag); diff --git a/lib/libcrypto/modes/cfb128.c b/lib/libcrypto/modes/cfb128.c index f538a2b11c2..931353a620f 100644 --- a/lib/libcrypto/modes/cfb128.c +++ b/lib/libcrypto/modes/cfb128.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cfb128.c,v 1.6 2023/07/08 14:55:36 beck Exp $ */ +/* $OpenBSD: cfb128.c,v 1.7 2023/07/08 14:56:54 beck Exp $ */ /* ==================================================================== * Copyright (c) 2008 The OpenSSL Project. All rights reserved. * @@ -177,6 +177,7 @@ CRYPTO_cfb128_encrypt(const unsigned char *in, unsigned char *out, *num = n; } } +LCRYPTO_ALIAS(CRYPTO_cfb128_encrypt); /* This expects a single block of size nbits for both in and out. Note that it corrupts any extra bits in the last byte of out */ @@ -234,6 +235,7 @@ CRYPTO_cfb128_1_encrypt(const unsigned char *in, unsigned char *out, ((d[0] & 0x80) >> (unsigned int)(n % 8)); } } +LCRYPTO_ALIAS(CRYPTO_cfb128_1_encrypt); void CRYPTO_cfb128_8_encrypt(const unsigned char *in, unsigned char *out, @@ -246,3 +248,4 @@ CRYPTO_cfb128_8_encrypt(const unsigned char *in, unsigned char *out, for (n = 0; n < length; ++n) cfbr_encrypt_block(&in[n], &out[n], 8, key, ivec, enc, block); } +LCRYPTO_ALIAS(CRYPTO_cfb128_8_encrypt); diff --git a/lib/libcrypto/modes/ctr128.c b/lib/libcrypto/modes/ctr128.c index 7ba68a9c4cf..6d507dfc3ae 100644 --- a/lib/libcrypto/modes/ctr128.c +++ b/lib/libcrypto/modes/ctr128.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ctr128.c,v 1.10 2023/07/08 14:55:36 beck Exp $ */ +/* $OpenBSD: ctr128.c,v 1.11 2023/07/08 14:56:54 beck Exp $ */ /* ==================================================================== * Copyright (c) 2008 The OpenSSL Project. All rights reserved. * @@ -179,6 +179,7 @@ CRYPTO_ctr128_encrypt(const unsigned char *in, unsigned char *out, *num = n; } +LCRYPTO_ALIAS(CRYPTO_ctr128_encrypt); /* increment upper 96 bits of 128-bit counter by 1 */ static void @@ -263,3 +264,4 @@ CRYPTO_ctr128_encrypt_ctr32(const unsigned char *in, unsigned char *out, *num = n; } +LCRYPTO_ALIAS(CRYPTO_ctr128_encrypt_ctr32); diff --git a/lib/libcrypto/modes/gcm128.c b/lib/libcrypto/modes/gcm128.c index 45d33db768c..c4fc5cb94fa 100644 --- a/lib/libcrypto/modes/gcm128.c +++ b/lib/libcrypto/modes/gcm128.c @@ -1,4 +1,4 @@ -/* $OpenBSD: gcm128.c,v 1.24 2023/07/08 14:55:36 beck Exp $ */ +/* $OpenBSD: gcm128.c,v 1.25 2023/07/08 14:56:54 beck Exp $ */ /* ==================================================================== * Copyright (c) 2010 The OpenSSL Project. All rights reserved. * @@ -784,6 +784,7 @@ CRYPTO_gcm128_init(GCM128_CONTEXT *ctx, void *key, block128_f block) # endif #endif } +LCRYPTO_ALIAS(CRYPTO_gcm128_init); void CRYPTO_gcm128_setiv(GCM128_CONTEXT *ctx, const unsigned char *iv, size_t len) @@ -865,6 +866,7 @@ CRYPTO_gcm128_setiv(GCM128_CONTEXT *ctx, const unsigned char *iv, size_t len) ctx->Yi.d[3] = ctr; #endif } +LCRYPTO_ALIAS(CRYPTO_gcm128_setiv); int CRYPTO_gcm128_aad(GCM128_CONTEXT *ctx, const unsigned char *aad, size_t len) @@ -927,6 +929,7 @@ CRYPTO_gcm128_aad(GCM128_CONTEXT *ctx, const unsigned char *aad, size_t len) ctx->ares = n; return 0; } +LCRYPTO_ALIAS(CRYPTO_gcm128_aad); int CRYPTO_gcm128_encrypt(GCM128_CONTEXT *ctx, @@ -1116,6 +1119,7 @@ CRYPTO_gcm128_encrypt(GCM128_CONTEXT *ctx, ctx->mres = n; return 0; } +LCRYPTO_ALIAS(CRYPTO_gcm128_encrypt); int CRYPTO_gcm128_decrypt(GCM128_CONTEXT *ctx, @@ -1310,6 +1314,7 @@ CRYPTO_gcm128_decrypt(GCM128_CONTEXT *ctx, ctx->mres = n; return 0; } +LCRYPTO_ALIAS(CRYPTO_gcm128_decrypt); int CRYPTO_gcm128_encrypt_ctr32(GCM128_CONTEXT *ctx, @@ -1431,6 +1436,7 @@ CRYPTO_gcm128_encrypt_ctr32(GCM128_CONTEXT *ctx, ctx->mres = n; return 0; } +LCRYPTO_ALIAS(CRYPTO_gcm128_encrypt_ctr32); int CRYPTO_gcm128_decrypt_ctr32(GCM128_CONTEXT *ctx, @@ -1559,6 +1565,7 @@ CRYPTO_gcm128_decrypt_ctr32(GCM128_CONTEXT *ctx, ctx->mres = n; return 0; } +LCRYPTO_ALIAS(CRYPTO_gcm128_decrypt_ctr32); int CRYPTO_gcm128_finish(GCM128_CONTEXT *ctx, const unsigned char *tag, @@ -1602,6 +1609,7 @@ CRYPTO_gcm128_finish(GCM128_CONTEXT *ctx, const unsigned char *tag, else return -1; } +LCRYPTO_ALIAS(CRYPTO_gcm128_finish); void CRYPTO_gcm128_tag(GCM128_CONTEXT *ctx, unsigned char *tag, size_t len) @@ -1610,6 +1618,7 @@ CRYPTO_gcm128_tag(GCM128_CONTEXT *ctx, unsigned char *tag, size_t len) memcpy(tag, ctx->Xi.c, len <= sizeof(ctx->Xi.c) ? len : sizeof(ctx->Xi.c)); } +LCRYPTO_ALIAS(CRYPTO_gcm128_tag); GCM128_CONTEXT * CRYPTO_gcm128_new(void *key, block128_f block) @@ -1621,9 +1630,11 @@ CRYPTO_gcm128_new(void *key, block128_f block) return ret; } +LCRYPTO_ALIAS(CRYPTO_gcm128_new); void CRYPTO_gcm128_release(GCM128_CONTEXT *ctx) { freezero(ctx, sizeof(*ctx)); } +LCRYPTO_ALIAS(CRYPTO_gcm128_release); diff --git a/lib/libcrypto/modes/ofb128.c b/lib/libcrypto/modes/ofb128.c index 9ef812a08b6..42afd29d583 100644 --- a/lib/libcrypto/modes/ofb128.c +++ b/lib/libcrypto/modes/ofb128.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ofb128.c,v 1.6 2023/07/08 14:55:36 beck Exp $ */ +/* $OpenBSD: ofb128.c,v 1.7 2023/07/08 14:56:54 beck Exp $ */ /* ==================================================================== * Copyright (c) 2008 The OpenSSL Project. All rights reserved. * @@ -121,3 +121,4 @@ CRYPTO_ofb128_encrypt(const unsigned char *in, unsigned char *out, *num = n; } +LCRYPTO_ALIAS(CRYPTO_ofb128_encrypt); diff --git a/lib/libcrypto/modes/xts128.c b/lib/libcrypto/modes/xts128.c index 449a802f37d..7516acf850d 100644 --- a/lib/libcrypto/modes/xts128.c +++ b/lib/libcrypto/modes/xts128.c @@ -1,4 +1,4 @@ -/* $OpenBSD: xts128.c,v 1.11 2023/07/08 14:55:36 beck Exp $ */ +/* $OpenBSD: xts128.c,v 1.12 2023/07/08 14:56:54 beck Exp $ */ /* ==================================================================== * Copyright (c) 2011 The OpenSSL Project. All rights reserved. * @@ -194,3 +194,4 @@ CRYPTO_xts128_encrypt(const XTS128_CONTEXT *ctx, const unsigned char iv[16], return 0; } +LCRYPTO_ALIAS(CRYPTO_xts128_encrypt);