linux/drivers/crypto/chelsio/chcr_crypto.h

/*
 * This file is part of the Chelsio T6 Crypto driver for Linux.
 *
 * Copyright (c) 2003-2016 Chelsio Communications, Inc. All rights reserved.
 *
 * This software is available to you under a choice of one of two
 * licenses.  You may choose to be licensed under the terms of the GNU
 * General Public License (GPL) Version 2, available from the file
 * COPYING in the main directory of this source tree, or the
 * OpenIB.org BSD license below:
 *
 *     Redistribution and use in source and binary forms, with or
 *     without modification, are permitted provided that the following
 *     conditions are met:
 *
 *      - Redistributions of source code must retain the above
 *        copyright notice, this list of conditions and the following
 *        disclaimer.
 *
 *      - Redistributions in binary form must reproduce the above
 *        copyright notice, this list of conditions and the following
 *        disclaimer in the documentation and/or other materials
 *        provided with the distribution.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
 *
 */

#ifndef __CHCR_CRYPTO_H__
#define __CHCR_CRYPTO_H__

#define GHASH_BLOCK_SIZE
#define GHASH_DIGEST_SIZE

#define CCM_B0_SIZE
#define CCM_AAD_FIELD_SIZE
// 511 - 16(For IV)
#define T6_MAX_AAD_SIZE


/* Define following if h/w is not dropping the AAD and IV data before
 * giving the processed data
 */

#define CHCR_CRA_PRIORITY
#define CHCR_AEAD_PRIORITY
#define CHCR_AES_MAX_KEY_LEN
#define CHCR_MAX_CRYPTO_IV_LEN

#define CHCR_MAX_AUTHENC_AES_KEY_LEN
#define CHCR_MAX_AUTHENC_SHA_KEY_LEN

#define CHCR_GIVENCRYPT_OP
/* CPL/SCMD parameters */

#define CHCR_ENCRYPT_OP
#define CHCR_DECRYPT_OP

#define CHCR_SCMD_SEQ_NO_CTRL_32BIT
#define CHCR_SCMD_SEQ_NO_CTRL_48BIT
#define CHCR_SCMD_SEQ_NO_CTRL_64BIT

#define CHCR_SCMD_PROTO_VERSION_GENERIC

#define CHCR_SCMD_AUTH_CTRL_AUTH_CIPHER
#define CHCR_SCMD_AUTH_CTRL_CIPHER_AUTH

#define CHCR_SCMD_CIPHER_MODE_NOP
#define CHCR_SCMD_CIPHER_MODE_AES_CBC
#define CHCR_SCMD_CIPHER_MODE_AES_GCM
#define CHCR_SCMD_CIPHER_MODE_AES_CTR
#define CHCR_SCMD_CIPHER_MODE_GENERIC_AES
#define CHCR_SCMD_CIPHER_MODE_AES_XTS
#define CHCR_SCMD_CIPHER_MODE_AES_CCM

#define CHCR_SCMD_AUTH_MODE_NOP
#define CHCR_SCMD_AUTH_MODE_SHA1
#define CHCR_SCMD_AUTH_MODE_SHA224
#define CHCR_SCMD_AUTH_MODE_SHA256
#define CHCR_SCMD_AUTH_MODE_GHASH
#define CHCR_SCMD_AUTH_MODE_SHA512_224
#define CHCR_SCMD_AUTH_MODE_SHA512_256
#define CHCR_SCMD_AUTH_MODE_SHA512_384
#define CHCR_SCMD_AUTH_MODE_SHA512_512
#define CHCR_SCMD_AUTH_MODE_CBCMAC
#define CHCR_SCMD_AUTH_MODE_CMAC

#define CHCR_SCMD_HMAC_CTRL_NOP
#define CHCR_SCMD_HMAC_CTRL_NO_TRUNC
#define CHCR_SCMD_HMAC_CTRL_TRUNC_RFC4366
#define CHCR_SCMD_HMAC_CTRL_IPSEC_96BIT
#define CHCR_SCMD_HMAC_CTRL_PL1
#define CHCR_SCMD_HMAC_CTRL_PL2
#define CHCR_SCMD_HMAC_CTRL_PL3
#define CHCR_SCMD_HMAC_CTRL_DIV2
#define VERIFY_HW
#define VERIFY_SW

#define CHCR_SCMD_IVGEN_CTRL_HW
#define CHCR_SCMD_IVGEN_CTRL_SW
/* This are not really mac key size. They are intermediate values
 * of sha engine and its size
 */
