diff options
Diffstat (limited to 'arch/s390/crypto/sha256_s390.c')
| -rw-r--r-- | arch/s390/crypto/sha256_s390.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/arch/s390/crypto/sha256_s390.c b/arch/s390/crypto/sha256_s390.c index f9fefc569632..61a7db372121 100644 --- a/arch/s390/crypto/sha256_s390.c +++ b/arch/s390/crypto/sha256_s390.c | |||
| @@ -42,12 +42,38 @@ static int sha256_init(struct shash_desc *desc) | |||
| 42 | return 0; | 42 | return 0; |
| 43 | } | 43 | } |
| 44 | 44 | ||
| 45 | static int sha256_export(struct shash_desc *desc, void *out) | ||
| 46 | { | ||
| 47 | struct s390_sha_ctx *sctx = shash_desc_ctx(desc); | ||
| 48 | struct sha256_state *octx = out; | ||
| 49 | |||
| 50 | octx->count = sctx->count; | ||
| 51 | memcpy(octx->state, sctx->state, sizeof(octx->state)); | ||
| 52 | memcpy(octx->buf, sctx->buf, sizeof(octx->buf)); | ||
| 53 | return 0; | ||
| 54 | } | ||
| 55 | |||
| 56 | static int sha256_import(struct shash_desc *desc, const void *in) | ||
| 57 | { | ||
| 58 | struct s390_sha_ctx *sctx = shash_desc_ctx(desc); | ||
| 59 | const struct sha256_state *ictx = in; | ||
| 60 | |||
| 61 | sctx->count = ictx->count; | ||
| 62 | memcpy(sctx->state, ictx->state, sizeof(ictx->state)); | ||
| 63 | memcpy(sctx->buf, ictx->buf, sizeof(ictx->buf)); | ||
| 64 | sctx->func = KIMD_SHA_256; | ||
| 65 | return 0; | ||
| 66 | } | ||
| 67 | |||
| 45 | static struct shash_alg alg = { | 68 | static struct shash_alg alg = { |
| 46 | .digestsize = SHA256_DIGEST_SIZE, | 69 | .digestsize = SHA256_DIGEST_SIZE, |
| 47 | .init = sha256_init, | 70 | .init = sha256_init, |
| 48 | .update = s390_sha_update, | 71 | .update = s390_sha_update, |
| 49 | .final = s390_sha_final, | 72 | .final = s390_sha_final, |
| 73 | .export = sha256_export, | ||
| 74 | .import = sha256_import, | ||
| 50 | .descsize = sizeof(struct s390_sha_ctx), | 75 | .descsize = sizeof(struct s390_sha_ctx), |
| 76 | .statesize = sizeof(struct sha256_state), | ||
| 51 | .base = { | 77 | .base = { |
| 52 | .cra_name = "sha256", | 78 | .cra_name = "sha256", |
| 53 | .cra_driver_name= "sha256-s390", | 79 | .cra_driver_name= "sha256-s390", |
