1
0
mirror of https://git.openwrt.org/openwrt/openwrt.git synced 2024-06-17 12:43:56 +02:00
openwrt/target/linux/mxs/patches-4.14/110-crypto-mxsdcp-provide-importexport.patch
Hauke Mehrtens 93a48cb1a0 kernel: bump 4.14 to 4.14.248
All updated automatically.

Compile-tested on: lantiq/xrx200, armvirt/64
Runtime-tested on: lantiq/xrx200, armvirt/64

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2021-10-02 16:11:47 +02:00

52 lines
1.3 KiB
Diff

--- a/drivers/crypto/mxs-dcp.c
+++ b/drivers/crypto/mxs-dcp.c
@@ -838,6 +838,24 @@ static void dcp_sha_cra_exit(struct cryp
{
}
+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[] = {
{
@@ -897,8 +915,11 @@ static struct ahash_alg dcp_sha1_alg = {
.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",
@@ -921,8 +942,11 @@ static struct ahash_alg dcp_sha256_alg =
.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",