1 From: Fabio Estevam <fabio.estevam@nxp.com>
3 Currently the mxs-dcp driver fails to probe:
5 mxs-dcp 80028000.dcp: Failed to register sha1 hash!
6 mxs-dcp: probe of 80028000.dcp failed with error -22
8 This happens since commit 8996eafdcbad ("crypto: ahash - ensure statesize
9 is non-zero"), which requires statesize to be filled.
11 Other than filling statesize, we also need to provide the import/export
14 Based on the implementation of the sahara and caam drivers.
16 Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
19 - Newly introduced in this series
21 drivers/crypto/mxs-dcp.c | 24 ++++++++++++++++++++++++
22 1 file changed, 24 insertions(+)
24 diff --git a/drivers/crypto/mxs-dcp.c b/drivers/crypto/mxs-dcp.c
25 index 59ed54e..1e2017f 100644
26 --- a/drivers/crypto/mxs-dcp.c
27 +++ b/drivers/crypto/mxs-dcp.c
28 @@ -775,6 +775,24 @@ static void dcp_sha_cra_exit(struct crypto_tfm *tfm)
32 +static int dcp_sha_export(struct ahash_request *req, void *out)
34 + struct dcp_sha_req_ctx *rctx = ahash_request_ctx(req);
36 + memcpy(out, rctx, sizeof(struct dcp_sha_req_ctx));
41 +static int dcp_sha_import(struct ahash_request *req, const void *in)
43 + struct dcp_sha_req_ctx *rctx = ahash_request_ctx(req);
45 + memcpy(rctx, in, sizeof(struct dcp_sha_req_ctx));
50 /* AES 128 ECB and AES 128 CBC */
51 static struct crypto_alg dcp_aes_algs[] = {
53 @@ -834,8 +852,11 @@ static struct ahash_alg dcp_sha1_alg = {
54 .final = dcp_sha_final,
55 .finup = dcp_sha_finup,
56 .digest = dcp_sha_digest,
57 + .import = dcp_sha_import,
58 + .export = dcp_sha_export,
60 .digestsize = SHA1_DIGEST_SIZE,
61 + .statesize = sizeof(struct dcp_sha_req_ctx),
64 .cra_driver_name = "sha1-dcp",
65 @@ -858,8 +879,11 @@ static struct ahash_alg dcp_sha256_alg = {
66 .final = dcp_sha_final,
67 .finup = dcp_sha_finup,
68 .digest = dcp_sha_digest,
69 + .import = dcp_sha_import,
70 + .export = dcp_sha_export,
72 .digestsize = SHA256_DIGEST_SIZE,
73 + .statesize = sizeof(struct dcp_sha_req_ctx),
76 .cra_driver_name = "sha256-dcp",