Skip to content

Commit a84d351

Browse files
Tero Kristoherbertx
authored andcommitted
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 <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
1 parent 8043bb1 commit a84d351

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

drivers/crypto/omap-sham.c

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1418,12 +1418,21 @@ static void omap_sham_cra_exit(struct crypto_tfm *tfm)
14181418

14191419
static int omap_sham_export(struct ahash_request *req, void *out)
14201420
{
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;
14221426
}
14231427

14241428
static int omap_sham_import(struct ahash_request *req, const void *in)
14251429
{
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;
14271436
}
14281437

14291438
static struct ahash_alg algs_sha1_md5[] = {
@@ -2083,7 +2092,8 @@ static int omap_sham_probe(struct platform_device *pdev)
20832092
alg = &dd->pdata->algs_info[i].algs_list[j];
20842093
alg->export = omap_sham_export;
20852094
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;
20872097
err = crypto_register_ahash(alg);
20882098
if (err)
20892099
goto err_algs;

0 commit comments

Comments
 (0)