Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

crypto: caam - fix SHA support detection

The addition of Chacha20 + Poly1305 authenc support inadvertently broke
detection of algorithms supported by MDHA (Message Digest Hardware
Accelerator), fix it.

Fixes: d6bbd4eea243 ("crypto: caam/jr - add support for Chacha20 + Poly1305")
Signed-off-by: Horia Geantă <horia.geanta@nxp.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

authored by

Horia Geantă and committed by
Herbert Xu
2dd3fde4 04e6d25c

+11 -1
+1 -1
drivers/crypto/caam/caamalg.c
··· 3476 3476 * Skip algorithms requiring message digests 3477 3477 * if MD or MD size is not supported by device. 3478 3478 */ 3479 - if ((c2_alg_sel & ~OP_ALG_ALGSEL_SUBMASK) == 0x40 && 3479 + if (is_mdha(c2_alg_sel) && 3480 3480 (!md_inst || t_alg->aead.maxauthsize > md_limit)) 3481 3481 continue; 3482 3482
+1
drivers/crypto/caam/desc.h
··· 1155 1155 #define OP_ALG_ALGSEL_DES (0x20 << OP_ALG_ALGSEL_SHIFT) 1156 1156 #define OP_ALG_ALGSEL_3DES (0x21 << OP_ALG_ALGSEL_SHIFT) 1157 1157 #define OP_ALG_ALGSEL_ARC4 (0x30 << OP_ALG_ALGSEL_SHIFT) 1158 + #define OP_ALG_CHA_MDHA (0x40 << OP_ALG_ALGSEL_SHIFT) 1158 1159 #define OP_ALG_ALGSEL_MD5 (0x40 << OP_ALG_ALGSEL_SHIFT) 1159 1160 #define OP_ALG_ALGSEL_SHA1 (0x41 << OP_ALG_ALGSEL_SHIFT) 1160 1161 #define OP_ALG_ALGSEL_SHA224 (0x42 << OP_ALG_ALGSEL_SHIFT)
+9
drivers/crypto/caam/error.h
··· 7 7 8 8 #ifndef CAAM_ERROR_H 9 9 #define CAAM_ERROR_H 10 + 11 + #include "desc.h" 12 + 10 13 #define CAAM_ERROR_STR_MAX 302 11 14 12 15 void caam_strstatus(struct device *dev, u32 status, bool qi_v2); ··· 20 17 void caam_dump_sg(const char *level, const char *prefix_str, int prefix_type, 21 18 int rowsize, int groupsize, struct scatterlist *sg, 22 19 size_t tlen, bool ascii); 20 + 21 + static inline bool is_mdha(u32 algtype) 22 + { 23 + return (algtype & OP_ALG_ALGSEL_MASK & ~OP_ALG_ALGSEL_SUBMASK) == 24 + OP_ALG_CHA_MDHA; 25 + } 23 26 #endif /* CAAM_ERROR_H */