blob: 46a31a4443a22925247cafacf59ad5425710f95c [file] [log] [blame]
yuezonghe824eb0c2024-06-27 02:32:26 -07001/* visibility.h
2 *
3 * Copyright (C) 2006-2021 wolfSSL Inc.
4 *
5 * This file is part of wolfSSL.
6 *
7 * wolfSSL is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * wolfSSL is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
20 */
21
22
23/* Visibility control macros */
24
25#ifndef WOLF_CRYPT_VISIBILITY_H
26#define WOLF_CRYPT_VISIBILITY_H
27
28
29/* for compatibility and so that fips is using same name of macro @wc_fips */
30/* The following visibility wrappers are for old FIPS. New FIPS should use
31 * the same as a non-FIPS build. */
32#if defined(HAVE_FIPS) && \
33 (!defined(HAVE_FIPS_VERSION) || (HAVE_FIPS_VERSION < 2))
34 #include <cyassl/ctaocrypt/visibility.h>
35 #define WOLFSSL_API CYASSL_API
36 #define WOLFSSL_LOCAL CYASSL_LOCAL
37#else
38
39/* WOLFSSL_API is used for the public API symbols.
40 It either imports or exports (or does nothing for static builds)
41
42 WOLFSSL_LOCAL is used for non-API symbols (private).
43*/
44
45#if defined(BUILDING_WOLFSSL)
46 #if defined(_MSC_VER) || defined(__MINGW32__) || defined(__CYGWIN__) || \
47 defined(_WIN32_WCE)
48 #if defined(WOLFSSL_DLL)
49 #define WOLFSSL_API __declspec(dllexport)
50 #else
51 #define WOLFSSL_API
52 #endif
53 #define WOLFSSL_LOCAL
54 #elif defined(HAVE_VISIBILITY) && HAVE_VISIBILITY
55 #define WOLFSSL_API __attribute__ ((visibility("default")))
56 #define WOLFSSL_LOCAL __attribute__ ((visibility("hidden")))
57 #elif defined(__SUNPRO_C) && (__SUNPRO_C >= 0x550)
58 #define WOLFSSL_API __global
59 #define WOLFSSL_LOCAL __hidden
60 #else
61 #define WOLFSSL_API
62 #define WOLFSSL_LOCAL
63 #endif /* HAVE_VISIBILITY */
64#else /* BUILDING_WOLFSSL */
65 #if defined(_MSC_VER) || defined(__MINGW32__) || defined(__CYGWIN__) || \
66 defined(_WIN32_WCE)
67 #if defined(WOLFSSL_DLL)
68 #define WOLFSSL_API __declspec(dllimport)
69 #else
70 #define WOLFSSL_API
71 #endif
72 #define WOLFSSL_LOCAL
73 #else
74 #define WOLFSSL_API
75 #define WOLFSSL_LOCAL
76 #endif
77#endif /* BUILDING_WOLFSSL */
78
79#endif /* HAVE_FIPS */
80#endif /* WOLF_CRYPT_VISIBILITY_H */
81