00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00067 #ifndef __PKCS11H_ENGINES_H
00068 #define __PKCS11H_ENGINES_H
00069
00070 #include <time.h>
00071 #if !defined(_WIN32)
00072 #include <sys/time.h>
00073 #endif
00074 #include <pkcs11-helper-1.0/pkcs11h-def.h>
00075
00076 #if defined(__cplusplus)
00077 extern "C" {
00078 #endif
00079
00083 typedef struct pkcs11h_sys_engine_s {
00084
00090 void *(*malloc) (size_t size);
00091
00096 void (*free) (void *ptr);
00097
00102 time_t (*time) (void);
00103
00108 void (*usleep) (unsigned long usec);
00109
00114 #if defined(_WIN32)
00115 void *gettimeofday;
00116 #else
00117 int (*gettimeofday) (struct timeval *tv);
00118 #endif
00119 } pkcs11h_engine_system_t;
00120
00124 typedef struct pkcs11h_crypto_engine_s {
00125 void *global_data;
00126
00132 int (*initialize) (
00133 IN void * const global_data
00134 );
00135
00141 int (*uninitialize) (
00142 IN void * const global_data
00143 );
00144
00153 int (*certificate_get_expiration) (
00154 IN void * const global_data,
00155 IN const unsigned char * const blob,
00156 IN const size_t blob_size,
00157 OUT time_t * const expiration
00158 );
00159
00169 int (*certificate_get_dn) (
00170 IN void * const global_data,
00171 IN const unsigned char * const blob,
00172 IN const size_t blob_size,
00173 OUT char * const dn,
00174 IN const size_t dn_max
00175 );
00176
00186 int (*certificate_is_issuer) (
00187 IN void * const global_data,
00188 IN const unsigned char * const issuer_blob,
00189 IN const size_t issuer_blob_size,
00190 IN const unsigned char * const cert_blob,
00191 IN const size_t cert_blob_size
00192 );
00193 } pkcs11h_engine_crypto_t;
00194
00202 #define PKCS11H_ENGINE_CRYPTO_AUTO ((pkcs11h_engine_crypto_t *)0)
00203
00204 #define PKCS11H_ENGINE_CRYPTO_OPENSSL ((pkcs11h_engine_crypto_t *)1)
00205
00206 #define PKCS11H_ENGINE_CRYPTO_GNUTLS ((pkcs11h_engine_crypto_t *)2)
00207
00208 #define PKCS11H_ENGINE_CRYPTO_WIN32 ((pkcs11h_engine_crypto_t *)3)
00209
00210 #define PKCS11H_ENGINE_CRYPTO_NSS ((pkcs11h_engine_crypto_t *)4)
00211
00212 #define PKCS11H_ENGINE_CRYPTO_GPL ((pkcs11h_engine_crypto_t *)10)
00213
00222 CK_RV
00223 pkcs11h_engine_setSystem (
00224 IN const pkcs11h_engine_system_t * const engine
00225 );
00226
00235 CK_RV
00236 pkcs11h_engine_setCrypto (
00237 IN const pkcs11h_engine_crypto_t * const engine
00238 );
00239
00240 #ifdef __cplusplus
00241 }
00242 #endif
00243
00246 #endif