Path: blob/master/drivers/crypto/cavium/cpt/cptvf_algs.h
26285 views
/* SPDX-License-Identifier: GPL-2.0-only */1/*2* Copyright (C) 2016 Cavium, Inc.3*/45#ifndef _CPTVF_ALGS_H_6#define _CPTVF_ALGS_H_78#include "request_manager.h"910#define MAX_DEVICES 1611#define MAJOR_OP_FC 0x3312#define MAX_ENC_KEY_SIZE 3213#define MAX_HASH_KEY_SIZE 6414#define MAX_KEY_SIZE (MAX_ENC_KEY_SIZE + MAX_HASH_KEY_SIZE)15#define CONTROL_WORD_LEN 816#define KEY2_OFFSET 481718#define DMA_MODE_FLAG(dma_mode) \19(((dma_mode) == DMA_GATHER_SCATTER) ? (1 << 7) : 0)2021enum req_type {22AE_CORE_REQ,23SE_CORE_REQ,24};2526enum cipher_type {27DES3_CBC = 0x1,28DES3_ECB = 0x2,29AES_CBC = 0x3,30AES_ECB = 0x4,31AES_CFB = 0x5,32AES_CTR = 0x6,33AES_GCM = 0x7,34AES_XTS = 0x835};3637enum aes_type {38AES_128_BIT = 0x1,39AES_192_BIT = 0x2,40AES_256_BIT = 0x341};4243union encr_ctrl {44u64 flags;45struct {46#if defined(__BIG_ENDIAN_BITFIELD)47u64 enc_cipher:4;48u64 reserved1:1;49u64 aes_key:2;50u64 iv_source:1;51u64 hash_type:4;52u64 reserved2:3;53u64 auth_input_type:1;54u64 mac_len:8;55u64 reserved3:8;56u64 encr_offset:16;57u64 iv_offset:8;58u64 auth_offset:8;59#else60u64 auth_offset:8;61u64 iv_offset:8;62u64 encr_offset:16;63u64 reserved3:8;64u64 mac_len:8;65u64 auth_input_type:1;66u64 reserved2:3;67u64 hash_type:4;68u64 iv_source:1;69u64 aes_key:2;70u64 reserved1:1;71u64 enc_cipher:4;72#endif73} e;74};7576struct cvm_cipher {77const char *name;78u8 value;79};8081struct enc_context {82union encr_ctrl enc_ctrl;83u8 encr_key[32];84u8 encr_iv[16];85};8687struct fchmac_context {88u8 ipad[64];89u8 opad[64]; /* or OPAD */90};9192struct fc_context {93struct enc_context enc;94struct fchmac_context hmac;95};9697struct cvm_enc_ctx {98u32 key_len;99u8 enc_key[MAX_KEY_SIZE];100u8 cipher_type:4;101u8 key_type:2;102};103104struct cvm_des3_ctx {105u32 key_len;106u8 des3_key[MAX_KEY_SIZE];107};108109struct cvm_req_ctx {110struct cpt_request_info cpt_req;111u64 control_word;112struct fc_context fctx;113};114115int cptvf_do_request(void *cptvf, struct cpt_request_info *req);116#endif /*_CPTVF_ALGS_H_*/117118119