2016-01-19 22:05:05 +00:00
|
|
|
From: Fabio Estevam <fabio.estevam@nxp.com>
|
|
|
|
|
|
|
|
Currently the mxs-dcp driver fails to probe:
|
|
|
|
|
|
|
|
mxs-dcp 80028000.dcp: Failed to register sha1 hash!
|
|
|
|
mxs-dcp: probe of 80028000.dcp failed with error -22
|
|
|
|
|
|
|
|
This happens since commit 8996eafdcbad ("crypto: ahash - ensure statesize
|
|
|
|
is non-zero"), which requires statesize to be filled.
|
|
|
|
|
|
|
|
Other than filling statesize, we also need to provide the import/export
|
|
|
|
functions.
|
|
|
|
|
|
|
|
Based on the implementation of the sahara and caam drivers.
|
|
|
|
|
|
|
|
Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
|
|
|
|
---
|
|
|
|
Changes since v2:
|
|
|
|
- Newly introduced in this series
|
|
|
|
|
|
|
|
drivers/crypto/mxs-dcp.c | 24 ++++++++++++++++++++++++
|
|
|
|
1 file changed, 24 insertions(+)
|
|
|
|
|
|
|
|
--- a/drivers/crypto/mxs-dcp.c
|
|
|
|
+++ b/drivers/crypto/mxs-dcp.c
|
2018-12-17 13:30:40 +00:00
|
|
|
@@ -782,6 +782,24 @@ static void dcp_sha_cra_exit(struct cryp
|
2016-01-19 22:05:05 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
+static int dcp_sha_export(struct ahash_request *req, void *out)
|
|
|
|
+{
|
|
|
|
+ struct dcp_sha_req_ctx *rctx = ahash_request_ctx(req);
|
|
|
|
+
|
|
|
|
+ memcpy(out, rctx, sizeof(struct dcp_sha_req_ctx));
|
|
|
|
+
|
|
|
|
+ return 0;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+static int dcp_sha_import(struct ahash_request *req, const void *in)
|
|
|
|
+{
|
|
|
|
+ struct dcp_sha_req_ctx *rctx = ahash_request_ctx(req);
|
|
|
|
+
|
|
|
|
+ memcpy(rctx, in, sizeof(struct dcp_sha_req_ctx));
|
|
|
|
+
|
|
|
|
+ return 0;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
/* AES 128 ECB and AES 128 CBC */
|
|
|
|
static struct crypto_alg dcp_aes_algs[] = {
|
|
|
|
{
|
2018-12-17 13:30:40 +00:00
|
|
|
@@ -841,8 +859,11 @@ static struct ahash_alg dcp_sha1_alg = {
|
2016-01-19 22:05:05 +00:00
|
|
|
.final = dcp_sha_final,
|
|
|
|
.finup = dcp_sha_finup,
|
|
|
|
.digest = dcp_sha_digest,
|
|
|
|
+ .import = dcp_sha_import,
|
|
|
|
+ .export = dcp_sha_export,
|
|
|
|
.halg = {
|
|
|
|
.digestsize = SHA1_DIGEST_SIZE,
|
|
|
|
+ .statesize = sizeof(struct dcp_sha_req_ctx),
|
|
|
|
.base = {
|
|
|
|
.cra_name = "sha1",
|
|
|
|
.cra_driver_name = "sha1-dcp",
|
2018-12-17 13:30:40 +00:00
|
|
|
@@ -865,8 +886,11 @@ static struct ahash_alg dcp_sha256_alg =
|
2016-01-19 22:05:05 +00:00
|
|
|
.final = dcp_sha_final,
|
|
|
|
.finup = dcp_sha_finup,
|
|
|
|
.digest = dcp_sha_digest,
|
|
|
|
+ .import = dcp_sha_import,
|
|
|
|
+ .export = dcp_sha_export,
|
|
|
|
.halg = {
|
|
|
|
.digestsize = SHA256_DIGEST_SIZE,
|
|
|
|
+ .statesize = sizeof(struct dcp_sha_req_ctx),
|
|
|
|
.base = {
|
|
|
|
.cra_name = "sha256",
|
|
|
|
.cra_driver_name = "sha256-dcp",
|