diff options
author | Luca Boccassi <luca.boccassi@gmail.com> | 2018-11-01 11:59:50 +0000 |
---|---|---|
committer | Luca Boccassi <luca.boccassi@gmail.com> | 2018-11-01 12:00:19 +0000 |
commit | 8d01b9cd70a67cdafd5b965a70420c3bd7fb3f82 (patch) | |
tree | 208e3bc33c220854d89d010e3abf720a2e62e546 /drivers/crypto/dpaa2_sec/hw/desc/algo.h | |
parent | b63264c8342e6a1b6971c79550d2af2024b6a4de (diff) |
New upstream version 18.11-rc1upstream/18.11-rc1
Change-Id: Iaa71986dd6332e878d8f4bf493101b2bbc6313bb
Signed-off-by: Luca Boccassi <luca.boccassi@gmail.com>
Diffstat (limited to 'drivers/crypto/dpaa2_sec/hw/desc/algo.h')
-rw-r--r-- | drivers/crypto/dpaa2_sec/hw/desc/algo.h | 58 |
1 files changed, 29 insertions, 29 deletions
diff --git a/drivers/crypto/dpaa2_sec/hw/desc/algo.h b/drivers/crypto/dpaa2_sec/hw/desc/algo.h index 91f3e067..febcb6d0 100644 --- a/drivers/crypto/dpaa2_sec/hw/desc/algo.h +++ b/drivers/crypto/dpaa2_sec/hw/desc/algo.h @@ -410,6 +410,35 @@ cnstr_shdsc_kasumi_f9(uint32_t *descbuf, bool ps, bool swap, } /** + * cnstr_shdsc_crc - CRC32 Accelerator (IEEE 802 CRC32 protocol mode) + * @descbuf: pointer to descriptor-under-construction buffer + * @swap: must be true when core endianness doesn't match SEC endianness + * + * Return: size of descriptor written in words or negative number on error + */ +static inline int +cnstr_shdsc_crc(uint32_t *descbuf, bool swap) +{ + struct program prg; + struct program *p = &prg; + + PROGRAM_CNTXT_INIT(p, descbuf, 0); + if (swap) + PROGRAM_SET_BSWAP(p); + + SHR_HDR(p, SHR_ALWAYS, 1, 0); + + MATHB(p, SEQINSZ, SUB, MATH2, VSEQINSZ, 4, 0); + ALG_OPERATION(p, OP_ALG_ALGSEL_CRC, + OP_ALG_AAI_802 | OP_ALG_AAI_DOC, + OP_ALG_AS_FINALIZE, 0, DIR_ENC); + SEQFIFOLOAD(p, MSG2, 0, VLF | LAST2); + SEQSTORE(p, CONTEXT2, 0, 4, 0); + + return PROGRAM_FINALIZE(p); +} + +/** * cnstr_shdsc_gcm_encap - AES-GCM encap as a shared descriptor * @descbuf: pointer to descriptor-under-construction buffer * @ps: if 36/40bit addressing is desired, this parameter must be true @@ -614,33 +643,4 @@ cnstr_shdsc_gcm_decap(uint32_t *descbuf, bool ps, bool swap, return PROGRAM_FINALIZE(p); } -/** - * cnstr_shdsc_crc - CRC32 Accelerator (IEEE 802 CRC32 protocol mode) - * @descbuf: pointer to descriptor-under-construction buffer - * @swap: must be true when core endianness doesn't match SEC endianness - * - * Return: size of descriptor written in words or negative number on error - */ -static inline int -cnstr_shdsc_crc(uint32_t *descbuf, bool swap) -{ - struct program prg; - struct program *p = &prg; - - PROGRAM_CNTXT_INIT(p, descbuf, 0); - if (swap) - PROGRAM_SET_BSWAP(p); - - SHR_HDR(p, SHR_ALWAYS, 1, 0); - - MATHB(p, SEQINSZ, SUB, MATH2, VSEQINSZ, 4, 0); - ALG_OPERATION(p, OP_ALG_ALGSEL_CRC, - OP_ALG_AAI_802 | OP_ALG_AAI_DOC, - OP_ALG_AS_FINALIZE, 0, DIR_ENC); - SEQFIFOLOAD(p, MSG2, 0, VLF | LAST2); - SEQSTORE(p, CONTEXT2, 0, 4, 0); - - return PROGRAM_FINALIZE(p); -} - #endif /* __DESC_ALGO_H__ */ |