diff options
| author | Horia Geantă <horia.geanta@nxp.com> | 2018-12-21 07:47:46 -0500 |
|---|---|---|
| committer | Herbert Xu <herbert@gondor.apana.org.au> | 2019-01-10 08:37:31 -0500 |
| commit | 2dd3fde41bf3dc68e38de23da87e72a07719b708 (patch) | |
| tree | 15a68d8de0dfa57a3db654230c26a4683e41d752 | |
| parent | 04e6d25c5bb244c1a37eb9fe0b604cc11a04e8c5 (diff) | |
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>
| -rw-r--r-- | drivers/crypto/caam/caamalg.c | 2 | ||||
| -rw-r--r-- | drivers/crypto/caam/desc.h | 1 | ||||
| -rw-r--r-- | drivers/crypto/caam/error.h | 9 |
3 files changed, 11 insertions, 1 deletions
diff --git a/drivers/crypto/caam/caamalg.c b/drivers/crypto/caam/caamalg.c index 92e593e2069a..80ae69f906fb 100644 --- a/drivers/crypto/caam/caamalg.c +++ b/drivers/crypto/caam/caamalg.c | |||
| @@ -3476,7 +3476,7 @@ static int __init caam_algapi_init(void) | |||
| 3476 | * Skip algorithms requiring message digests | 3476 | * Skip algorithms requiring message digests |
| 3477 | * if MD or MD size is not supported by device. | 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 | (!md_inst || t_alg->aead.maxauthsize > md_limit)) | 3480 | (!md_inst || t_alg->aead.maxauthsize > md_limit)) |
| 3481 | continue; | 3481 | continue; |
| 3482 | 3482 | ||
diff --git a/drivers/crypto/caam/desc.h b/drivers/crypto/caam/desc.h index ec10230178c5..4b6854bf896a 100644 --- a/drivers/crypto/caam/desc.h +++ b/drivers/crypto/caam/desc.h | |||
| @@ -1155,6 +1155,7 @@ | |||
| 1155 | #define OP_ALG_ALGSEL_DES (0x20 << OP_ALG_ALGSEL_SHIFT) | 1155 | #define OP_ALG_ALGSEL_DES (0x20 << OP_ALG_ALGSEL_SHIFT) |
| 1156 | #define OP_ALG_ALGSEL_3DES (0x21 << OP_ALG_ALGSEL_SHIFT) | 1156 | #define OP_ALG_ALGSEL_3DES (0x21 << OP_ALG_ALGSEL_SHIFT) |
| 1157 | #define OP_ALG_ALGSEL_ARC4 (0x30 << OP_ALG_ALGSEL_SHIFT) | 1157 | #define OP_ALG_ALGSEL_ARC4 (0x30 << OP_ALG_ALGSEL_SHIFT) |
| 1158 | #define OP_ALG_CHA_MDHA (0x40 << OP_ALG_ALGSEL_SHIFT) | ||
| 1158 | #define OP_ALG_ALGSEL_MD5 (0x40 << OP_ALG_ALGSEL_SHIFT) | 1159 | #define OP_ALG_ALGSEL_MD5 (0x40 << OP_ALG_ALGSEL_SHIFT) |
| 1159 | #define OP_ALG_ALGSEL_SHA1 (0x41 << OP_ALG_ALGSEL_SHIFT) | 1160 | #define OP_ALG_ALGSEL_SHA1 (0x41 << OP_ALG_ALGSEL_SHIFT) |
| 1160 | #define OP_ALG_ALGSEL_SHA224 (0x42 << OP_ALG_ALGSEL_SHIFT) | 1161 | #define OP_ALG_ALGSEL_SHA224 (0x42 << OP_ALG_ALGSEL_SHIFT) |
diff --git a/drivers/crypto/caam/error.h b/drivers/crypto/caam/error.h index 67ea94079837..8c6b83e02a70 100644 --- a/drivers/crypto/caam/error.h +++ b/drivers/crypto/caam/error.h | |||
| @@ -7,6 +7,9 @@ | |||
| 7 | 7 | ||
| 8 | #ifndef CAAM_ERROR_H | 8 | #ifndef CAAM_ERROR_H |
| 9 | #define CAAM_ERROR_H | 9 | #define CAAM_ERROR_H |
| 10 | |||
| 11 | #include "desc.h" | ||
| 12 | |||
| 10 | #define CAAM_ERROR_STR_MAX 302 | 13 | #define CAAM_ERROR_STR_MAX 302 |
| 11 | 14 | ||
| 12 | void caam_strstatus(struct device *dev, u32 status, bool qi_v2); | 15 | void caam_strstatus(struct device *dev, u32 status, bool qi_v2); |
| @@ -17,4 +20,10 @@ void caam_strstatus(struct device *dev, u32 status, bool qi_v2); | |||
| 17 | void caam_dump_sg(const char *level, const char *prefix_str, int prefix_type, | 20 | void caam_dump_sg(const char *level, const char *prefix_str, int prefix_type, |
| 18 | int rowsize, int groupsize, struct scatterlist *sg, | 21 | int rowsize, int groupsize, struct scatterlist *sg, |
| 19 | size_t tlen, bool ascii); | 22 | size_t tlen, bool ascii); |
| 23 | |||
| 24 | static inline bool is_mdha(u32 algtype) | ||
| 25 | { | ||
| 26 | return (algtype & OP_ALG_ALGSEL_MASK & ~OP_ALG_ALGSEL_SUBMASK) == | ||
| 27 | OP_ALG_CHA_MDHA; | ||
| 28 | } | ||
| 20 | #endif /* CAAM_ERROR_H */ | 29 | #endif /* CAAM_ERROR_H */ |
