mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-19 18:53:52 +08:00
crypto: caam - trivial code clean-up
-replace offsetof with container_of -remove unused "assoc_nents", "iv_dma" from aead_edesc and fix comments -remove unused CAAM_MAX_IV_LENGTH #define 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
1b008eedb0
commit
4ca7c7d8fe
@ -62,8 +62,6 @@
|
||||
#define CAAM_MAX_KEY_SIZE (AES_MAX_KEY_SIZE + \
|
||||
CTR_RFC3686_NONCE_SIZE + \
|
||||
SHA512_DIGEST_SIZE * 2)
|
||||
/* max IV is max of AES_BLOCK_SIZE, DES3_EDE_BLOCK_SIZE */
|
||||
#define CAAM_MAX_IV_LENGTH 16
|
||||
|
||||
#define AEAD_DESC_JOB_IO_LEN (DESC_JOB_IO_LEN + CAAM_CMD_SZ * 2)
|
||||
#define GCM_DESC_JOB_IO_LEN (AEAD_DESC_JOB_IO_LEN + \
|
||||
@ -1873,20 +1871,16 @@ static int xts_ablkcipher_setkey(struct crypto_ablkcipher *ablkcipher,
|
||||
|
||||
/*
|
||||
* aead_edesc - s/w-extended aead descriptor
|
||||
* @assoc_nents: number of segments in associated data (SPI+Seq) scatterlist
|
||||
* @src_nents: number of segments in input scatterlist
|
||||
* @dst_nents: number of segments in output scatterlist
|
||||
* @iv_dma: dma address of iv for checking continuity and link table
|
||||
* @desc: h/w descriptor (variable length; must not exceed MAX_CAAM_DESCSIZE)
|
||||
* @sec4_sg_bytes: length of dma mapped sec4_sg space
|
||||
* @sec4_sg_dma: bus physical mapped address of h/w link table
|
||||
* @sec4_sg: pointer to h/w link table
|
||||
* @hw_desc: the h/w job descriptor followed by any referenced link tables
|
||||
*/
|
||||
struct aead_edesc {
|
||||
int assoc_nents;
|
||||
int src_nents;
|
||||
int dst_nents;
|
||||
dma_addr_t iv_dma;
|
||||
int sec4_sg_bytes;
|
||||
dma_addr_t sec4_sg_dma;
|
||||
struct sec4_sg_entry *sec4_sg;
|
||||
@ -1898,9 +1892,9 @@ struct aead_edesc {
|
||||
* @src_nents: number of segments in input scatterlist
|
||||
* @dst_nents: number of segments in output scatterlist
|
||||
* @iv_dma: dma address of iv for checking continuity and link table
|
||||
* @desc: h/w descriptor (variable length; must not exceed MAX_CAAM_DESCSIZE)
|
||||
* @sec4_sg_bytes: length of dma mapped sec4_sg space
|
||||
* @sec4_sg_dma: bus physical mapped address of h/w link table
|
||||
* @sec4_sg: pointer to h/w link table
|
||||
* @hw_desc: the h/w job descriptor followed by any referenced link tables
|
||||
*/
|
||||
struct ablkcipher_edesc {
|
||||
@ -2017,8 +2011,7 @@ static void ablkcipher_encrypt_done(struct device *jrdev, u32 *desc, u32 err,
|
||||
dev_err(jrdev, "%s %d: err 0x%x\n", __func__, __LINE__, err);
|
||||
#endif
|
||||
|
||||
edesc = (struct ablkcipher_edesc *)((char *)desc -
|
||||
offsetof(struct ablkcipher_edesc, hw_desc));
|
||||
edesc = container_of(desc, struct ablkcipher_edesc, hw_desc[0]);
|
||||
|
||||
if (err)
|
||||
caam_jr_strstatus(jrdev, err);
|
||||
@ -2050,8 +2043,7 @@ static void ablkcipher_decrypt_done(struct device *jrdev, u32 *desc, u32 err,
|
||||
dev_err(jrdev, "%s %d: err 0x%x\n", __func__, __LINE__, err);
|
||||
#endif
|
||||
|
||||
edesc = (struct ablkcipher_edesc *)((char *)desc -
|
||||
offsetof(struct ablkcipher_edesc, hw_desc));
|
||||
edesc = container_of(desc, struct ablkcipher_edesc, hw_desc[0]);
|
||||
if (err)
|
||||
caam_jr_strstatus(jrdev, err);
|
||||
|
||||
|
@ -636,8 +636,7 @@ static void ahash_done(struct device *jrdev, u32 *desc, u32 err,
|
||||
dev_err(jrdev, "%s %d: err 0x%x\n", __func__, __LINE__, err);
|
||||
#endif
|
||||
|
||||
edesc = (struct ahash_edesc *)((char *)desc -
|
||||
offsetof(struct ahash_edesc, hw_desc));
|
||||
edesc = container_of(desc, struct ahash_edesc, hw_desc[0]);
|
||||
if (err)
|
||||
caam_jr_strstatus(jrdev, err);
|
||||
|
||||
@ -671,8 +670,7 @@ static void ahash_done_bi(struct device *jrdev, u32 *desc, u32 err,
|
||||
dev_err(jrdev, "%s %d: err 0x%x\n", __func__, __LINE__, err);
|
||||
#endif
|
||||
|
||||
edesc = (struct ahash_edesc *)((char *)desc -
|
||||
offsetof(struct ahash_edesc, hw_desc));
|
||||
edesc = container_of(desc, struct ahash_edesc, hw_desc[0]);
|
||||
if (err)
|
||||
caam_jr_strstatus(jrdev, err);
|
||||
|
||||
@ -706,8 +704,7 @@ static void ahash_done_ctx_src(struct device *jrdev, u32 *desc, u32 err,
|
||||
dev_err(jrdev, "%s %d: err 0x%x\n", __func__, __LINE__, err);
|
||||
#endif
|
||||
|
||||
edesc = (struct ahash_edesc *)((char *)desc -
|
||||
offsetof(struct ahash_edesc, hw_desc));
|
||||
edesc = container_of(desc, struct ahash_edesc, hw_desc[0]);
|
||||
if (err)
|
||||
caam_jr_strstatus(jrdev, err);
|
||||
|
||||
@ -741,8 +738,7 @@ static void ahash_done_ctx_dst(struct device *jrdev, u32 *desc, u32 err,
|
||||
dev_err(jrdev, "%s %d: err 0x%x\n", __func__, __LINE__, err);
|
||||
#endif
|
||||
|
||||
edesc = (struct ahash_edesc *)((char *)desc -
|
||||
offsetof(struct ahash_edesc, hw_desc));
|
||||
edesc = container_of(desc, struct ahash_edesc, hw_desc[0]);
|
||||
if (err)
|
||||
caam_jr_strstatus(jrdev, err);
|
||||
|
||||
|
@ -100,8 +100,7 @@ static void rng_done(struct device *jrdev, u32 *desc, u32 err, void *context)
|
||||
{
|
||||
struct buf_data *bd;
|
||||
|
||||
bd = (struct buf_data *)((char *)desc -
|
||||
offsetof(struct buf_data, hw_desc));
|
||||
bd = container_of(desc, struct buf_data, hw_desc[0]);
|
||||
|
||||
if (err)
|
||||
caam_jr_strstatus(jrdev, err);
|
||||
|
Loading…
Reference in New Issue
Block a user