diff --git a/include/mbedtls/pkcs11_client.h b/include/mbedtls/pkcs11_client.h index 978552df8..ff555b7fd 100644 --- a/include/mbedtls/pkcs11_client.h +++ b/include/mbedtls/pkcs11_client.h @@ -47,12 +47,12 @@ extern "C" { #if defined(MBEDTLS_PK_C) -#define MBEDTLS_PK_FLAG_SENSITIVE ( (uint32_t) 0x00000001 ) -#define MBEDTLS_PK_FLAG_EXTRACTABLE ( (uint32_t) 0x00000002 ) -#define MBEDTLS_PK_FLAG_SIGN ( (uint32_t) 0x00000010 ) -#define MBEDTLS_PK_FLAG_VERIFY ( (uint32_t) 0x00000020 ) -#define MBEDTLS_PK_FLAG_DECRYPT ( (uint32_t) 0x00000040 ) -#define MBEDTLS_PK_FLAG_ENCRYPT ( (uint32_t) 0x00000080 ) +#define MBEDTLS_PKCS11_FLAG_SENSITIVE ( (uint32_t) 0x00000001 ) +#define MBEDTLS_PKCS11_FLAG_EXTRACTABLE ( (uint32_t) 0x00000002 ) +#define MBEDTLS_PKCS11_FLAG_SIGN ( (uint32_t) 0x00000010 ) +#define MBEDTLS_PKCS11_FLAG_VERIFY ( (uint32_t) 0x00000020 ) +#define MBEDTLS_PKCS11_FLAG_DECRYPT ( (uint32_t) 0x00000040 ) +#define MBEDTLS_PKCS11_FLAG_ENCRYPT ( (uint32_t) 0x00000080 ) #include "pk.h" diff --git a/library/pkcs11_client.c b/library/pkcs11_client.c index 700587b30..833ae72a3 100644 --- a/library/pkcs11_client.c +++ b/library/pkcs11_client.c @@ -436,7 +436,7 @@ static int mpi_to_ck( const mbedtls_mpi *mpi, while( 0 ) #endif /* defined(MBEDTLS_RSA_C) || defined(MBEDTLS_ECDSA_C) */ -#define CK_BOOL( x ) ( ( x ) ? CK_TRUE : CK_FALSE ) +#define MBEDTLS_PKCS11_BOOL( x ) ( ( x ) ? CK_TRUE : CK_FALSE ) int mbedtls_pk_import_to_pkcs11( const mbedtls_pk_context *ctx, uint32_t flags, @@ -447,13 +447,13 @@ int mbedtls_pk_import_to_pkcs11( const mbedtls_pk_context *ctx, CK_OBJECT_CLASS cko_private_key = CKO_PRIVATE_KEY; CK_OBJECT_CLASS cko_public_key = CKO_PUBLIC_KEY; CK_KEY_TYPE ck_key_type; - CK_BBOOL ck_sensitive = CK_BOOL( flags & MBEDTLS_PK_FLAG_SENSITIVE ); - CK_BBOOL ck_extractable = CK_BOOL( flags & MBEDTLS_PK_FLAG_EXTRACTABLE ); - CK_BBOOL ck_sign = CK_BOOL( flags & MBEDTLS_PK_FLAG_SIGN ); - CK_BBOOL ck_verify = CK_BOOL( flags & MBEDTLS_PK_FLAG_VERIFY ); - CK_BBOOL ck_decrypt = CK_BOOL( flags & MBEDTLS_PK_FLAG_DECRYPT ); - CK_BBOOL ck_encrypt = CK_BOOL( flags & MBEDTLS_PK_FLAG_ENCRYPT ); - CK_BBOOL ck_token = CK_BOOL( flags & MBEDTLS_PKCS11_FLAG_TOKEN ); + CK_BBOOL ck_sensitive = MBEDTLS_PKCS11_BOOL( flags & MBEDTLS_PKCS11_FLAG_SENSITIVE ); + CK_BBOOL ck_extractable = MBEDTLS_PKCS11_BOOL( flags & MBEDTLS_PKCS11_FLAG_EXTRACTABLE ); + CK_BBOOL ck_sign = MBEDTLS_PKCS11_BOOL( flags & MBEDTLS_PKCS11_FLAG_SIGN ); + CK_BBOOL ck_verify = MBEDTLS_PKCS11_BOOL( flags & MBEDTLS_PKCS11_FLAG_VERIFY ); + CK_BBOOL ck_decrypt = MBEDTLS_PKCS11_BOOL( flags & MBEDTLS_PKCS11_FLAG_DECRYPT ); + CK_BBOOL ck_encrypt = MBEDTLS_PKCS11_BOOL( flags & MBEDTLS_PKCS11_FLAG_ENCRYPT ); + CK_BBOOL ck_token = MBEDTLS_PKCS11_BOOL( flags & MBEDTLS_PKCS11_FLAG_TOKEN ); CK_ATTRIBUTE public_attributes[] = { {CKA_CLASS, &cko_public_key, sizeof( cko_public_key )}, {CKA_KEY_TYPE, &ck_key_type, sizeof( ck_key_type )},