diff options
author | Tero Kristo <t-kristo@ti.com> | 2016-09-19 11:22:18 -0400 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2016-09-22 06:32:51 -0400 |
commit | a84d351f6b8624cf3e365971f8eab7af8ef690cf (patch) | |
tree | b5681cb671d9ffe150024570b14f37357e88ca80 /drivers/crypto/omap-sham.c | |
parent | 8043bb1ae03cb842cd06a33fb1233e458f6f7f37 (diff) |
crypto: omap-sham - add support for export/import
Now that the driver has been converted to use scatterlists for data
handling, add proper implementation for the export/import stubs also.
Signed-off-by: Tero Kristo <t-kristo@ti.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'drivers/crypto/omap-sham.c')
-rw-r--r-- | drivers/crypto/omap-sham.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/drivers/crypto/omap-sham.c b/drivers/crypto/omap-sham.c index 412559e9b2a1..8eefd793cc82 100644 --- a/drivers/crypto/omap-sham.c +++ b/drivers/crypto/omap-sham.c | |||
@@ -1418,12 +1418,21 @@ static void omap_sham_cra_exit(struct crypto_tfm *tfm) | |||
1418 | 1418 | ||
1419 | static int omap_sham_export(struct ahash_request *req, void *out) | 1419 | static int omap_sham_export(struct ahash_request *req, void *out) |
1420 | { | 1420 | { |
1421 | return -ENOTSUPP; | 1421 | struct omap_sham_reqctx *rctx = ahash_request_ctx(req); |
1422 | |||
1423 | memcpy(out, rctx, sizeof(*rctx) + rctx->bufcnt); | ||
1424 | |||
1425 | return 0; | ||
1422 | } | 1426 | } |
1423 | 1427 | ||
1424 | static int omap_sham_import(struct ahash_request *req, const void *in) | 1428 | static int omap_sham_import(struct ahash_request *req, const void *in) |
1425 | { | 1429 | { |
1426 | return -ENOTSUPP; | 1430 | struct omap_sham_reqctx *rctx = ahash_request_ctx(req); |
1431 | const struct omap_sham_reqctx *ctx_in = in; | ||
1432 | |||
1433 | memcpy(rctx, in, sizeof(*rctx) + ctx_in->bufcnt); | ||
1434 | |||
1435 | return 0; | ||
1427 | } | 1436 | } |
1428 | 1437 | ||
1429 | static struct ahash_alg algs_sha1_md5[] = { | 1438 | static struct ahash_alg algs_sha1_md5[] = { |
@@ -2083,7 +2092,8 @@ static int omap_sham_probe(struct platform_device *pdev) | |||
2083 | alg = &dd->pdata->algs_info[i].algs_list[j]; | 2092 | alg = &dd->pdata->algs_info[i].algs_list[j]; |
2084 | alg->export = omap_sham_export; | 2093 | alg->export = omap_sham_export; |
2085 | alg->import = omap_sham_import; | 2094 | alg->import = omap_sham_import; |
2086 | alg->halg.statesize = sizeof(struct omap_sham_reqctx); | 2095 | alg->halg.statesize = sizeof(struct omap_sham_reqctx) + |
2096 | BUFLEN; | ||
2087 | err = crypto_register_ahash(alg); | 2097 | err = crypto_register_ahash(alg); |
2088 | if (err) | 2098 | if (err) |
2089 | goto err_algs; | 2099 | goto err_algs; |