From 1e9308c109800f08f48ff117b986058857152113 Mon Sep 17 00:00:00 2001 From: beck Date: Sat, 8 Jul 2023 12:27:51 +0000 Subject: [PATCH] Hide symbols in objects ok tb@ --- lib/libcrypto/Symbols.namespace | 32 ++++++++++++++ lib/libcrypto/hidden/openssl/objects.h | 61 ++++++++++++++++++++++++++ lib/libcrypto/objects/o_names.c | 10 ++++- lib/libcrypto/objects/obj_dat.c | 19 +++++++- lib/libcrypto/objects/obj_err.c | 3 +- lib/libcrypto/objects/obj_lib.c | 4 +- lib/libcrypto/objects/obj_xref.c | 6 ++- 7 files changed, 130 insertions(+), 5 deletions(-) create mode 100644 lib/libcrypto/hidden/openssl/objects.h diff --git a/lib/libcrypto/Symbols.namespace b/lib/libcrypto/Symbols.namespace index da7ad8dbe7f..63f9e7c6f01 100644 --- a/lib/libcrypto/Symbols.namespace +++ b/lib/libcrypto/Symbols.namespace @@ -2525,3 +2525,35 @@ _libre_RSA_meth_set_sign _libre_RSA_meth_get_verify _libre_RSA_meth_set_verify _libre_ERR_load_RSA_strings +_libre_OBJ_NAME_init +_libre_OBJ_NAME_new_index +_libre_OBJ_NAME_get +_libre_OBJ_NAME_add +_libre_OBJ_NAME_remove +_libre_OBJ_NAME_cleanup +_libre_OBJ_NAME_do_all +_libre_OBJ_NAME_do_all_sorted +_libre_OBJ_dup +_libre_OBJ_nid2obj +_libre_OBJ_nid2ln +_libre_OBJ_nid2sn +_libre_OBJ_obj2nid +_libre_OBJ_txt2obj +_libre_OBJ_obj2txt +_libre_OBJ_txt2nid +_libre_OBJ_ln2nid +_libre_OBJ_sn2nid +_libre_OBJ_cmp +_libre_OBJ_bsearch_ +_libre_OBJ_new_nid +_libre_OBJ_add_object +_libre_OBJ_create +_libre_OBJ_cleanup +_libre_OBJ_create_objects +_libre_OBJ_length +_libre_OBJ_get0_data +_libre_OBJ_find_sigid_algs +_libre_OBJ_find_sigid_by_algs +_libre_OBJ_add_sigid +_libre_OBJ_sigid_free +_libre_ERR_load_OBJ_strings diff --git a/lib/libcrypto/hidden/openssl/objects.h b/lib/libcrypto/hidden/openssl/objects.h new file mode 100644 index 00000000000..f658a7cfa51 --- /dev/null +++ b/lib/libcrypto/hidden/openssl/objects.h @@ -0,0 +1,61 @@ +/* $OpenBSD: objects.h,v 1.1 2023/07/08 12:27:51 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_OBJECTS_H +#define _LIBCRYPTO_OBJECTS_H + +#ifndef _MSC_VER +#include_next +#else +#include "../include/openssl/objects.h" +#endif +#include "crypto_namespace.h" + +LCRYPTO_USED(OBJ_NAME_init); +LCRYPTO_USED(OBJ_NAME_new_index); +LCRYPTO_USED(OBJ_NAME_get); +LCRYPTO_USED(OBJ_NAME_add); +LCRYPTO_USED(OBJ_NAME_remove); +LCRYPTO_USED(OBJ_NAME_cleanup); +LCRYPTO_USED(OBJ_NAME_do_all); +LCRYPTO_USED(OBJ_NAME_do_all_sorted); +LCRYPTO_USED(OBJ_dup); +LCRYPTO_USED(OBJ_nid2obj); +LCRYPTO_USED(OBJ_nid2ln); +LCRYPTO_USED(OBJ_nid2sn); +LCRYPTO_USED(OBJ_obj2nid); +LCRYPTO_USED(OBJ_txt2obj); +LCRYPTO_USED(OBJ_obj2txt); +LCRYPTO_USED(OBJ_txt2nid); +LCRYPTO_USED(OBJ_ln2nid); +LCRYPTO_USED(OBJ_sn2nid); +LCRYPTO_USED(OBJ_cmp); +LCRYPTO_USED(OBJ_bsearch_); +LCRYPTO_USED(OBJ_new_nid); +LCRYPTO_USED(OBJ_add_object); +LCRYPTO_USED(OBJ_create); +LCRYPTO_USED(OBJ_cleanup); +LCRYPTO_USED(OBJ_create_objects); +LCRYPTO_USED(OBJ_length); +LCRYPTO_USED(OBJ_get0_data); +LCRYPTO_USED(OBJ_find_sigid_algs); +LCRYPTO_USED(OBJ_find_sigid_by_algs); +LCRYPTO_USED(OBJ_add_sigid); +LCRYPTO_USED(OBJ_sigid_free); +LCRYPTO_USED(ERR_load_OBJ_strings); + +#endif /* _LIBCRYPTO_OBJECTS_H */ diff --git a/lib/libcrypto/objects/o_names.c b/lib/libcrypto/objects/o_names.c index 2cdd2f3aa6d..48b95d6767a 100644 --- a/lib/libcrypto/objects/o_names.c +++ b/lib/libcrypto/objects/o_names.c @@ -1,4 +1,4 @@ -/* $OpenBSD: o_names.c,v 1.23 2022/11/08 23:19:09 mbuhl Exp $ */ +/* $OpenBSD: o_names.c,v 1.24 2023/07/08 12:27:51 beck Exp $ */ #include #include #include @@ -47,6 +47,7 @@ OBJ_NAME_init(void) names_lh = lh_OBJ_NAME_new(); return (names_lh != NULL); } +LCRYPTO_ALIAS(OBJ_NAME_init); int OBJ_NAME_new_index(unsigned long (*hash_func)(const char *), @@ -88,6 +89,7 @@ OBJ_NAME_new_index(unsigned long (*hash_func)(const char *), name_funcs->free_func = free_func; return (ret); } +LCRYPTO_ALIAS(OBJ_NAME_new_index); /* static int obj_name_cmp(OBJ_NAME *a, OBJ_NAME *b) */ static int @@ -157,6 +159,7 @@ OBJ_NAME_get(const char *name, int type) } } } +LCRYPTO_ALIAS(OBJ_NAME_get); int OBJ_NAME_add(const char *name, int type, const char *data) @@ -204,6 +207,7 @@ OBJ_NAME_add(const char *name, int type, const char *data) } return (1); } +LCRYPTO_ALIAS(OBJ_NAME_add); int OBJ_NAME_remove(const char *name, int type) @@ -234,6 +238,7 @@ OBJ_NAME_remove(const char *name, int type) } else return (0); } +LCRYPTO_ALIAS(OBJ_NAME_remove); struct doall { int type; @@ -262,6 +267,7 @@ OBJ_NAME_do_all(int type, void (*fn)(const OBJ_NAME *, void *arg), void *arg) lh_OBJ_NAME_doall_arg(names_lh, LHASH_DOALL_ARG_FN(do_all_fn), struct doall, &d); } +LCRYPTO_ALIAS(OBJ_NAME_do_all); struct doall_sorted { int type; @@ -311,6 +317,7 @@ OBJ_NAME_do_all_sorted(int type, void (*fn)(const OBJ_NAME *, void *arg), free(d.names); } } +LCRYPTO_ALIAS(OBJ_NAME_do_all_sorted); static int free_type; @@ -353,3 +360,4 @@ OBJ_NAME_cleanup(int type) } else lh_OBJ_NAME_down_load(names_lh) = down_load; } +LCRYPTO_ALIAS(OBJ_NAME_cleanup); diff --git a/lib/libcrypto/objects/obj_dat.c b/lib/libcrypto/objects/obj_dat.c index 7516a6d09a7..ff061774515 100644 --- a/lib/libcrypto/objects/obj_dat.c +++ b/lib/libcrypto/objects/obj_dat.c @@ -1,4 +1,4 @@ -/* $OpenBSD: obj_dat.c,v 1.53 2023/05/23 11:51:12 tb Exp $ */ +/* $OpenBSD: obj_dat.c,v 1.54 2023/07/08 12:27:51 beck Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -280,6 +280,7 @@ OBJ_cleanup(void) lh_ADDED_OBJ_free(added); added = NULL; } +LCRYPTO_ALIAS(OBJ_cleanup); int OBJ_new_nid(int num) @@ -290,6 +291,7 @@ OBJ_new_nid(int num) new_nid += num; return (i); } +LCRYPTO_ALIAS(OBJ_new_nid); int OBJ_add_object(const ASN1_OBJECT *obj) @@ -338,6 +340,7 @@ OBJ_add_object(const ASN1_OBJECT *obj) ASN1_OBJECT_free(o); return (NID_undef); } +LCRYPTO_ALIAS(OBJ_add_object); ASN1_OBJECT * OBJ_nid2obj(int n) @@ -366,6 +369,7 @@ OBJ_nid2obj(int n) } } } +LCRYPTO_ALIAS(OBJ_nid2obj); const char * OBJ_nid2sn(int n) @@ -394,6 +398,7 @@ OBJ_nid2sn(int n) } } } +LCRYPTO_ALIAS(OBJ_nid2sn); const char * OBJ_nid2ln(int n) @@ -422,6 +427,7 @@ OBJ_nid2ln(int n) } } } +LCRYPTO_ALIAS(OBJ_nid2ln); static int obj_cmp(const ASN1_OBJECT * const *ap, const unsigned int *bp) @@ -475,6 +481,7 @@ OBJ_obj2nid(const ASN1_OBJECT *a) return (NID_undef); return (nid_objs[*op].nid); } +LCRYPTO_ALIAS(OBJ_obj2nid); /* Convert an object name into an ASN1_OBJECT * if "noname" is not set then search for short and long names first. @@ -495,12 +502,14 @@ OBJ_txt2obj(const char *s, int no_name) return t2i_ASN1_OBJECT_internal(s); } +LCRYPTO_ALIAS(OBJ_txt2obj); int OBJ_obj2txt(char *buf, int buf_len, const ASN1_OBJECT *aobj, int no_name) { return i2t_ASN1_OBJECT_internal(aobj, buf, buf_len, no_name); } +LCRYPTO_ALIAS(OBJ_obj2txt); int OBJ_txt2nid(const char *s) @@ -513,6 +522,7 @@ OBJ_txt2nid(const char *s) ASN1_OBJECT_free(obj); return nid; } +LCRYPTO_ALIAS(OBJ_txt2nid); int OBJ_ln2nid(const char *s) @@ -535,6 +545,7 @@ OBJ_ln2nid(const char *s) return (NID_undef); return (nid_objs[*op].nid); } +LCRYPTO_ALIAS(OBJ_ln2nid); int OBJ_sn2nid(const char *s) @@ -557,6 +568,7 @@ OBJ_sn2nid(const char *s) return (NID_undef); return (nid_objs[*op].nid); } +LCRYPTO_ALIAS(OBJ_sn2nid); const void * OBJ_bsearch_(const void *key, const void *base, int num, int size, @@ -564,6 +576,7 @@ OBJ_bsearch_(const void *key, const void *base, int num, int size, { return OBJ_bsearch_ex_(key, base, num, size, cmp, 0); } +LCRYPTO_ALIAS(OBJ_bsearch_); const void * OBJ_bsearch_ex_(const void *key, const void *base_, int num, int size, @@ -646,6 +659,7 @@ OBJ_create_objects(BIO *in) } /* return(num); */ } +LCRYPTO_ALIAS(OBJ_create_objects); int OBJ_create(const char *oid, const char *sn, const char *ln) @@ -676,6 +690,7 @@ OBJ_create(const char *oid, const char *sn, const char *ln) free(buf); return (ok); } +LCRYPTO_ALIAS(OBJ_create); size_t OBJ_length(const ASN1_OBJECT *obj) @@ -688,6 +703,7 @@ OBJ_length(const ASN1_OBJECT *obj) return obj->length; } +LCRYPTO_ALIAS(OBJ_length); const unsigned char * OBJ_get0_data(const ASN1_OBJECT *obj) @@ -697,3 +713,4 @@ OBJ_get0_data(const ASN1_OBJECT *obj) return obj->data; } +LCRYPTO_ALIAS(OBJ_get0_data); diff --git a/lib/libcrypto/objects/obj_err.c b/lib/libcrypto/objects/obj_err.c index 50e2a0e0c4d..04cb4218c24 100644 --- a/lib/libcrypto/objects/obj_err.c +++ b/lib/libcrypto/objects/obj_err.c @@ -1,4 +1,4 @@ -/* $OpenBSD: obj_err.c,v 1.13 2022/07/12 14:42:49 kn Exp $ */ +/* $OpenBSD: obj_err.c,v 1.14 2023/07/08 12:27:51 beck Exp $ */ /* ==================================================================== * Copyright (c) 1999-2006 The OpenSSL Project. All rights reserved. * @@ -88,3 +88,4 @@ ERR_load_OBJ_strings(void) } #endif } +LCRYPTO_ALIAS(ERR_load_OBJ_strings); diff --git a/lib/libcrypto/objects/obj_lib.c b/lib/libcrypto/objects/obj_lib.c index eb06adfb92a..83575c16c92 100644 --- a/lib/libcrypto/objects/obj_lib.c +++ b/lib/libcrypto/objects/obj_lib.c @@ -1,4 +1,4 @@ -/* $OpenBSD: obj_lib.c,v 1.17 2022/11/26 16:08:53 tb Exp $ */ +/* $OpenBSD: obj_lib.c,v 1.18 2023/07/08 12:27:51 beck Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -119,6 +119,7 @@ OBJ_dup(const ASN1_OBJECT *o) free(r); return (NULL); } +LCRYPTO_ALIAS(OBJ_dup); int OBJ_cmp(const ASN1_OBJECT *a, const ASN1_OBJECT *b) @@ -130,3 +131,4 @@ OBJ_cmp(const ASN1_OBJECT *a, const ASN1_OBJECT *b) return (ret); return (memcmp(a->data, b->data, a->length)); } +LCRYPTO_ALIAS(OBJ_cmp); diff --git a/lib/libcrypto/objects/obj_xref.c b/lib/libcrypto/objects/obj_xref.c index 3e8730d1c6b..2318c86ce25 100644 --- a/lib/libcrypto/objects/obj_xref.c +++ b/lib/libcrypto/objects/obj_xref.c @@ -1,4 +1,4 @@ -/* $OpenBSD: obj_xref.c,v 1.8 2017/01/21 04:44:43 jsing Exp $ */ +/* $OpenBSD: obj_xref.c,v 1.9 2023/07/08 12:27:51 beck Exp $ */ /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL * project 2006. */ @@ -151,6 +151,7 @@ OBJ_find_sigid_algs(int signid, int *pdig_nid, int *ppkey_nid) *ppkey_nid = rv->pkey_id; return 1; } +LCRYPTO_ALIAS(OBJ_find_sigid_algs); int OBJ_find_sigid_by_algs(int *psignid, int dig_nid, int pkey_nid) @@ -182,6 +183,7 @@ OBJ_find_sigid_by_algs(int *psignid, int dig_nid, int pkey_nid) *psignid = (*rv)->sign_id; return 1; } +LCRYPTO_ALIAS(OBJ_find_sigid_by_algs); int OBJ_add_sigid(int signid, int dig_id, int pkey_id) @@ -216,6 +218,7 @@ OBJ_add_sigid(int signid, int dig_id, int pkey_id) return 1; } +LCRYPTO_ALIAS(OBJ_add_sigid); static void sid_free(nid_triple *tt) @@ -235,3 +238,4 @@ OBJ_sigid_free(void) sigx_app = NULL; } } +LCRYPTO_ALIAS(OBJ_sigid_free); -- 2.20.1