diff options
Diffstat (limited to 'drivers/crypto/padlock-sha.c')
-rw-r--r-- | drivers/crypto/padlock-sha.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/drivers/crypto/padlock-sha.c b/drivers/crypto/padlock-sha.c index 0af80577dc7b..d3a27e0119bc 100644 --- a/drivers/crypto/padlock-sha.c +++ b/drivers/crypto/padlock-sha.c | |||
@@ -57,6 +57,23 @@ static int padlock_sha_update(struct shash_desc *desc, | |||
57 | return crypto_shash_update(&dctx->fallback, data, length); | 57 | return crypto_shash_update(&dctx->fallback, data, length); |
58 | } | 58 | } |
59 | 59 | ||
60 | static int padlock_sha_export(struct shash_desc *desc, void *out) | ||
61 | { | ||
62 | struct padlock_sha_desc *dctx = shash_desc_ctx(desc); | ||
63 | |||
64 | return crypto_shash_export(&dctx->fallback, out); | ||
65 | } | ||
66 | |||
67 | static int padlock_sha_import(struct shash_desc *desc, const void *in) | ||
68 | { | ||
69 | struct padlock_sha_desc *dctx = shash_desc_ctx(desc); | ||
70 | struct padlock_sha_ctx *ctx = crypto_shash_ctx(desc->tfm); | ||
71 | |||
72 | dctx->fallback.tfm = ctx->fallback; | ||
73 | dctx->fallback.flags = desc->flags & CRYPTO_TFM_REQ_MAY_SLEEP; | ||
74 | return crypto_shash_import(&dctx->fallback, in); | ||
75 | } | ||
76 | |||
60 | static inline void padlock_output_block(uint32_t *src, | 77 | static inline void padlock_output_block(uint32_t *src, |
61 | uint32_t *dst, size_t count) | 78 | uint32_t *dst, size_t count) |
62 | { | 79 | { |
@@ -235,7 +252,10 @@ static struct shash_alg sha1_alg = { | |||
235 | .update = padlock_sha_update, | 252 | .update = padlock_sha_update, |
236 | .finup = padlock_sha1_finup, | 253 | .finup = padlock_sha1_finup, |
237 | .final = padlock_sha1_final, | 254 | .final = padlock_sha1_final, |
255 | .export = padlock_sha_export, | ||
256 | .import = padlock_sha_import, | ||
238 | .descsize = sizeof(struct padlock_sha_desc), | 257 | .descsize = sizeof(struct padlock_sha_desc), |
258 | .statesize = sizeof(struct sha1_state), | ||
239 | .base = { | 259 | .base = { |
240 | .cra_name = "sha1", | 260 | .cra_name = "sha1", |
241 | .cra_driver_name = "sha1-padlock", | 261 | .cra_driver_name = "sha1-padlock", |
@@ -256,7 +276,10 @@ static struct shash_alg sha256_alg = { | |||
256 | .update = padlock_sha_update, | 276 | .update = padlock_sha_update, |
257 | .finup = padlock_sha256_finup, | 277 | .finup = padlock_sha256_finup, |
258 | .final = padlock_sha256_final, | 278 | .final = padlock_sha256_final, |
279 | .export = padlock_sha_export, | ||
280 | .import = padlock_sha_import, | ||
259 | .descsize = sizeof(struct padlock_sha_desc), | 281 | .descsize = sizeof(struct padlock_sha_desc), |
282 | .statesize = sizeof(struct sha256_state), | ||
260 | .base = { | 283 | .base = { |
261 | .cra_name = "sha256", | 284 | .cra_name = "sha256", |
262 | .cra_driver_name = "sha256-padlock", | 285 | .cra_driver_name = "sha256-padlock", |