xref: /openbsd-src/lib/libssl/hidden/ssl_namespace.h (revision ff0e7be1ebbcc809ea8ad2b6dafe215824da9e46)
1 /*	$OpenBSD: ssl_namespace.h,v 1.2 2023/02/16 08:38:17 tb Exp $	*/
2 /*
3  * Copyright (c) 2016 Philip Guenther <guenther@openbsd.org>
4  *
5  * Permission to use, copy, modify, and distribute this software for any
6  * purpose with or without fee is hereby granted, provided that the above
7  * copyright notice and this permission notice appear in all copies.
8  *
9  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16  */
17 
18 #ifndef _LIBSSL_SSL_NAMESPACE_H_
19 #define _LIBSSL_SSL_NAMESPACE_H_
20 
21 /*
22  * If marked as 'used', then internal calls use the name with prefix "_lssl_"
23  * and we alias that to the normal name.
24  */
25 
26 #ifdef LIBRESSL_NAMESPACE
27 #define LSSL_UNUSED(x)		typeof(x) x __attribute__((deprecated))
28 #define LSSL_USED(x)		__attribute__((visibility("hidden")))	\
29 				typeof(x) x asm("_lssl_"#x)
30 #define LSSL_ALIAS(x)		asm(".global "#x"; "#x" = _lssl_"#x)
31 #else
32 #define LSSL_UNUSED(x)
33 #define LSSL_USED(x)
34 #define LSSL_ALIAS(x)		asm("")
35 #endif
36 
37 #endif	/* _LIBSSL_SSL_NAMESPACE_H_ */
38