/* size of salt value for AES-GCM-ESP and AES-CCM-ESP */ #define GCM_ESP_SALT_SIZE 4 #define CCM_ESP_SALT_SIZE 3 #define MAX_SALT_SIZE GCM_ESP_SALT_SIZE #define GCM_ESP_SALT_OFFSET 0 #define CCM_ESP_SALT_OFFSET 1
#define GCM_ESP_DIGESTSIZE 16
#define MAX_HASH_BLOCK_SIZE SHA512_BLOCK_SIZE
/* * Maximum number of bytes from a non-final hash request that can be deferred * until more data is available. With new crypto API framework, this * can be no more than one block of data.
*/ #define HASH_CARRY_MAX MAX_HASH_BLOCK_SIZE
/* Force at least 4-byte alignment of all SPU message fields */ #define SPU_MSG_ALIGN 4
/* Number of times to resend mailbox message if mb queue is full */ #define SPU_MB_RETRY_MAX 1000
/* * Buffers for a SPU request/reply message pair. All part of one structure to * allow a single alloc per request.
*/ struct spu_msg_buf { /* Request message fragments */
/* * SPU request message header. For SPU-M, holds MH, EMH, SCTX, BDESC, * and BD header. For SPU2, holds FMD, OMD.
*/
u8 bcm_spu_req_hdr[ALIGN(SPU2_HEADER_ALLOC_LEN, SPU_MSG_ALIGN)];
/* IV or counter. Size to include salt. Also used for XTS tweek. */
u8 iv_ctr[ALIGN(2 * AES_BLOCK_SIZE, SPU_MSG_ALIGN)];
/* Hash digest. request and response. */
u8 digest[ALIGN(MAX_DIGEST_SIZE, SPU_MSG_ALIGN)];
/* SPU response message STATUS field padding */
u8 rx_stat_pad[ALIGN(SPU_STAT_PAD_MAX, SPU_MSG_ALIGN)];
/* SPU response message STATUS field */
u8 rx_stat[ALIGN(SPU_RX_STATUS_LEN, SPU_MSG_ALIGN)];
union { /* Buffers only used for skcipher */ struct { /* * Field used for either SUPDT when RC4 is used * -OR- tweak value when XTS/AES is used
*/
u8 supdt_tweak[ALIGN(SPU_SUPDT_LEN, SPU_MSG_ALIGN)];
} c;
/* Buffers only used for aead */ struct { /* SPU response pad for GCM data */
u8 gcmpad[ALIGN(AES_BLOCK_SIZE, SPU_MSG_ALIGN)];
/* * The maximum length in bytes of the payload in a SPU message for this * context. For SPU-M, the payload is the combination of AAD and data. * For SPU2, the payload is just data. A value of SPU_MAX_PAYLOAD_INF * indicates that there is no limit to the length of the SPU message * payload.
*/ unsignedint max_payload;
struct crypto_aead *fallback_cipher;
/* auth_type is determined during processing of request */
/* * Buffer to hold SPU message header template. Template is created at * setkey time for skcipher requests, since most of the fields in the * header are known at that time. At request time, just fill in a few * missing pieces related to length of data in the request and IVs, etc.
*/
u8 bcm_spu_req_hdr[ALIGN(SPU2_HEADER_ALLOC_LEN, SPU_MSG_ALIGN)];
/* Length of SPU request header */
u16 spu_req_hdr_len;
/* Expected length of SPU response header */
u16 spu_resp_hdr_len;
/* * shash descriptor - needed to perform incremental hashing in * software, when hw doesn't support it.
*/ struct shash_desc *shash;
bool is_rfc4543; /* RFC 4543 style of GMAC */
};
/* state from iproc_reqctx_s necessary for hash state export/import */ struct spu_hash_export_s { unsignedint total_todo; unsignedint total_sent;
u8 hash_carry[HASH_CARRY_MAX]; unsignedint hash_carry_len;
u8 incr_hash[MAX_DIGEST_SIZE]; bool is_sw_hmac;
};
struct iproc_reqctx_s { /* general context */ struct crypto_async_request *parent;
/* only valid after enqueue() */ struct iproc_ctx_s *ctx;
u8 chan_idx; /* Mailbox channel to be used to submit this request */
/* total todo, rx'd, and sent for this request */ unsignedint total_todo; unsignedint total_received; /* only valid for skcipher */ unsignedint total_sent;
/* * num bytes sent to hw from the src sg in this request. This can differ * from total_sent for incremental hashing. total_sent includes previous * init() and update() data. src_sent does not.
*/ unsignedint src_sent;
/* * For AEAD requests, start of associated data. This will typically * point to the beginning of the src scatterlist from the request, * since assoc data is at the beginning of the src scatterlist rather * than in its own sg.
*/ struct scatterlist *assoc;
/* * scatterlist entry and offset to start of data for next chunk. Crypto * API src scatterlist for AEAD starts with AAD, if present. For first * chunk, src_sg is sg entry at beginning of input data (after AAD). * src_skip begins at the offset in that sg entry where data begins.
*/ struct scatterlist *src_sg; int src_nents; /* Number of src entries with data */
u32 src_skip; /* bytes of current sg entry already used */
/* * Same for destination. For AEAD, if there is AAD, output data must * be written at offset following AAD.
*/ struct scatterlist *dst_sg; int dst_nents; /* Number of dst entries with data */
u32 dst_skip; /* bytes of current sg entry already written */
/* Mailbox message used to send this request to PDC driver */ struct brcm_message mb_mssg;
bool bd_suppress; /* suppress BD field in SPU response? */
/* cipher context */ bool is_encrypt;
/* * CBC mode: IV. CTR mode: counter. Else empty. Used as a DMA * buffer for AEAD requests. So allocate as DMAable memory. If IV * concatenated with salt, includes the salt.
*/
u8 *iv_ctr; /* Length of IV or counter, in bytes */ unsignedint iv_ctr_len;
/* * Hash requests can be of any size, whether initial, update, or final. * A non-final request must be submitted to the SPU as an integral * number of blocks. This may leave data at the end of the request * that is not a full block. Since the request is non-final, it cannot * be padded. So, we write the remainder to this hash_carry buffer and * hold it until the next request arrives. The carry data is then * submitted at the beginning of the data in the next SPU msg. * hash_carry_len is the number of bytes currently in hash_carry. These * fields are only used for ahash requests.
*/
u8 hash_carry[HASH_CARRY_MAX]; unsignedint hash_carry_len; unsignedint is_final; /* is this the final for the hash op? */
/* * Digest from incremental hash is saved here to include in next hash * operation. Cannot be stored in req->result for truncated hashes, * since result may be sized for final digest. Cannot be saved in * msg_buf because that gets deleted between incremental hash ops * and is not saved as part of export().
*/
u8 incr_hash[MAX_DIGEST_SIZE];
/* hmac context */ bool is_sw_hmac;
gfp_t gfp;
/* Buffers used to build SPU request and response messages */ struct spu_msg_buf msg_buf;
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.