#define CHCR_KEYCTX_MAC_KEY_SIZE_128
#define CHCR_KEYCTX_MAC_KEY_SIZE_160
#define CHCR_KEYCTX_MAC_KEY_SIZE_192
#define CHCR_KEYCTX_MAC_KEY_SIZE_256
#define CHCR_KEYCTX_MAC_KEY_SIZE_512
#define CHCR_KEYCTX_CIPHER_KEY_SIZE_128
#define CHCR_KEYCTX_CIPHER_KEY_SIZE_192
#define CHCR_KEYCTX_CIPHER_KEY_SIZE_256
#define CHCR_KEYCTX_NO_KEY

#define CHCR_CPL_FW4_PLD_IV_OFFSET
#define CHCR_CPL_FW4_PLD_HASH_RESULT_OFFSET
#define CHCR_CPL_FW4_PLD_DATA_SIZE

#define KEY_CONTEXT_HDR_SALT_AND_PAD
#define flits_to_bytes(x)

#define IV_NOP
#define IV_IMMEDIATE
#define IV_DSGL

#define AEAD_H_SIZE

#define CRYPTO_ALG_SUB_TYPE_MASK
#define CRYPTO_ALG_SUB_TYPE_HASH_HMAC
#define CRYPTO_ALG_SUB_TYPE_AEAD_RFC4106
#define CRYPTO_ALG_SUB_TYPE_AEAD_GCM
#define CRYPTO_ALG_SUB_TYPE_CBC_SHA
#define CRYPTO_ALG_SUB_TYPE_AEAD_CCM
#define CRYPTO_ALG_SUB_TYPE_AEAD_RFC4309
#define CRYPTO_ALG_SUB_TYPE_CBC_NULL
#define CRYPTO_ALG_SUB_TYPE_CTR
#define CRYPTO_ALG_SUB_TYPE_CTR_RFC3686
#define CRYPTO_ALG_SUB_TYPE_XTS
#define CRYPTO_ALG_SUB_TYPE_CBC
#define CRYPTO_ALG_SUB_TYPE_CTR_SHA
#define CRYPTO_ALG_SUB_TYPE_CTR_NULL
#define CRYPTO_ALG_TYPE_HMAC

#define MAX_SCRATCH_PAD_SIZE

#define CHCR_HASH_MAX_BLOCK_SIZE_64
#define CHCR_HASH_MAX_BLOCK_SIZE_128
#define CHCR_SRC_SG_SIZE
#define CHCR_DST_SG_SIZE

static inline struct chcr_context *a_ctx(struct crypto_aead *tfm)
{}

static inline struct chcr_context *c_ctx(struct crypto_skcipher *tfm)
{}

static inline struct chcr_context *h_ctx(struct crypto_ahash *tfm)
{}

struct ablk_ctx {};
struct chcr_aead_reqctx {};

struct ulptx_walk {};

struct dsgl_walk {};

struct chcr_gcm_ctx {};

struct chcr_authenc_ctx {};

struct __aead_ctx {};

struct chcr_aead_ctx {};

struct hmac_ctx {};

struct __crypto_ctx {};

struct chcr_context {};

struct chcr_hctx_per_wr {};

struct chcr_ahash_req_ctx {};

struct chcr_skcipher_req_ctx {};

struct chcr_alg_template {};

create_wr_t;

void chcr_verify_tag(struct aead_request *req, u8 *input, int *err);
int chcr_aead_dma_map(struct device *dev, struct aead_request *req,
		      unsigned short op_type);
void chcr_aead_dma_unmap(struct device *dev, struct aead_request *req,
			 unsigned short op_type);
void chcr_add_aead_dst_ent(struct aead_request *req,
			   struct cpl_rx_phys_dsgl *phys_cpl,
			   unsigned short qid);
void chcr_add_aead_src_ent(struct aead_request *req, struct ulptx_sgl *ulptx);
void chcr_add_cipher_src_ent(struct skcipher_request *req,
			     void *ulptx,
			     struct  cipher_wr_param *wrparam);
int chcr_cipher_dma_map(struct device *dev, struct skcipher_request *req);
void chcr_cipher_dma_unmap(struct device *dev, struct skcipher_request *req);
void chcr_add_cipher_dst_ent(struct skcipher_request *req,
			     struct cpl_rx_phys_dsgl *phys_cpl,
			     struct  cipher_wr_param *wrparam,
			     unsigned short qid);
void chcr_add_hash_src_ent(struct ahash_request *req, struct ulptx_sgl *ulptx,
			   struct hash_wr_param *param);
int chcr_hash_dma_map(struct device *dev, struct ahash_request *req);
void chcr_hash_dma_unmap(struct device *dev, struct ahash_request *req);
void chcr_aead_common_exit(struct aead_request *req);
#endif /* __CHCR_CRYPTO_H__ */