/* * This file contains the definition of SPU messages. There are currently two * SPU message formats: SPU-M and SPU2. The hardware uses different values to * identify the same things in SPU-M vs SPU2. So this file defines values that * are hardware independent. Software can use these values for any version of * SPU hardware. These values are used in APIs in spu.c. Functions internal to * spu.c and spu2.c convert these to hardware-specific values.
*/
struct spu_aead_parms {
u32 assoc_size;
u16 iv_len; /* length of IV field between assoc data and data */
u8 aad_pad_len; /* For AES GCM/CCM, length of padding after AAD */
u8 data_pad_len;/* For AES GCM/CCM, length of padding after data */ bool return_iv; /* True if SPU should return an IV */
u32 ret_iv_len; /* Length in bytes of returned IV */
u32 ret_iv_off; /* Offset into full IV if partial IV returned */
};
/************** SPU sizes ***************/
#define SPU_RX_STATUS_LEN 4
/* Max length of padding for 4-byte alignment of STATUS field */ #define SPU_STAT_PAD_MAX 4
/* Max length of pad fragment. 4 is for 4-byte alignment of STATUS field */ #define SPU_PAD_LEN_MAX (SPU_GCM_CCM_ALIGN + MAX_HASH_BLOCK_SIZE + \
SPU_STAT_PAD_MAX)
/* Length up SUPDT field in SPU response message for RC4 */ #define SPU_SUPDT_LEN 260
/* SPU status error codes. These used as common error codes across all * SPU variants.
*/ #define SPU_INVALID_ICV 1
/* Indicates no limit to the length of the payload in a SPU message */ #define SPU_MAX_PAYLOAD_INF 0xFFFFFFFF
/* Size of XTS tweak ("i" parameter), in bytes */ #define SPU_XTS_TWEAK_SIZE 16
/* CCM B_0 field definitions, common for SPU-M and SPU2 */ #define CCM_B0_ADATA 0x40 #define CCM_B0_ADATA_SHIFT 6 #define CCM_B0_M_PRIME 0x38 #define CCM_B0_M_PRIME_SHIFT 3 #define CCM_B0_L_PRIME 0x07 #define CCM_B0_L_PRIME_SHIFT 0 #define CCM_ESP_L_VALUE 4
/** * spu_req_incl_icv() - Return true if SPU request message should include the * ICV as a separate buffer. * @cipher_mode: the cipher mode being requested * @is_encrypt: true if encrypting. false if decrypting. * * Return: true if ICV to be included as separate buffer
*/ static __always_inline bool spu_req_incl_icv(enum spu_cipher_mode cipher_mode, bool is_encrypt)
{ if ((cipher_mode == CIPHER_MODE_GCM) && !is_encrypt) returntrue; if ((cipher_mode == CIPHER_MODE_CCM) && !is_encrypt) returntrue;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.