/* Copyright (c) OASIS Open 2016,2019,2024. All Rights Reserved./ */DistributedunderthetermsoftheOASISIPRPolicy, *[http://www.oasis-open.org/policies-guidelines/ipr], AS-IS, WITHOUT ANY *IMPLIEDOREXPRESSWARRANTY;thereisnowarrantyofMERCHANTABILITY,FITNESSFORA *PARTICULARPURPOSEorNONINFRINGEMENToftherightsofothers.
*/
/* Latest version of the specification: *http://docs.oasis-open.org/pkcs11/pkcs11-base/v3.2/pkcs11-base-v3.2.html
*/
#ifndef _PKCS11_H_ #define _PKCS11_H_ 1
#ifdef __cplusplus
extern "C" { #endif
/* Before including this file (pkcs11.h) (or pkcs11t.h by *itself),5platform-specificmacrosmustbedefined.These *macrosaredescribedbelow,andtypicaldefinitionsforthem *arealsogiven.Beadvisedthatthesedefinitionscandepend *onboththeplatformandthecompilerused(andpossiblyalso *onwhetheraCryptokilibraryislinkedstaticallyor *dynamically). * *Inadditiontodefiningthese5macros,thepackingconvention *forCryptokistructuresshouldbeset.TheCryptoki *conventiononpackingisthatstructuresshouldbe1-byte *aligned. * *Ifyou'reusingWindowsthismightbedonebyusingthefollowing *preprocessordirectivebeforeincludingpkcs11.horpkcs11t.h: * *#pragmapack(push,cryptoki,1) * *andusingthefollowingpreprocessordirectiveafterincluding *pkcs11.horpkcs11t.h: * *#pragmapack(pop,cryptoki) * *InaUNIXenvironment,you'reonyourownforthis.Youmight *notneedtodo(orbeabletodo!)anything. * * *Nowforthemacros: * * *1.CK_PTR:Theindirectionstringformakingapointertoan *object.Itcanbeusedlikethis: * *typedefCK_BYTECK_PTRCK_BYTE_PTR; * *Ifyou'reusingWindows,itmightbedefinedby: * *#defineCK_PTR* * *InatypicalUNIXenvironment,itmightbedefinedby: * *#defineCK_PTR* * * *2.CK_DECLARE_FUNCTION(returnType,name):Amacrowhichmakes *animportableCryptokilibraryfunctiondeclarationoutofa *returntypeandafunctionname.Itshouldbeusedinthe *followingfashion: * *externCK_DECLARE_FUNCTION(CK_RV,C_Initialize)( *CK_VOID_PTRpReserved *); * *Ifyou'reusingWindowstodeclareafunctioninaWin32Cryptoki.dll, *itmightbedefinedby: * *#defineCK_DECLARE_FUNCTION(returnType,name)\ *returnType__declspec(dllimport)name * *InaUNIXenvironment,itmightbedefinedby: * *#defineCK_DECLARE_FUNCTION(returnType,name)\ *returnTypename * * *3.CK_DECLARE_FUNCTION_POINTER(returnType,name):Amacro *whichmakesaCryptokiAPIfunctionpointerdeclarationor *functionpointertypedeclarationoutofareturntypeanda *functionname.Itshouldbeusedinthefollowingfashion: * *// Define funcPtr to be a pointer to a Cryptoki API function *// taking arguments args and returning CK_RV. *CK_DECLARE_FUNCTION_POINTER(CK_RV,funcPtr)(args); * *or * *// Define funcPtrType to be the type of a pointer to a *// Cryptoki API function taking arguments args and returning *// CK_RV, and then define funcPtr to be a variable of type *// funcPtrType. *typedefCK_DECLARE_FUNCTION_POINTER(CK_RV,funcPtrType)(args); *funcPtrTypefuncPtr; * *Ifyou'reusingWindowstoaccess *functionsinaWin32Cryptoki.dll,inmightbedefinedby: * *#defineCK_DECLARE_FUNCTION_POINTER(returnType,name)\ *returnType__declspec(dllimport)(*name) * *InaUNIXenvironment,itmightbedefinedby: * *#defineCK_DECLARE_FUNCTION_POINTER(returnType,name)\ *returnType(*name) * * *4.CK_CALLBACK_FUNCTION(returnType,name):Amacrowhichmakes *afunctionpointertypeforanapplicationcallbackoutof *areturntypeforthecallbackandanameforthecallback. *Itshouldbeusedinthefollowingfashion: * *CK_CALLBACK_FUNCTION(CK_RV,myCallback)(args); * *todeclareafunctionpointer,myCallback,toacallback *whichtakesargumentsargsandreturnsaCK_RV.Itcanalso *beusedlikethis: * *typedefCK_CALLBACK_FUNCTION(CK_RV,myCallbackType)(args); *myCallbackTypemyCallback; * *Ifyou'reusingWindows,itmightbedefinedby: * *#defineCK_CALLBACK_FUNCTION(returnType,name)\ *returnType(*name) * *InaUNIXenvironment,itmightbedefinedby: * *#defineCK_CALLBACK_FUNCTION(returnType,name)\ *returnType(*name) * * *5.NULL_PTR:ThismacroisthevalueofaNULLpointer. * *InanyANSI/ISOCenvironment(andinmanyothersaswell), *thisshouldbestbedefinedby * *#ifndefNULL_PTR *#defineNULL_PTR0 *#endif
*/
/* All the various Cryptoki types and #define'd values are in the *filepkcs11t.h.
*/ #include"pkcs11t.h"
/* Create the 3.2 Function list */ struct CK_FUNCTION_LIST_3_2 {
CK_VERSION version; /* Cryptoki version */
/* Pile all the function pointers into the CK_FUNCTION_LIST. */ /* pkcs11f.h has all the information about the Cryptoki *functionprototypes.
*/ #include"pkcs11f.h"
};
#define CK_PKCS11_3_0_ONLY 1/* don't include the 3.2 and later functions */
/* Create the 3.0 Function list */ struct CK_FUNCTION_LIST_3_0 {
CK_VERSION version; /* Cryptoki version */
/* Pile all the function pointers into the CK_FUNCTION_LIST. */ /* pkcs11f.h has all the information about the Cryptoki *functionprototypes.
*/ #include"pkcs11f.h"
};
#undef CK_PKCS11_3_0_ONLY
#define CK_PKCS11_2_0_ONLY 1/* don't include the 3.0 and later functions */
/* Continue to define the old CK_FUNCTION_LIST */ struct CK_FUNCTION_LIST {
CK_VERSION version; /* Cryptoki version */
/* Pile all the function pointers into the CK_FUNCTION_LIST. */ /* pkcs11f.h has all the information about the Cryptoki *functionprototypes.
*/ #include"pkcs11f.h"
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.