blob: d278b42f91c8a34f64ead8a02723328bee6eba35 [file] [log] [blame]
NingSun0c89b3c2018-02-08 08:34:03 -08001/*
2 * Copyright (c) 2017 SURFnet bv
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 *
14 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
15 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
16 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
18 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
20 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
21 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
22 * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
23 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
24 * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 */
26
27/*****************************************************************************
28 cryptoki.h
29
30 Set the PKCS#11 macros.
31 *****************************************************************************/
32
33#ifndef _CRYPTOKI_H
34#define _CRYPTOKI_H
35
36#ifdef _WIN32
37#pragma pack(push, cryptoki, 1)
38#endif
39
40// 1. CK_PTR: The indirection string for making a pointer to an
41// object.
42
43#define CK_PTR *
44
45// 2. CK_DECLARE_FUNCTION(returnType, name): A macro which makes
46// an importable Cryptoki library function declaration out of a
47// return type and a function name.
48
49#ifdef _WIN32
50#ifdef CRYPTOKI_EXPORTS
51#define CK_DECLARE_FUNCTION(returnType, name) \
52 returnType __declspec(dllexport) name
53#else
54#define CK_DECLARE_FUNCTION(returnType, name) \
55 returnType __declspec(dllimport) name
56#endif
57#else
58#define CK_DECLARE_FUNCTION(returnType, name) \
59 returnType name
60#endif
61
62// 3. CK_DECLARE_FUNCTION_POINTER(returnType, name): A macro
63// which makes a Cryptoki API function pointer declaration or
64// function pointer type declaration out of a return type and a
65// function name.
66
67#ifdef _WIN32
68#define CK_DECLARE_FUNCTION_POINTER(returnType, name) \
69 returnType __declspec(dllimport) (* name)
70#else
71#define CK_DECLARE_FUNCTION_POINTER(returnType, name) \
72 returnType (* name)
73#endif
74
75// 4. CK_CALLBACK_FUNCTION(returnType, name): A macro which makes
76// a function pointer type for an application callback out of
77// a return type for the callback and a name for the callback.
78
79#define CK_CALLBACK_FUNCTION(returnType, name) \
80 returnType (* name)
81
82// 5. NULL_PTR: This macro is the value of a NULL pointer.
83
84#ifndef NULL_PTR
85#define NULL_PTR 0
86#endif
87
88#include "pkcs11.h"
89
90#ifdef _WIN32
91#pragma pack(pop, cryptoki)
92#endif
93
94#endif // !_CRYPTOKI_H