pam_pkcs11  0.6.8
pkcs11.h
Go to the documentation of this file.
00001 /*
00002  * PKCS #11 PAM Login Module
00003  * Copyright (C) 2003 Mario Strasser <mast@gmx.net>,
00004  *
00005  * This library is free software; you can redistribute it and/or
00006  * modify it under the terms of the GNU Lesser General Public
00007  * License as published by the Free Software Foundation; either
00008  * version 2.1 of the License, or (at your option) any later version.
00009  *
00010  * This library is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013  * Lesser General Public License for more details.
00014  *
00015  * $Id: pkcs11.h 358 2008-11-06 14:28:46Z ludovic.rousseau $
00016  */
00017 
00018 #ifndef PKCS11_H
00019 #define PKCS11_H
00020 
00021 #include <openssl/x509.h>
00022 
00023 /* Some UNIX specific macros */
00024 
00025 #define CK_PTR *
00026 #define CK_DEFINE_FUNCTION(returnType, name) \
00027   returnType name
00028 #define CK_DECLARE_FUNCTION(returnType, name) \
00029   returnType name
00030 #define CK_DECLARE_FUNCTION_POINTER(returnType, name) \
00031   returnType (* name)
00032 #define CK_CALLBACK_FUNCTION(returnType, name) \
00033   returnType (* name)
00034 #ifndef NULL_PTR
00035 #define NULL_PTR 0
00036 #endif
00037 
00038 /* License to copy and use this software is granted provided that it is
00039  * identified as "RSA Security Inc. PKCS #11 Cryptographic Token Interface
00040  * (Cryptoki)" in all material mentioning or referencing this software.
00041 
00042  * License is also granted to make and use derivative works provided that
00043  * such works are identified as "derived from the RSA Security Inc. PKCS #11
00044  * Cryptographic Token Interface (Cryptoki)" in all material mentioning or
00045  * referencing the derived work.
00046 
00047  * RSA Security Inc. makes no representations concerning either the
00048  * merchantability of this software or the suitability of this software for
00049  * any particular purpose. It is provided "as is" without express or implied
00050  * warranty of any kind.
00051  */
00052 
00053 /* All the various Cryptoki types and #define'd values are in the
00054  * file pkcs11t.h. */
00055 #include "pkcs11t.h"
00056 
00057 #define __PASTE(x,y)      x##y
00058 
00059 
00060 /* ==============================================================
00061  * Define the "extern" form of all the entry points.
00062  * ==============================================================
00063  */
00064 
00065 #define CK_NEED_ARG_LIST  1
00066 #define CK_PKCS11_FUNCTION_INFO(name) \
00067   extern CK_DECLARE_FUNCTION(CK_RV, name)
00068 
00069 /* pkcs11f.h has all the information about the Cryptoki
00070  * function prototypes. */
00071 #include "pkcs11f.h"
00072 
00073 #undef CK_NEED_ARG_LIST
00074 #undef CK_PKCS11_FUNCTION_INFO
00075 
00076 
00077 /* ==============================================================
00078  * Define the typedef form of all the entry points.  That is, for
00079  * each Cryptoki function C_XXX, define a type CK_C_XXX which is
00080  * a pointer to that kind of function.
00081  * ==============================================================
00082  */
00083 
00084 #define CK_NEED_ARG_LIST  1
00085 #define CK_PKCS11_FUNCTION_INFO(name) \
00086   typedef CK_DECLARE_FUNCTION_POINTER(CK_RV, __PASTE(CK_,name))
00087 
00088 /* pkcs11f.h has all the information about the Cryptoki
00089  * function prototypes. */
00090 #include "pkcs11f.h"
00091 
00092 #undef CK_NEED_ARG_LIST
00093 #undef CK_PKCS11_FUNCTION_INFO
00094 
00095 
00096 /* ==============================================================
00097  * Define structed vector of entry points.  A CK_FUNCTION_LIST
00098  * contains a CK_VERSION indicating a library's Cryptoki version
00099  * and then a whole slew of function pointers to the routines in
00100  * the library.  This type was declared, but not defined, in
00101  * pkcs11t.h.
00102  * ==============================================================
00103  */
00104 
00105 #define CK_PKCS11_FUNCTION_INFO(name) \
00106   __PASTE(CK_,name) name;
00107 
00108 struct CK_FUNCTION_LIST {
00109 
00110   CK_VERSION version;           /* Cryptoki version */
00111 
00112 /* Pile all the function pointers into the CK_FUNCTION_LIST. */
00113 /* pkcs11f.h has all the information about the Cryptoki
00114  * function prototypes. */
00115 #include "pkcs11f.h"
00116 
00117 };
00118 
00119 #undef CK_PKCS11_FUNCTION_INFO
00120 #undef __PASTE
00121 
00122 #endif /* PKCS11_H */