ISARA Radiate™ Quantum-safe Library Version 3.1

Quantum-safe cryptographic primitives and algorithms.

iqr_api.h
Go to the documentation of this file.
1 
54 #ifndef IQR_API_H
55 #define IQR_API_H
56 
57 #include <limits.h>
58 
61 /* Compatibility check. */
62 #if CHAR_BIT != 8
63 # error "This library assumes 8 bit byte sizes."
64 #endif
65 
66 /* User defined overrides. */
67 #if defined(IQR_UNENFORCED_RETURNS)
68 # define IQR_MUST_CHECK
69 #endif
70 
71 /* Function Decorator Macros
72  *
73  * gcc and clang are our supported and preferred compiler platforms. MSVC is
74  * also supported. Whenever possible, use one of these compilers.
75  *
76  * TI's embedded compiler and cppcheck are partially supported; things will
77  * build, but we're not necessarily taking advantage of their features. Use
78  * these when you have no other choice.
79  *
80  * Other compilers will produce a warning and attempt to continue. Using these
81  * compilers is not supported by ISARA's technical support.
82  */
83 #if (defined(__GNUC__) || defined(__clang__)) && !defined(_TMS320C6X)
84 # if defined(_WIN32) || defined(_WIN64)
85 # define IQR_EXPORT __attribute__((dllexport))
86 # define IQR_IMPORT __attribute__((dllimport))
87 # else
88 # define IQR_EXPORT __attribute__((visibility("default")))
89 # define IQR_IMPORT
90 # endif
91 # if !defined(IQR_UNENFORCED_RETURNS)
92 # define IQR_MUST_CHECK __attribute__((warn_unused_result))
93 # endif
94 # define IQR_DEPRECATED __attribute__((deprecated))
95 # define IQR_DEPRECATED_MSG(msg) __attribute__((deprecated(msg)))
96 #elif defined(_MSC_VER)
97 # define IQR_EXPORT __declspec(dllexport)
98 # define IQR_IMPORT __declspec(dllimport)
99 # if !defined(IQR_UNENFORCED_RETURNS)
100 # define IQR_MUST_CHECK _Check_return_
101 # endif
102 # define IQR_DEPRECATED __declspec(deprecated)
103 # define IQR_DEPRECATED_MSG(msg) __declspec(deprecated(msg))
104 #elif defined(__TI_COMPILER_VERSION__) || defined(_TMS320C6X) || defined(CPPCHECK)
105 # define IQR_EXPORT
106 # define IQR_IMPORT
107 # define IQR_MUST_CHECK
108 # define IQR_DEPRECATED
109 # define IQR_DEPRECATED_MSG(msg)
110 #else
111 # warning "Unsupported compiler suite!"
112 # define IQR_EXPORT
113 # define IQR_IMPORT
114 # define IQR_MUST_CHECK
115 # define IQR_DEPRECATED
116 # define IQR_DEPRECATED_MSG(msg)
117 #endif
118 
119 /* API */
120 #if defined(IQR_ISARA_BUILD)
121 # define IQR_API IQR_EXPORT IQR_MUST_CHECK
122 # define IQR_API_UNENFORCED_RETURN IQR_EXPORT
123 # define IQR_EXTERN IQR_EXPORT extern
124 #else
125 # if defined(_MSC_VER) && defined(IQR_DLL)
126 # define IQR_API IQR_IMPORT IQR_MUST_CHECK
127 # define IQR_API_UNENFORCED_RETURN IQR_IMPORT
128 # define IQR_EXTERN IQR_IMPORT extern
129 # else
130 # define IQR_API IQR_MUST_CHECK
131 # define IQR_API_UNENFORCED_RETURN
132 # define IQR_EXTERN extern
133 # endif
134 #endif
135 
138 #endif /* IQR_API_H */