1 /* 2 * PKCS #11 PAM Login Module 3 * Copyright (C) 2003 Mario Strasser <mast@gmx.net>, 4 * 5 * This library is free software; you can redistribute it and/or 6 * modify it under the terms of the GNU Lesser General Public 7 * License as published by the Free Software Foundation; either 8 * version 2.1 of the License, or (at your option) any later version. 9 * 10 * This library is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 * Lesser General Public License for more details. 14 * 15 * $Id$ 16 */ 17 18 #ifndef PKCS11_H 19 #define PKCS11_H 20 21 #include <openssl/x509.h> 22 23 /* Some UNIX specific macros */ 24 25 #define CK_PTR * 26 #define CK_DEFINE_FUNCTION(returnType, name) \ 27 returnType name 28 #define CK_DECLARE_FUNCTION(returnType, name) \ 29 returnType name 30 #define CK_DECLARE_FUNCTION_POINTER(returnType, name) \ 31 returnType (* name) 32 #define CK_CALLBACK_FUNCTION(returnType, name) \ 33 returnType (* name) 34 #ifndef NULL_PTR 35 #define NULL_PTR 0 36 #endif 37 38 /* License to copy and use this software is granted provided that it is 39 * identified as "RSA Security Inc. PKCS #11 Cryptographic Token Interface BOOST_AUTO_TEST_CASE(constructors_test)40 * (Cryptoki)" in all material mentioning or referencing this software. 41 42 * License is also granted to make and use derivative works provided that 43 * such works are identified as "derived from the RSA Security Inc. PKCS #11 44 * Cryptographic Token Interface (Cryptoki)" in all material mentioning or 45 * referencing the derived work. 46 47 * RSA Security Inc. makes no representations concerning either the 48 * merchantability of this software or the suitability of this software for 49 * any particular purpose. It is provided "as is" without express or implied 50 * warranty of any kind. 51 */ 52 53 /* All the various Cryptoki types and #define'd values are in the 54 * file pkcs11t.h. */ 55 #include "pkcs11t.h" 56 57 #define __PASTE(x,y) x##y 58 59 60 /* ============================================================== 61 * Define the "extern" form of all the entry points. 62 * ============================================================== 63 */ 64 65 #define CK_NEED_ARG_LIST 1 66 #define CK_PKCS11_FUNCTION_INFO(name) \ 67 extern CK_DECLARE_FUNCTION(CK_RV, name) 68 69 /* pkcs11f.h has all the information about the Cryptoki 70 * function prototypes. */ 71 #include "pkcs11f.h" 72 73 #undef CK_NEED_ARG_LIST 74 #undef CK_PKCS11_FUNCTION_INFO 75 76 77 /* ============================================================== 78 * Define the typedef form of all the entry points. That is, for 79 * each Cryptoki function C_XXX, define a type CK_C_XXX which is 80 * a pointer to that kind of function. 81 * ============================================================== 82 */ 83 84 #define CK_NEED_ARG_LIST 1 85 #define CK_PKCS11_FUNCTION_INFO(name) \ 86 typedef CK_DECLARE_FUNCTION_POINTER(CK_RV, __PASTE(CK_,name)) 87 88 /* pkcs11f.h has all the information about the Cryptoki 89 * function prototypes. */ 90 #include "pkcs11f.h" 91 92 #undef CK_NEED_ARG_LIST 93 #undef CK_PKCS11_FUNCTION_INFO 94 95 96 /* ============================================================== 97 * Define structed vector of entry points. A CK_FUNCTION_LIST 98 * contains a CK_VERSION indicating a library's Cryptoki version 99 * and then a whole slew of function pointers to the routines in 100 * the library. This type was declared, but not defined, in 101 * pkcs11t.h. 102 * ============================================================== 103 */ 104 105 #define CK_PKCS11_FUNCTION_INFO(name) \ 106 __PASTE(CK_,name) name; 107 108 struct CK_FUNCTION_LIST { 109 110 CK_VERSION version; /* Cryptoki version */ 111 112 /* Pile all the function pointers into the CK_FUNCTION_LIST. */ 113 /* pkcs11f.h has all the information about the Cryptoki 114 * function prototypes. */ 115 #include "pkcs11f.h" 116 117 }; 118 119 #undef CK_PKCS11_FUNCTION_INFO 120 #undef __PASTE 121 122 #endif /* PKCS11_H */ 123