29 #ifndef POLARSSL_PKCS11_H
30 #define POLARSSL_PKCS11_H
34 #if defined(POLARSSL_PKCS11_C)
38 #include <pkcs11-helper-1.0/pkcs11h-certificate.h>
40 #if defined(_MSC_VER) && !defined(inline)
41 #define inline _inline
43 #if defined(__ARMCC_VERSION) && !defined(inline)
44 #define inline __inline
56 pkcs11h_certificate_t pkcs11h_cert;
68 int pkcs11_x509_cert_init(
x509_crt *cert, pkcs11h_certificate_t pkcs11h_cert );
80 int pkcs11_priv_key_init( pkcs11_context *priv_key,
81 pkcs11h_certificate_t pkcs11_cert );
89 void pkcs11_priv_key_free( pkcs11_context *priv_key );
107 int pkcs11_decrypt( pkcs11_context *ctx,
108 int mode,
size_t *olen,
109 const unsigned char *input,
110 unsigned char *output,
111 size_t output_max_len );
129 int pkcs11_sign( pkcs11_context *ctx,
132 unsigned int hashlen,
133 const unsigned char *hash,
134 unsigned char *sig );
139 static inline int ssl_pkcs11_decrypt(
void *ctx,
int mode,
size_t *olen,
140 const unsigned char *input,
unsigned char *output,
141 size_t output_max_len )
143 return pkcs11_decrypt( (pkcs11_context *) ctx, mode, olen, input, output,
147 static inline int ssl_pkcs11_sign(
void *ctx,
148 int (*f_rng)(
void *,
unsigned char *,
size_t),
void *p_rng,
149 int mode,
int hash_id,
unsigned int hashlen,
150 const unsigned char *hash,
unsigned char *sig )
154 return pkcs11_sign( (pkcs11_context *) ctx, mode, hash_id,
155 hashlen, hash, sig );
158 static inline size_t ssl_pkcs11_key_len(
void *ctx )
160 return ( (pkcs11_context *) ctx )->len;
Configuration options (set of defines)
Container for an X.509 certificate.
X.509 certificate parsing and writing.