From 7a40b1c1e27ff32612969514b04af60a9ab61f4c Mon Sep 17 00:00:00 2001 From: beck Date: Fri, 11 Nov 2022 19:18:55 +0000 Subject: [PATCH] Hide symbols in libcrypto/stack Automated change from the first attempts at the semi automated Guentherizer 2000. ok jsing@ tb@ joshua@ --- lib/libcrypto/Symbols.namespace | 21 +++++++++++++ lib/libcrypto/hidden/openssl/stack.h | 46 ++++++++++++++++++++++++++++ lib/libcrypto/stack/stack.c | 23 +++++++++++++- 3 files changed, 89 insertions(+), 1 deletion(-) create mode 100644 lib/libcrypto/hidden/openssl/stack.h diff --git a/lib/libcrypto/Symbols.namespace b/lib/libcrypto/Symbols.namespace index 31f7fba4c81..6ec4d6f6486 100644 --- a/lib/libcrypto/Symbols.namespace +++ b/lib/libcrypto/Symbols.namespace @@ -7,3 +7,24 @@ _libre_HMAC_CTX_set_flags _libre_HMAC_Final _libre_HMAC_Init_ex _libre_HMAC_Update +_libre_sk_num +_libre_sk_value +_libre_sk_set +_libre_sk_new +_libre_sk_new_null +_libre_sk_free +_libre_sk_pop_free +_libre_sk_insert +_libre_sk_delete +_libre_sk_delete_ptr +_libre_sk_find +_libre_sk_find_ex +_libre_sk_push +_libre_sk_unshift +_libre_sk_shift +_libre_sk_pop +_libre_sk_zero +_libre_sk_set_cmp_func +_libre_sk_dup +_libre_sk_sort +_libre_sk_is_sorted diff --git a/lib/libcrypto/hidden/openssl/stack.h b/lib/libcrypto/hidden/openssl/stack.h new file mode 100644 index 00000000000..671735436fc --- /dev/null +++ b/lib/libcrypto/hidden/openssl/stack.h @@ -0,0 +1,46 @@ +/* $OpenBSD: stack.h,v 1.1 2022/11/11 19:18:55 beck Exp $ */ +/* + * Copyright (c) 2022 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_STACK_H +#define _LIBCRYPTO_STACK_H + +#include_next +#include "crypto_namespace.h" + +LCRYPTO_USED(sk_num); +LCRYPTO_USED(sk_value); +LCRYPTO_USED(sk_set); +LCRYPTO_USED(sk_new); +LCRYPTO_USED(sk_new_null); +LCRYPTO_USED(sk_free); +LCRYPTO_USED(sk_pop_free); +LCRYPTO_USED(sk_insert); +LCRYPTO_USED(sk_delete); +LCRYPTO_USED(sk_delete_ptr); +LCRYPTO_USED(sk_find); +LCRYPTO_USED(sk_find_ex); +LCRYPTO_USED(sk_push); +LCRYPTO_USED(sk_unshift); +LCRYPTO_USED(sk_shift); +LCRYPTO_USED(sk_pop); +LCRYPTO_USED(sk_zero); +LCRYPTO_USED(sk_set_cmp_func); +LCRYPTO_USED(sk_dup); +LCRYPTO_USED(sk_sort); +LCRYPTO_USED(sk_is_sorted); + +#endif /* _LIBCRYPTO_STACK_H */ diff --git a/lib/libcrypto/stack/stack.c b/lib/libcrypto/stack/stack.c index b76a0d7271c..c99941aa46f 100644 --- a/lib/libcrypto/stack/stack.c +++ b/lib/libcrypto/stack/stack.c @@ -1,4 +1,4 @@ -/* $OpenBSD: stack.c,v 1.20 2018/04/01 00:36:28 schwarze Exp $ */ +/* $OpenBSD: stack.c,v 1.21 2022/11/11 19:18:55 beck Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -79,6 +79,7 @@ int return old; } +LCRYPTO_ALIAS(sk_set_cmp_func) _STACK * sk_dup(_STACK *sk) @@ -105,12 +106,14 @@ err: sk_free(ret); return (NULL); } +LCRYPTO_ALIAS(sk_dup) _STACK * sk_new_null(void) { return sk_new((int (*)(const void *, const void *))0); } +LCRYPTO_ALIAS(sk_new_null) _STACK * sk_new(int (*c)(const void *, const void *)) @@ -134,6 +137,7 @@ err: free(ret); return (NULL); } +LCRYPTO_ALIAS(sk_new) int sk_insert(_STACK *st, void *data, int loc) @@ -160,6 +164,7 @@ sk_insert(_STACK *st, void *data, int loc) st->sorted = 0; return (st->num); } +LCRYPTO_ALIAS(sk_insert) void * sk_delete_ptr(_STACK *st, void *p) @@ -171,6 +176,7 @@ sk_delete_ptr(_STACK *st, void *p) return (sk_delete(st, i)); return (NULL); } +LCRYPTO_ALIAS(sk_delete_ptr) void * sk_delete(_STACK *st, int loc) @@ -188,6 +194,7 @@ sk_delete(_STACK *st, int loc) st->num--; return (ret); } +LCRYPTO_ALIAS(sk_delete) static int internal_find(_STACK *st, void *data, int ret_val_options) @@ -219,24 +226,28 @@ sk_find(_STACK *st, void *data) { return internal_find(st, data, OBJ_BSEARCH_FIRST_VALUE_ON_MATCH); } +LCRYPTO_ALIAS(sk_find) int sk_find_ex(_STACK *st, void *data) { return internal_find(st, data, OBJ_BSEARCH_VALUE_ON_NOMATCH); } +LCRYPTO_ALIAS(sk_find_ex) int sk_push(_STACK *st, void *data) { return (sk_insert(st, data, st->num)); } +LCRYPTO_ALIAS(sk_push) int sk_unshift(_STACK *st, void *data) { return (sk_insert(st, data, 0)); } +LCRYPTO_ALIAS(sk_unshift) void * sk_shift(_STACK *st) @@ -247,6 +258,7 @@ sk_shift(_STACK *st) return (NULL); return (sk_delete(st, 0)); } +LCRYPTO_ALIAS(sk_shift) void * sk_pop(_STACK *st) @@ -257,6 +269,7 @@ sk_pop(_STACK *st) return (NULL); return (sk_delete(st, st->num - 1)); } +LCRYPTO_ALIAS(sk_pop) void sk_zero(_STACK *st) @@ -268,6 +281,7 @@ sk_zero(_STACK *st) memset(st->data, 0, sizeof(st->data)*st->num); st->num = 0; } +LCRYPTO_ALIAS(sk_zero) void sk_pop_free(_STACK *st, void (*func)(void *)) @@ -281,6 +295,7 @@ sk_pop_free(_STACK *st, void (*func)(void *)) func(st->data[i]); sk_free(st); } +LCRYPTO_ALIAS(sk_pop_free) void sk_free(_STACK *st) @@ -290,6 +305,7 @@ sk_free(_STACK *st) free(st->data); free(st); } +LCRYPTO_ALIAS(sk_free) int sk_num(const _STACK *st) @@ -298,6 +314,7 @@ sk_num(const _STACK *st) return -1; return st->num; } +LCRYPTO_ALIAS(sk_num) void * sk_value(const _STACK *st, int i) @@ -306,6 +323,7 @@ sk_value(const _STACK *st, int i) return NULL; return st->data[i]; } +LCRYPTO_ALIAS(sk_value) void * sk_set(_STACK *st, int i, void *value) @@ -315,6 +333,7 @@ sk_set(_STACK *st, int i, void *value) st->sorted = 0; return (st->data[i] = value); } +LCRYPTO_ALIAS(sk_set) void sk_sort(_STACK *st) @@ -332,6 +351,7 @@ sk_sort(_STACK *st) st->sorted = 1; } } +LCRYPTO_ALIAS(sk_sort) int sk_is_sorted(const _STACK *st) @@ -340,3 +360,4 @@ sk_is_sorted(const _STACK *st) return 1; return st->sorted; } +LCRYPTO_ALIAS(sk_is_sorted) -- 2.20.1