25 #ifndef MBEDTLS_PKCS11_H
26 #define MBEDTLS_PKCS11_H
28 #if !defined(MBEDTLS_CONFIG_FILE)
31 #include MBEDTLS_CONFIG_FILE
34 #if defined(MBEDTLS_PKCS11_C)
38 #include <pkcs11-helper-1.0/pkcs11h-certificate.h>
40 #if ( defined(__ARMCC_VERSION) || defined(_MSC_VER) ) && \
41 !defined(inline) && !defined(__cplusplus)
42 #define inline __inline
53 pkcs11h_certificate_t pkcs11h_cert;
55 } mbedtls_pkcs11_context;
61 void mbedtls_pkcs11_init( mbedtls_pkcs11_context *ctx );
71 int mbedtls_pkcs11_x509_cert_bind(
mbedtls_x509_crt *cert, pkcs11h_certificate_t pkcs11h_cert );
83 int mbedtls_pkcs11_priv_key_bind( mbedtls_pkcs11_context *priv_key,
84 pkcs11h_certificate_t pkcs11_cert );
92 void mbedtls_pkcs11_priv_key_free( mbedtls_pkcs11_context *priv_key );
111 int mbedtls_pkcs11_decrypt( mbedtls_pkcs11_context *ctx,
112 int mode,
size_t *olen,
113 const unsigned char *input,
114 unsigned char *output,
115 size_t output_max_len );
133 int mbedtls_pkcs11_sign( mbedtls_pkcs11_context *ctx,
136 unsigned int hashlen,
137 const unsigned char *hash,
138 unsigned char *sig );
143 static inline int mbedtls_ssl_pkcs11_decrypt(
void *ctx,
int mode,
size_t *olen,
144 const unsigned char *input,
unsigned char *output,
145 size_t output_max_len )
147 return mbedtls_pkcs11_decrypt( (mbedtls_pkcs11_context *) ctx, mode, olen, input, output,
151 static inline int mbedtls_ssl_pkcs11_sign(
void *ctx,
152 int (*f_rng)(
void *,
unsigned char *,
size_t),
void *p_rng,
154 const unsigned char *hash,
unsigned char *sig )
158 return mbedtls_pkcs11_sign( (mbedtls_pkcs11_context *) ctx, mode, md_alg,
159 hashlen, hash, sig );
162 static inline size_t mbedtls_ssl_pkcs11_key_len(
void *ctx )
164 return ( (mbedtls_pkcs11_context *) ctx )->len;
Compatibility names (set of defines)
X.509 certificate parsing and writing.
Container for an X.509 certificate.