From: beck Date: Sat, 8 Jul 2023 14:30:44 +0000 (+0000) Subject: Hide symbols in gost. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=81e3f6b17a995c6ec6b1f5251efd4b2e2f1a77e4;p=openbsd Hide symbols in gost. ok tb@ after some puking in his mouth. --- diff --git a/lib/libcrypto/Symbols.namespace b/lib/libcrypto/Symbols.namespace index 7676e45f909..6e6d27bd4e2 100644 --- a/lib/libcrypto/Symbols.namespace +++ b/lib/libcrypto/Symbols.namespace @@ -2631,3 +2631,45 @@ _libre_DSA_meth_set1_name _libre_DSA_meth_set_sign _libre_DSA_meth_set_finish _libre_ERR_load_DSA_strings +_libre_Gost2814789_set_sbox +_libre_Gost2814789_set_key +_libre_Gost2814789_ecb_encrypt +_libre_Gost2814789_cfb64_encrypt +_libre_Gost2814789_cnt_encrypt +_libre_GOST_CIPHER_PARAMS_new +_libre_GOST_CIPHER_PARAMS_free +_libre_d2i_GOST_CIPHER_PARAMS +_libre_i2d_GOST_CIPHER_PARAMS +_libre_GOST2814789IMIT_Init +_libre_GOST2814789IMIT_Update +_libre_GOST2814789IMIT_Final +_libre_GOST2814789IMIT_Transform +_libre_GOST2814789IMIT +_libre_GOSTR341194_Init +_libre_GOSTR341194_Update +_libre_GOSTR341194_Final +_libre_GOSTR341194_Transform +_libre_GOSTR341194 +_libre_STREEBOG256_Init +_libre_STREEBOG256_Update +_libre_STREEBOG256_Final +_libre_STREEBOG256 +_libre_STREEBOG512_Init +_libre_STREEBOG512_Update +_libre_STREEBOG512_Final +_libre_STREEBOG512_Transform +_libre_STREEBOG512 +_libre_GOST_KEY_new +_libre_GOST_KEY_free +_libre_GOST_KEY_check_key +_libre_GOST_KEY_set_public_key_affine_coordinates +_libre_GOST_KEY_get0_group +_libre_GOST_KEY_set_group +_libre_GOST_KEY_get_digest +_libre_GOST_KEY_set_digest +_libre_GOST_KEY_get0_private_key +_libre_GOST_KEY_set_private_key +_libre_GOST_KEY_get0_public_key +_libre_GOST_KEY_set_public_key +_libre_GOST_KEY_get_size +_libre_ERR_load_GOST_strings diff --git a/lib/libcrypto/gost/gost2814789.c b/lib/libcrypto/gost/gost2814789.c index 1e0f17da434..dac3a8eab82 100644 --- a/lib/libcrypto/gost/gost2814789.c +++ b/lib/libcrypto/gost/gost2814789.c @@ -1,4 +1,4 @@ -/* $OpenBSD: gost2814789.c,v 1.8 2022/11/26 16:08:53 tb Exp $ */ +/* $OpenBSD: gost2814789.c,v 1.9 2023/07/08 14:30:44 beck Exp $ */ /* * Copyright (c) 2014 Dmitry Eremin-Solenikov * Copyright (c) 2005-2006 Cryptocom LTD @@ -180,6 +180,7 @@ Gost2814789_ecb_encrypt(const unsigned char *in, unsigned char *out, else Gost2814789_decrypt(in, out, key); } +LCRYPTO_ALIAS(Gost2814789_ecb_encrypt); static inline void Gost2814789_encrypt_mesh(unsigned char *iv, GOST2814789_KEY *key) @@ -318,6 +319,7 @@ Gost2814789_cfb64_encrypt(const unsigned char *in, unsigned char *out, *num = n; } } +LCRYPTO_ALIAS(Gost2814789_cfb64_encrypt); static inline void Gost2814789_cnt_next(unsigned char *ivec, unsigned char *out, @@ -403,6 +405,7 @@ Gost2814789_cnt_encrypt(const unsigned char *in, unsigned char *out, size_t len, *num=n; } +LCRYPTO_ALIAS(Gost2814789_cnt_encrypt); int GOST2814789IMIT_Init(GOST2814789IMIT_CTX *c, int nid) @@ -411,6 +414,7 @@ GOST2814789IMIT_Init(GOST2814789IMIT_CTX *c, int nid) memset(c->mac, 0, 8); return Gost2814789_set_sbox(&c->cipher, nid); } +LCRYPTO_ALIAS(GOST2814789IMIT_Init); static void GOST2814789IMIT_block_data_order(GOST2814789IMIT_CTX *ctx, @@ -435,6 +439,8 @@ GOST2814789IMIT_block_data_order(GOST2814789IMIT_CTX *ctx, #define HASH_BLOCK_DATA_ORDER GOST2814789IMIT_block_data_order #include "md32_common.h" +LCRYPTO_ALIAS(GOST2814789IMIT_Update); +LCRYPTO_ALIAS(GOST2814789IMIT_Transform); int GOST2814789IMIT_Final(unsigned char *md, GOST2814789IMIT_CTX *c) @@ -450,6 +456,7 @@ GOST2814789IMIT_Final(unsigned char *md, GOST2814789IMIT_CTX *c) memcpy(md, c->mac, 4); return 1; } +LCRYPTO_ALIAS(GOST2814789IMIT_Final); unsigned char * GOST2814789IMIT(const unsigned char *d, size_t n, unsigned char *md, int nid, @@ -468,5 +475,6 @@ GOST2814789IMIT(const unsigned char *d, size_t n, unsigned char *md, int nid, explicit_bzero(&c, sizeof(c)); return (md); } +LCRYPTO_ALIAS(GOST2814789IMIT); #endif diff --git a/lib/libcrypto/gost/gost89_params.c b/lib/libcrypto/gost/gost89_params.c index 9c4a97ee6dc..ef9c9cde6b0 100644 --- a/lib/libcrypto/gost/gost89_params.c +++ b/lib/libcrypto/gost/gost89_params.c @@ -1,4 +1,4 @@ -/* $OpenBSD: gost89_params.c,v 1.3 2022/11/26 16:08:53 tb Exp $ */ +/* $OpenBSD: gost89_params.c,v 1.4 2023/07/08 14:30:44 beck Exp $ */ /* * Copyright (c) 2014 Dmitry Eremin-Solenikov * Copyright (c) 2005-2006 Cryptocom LTD @@ -211,6 +211,7 @@ Gost2814789_set_sbox(GOST2814789_KEY *key, int nid) return 1; } +LCRYPTO_ALIAS(Gost2814789_set_sbox); int Gost2814789_set_key(GOST2814789_KEY *key, const unsigned char *userKey, @@ -228,6 +229,7 @@ Gost2814789_set_key(GOST2814789_KEY *key, const unsigned char *userKey, return 1; } +LCRYPTO_ALIAS(Gost2814789_set_key); void Gost2814789_cryptopro_key_mesh(GOST2814789_KEY *key) diff --git a/lib/libcrypto/gost/gost_asn1.c b/lib/libcrypto/gost/gost_asn1.c index d83ded55b14..28e3a58e53c 100644 --- a/lib/libcrypto/gost/gost_asn1.c +++ b/lib/libcrypto/gost/gost_asn1.c @@ -273,23 +273,27 @@ d2i_GOST_CIPHER_PARAMS(GOST_CIPHER_PARAMS **a, const unsigned char **in, long le return (GOST_CIPHER_PARAMS *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, &GOST_CIPHER_PARAMS_it); } +LCRYPTO_ALIAS(d2i_GOST_CIPHER_PARAMS); int i2d_GOST_CIPHER_PARAMS(GOST_CIPHER_PARAMS *a, unsigned char **out) { return ASN1_item_i2d((ASN1_VALUE *)a, out, &GOST_CIPHER_PARAMS_it); } +LCRYPTO_ALIAS(i2d_GOST_CIPHER_PARAMS); GOST_CIPHER_PARAMS * GOST_CIPHER_PARAMS_new(void) { return (GOST_CIPHER_PARAMS *)ASN1_item_new(&GOST_CIPHER_PARAMS_it); } +LCRYPTO_ALIAS(GOST_CIPHER_PARAMS_new); void GOST_CIPHER_PARAMS_free(GOST_CIPHER_PARAMS *a) { ASN1_item_free((ASN1_VALUE *)a, &GOST_CIPHER_PARAMS_it); } +LCRYPTO_ALIAS(GOST_CIPHER_PARAMS_free); #endif diff --git a/lib/libcrypto/gost/gost_err.c b/lib/libcrypto/gost/gost_err.c index 0c46dbc36ce..380f60289e1 100644 --- a/lib/libcrypto/gost/gost_err.c +++ b/lib/libcrypto/gost/gost_err.c @@ -103,3 +103,4 @@ ERR_load_GOST_strings(void) { } #endif } +LCRYPTO_ALIAS(ERR_load_GOST_strings); diff --git a/lib/libcrypto/gost/gostr341001_key.c b/lib/libcrypto/gost/gostr341001_key.c index 62694318d58..efc9e57452f 100644 --- a/lib/libcrypto/gost/gostr341001_key.c +++ b/lib/libcrypto/gost/gostr341001_key.c @@ -1,4 +1,4 @@ -/* $OpenBSD: gostr341001_key.c,v 1.12 2023/03/07 09:27:10 jsing Exp $ */ +/* $OpenBSD: gostr341001_key.c,v 1.13 2023/07/08 14:30:44 beck Exp $ */ /* * Copyright (c) 2014 Dmitry Eremin-Solenikov * Copyright (c) 2005-2006 Cryptocom LTD @@ -88,6 +88,7 @@ GOST_KEY_new(void) ret->digest_nid = NID_undef; return (ret); } +LCRYPTO_ALIAS(GOST_KEY_new); void GOST_KEY_free(GOST_KEY *r) @@ -107,6 +108,7 @@ GOST_KEY_free(GOST_KEY *r) freezero(r, sizeof(GOST_KEY)); } +LCRYPTO_ALIAS(GOST_KEY_free); int GOST_KEY_check_key(const GOST_KEY *key) @@ -176,6 +178,7 @@ err: EC_POINT_free(point); return (ok); } +LCRYPTO_ALIAS(GOST_KEY_check_key); int GOST_KEY_set_public_key_affine_coordinates(GOST_KEY *key, BIGNUM *x, BIGNUM *y) @@ -232,12 +235,14 @@ err: return ok; } +LCRYPTO_ALIAS(GOST_KEY_set_public_key_affine_coordinates); const EC_GROUP * GOST_KEY_get0_group(const GOST_KEY *key) { return key->group; } +LCRYPTO_ALIAS(GOST_KEY_get0_group); int GOST_KEY_set_group(GOST_KEY *key, const EC_GROUP *group) @@ -246,12 +251,14 @@ GOST_KEY_set_group(GOST_KEY *key, const EC_GROUP *group) key->group = EC_GROUP_dup(group); return (key->group == NULL) ? 0 : 1; } +LCRYPTO_ALIAS(GOST_KEY_set_group); const BIGNUM * GOST_KEY_get0_private_key(const GOST_KEY *key) { return key->priv_key; } +LCRYPTO_ALIAS(GOST_KEY_get0_private_key); int GOST_KEY_set_private_key(GOST_KEY *key, const BIGNUM *priv_key) @@ -260,12 +267,14 @@ GOST_KEY_set_private_key(GOST_KEY *key, const BIGNUM *priv_key) key->priv_key = BN_dup(priv_key); return (key->priv_key == NULL) ? 0 : 1; } +LCRYPTO_ALIAS(GOST_KEY_set_private_key); const EC_POINT * GOST_KEY_get0_public_key(const GOST_KEY *key) { return key->pub_key; } +LCRYPTO_ALIAS(GOST_KEY_get0_public_key); int GOST_KEY_set_public_key(GOST_KEY *key, const EC_POINT *pub_key) @@ -274,12 +283,14 @@ GOST_KEY_set_public_key(GOST_KEY *key, const EC_POINT *pub_key) key->pub_key = EC_POINT_dup(pub_key, key->group); return (key->pub_key == NULL) ? 0 : 1; } +LCRYPTO_ALIAS(GOST_KEY_set_public_key); int GOST_KEY_get_digest(const GOST_KEY *key) { return key->digest_nid; } +LCRYPTO_ALIAS(GOST_KEY_get_digest); int GOST_KEY_set_digest(GOST_KEY *key, int digest_nid) { @@ -292,6 +303,7 @@ GOST_KEY_set_digest(GOST_KEY *key, int digest_nid) return 0; } +LCRYPTO_ALIAS(GOST_KEY_set_digest); size_t GOST_KEY_get_size(const GOST_KEY *r) @@ -318,4 +330,5 @@ GOST_KEY_get_size(const GOST_KEY *r) BN_free(order); return (i); } +LCRYPTO_ALIAS(GOST_KEY_get_size); #endif diff --git a/lib/libcrypto/gost/gostr341194.c b/lib/libcrypto/gost/gostr341194.c index 63058300a3a..311c304539d 100644 --- a/lib/libcrypto/gost/gostr341194.c +++ b/lib/libcrypto/gost/gostr341194.c @@ -1,4 +1,4 @@ -/* $OpenBSD: gostr341194.c,v 1.6 2022/11/26 16:08:53 tb Exp $ */ +/* $OpenBSD: gostr341194.c,v 1.7 2023/07/08 14:30:44 beck Exp $ */ /* * Copyright (c) 2014 Dmitry Eremin-Solenikov * Copyright (c) 2005-2006 Cryptocom LTD @@ -205,6 +205,7 @@ GOSTR341194_Init(GOSTR341194_CTX *c, int nid) memset(c, 0, sizeof(*c)); return Gost2814789_set_sbox(&c->cipher, nid); } +LCRYPTO_ALIAS(GOSTR341194_Init); static void GOSTR341194_block_data_order(GOSTR341194_CTX *ctx, const unsigned char *p, @@ -230,6 +231,8 @@ GOSTR341194_block_data_order(GOSTR341194_CTX *ctx, const unsigned char *p, #define HASH_BLOCK_DATA_ORDER GOSTR341194_block_data_order #include "md32_common.h" +LCRYPTO_ALIAS(GOSTR341194_Update); +LCRYPTO_ALIAS(GOSTR341194_Transform); int GOSTR341194_Final(unsigned char *md, GOSTR341194_CTX * c) @@ -254,6 +257,7 @@ GOSTR341194_Final(unsigned char *md, GOSTR341194_CTX * c) return 1; } +LCRYPTO_ALIAS(GOSTR341194_Final); unsigned char * GOSTR341194(const unsigned char *d, size_t n, unsigned char *md, int nid) @@ -270,4 +274,5 @@ GOSTR341194(const unsigned char *d, size_t n, unsigned char *md, int nid) explicit_bzero(&c, sizeof(c)); return (md); } +LCRYPTO_ALIAS(GOSTR341194); #endif diff --git a/lib/libcrypto/gost/streebog.c b/lib/libcrypto/gost/streebog.c index 2785fca619a..60c575794cb 100644 --- a/lib/libcrypto/gost/streebog.c +++ b/lib/libcrypto/gost/streebog.c @@ -1,4 +1,4 @@ -/* $OpenBSD: streebog.c,v 1.8 2022/11/26 16:08:53 tb Exp $ */ +/* $OpenBSD: streebog.c,v 1.9 2023/07/08 14:30:44 beck Exp $ */ /* * Copyright (c) 2014 Dmitry Eremin-Solenikov * Copyright (c) 2005-2006 Cryptocom LTD @@ -1365,12 +1365,14 @@ STREEBOG512_Final(unsigned char *md, STREEBOG_CTX *c) return 1; } +LCRYPTO_ALIAS(STREEBOG512_Final); int STREEBOG256_Final(unsigned char *md, STREEBOG_CTX * c) { return STREEBOG512_Final(md, c); } +LCRYPTO_ALIAS(STREEBOG256_Final); int STREEBOG512_Update(STREEBOG_CTX *c, const void *_data, size_t len) @@ -1411,18 +1413,21 @@ STREEBOG512_Update(STREEBOG_CTX *c, const void *_data, size_t len) return 1; } +LCRYPTO_ALIAS(STREEBOG512_Update); int STREEBOG256_Update(STREEBOG_CTX *c, const void *data, size_t len) { return STREEBOG512_Update(c, data, len); } +LCRYPTO_ALIAS(STREEBOG256_Update); void STREEBOG512_Transform(STREEBOG_CTX *c, const unsigned char *data) { streebog_block_data_order(c, data, 1); } +LCRYPTO_ALIAS(STREEBOG512_Transform); int STREEBOG256_Init(STREEBOG_CTX *c) @@ -1433,6 +1438,7 @@ STREEBOG256_Init(STREEBOG_CTX *c) c->md_len = STREEBOG256_LENGTH; return 1; } +LCRYPTO_ALIAS(STREEBOG256_Init); int STREEBOG512_Init(STREEBOG_CTX *c) @@ -1444,6 +1450,7 @@ STREEBOG512_Init(STREEBOG_CTX *c) c->md_len = STREEBOG512_LENGTH; return 1; } +LCRYPTO_ALIAS(STREEBOG512_Init); unsigned char * STREEBOG256(const unsigned char *d, size_t n, unsigned char *md) @@ -1459,6 +1466,7 @@ STREEBOG256(const unsigned char *d, size_t n, unsigned char *md) explicit_bzero(&c, sizeof(c)); return (md); } +LCRYPTO_ALIAS(STREEBOG256); unsigned char * STREEBOG512(const unsigned char *d, size_t n, unsigned char *md) @@ -1474,5 +1482,6 @@ STREEBOG512(const unsigned char *d, size_t n, unsigned char *md) explicit_bzero(&c, sizeof(c)); return (md); } +LCRYPTO_ALIAS(STREEBOG512); #endif diff --git a/lib/libcrypto/hidden/openssl/gost.h b/lib/libcrypto/hidden/openssl/gost.h new file mode 100644 index 00000000000..e30e6611af5 --- /dev/null +++ b/lib/libcrypto/hidden/openssl/gost.h @@ -0,0 +1,71 @@ +/* $OpenBSD: gost.h,v 1.1 2023/07/08 14:30:44 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_GOST_H +#define _LIBCRYPTO_GOST_H + +#ifndef _MSC_VER +#include_next +#else +#include "../include/openssl/gost.h" +#endif +#include "crypto_namespace.h" + +LCRYPTO_USED(Gost2814789_set_sbox); +LCRYPTO_USED(Gost2814789_set_key); +LCRYPTO_USED(Gost2814789_ecb_encrypt); +LCRYPTO_USED(Gost2814789_cfb64_encrypt); +LCRYPTO_USED(Gost2814789_cnt_encrypt); +LCRYPTO_USED(GOST_CIPHER_PARAMS_new); +LCRYPTO_USED(GOST_CIPHER_PARAMS_free); +LCRYPTO_USED(d2i_GOST_CIPHER_PARAMS); +LCRYPTO_USED(i2d_GOST_CIPHER_PARAMS); +LCRYPTO_USED(GOST2814789IMIT_Init); +LCRYPTO_USED(GOST2814789IMIT_Update); +LCRYPTO_USED(GOST2814789IMIT_Final); +LCRYPTO_USED(GOST2814789IMIT_Transform); +LCRYPTO_USED(GOST2814789IMIT); +LCRYPTO_USED(GOSTR341194_Init); +LCRYPTO_USED(GOSTR341194_Update); +LCRYPTO_USED(GOSTR341194_Final); +LCRYPTO_USED(GOSTR341194_Transform); +LCRYPTO_USED(GOSTR341194); +LCRYPTO_USED(STREEBOG256_Init); +LCRYPTO_USED(STREEBOG256_Update); +LCRYPTO_USED(STREEBOG256_Final); +LCRYPTO_USED(STREEBOG256); +LCRYPTO_USED(STREEBOG512_Init); +LCRYPTO_USED(STREEBOG512_Update); +LCRYPTO_USED(STREEBOG512_Final); +LCRYPTO_USED(STREEBOG512_Transform); +LCRYPTO_USED(STREEBOG512); +LCRYPTO_USED(GOST_KEY_new); +LCRYPTO_USED(GOST_KEY_free); +LCRYPTO_USED(GOST_KEY_check_key); +LCRYPTO_USED(GOST_KEY_set_public_key_affine_coordinates); +LCRYPTO_USED(GOST_KEY_get0_group); +LCRYPTO_USED(GOST_KEY_set_group); +LCRYPTO_USED(GOST_KEY_get_digest); +LCRYPTO_USED(GOST_KEY_set_digest); +LCRYPTO_USED(GOST_KEY_get0_private_key); +LCRYPTO_USED(GOST_KEY_set_private_key); +LCRYPTO_USED(GOST_KEY_get0_public_key); +LCRYPTO_USED(GOST_KEY_set_public_key); +LCRYPTO_USED(GOST_KEY_get_size); +LCRYPTO_USED(ERR_load_GOST_strings); + +#endif /* _LIBCRYPTO_GOST_H */