TuyaOS
|
PSA cryptography module: Mbed TLS structured type implementations 更多...
#include "mbedtls/private_access.h"
#include "mbedtls/build_info.h"
#include "mbedtls/cmac.h"
#include "mbedtls/gcm.h"
#include "mbedtls/ccm.h"
#include "mbedtls/chachapoly.h"
#include "psa/crypto_driver_contexts_primitives.h"
#include "psa/crypto_driver_contexts_composites.h"
结构体 | |
struct | psa_key_attributes_s |
宏定义 | |
#define | MBEDTLS_PSA_KA_FLAG_HAS_SLOT_NUMBER ( (psa_key_attributes_flag_t) 0x0001 ) |
#define | MBEDTLS_PSA_KA_MASK_DUAL_USE |
#define | MBEDTLS_PSA_KA_MASK_EXTERNAL_ONLY |
#define | PSA_AEAD_OPERATION_INIT {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0}} |
#define | PSA_CIPHER_OPERATION_INIT { 0, 0, 0, 0, { 0 } } |
#define | PSA_CORE_KEY_ATTRIBUTES_INIT |
#define | PSA_HASH_OPERATION_INIT { 0, { 0 } } |
#define | PSA_KEY_ATTRIBUTES_INIT { PSA_CORE_KEY_ATTRIBUTES_INIT, NULL, 0 } |
#define | PSA_KEY_BITS_TOO_LARGE ( ( psa_key_bits_t ) -1 ) |
#define | PSA_KEY_DERIVATION_OPERATION_INIT { 0, 0, 0, { 0 } } |
#define | PSA_KEY_POLICY_INIT { 0, 0, 0 } |
#define | PSA_MAC_OPERATION_INIT { 0, 0, 0, { 0 } } |
#define | PSA_MAX_KEY_BITS 0xfff8 |
类型定义 | |
typedef uint16_t | psa_key_attributes_flag_t |
typedef uint16_t | psa_key_bits_t |
typedef struct psa_key_policy_s | psa_key_policy_t |
函数 | |
uint8_t | MBEDTLS_PRIVATE (dummy) |
psa_status_t | psa_set_key_domain_parameters (psa_key_attributes_t *attributes, psa_key_type_t type, const uint8_t *data, size_t data_length) |
PSA cryptography module: Mbed TLS structured type implementations
This file contains the definitions of some data structures with implementation-specific definitions.
In implementations with isolation between the application and the cryptography module, it is expected that the front-end and the back-end would have different versions of this file.
For multipart operations without driver delegation support, each multipart operation structure contains a psa_algorithm_t alg
field which indicates which specific algorithm the structure is for. When the structure is not in use, alg
is 0. Most of the structure consists of a union which is discriminated by alg
.
For multipart operations with driver delegation support, each multipart operation structure contains an unsigned int id
field indicating which driver got assigned to do the operation. When the structure is not in use, 'id' is 0. The structure contains also a driver context which is the union of the contexts of all drivers able to handle the type of multipart operation.
Note that when alg
or id
is 0, the content of other fields is undefined. In particular, it is not guaranteed that a freshly-initialized structure is all-zero: we initialize structures to something like {0, 0}
, which is only guaranteed to initializes the first member of the union; GCC and Clang initialize the whole structure to 0 (at the time of writing), but MSVC and CompCert don't.
In Mbed Crypto, multipart operation structures live independently from the key. This allows Mbed Crypto to free the key objects when destroying a key slot. If a multipart operation needs to remember the key after the setup function returns, the operation structure needs to contain a copy of the key.
#define MBEDTLS_PSA_KA_MASK_DUAL_USE |
#define MBEDTLS_PSA_KA_MASK_EXTERNAL_ONLY |
#define PSA_CORE_KEY_ATTRIBUTES_INIT |
typedef uint16_t psa_key_attributes_flag_t |
A mask of flags that can be stored in key attributes.
This type is also used internally to store flags in slots. Internal flags are defined in library/psa_crypto_core.h. Internal flags may have the same value as external flags if they are properly handled during key creation and in psa_get_key_attributes.