Rename pkcs11_xxx_init() to bind()

This commit is contained in:
Manuel Pégourié-Gonnard 2015-04-29 01:10:10 +02:00
parent 69a69cc5ae
commit eab147c4d0
5 changed files with 23 additions and 9 deletions

View File

@ -20,6 +20,9 @@ API Changes
mbedtls_gcm_init() -> mbedtls_gcm_setkey()
mbedtls_hmac_drbg_init() -> mbedtls_hmac_drbg_init(_buf)()
mbedtls_ctr_drbg_init() -> mbedtls_ctr_drbg_init(_buf)()
* Renamed mbedtls_pkcs11_priv_key_init() to ..._bind() and
mbedtls_pkcs11_x509_cert_init() as well (handled by rename.pl and
compat-1.3.h)
* mbedtls_memory_bufer_alloc_init() now returns void
* In the threading layer, mbedtls_mutex_init() and mbedtls_mutex_free() now
return void.

View File

@ -2256,9 +2256,9 @@
#define pkcs11_context mbedtls_pkcs11_context
#define pkcs11_decrypt mbedtls_pkcs11_decrypt
#define pkcs11_priv_key_free mbedtls_pkcs11_priv_key_free
#define pkcs11_priv_key_init mbedtls_pkcs11_priv_key_init
#define pkcs11_priv_key_init mbedtls_pkcs11_priv_key_bind
#define pkcs11_sign mbedtls_pkcs11_sign
#define pkcs11_x509_cert_init mbedtls_pkcs11_x509_cert_init
#define pkcs11_x509_cert_init mbedtls_pkcs11_x509_cert_bind
#define pkcs12_derivation mbedtls_pkcs12_derivation
#define pkcs12_pbe mbedtls_pkcs12_pbe
#define pkcs12_pbe_sha1_rc4_128 mbedtls_pkcs12_pbe_sha1_rc4_128

View File

@ -58,6 +58,12 @@ typedef struct {
int len;
} mbedtls_pkcs11_context;
/**
* Initialize a mbetls_pkcs11_context.
* (Just making memory references valid.)
*/
void mbedtls_pkcs11_init( mbedtls_pkcs11_context *ctx );
/**
* Fill in a mbed TLS certificate, based on the given PKCS11 helper certificate.
*
@ -66,10 +72,10 @@ typedef struct {
*
* \return 0 on success.
*/
int mbedtls_pkcs11_x509_cert_init( mbedtls_x509_crt *cert, pkcs11h_certificate_t pkcs11h_cert );
int mbedtls_pkcs11_x509_cert_bind( mbedtls_x509_crt *cert, pkcs11h_certificate_t pkcs11h_cert );
/**
* Initialise a mbedtls_pkcs11_context, storing the given certificate. Note that the
* Set up a mbedtls_pkcs11_context storing the given certificate. Note that the
* mbedtls_pkcs11_context will take over control of the certificate, freeing it when
* done.
*
@ -78,7 +84,7 @@ int mbedtls_pkcs11_x509_cert_init( mbedtls_x509_crt *cert, pkcs11h_certificate_t
*
* \return 0 on success
*/
int mbedtls_pkcs11_priv_key_init( mbedtls_pkcs11_context *priv_key,
int mbedtls_pkcs11_priv_key_bind( mbedtls_pkcs11_context *priv_key,
pkcs11h_certificate_t pkcs11_cert );
/**

View File

@ -40,7 +40,12 @@
#define mbedtls_free free
#endif
int mbedtls_pkcs11_x509_cert_init( mbedtls_x509_crt *cert, pkcs11h_certificate_t pkcs11_cert )
void mbedtls_pkcs11_init( mbedtls_pkcs11_context *ctx )
{
memset( ctx, 0, sizeof( mbedtls_pkcs11_context ) );
}
int mbedtls_pkcs11_x509_cert_bind( mbedtls_x509_crt *cert, pkcs11h_certificate_t pkcs11_cert )
{
int ret = 1;
unsigned char *cert_blob = NULL;
@ -89,7 +94,7 @@ cleanup:
}
int mbedtls_pkcs11_priv_key_init( mbedtls_pkcs11_context *priv_key,
int mbedtls_pkcs11_priv_key_bind( mbedtls_pkcs11_context *priv_key,
pkcs11h_certificate_t pkcs11_cert )
{
int ret = 1;

View File

@ -1782,9 +1782,9 @@ pk_write_pubkey_pem mbedtls_pk_write_pubkey_pem
pkcs11_context mbedtls_pkcs11_context
pkcs11_decrypt mbedtls_pkcs11_decrypt
pkcs11_priv_key_free mbedtls_pkcs11_priv_key_free
pkcs11_priv_key_init mbedtls_pkcs11_priv_key_init
pkcs11_priv_key_init mbedtls_pkcs11_priv_key_bind
pkcs11_sign mbedtls_pkcs11_sign
pkcs11_x509_cert_init mbedtls_pkcs11_x509_cert_init
pkcs11_x509_cert_init mbedtls_pkcs11_x509_cert_bind
pkcs12_derivation mbedtls_pkcs12_derivation
pkcs12_pbe mbedtls_pkcs12_pbe
pkcs12_pbe_sha1_rc4_128 mbedtls_pkcs12_pbe_sha1_rc4_128