26 #ifndef POLARSSL_PKCS11_H
27 #define POLARSSL_PKCS11_H
29 #if !defined(POLARSSL_CONFIG_FILE)
32 #include POLARSSL_CONFIG_FILE
35 #if defined(POLARSSL_PKCS11_C)
39 #include <pkcs11-helper-1.0/pkcs11h-certificate.h>
41 #if defined(_MSC_VER) && !defined(inline)
42 #define inline _inline
44 #if defined(__ARMCC_VERSION) && !defined(inline)
45 #define inline __inline
57 pkcs11h_certificate_t pkcs11h_cert;
69 int pkcs11_x509_cert_init(
x509_crt *cert, pkcs11h_certificate_t pkcs11h_cert );
81 int pkcs11_priv_key_init( pkcs11_context *priv_key,
82 pkcs11h_certificate_t pkcs11_cert );
90 void pkcs11_priv_key_free( pkcs11_context *priv_key );
109 int pkcs11_decrypt( pkcs11_context *ctx,
110 int mode,
size_t *olen,
111 const unsigned char *input,
112 unsigned char *output,
113 size_t output_max_len );
131 int pkcs11_sign( pkcs11_context *ctx,
134 unsigned int hashlen,
135 const unsigned char *hash,
136 unsigned char *sig );
141 static inline int ssl_pkcs11_decrypt(
void *ctx,
int mode,
size_t *olen,
142 const unsigned char *input,
unsigned char *output,
143 size_t output_max_len )
145 return pkcs11_decrypt( (pkcs11_context *) ctx, mode, olen, input, output,
149 static inline int ssl_pkcs11_sign(
void *ctx,
150 int (*f_rng)(
void *,
unsigned char *,
size_t),
void *p_rng,
151 int mode,
md_type_t md_alg,
unsigned int hashlen,
152 const unsigned char *hash,
unsigned char *sig )
156 return pkcs11_sign( (pkcs11_context *) ctx, mode, md_alg,
157 hashlen, hash, sig );
160 static inline size_t ssl_pkcs11_key_len(
void *ctx )
162 return ( (pkcs11_context *) ctx )->len;
Configuration options (set of defines)
Container for an X.509 certificate.
X.509 certificate parsing and writing.