24#ifndef MBEDTLS_PKCS11_H
25#define MBEDTLS_PKCS11_H
27#if !defined(MBEDTLS_CONFIG_FILE)
30#include MBEDTLS_CONFIG_FILE
33#if defined(MBEDTLS_PKCS11_C)
37#include <pkcs11-helper-1.0/pkcs11h-certificate.h>
39#if ( defined(__ARMCC_VERSION) || defined(_MSC_VER) ) && \
40 !defined(inline) && !defined(__cplusplus)
41#define inline __inline
48#if defined(MBEDTLS_DEPRECATED_REMOVED)
53typedef struct mbedtls_pkcs11_context
55 pkcs11h_certificate_t pkcs11h_cert;
57} mbedtls_pkcs11_context;
59#if defined(MBEDTLS_DEPRECATED_WARNING)
60#define MBEDTLS_DEPRECATED __attribute__((deprecated))
62#define MBEDTLS_DEPRECATED
72MBEDTLS_DEPRECATED
void mbedtls_pkcs11_init( mbedtls_pkcs11_context *ctx );
86 pkcs11h_certificate_t pkcs11h_cert );
101MBEDTLS_DEPRECATED
int mbedtls_pkcs11_priv_key_bind(
102 mbedtls_pkcs11_context *priv_key,
103 pkcs11h_certificate_t pkcs11_cert );
114MBEDTLS_DEPRECATED
void mbedtls_pkcs11_priv_key_free(
115 mbedtls_pkcs11_context *priv_key );
137MBEDTLS_DEPRECATED
int mbedtls_pkcs11_decrypt( mbedtls_pkcs11_context *ctx,
138 int mode,
size_t *olen,
139 const unsigned char *input,
140 unsigned char *output,
141 size_t output_max_len );
162MBEDTLS_DEPRECATED
int mbedtls_pkcs11_sign( mbedtls_pkcs11_context *ctx,
165 unsigned int hashlen,
166 const unsigned char *hash,
167 unsigned char *sig );
175MBEDTLS_DEPRECATED
static inline int mbedtls_ssl_pkcs11_decrypt(
void *ctx,
176 int mode,
size_t *olen,
177 const unsigned char *input,
unsigned char *output,
178 size_t output_max_len )
180 return mbedtls_pkcs11_decrypt( (mbedtls_pkcs11_context *) ctx, mode, olen, input, output,
210MBEDTLS_DEPRECATED
static inline int mbedtls_ssl_pkcs11_sign(
void *ctx,
211 int (*f_rng)(
void *,
unsigned char *,
size_t),
void *p_rng,
213 const unsigned char *hash,
unsigned char *sig )
217 return mbedtls_pkcs11_sign( (mbedtls_pkcs11_context *) ctx, mode, md_alg,
218 hashlen, hash, sig );
231MBEDTLS_DEPRECATED
static inline size_t mbedtls_ssl_pkcs11_key_len(
void *ctx )
233 return ( (mbedtls_pkcs11_context *) ctx )->len;
236#undef MBEDTLS_DEPRECATED
Configuration options (set of defines)
mbedtls_md_type_t
Supported message digests.
Container for an X.509 certificate.
X.509 certificate parsing and writing.