1 
2 #ifndef sodium_export_H
3 #define sodium_export_H
4 
5 #include <stddef.h>
6 #include <stdint.h>
7 #include <limits.h>
8 
9 #if !defined(__clang__) && !defined(__GNUC__)
10 # ifdef __attribute__
11 #  undef __attribute__
12 # endif
13 # define __attribute__(a)
14 #endif
15 
16 #ifdef SODIUM_STATIC
17 # define SODIUM_EXPORT
18 # define SODIUM_EXPORT_WEAK
19 #else
20 # if defined(_MSC_VER)
21 #  ifdef SODIUM_DLL_EXPORT
22 #   define SODIUM_EXPORT __declspec(dllexport)
23 #  else
24 #   define SODIUM_EXPORT __declspec(dllimport)
25 #  endif
26 # else
27 #  if defined(__SUNPRO_C)
28 #   ifndef __GNU_C__
29 #    define SODIUM_EXPORT __attribute__ (visibility(__global))
30 #   else
31 #    define SODIUM_EXPORT __attribute__ __global
32 #   endif
33 #  elif defined(_MSG_VER)
34 #   define SODIUM_EXPORT extern __declspec(dllexport)
35 #  else
36 #   define SODIUM_EXPORT __attribute__ ((visibility ("default")))
37 #  endif
38 # endif
39 # if defined(__ELF__) && !defined(SODIUM_DISABLE_WEAK_FUNCTIONS)
40 #  define SODIUM_EXPORT_WEAK SODIUM_EXPORT __attribute__((weak))
41 # else
42 #  define SODIUM_EXPORT_WEAK SODIUM_EXPORT
43 # endif
44 #endif
45 
46 #ifndef CRYPTO_ALIGN
47 # if defined(__INTEL_COMPILER) || defined(_MSC_VER)
48 #  define CRYPTO_ALIGN(x) __declspec(align(x))
49 # else
50 #  define CRYPTO_ALIGN(x) __attribute__ ((aligned(x)))
51 # endif
52 #endif
53 
54 #define SODIUM_MIN(A, B) ((A) < (B) ? (A) : (B))
55 #define SODIUM_SIZE_MAX SODIUM_MIN(UINT64_MAX, SIZE_MAX)
56 
57 #ifdef _KERNEL
58 #include <sys/param.h>
59 #include <sys/libkern.h>
60 static inline void
61 sodium_misuse(void)
62 {
63 	panic("bad value passed to sodium");
64 }
65 #endif
66 
67 #endif
68