mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-15 16:24:13 +08:00
crypto: caam - refactor encryption descriptors generation
Refactor the generation of the authenc, ablkcipher shared descriptors and exports the functionality, such that they could be shared with the upcoming caam/qi (Queue Interface) driver. Signed-off-by: Horia Geantă <horia.geanta@nxp.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
This commit is contained in:
parent
746f069038
commit
8cea7b66b8
@ -134,3 +134,6 @@ config CRYPTO_DEV_FSL_CAAM_DEBUG
|
||||
help
|
||||
Selecting this will enable printing of various debug
|
||||
information in the CAAM driver.
|
||||
|
||||
config CRYPTO_DEV_FSL_CAAM_CRYPTO_API_DESC
|
||||
def_bool CRYPTO_DEV_FSL_CAAM_CRYPTO_API
|
||||
|
@ -8,6 +8,7 @@ endif
|
||||
obj-$(CONFIG_CRYPTO_DEV_FSL_CAAM) += caam.o
|
||||
obj-$(CONFIG_CRYPTO_DEV_FSL_CAAM_JR) += caam_jr.o
|
||||
obj-$(CONFIG_CRYPTO_DEV_FSL_CAAM_CRYPTO_API) += caamalg.o
|
||||
obj-$(CONFIG_CRYPTO_DEV_FSL_CAAM_CRYPTO_API_DESC) += caamalg_desc.o
|
||||
obj-$(CONFIG_CRYPTO_DEV_FSL_CAAM_AHASH_API) += caamhash.o
|
||||
obj-$(CONFIG_CRYPTO_DEV_FSL_CAAM_RNG_API) += caamrng.o
|
||||
obj-$(CONFIG_CRYPTO_DEV_FSL_CAAM_PKC_API) += caam_pkc.o
|
||||
|
File diff suppressed because it is too large
Load Diff
1302
drivers/crypto/caam/caamalg_desc.c
Normal file
1302
drivers/crypto/caam/caamalg_desc.c
Normal file
File diff suppressed because it is too large
Load Diff
97
drivers/crypto/caam/caamalg_desc.h
Normal file
97
drivers/crypto/caam/caamalg_desc.h
Normal file
@ -0,0 +1,97 @@
|
||||
/*
|
||||
* Shared descriptors for aead, ablkcipher algorithms
|
||||
*
|
||||
* Copyright 2016 NXP
|
||||
*/
|
||||
|
||||
#ifndef _CAAMALG_DESC_H_
|
||||
#define _CAAMALG_DESC_H_
|
||||
|
||||
/* length of descriptors text */
|
||||
#define DESC_AEAD_BASE (4 * CAAM_CMD_SZ)
|
||||
#define DESC_AEAD_ENC_LEN (DESC_AEAD_BASE + 11 * CAAM_CMD_SZ)
|
||||
#define DESC_AEAD_DEC_LEN (DESC_AEAD_BASE + 15 * CAAM_CMD_SZ)
|
||||
#define DESC_AEAD_GIVENC_LEN (DESC_AEAD_ENC_LEN + 7 * CAAM_CMD_SZ)
|
||||
|
||||
/* Note: Nonce is counted in cdata.keylen */
|
||||
#define DESC_AEAD_CTR_RFC3686_LEN (4 * CAAM_CMD_SZ)
|
||||
|
||||
#define DESC_AEAD_NULL_BASE (3 * CAAM_CMD_SZ)
|
||||
#define DESC_AEAD_NULL_ENC_LEN (DESC_AEAD_NULL_BASE + 11 * CAAM_CMD_SZ)
|
||||
#define DESC_AEAD_NULL_DEC_LEN (DESC_AEAD_NULL_BASE + 13 * CAAM_CMD_SZ)
|
||||
|
||||
#define DESC_GCM_BASE (3 * CAAM_CMD_SZ)
|
||||
#define DESC_GCM_ENC_LEN (DESC_GCM_BASE + 16 * CAAM_CMD_SZ)
|
||||
#define DESC_GCM_DEC_LEN (DESC_GCM_BASE + 12 * CAAM_CMD_SZ)
|
||||
|
||||
#define DESC_RFC4106_BASE (3 * CAAM_CMD_SZ)
|
||||
#define DESC_RFC4106_ENC_LEN (DESC_RFC4106_BASE + 13 * CAAM_CMD_SZ)
|
||||
#define DESC_RFC4106_DEC_LEN (DESC_RFC4106_BASE + 13 * CAAM_CMD_SZ)
|
||||
|
||||
#define DESC_RFC4543_BASE (3 * CAAM_CMD_SZ)
|
||||
#define DESC_RFC4543_ENC_LEN (DESC_RFC4543_BASE + 11 * CAAM_CMD_SZ)
|
||||
#define DESC_RFC4543_DEC_LEN (DESC_RFC4543_BASE + 12 * CAAM_CMD_SZ)
|
||||
|
||||
#define DESC_ABLKCIPHER_BASE (3 * CAAM_CMD_SZ)
|
||||
#define DESC_ABLKCIPHER_ENC_LEN (DESC_ABLKCIPHER_BASE + \
|
||||
20 * CAAM_CMD_SZ)
|
||||
#define DESC_ABLKCIPHER_DEC_LEN (DESC_ABLKCIPHER_BASE + \
|
||||
15 * CAAM_CMD_SZ)
|
||||
|
||||
void cnstr_shdsc_aead_null_encap(u32 * const desc, struct alginfo *adata,
|
||||
unsigned int icvsize);
|
||||
|
||||
void cnstr_shdsc_aead_null_decap(u32 * const desc, struct alginfo *adata,
|
||||
unsigned int icvsize);
|
||||
|
||||
void cnstr_shdsc_aead_encap(u32 * const desc, struct alginfo *cdata,
|
||||
struct alginfo *adata, unsigned int icvsize,
|
||||
const bool is_rfc3686, u32 *nonce,
|
||||
const u32 ctx1_iv_off);
|
||||
|
||||
void cnstr_shdsc_aead_decap(u32 * const desc, struct alginfo *cdata,
|
||||
struct alginfo *adata, unsigned int ivsize,
|
||||
unsigned int icvsize, const bool geniv,
|
||||
const bool is_rfc3686, u32 *nonce,
|
||||
const u32 ctx1_iv_off);
|
||||
|
||||
void cnstr_shdsc_aead_givencap(u32 * const desc, struct alginfo *cdata,
|
||||
struct alginfo *adata, unsigned int ivsize,
|
||||
unsigned int icvsize, const bool is_rfc3686,
|
||||
u32 *nonce, const u32 ctx1_iv_off);
|
||||
|
||||
void cnstr_shdsc_gcm_encap(u32 * const desc, struct alginfo *cdata,
|
||||
unsigned int icvsize);
|
||||
|
||||
void cnstr_shdsc_gcm_decap(u32 * const desc, struct alginfo *cdata,
|
||||
unsigned int icvsize);
|
||||
|
||||
void cnstr_shdsc_rfc4106_encap(u32 * const desc, struct alginfo *cdata,
|
||||
unsigned int icvsize);
|
||||
|
||||
void cnstr_shdsc_rfc4106_decap(u32 * const desc, struct alginfo *cdata,
|
||||
unsigned int icvsize);
|
||||
|
||||
void cnstr_shdsc_rfc4543_encap(u32 * const desc, struct alginfo *cdata,
|
||||
unsigned int icvsize);
|
||||
|
||||
void cnstr_shdsc_rfc4543_decap(u32 * const desc, struct alginfo *cdata,
|
||||
unsigned int icvsize);
|
||||
|
||||
void cnstr_shdsc_ablkcipher_encap(u32 * const desc, struct alginfo *cdata,
|
||||
unsigned int ivsize, const bool is_rfc3686,
|
||||
const u32 ctx1_iv_off);
|
||||
|
||||
void cnstr_shdsc_ablkcipher_decap(u32 * const desc, struct alginfo *cdata,
|
||||
unsigned int ivsize, const bool is_rfc3686,
|
||||
const u32 ctx1_iv_off);
|
||||
|
||||
void cnstr_shdsc_ablkcipher_givencap(u32 * const desc, struct alginfo *cdata,
|
||||
unsigned int ivsize, const bool is_rfc3686,
|
||||
const u32 ctx1_iv_off);
|
||||
|
||||
void cnstr_shdsc_xts_ablkcipher_encap(u32 * const desc, struct alginfo *cdata);
|
||||
|
||||
void cnstr_shdsc_xts_ablkcipher_decap(u32 * const desc, struct alginfo *cdata);
|
||||
|
||||
#endif /* _CAAMALG_DESC_H_ */
|
Loading…
Reference in New Issue
Block a user