linux/drivers/crypto/chelsio/chcr_algo.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_ALGO_H__
#define __CHCR_ALGO_H__

/* Crypto key context */
#define KEY_CONTEXT_CTX_LEN_S
#define KEY_CONTEXT_CTX_LEN_M
#define KEY_CONTEXT_CTX_LEN_V(x)
#define KEY_CONTEXT_CTX_LEN_G(x)

#define KEY_CONTEXT_DUAL_CK_S
#define KEY_CONTEXT_DUAL_CK_M
#define KEY_CONTEXT_DUAL_CK_V(x)
#define KEY_CONTEXT_DUAL_CK_G(x)
#define KEY_CONTEXT_DUAL_CK_F

#define KEY_CONTEXT_SALT_PRESENT_S
#define KEY_CONTEXT_SALT_PRESENT_M
#define KEY_CONTEXT_SALT_PRESENT_V(x)
#define KEY_CONTEXT_SALT_PRESENT_G(x)
#define KEY_CONTEXT_SALT_PRESENT_F

#define KEY_CONTEXT_VALID_S
#define KEY_CONTEXT_VALID_M
#define KEY_CONTEXT_VALID_V(x)
#define KEY_CONTEXT_VALID_G(x)
#define KEY_CONTEXT_VALID_F

#define KEY_CONTEXT_CK_SIZE_S
#define KEY_CONTEXT_CK_SIZE_M
#define KEY_CONTEXT_CK_SIZE_V(x)
#define KEY_CONTEXT_CK_SIZE_G(x)

#define KEY_CONTEXT_MK_SIZE_S
#define KEY_CONTEXT_MK_SIZE_M
#define KEY_CONTEXT_MK_SIZE_V(x)
#define KEY_CONTEXT_MK_SIZE_G(x)

#define KEY_CONTEXT_OPAD_PRESENT_S
#define KEY_CONTEXT_OPAD_PRESENT_M
#define KEY_CONTEXT_OPAD_PRESENT_V(x)
#define KEY_CONTEXT_OPAD_PRESENT_G(x)
#define KEY_CONTEXT_OPAD_PRESENT_F

#define CHCR_HASH_MAX_DIGEST_SIZE
#define CHCR_MAX_SHA_DIGEST_SIZE

#define IPSEC_TRUNCATED_ICV_SIZE
#define TLS_TRUNCATED_HMAC_SIZE
#define CBCMAC_DIGEST_SIZE
#define MAX_HASH_NAME

#define SHA1_INIT_STATE_5X4B
#define SHA256_INIT_STATE_8X4B
#define SHA512_INIT_STATE_8X8B
#define SHA1_INIT_STATE
#define SHA224_INIT_STATE
#define SHA256_INIT_STATE
#define SHA384_INIT_STATE
#define SHA512_INIT_STATE

#define DUMMY_BYTES

#define IPAD_DATA
#define OPAD_DATA

#define TRANSHDR_SIZE(kctx_len)
#define CIPHER_TRANSHDR_SIZE(kctx_len, sge_pairs)
#define HASH_TRANSHDR_SIZE(kctx_len)


#define FILL_SEC_CPL_OP_IVINSR(id, len, ofst)

#define FILL_SEC_CPL_CIPHERSTOP_HI(a_start, a_stop, c_start, c_stop_hi)

#define FILL_SEC_CPL_AUTHINSERT(c_stop_lo, a_start, a_stop, a_inst)

#define FILL_SEC_CPL_SCMD0_SEQNO(ctrl, seq, cmode, amode, opad, size)

#define FILL_SEC_CPL_IVGEN_HDRLEN(last, more, ctx_in, mac, ivdrop, len)

#define FILL_KEY_CTX_HDR(ck_size, mk_size, d_ck, opad, ctx_len)

#define FILL_KEY_CRX_HDR(ck_size, mk_size, d_ck, opad, ctx_len)

#define FILL_WR_OP_CCTX_SIZE

#define FILL_WR_RX_Q_ID(cid, qid, lcb, fid)

#define FILL_ULPTX_CMD_DEST(cid, qid)

#define KEYCTX_ALIGN_PAD(bs)

#define FILL_PLD_SIZE_HASH_SIZE(payload_sgl_len, sgl_lengths, total_frags)

#define FILL_LEN_PKD(calc_tx_flits_ofld, skb)

#define FILL_CMD_MORE(immdatalen)
#define MAX_NK
#define MAX_DSGL_ENT
#define MIN_AUTH_SG
#define MIN_GCM_SG
#define MIN_DIGEST_SG
#define MIN_CCM_SG
#define CIP_SPACE_LEFT(len)
#define HASH_SPACE_LEFT(len)

struct algo_param {};

struct hash_wr_param {};

struct cipher_wr_param {};
enum {};

enum {};

enum {};

/*
 * CCM defines values of 4, 6, 8, 10, 12, 14, and 16 octets,
 * where they indicate the size of the integrity check value (ICV)
 */
enum {};

struct phys_sge_pairs {};


static const u32 chcr_sha1_init[SHA1_DIGEST_SIZE / 4] =;

static const u32 chcr_sha224_init[SHA256_DIGEST_SIZE / 4] =;

static const u32 chcr_sha256_init[SHA256_DIGEST_SIZE / 4] =;

static const u64 chcr_sha384_init[SHA512_DIGEST_SIZE / 8] =;

static const u64 chcr_sha512_init[SHA512_DIGEST_SIZE / 8] =;

static inline void copy_hash_init_values(char *key, int digestsize)
{}

/* Number of len fields(8) * size of one addr field */
#define PHYSDSGL_MAX_LEN_SIZE

static inline u16 get_space_for_phys_dsgl(unsigned int sgl_entr)
{}

/* The AES s-transform matrix (s-box). */
static const u8 aes_sbox[256] =;

static inline u32 aes_ks_subword(const u32 w)
{}

#endif /* __CHCR_ALGO_H__ */