pkcs11.h
mbedtls/config.h
mbedtls/check_config.h
mbedtls/config.h
pkcs11.h
limits.h

Wrapper for PKCS#11 library libpkcs11-helper.

Adriaan de Jong dejong@fox-it.com

    /*
    *CopyrightTheMbedTLSContributors
    *SPDX-License-Identifier:Apache-2.0ORGPL-2.0-or-later
    */
    #ifndefMBEDTLS_PKCS11_H
    #defineMBEDTLS_PKCS11_H

    #if!defined(MBEDTLS_CONFIG_FILE)
    #include"mbedtls/config.h"
    #else
    #includeMBEDTLS_CONFIG_FILE
    #endif

    #ifdefined(MBEDTLS_PKCS11_C)

    #include"mbedtls/x509_crt.h"

    #include<pkcs11-helper-1.0/pkcs11h-certificate.h>

    #if(defined(__ARMCC_VERSION)||defined(_MSC_VER))&&\
    !defined(inline)&&!defined(__cplusplus)
    #defineinline__inline
    #endif

    #ifdef__cplusplus
    extern"C"{
    #endif

    #ifdefined(MBEDTLS_DEPRECATED_REMOVED)

    typedefstructmbedtls_pkcs11_context{
    pkcs11h_certificate_tpkcs11h_cert;
    intlen;
    }mbedtls_pkcs11_context;

    #ifdefined(MBEDTLS_DEPRECATED_WARNING)
    #defineMBEDTLS_DEPRECATED__attribute__((deprecated))
    #else
    #defineMBEDTLS_DEPRECATED
    #endif

    MBEDTLS_DEPRECATEDvoidmbedtls_pkcs11_init(mbedtls_pkcs11_context*ctx);

    MBEDTLS_DEPRECATEDintmbedtls_pkcs11_x509_cert_bind(mbedtls_x509_crt*cert,
    pkcs11h_certificate_tpkcs11h_cert);

    MBEDTLS_DEPRECATEDintmbedtls_pkcs11_priv_key_bind(
    mbedtls_pkcs11_context*priv_key,
    pkcs11h_certificate_tpkcs11_cert);

    MBEDTLS_DEPRECATEDvoidmbedtls_pkcs11_priv_key_free(
    mbedtls_pkcs11_context*priv_key);

    MBEDTLS_DEPRECATEDintmbedtls_pkcs11_decrypt(mbedtls_pkcs11_context*ctx,
    intmode,size_t*olen,
    constunsignedchar*input,
    unsignedchar*output,
    size_toutput_max_len);

    MBEDTLS_DEPRECATEDintmbedtls_pkcs11_sign(mbedtls_pkcs11_context*ctx,
    intmode,
    mbedtls_md_type_tmd_alg,
    unsignedinthashlen,
    constunsignedchar*hash,
    unsignedchar*sig);

    MBEDTLS_DEPRECATEDstaticinlineintmbedtls_ssl_pkcs11_decrypt(void*ctx,
    intmode,
    size_t*olen,
    constunsignedchar*input,
    unsignedchar*output,
    size_toutput_max_len)
    {
    returnmbedtls_pkcs11_decrypt((mbedtls_pkcs11_context*)ctx,mode,olen,input,output,
    output_max_len);
    }

    MBEDTLS_DEPRECATEDstaticinlineintmbedtls_ssl_pkcs11_sign(void*ctx,
    int(*f_rng)(void*,
    unsignedchar*,
    size_t),
    void*p_rng,
    intmode,
    mbedtls_md_type_tmd_alg,
    unsignedinthashlen,
    constunsignedchar*hash,
    unsignedchar*sig)
    {
    ((void)f_rng);
    ((void)p_rng);
    returnmbedtls_pkcs11_sign((mbedtls_pkcs11_context*)ctx,mode,md_alg,
    hashlen,hash,sig);
    }

    MBEDTLS_DEPRECATEDstaticinlinesize_tmbedtls_ssl_pkcs11_key_len(void*ctx)
    {
    return((mbedtls_pkcs11_context*)ctx)->len;
    }

    #undefMBEDTLS_DEPRECATED

    #endif/*MBEDTLS_DEPRECATED_REMOVED*/

    #ifdef__cplusplus
    }
    #endif

    #endif/*MBEDTLS_PKCS11_C*/

    #endif/*MBEDTLS_PKCS11_H*/