From 2d59b2cd6bd1fe0c862b02c140f3b40b24accc06 Mon Sep 17 00:00:00 2001 From: Gilles Peskine Date: Wed, 12 Dec 2018 13:51:19 +0100 Subject: [PATCH] crypto_driver.h: get type definitions from crypto_enum.h Now that the type definitions that are useful for driver are in a separate header file from the application interface function declarations, include that header file in crypto_driver.h. --- include/psa/crypto_driver.h | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/include/psa/crypto_driver.h b/include/psa/crypto_driver.h index a52ecc427..43b3cf760 100644 --- a/include/psa/crypto_driver.h +++ b/include/psa/crypto_driver.h @@ -35,19 +35,23 @@ extern "C" { #endif -/** The following types are redefinitions from the psa/crypto.h file. - * It is intended that these will be moved to a new common header file to - * avoid duplication. They are included here for expediency in publication. - */ -typedef uint32_t psa_status_t; -typedef uint32_t psa_algorithm_t; -typedef uint8_t psa_encrypt_or_decrypt_t; -typedef uint32_t psa_key_slot_t; -typedef uint32_t psa_key_type_t; -typedef uint32_t psa_key_usage_t; +/* Include type definitions (psa_status_t, psa_algorithm_t, + * psa_key_type_t, etc.) and macros to build and analyze values + * of these types. */ +#include "crypto_types.h" +#include "crypto_values.h" -#define PSA_CRYPTO_DRIVER_ENCRYPT 1 -#define PSA_CRYPTO_DRIVER_DECRYPT 0 +/** An internal designation of a key slot between the core part of the + * PSA Crypto implementation and the driver. The meaning of this value + * is driver-dependent. */ +typedef uint32_t psa_key_slot_t; + +/** For encrypt-decrypt functions, whether the operation is an encryption + * or a decryption. */ +typedef enum { + PSA_CRYPTO_DRIVER_DECRYPT, + PSA_CRYPTO_DRIVER_ENCRYPT +} psa_encrypt_or_decrypt_t; /** \defgroup opaque_mac Opaque Message Authentication Code * Generation and authentication of Message Authentication Codes (MACs) using