Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

crypto: s390/sha256 - Use API partial block handling

Use the Crypto API partial block handling.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

+18 -17
+18 -17
arch/s390/crypto/sha256_s390.c
··· 8 8 * Copyright IBM Corp. 2005, 2011 9 9 * Author(s): Jan Glauber (jang@de.ibm.com) 10 10 */ 11 - #include <crypto/internal/hash.h> 12 - #include <linux/init.h> 13 - #include <linux/module.h> 14 - #include <linux/cpufeature.h> 15 - #include <crypto/sha2.h> 16 11 #include <asm/cpacf.h> 12 + #include <crypto/internal/hash.h> 13 + #include <crypto/sha2.h> 14 + #include <linux/cpufeature.h> 15 + #include <linux/kernel.h> 16 + #include <linux/module.h> 17 + #include <linux/string.h> 17 18 18 19 #include "sha.h" 19 20 ··· 39 38 static int sha256_export(struct shash_desc *desc, void *out) 40 39 { 41 40 struct s390_sha_ctx *sctx = shash_desc_ctx(desc); 42 - struct sha256_state *octx = out; 41 + struct crypto_sha256_state *octx = out; 43 42 44 43 octx->count = sctx->count; 45 44 memcpy(octx->state, sctx->state, sizeof(octx->state)); 46 - memcpy(octx->buf, sctx->buf, sizeof(octx->buf)); 47 45 return 0; 48 46 } 49 47 50 48 static int sha256_import(struct shash_desc *desc, const void *in) 51 49 { 52 50 struct s390_sha_ctx *sctx = shash_desc_ctx(desc); 53 - const struct sha256_state *ictx = in; 51 + const struct crypto_sha256_state *ictx = in; 54 52 55 53 sctx->count = ictx->count; 56 54 memcpy(sctx->state, ictx->state, sizeof(ictx->state)); 57 - memcpy(sctx->buf, ictx->buf, sizeof(ictx->buf)); 58 55 sctx->func = CPACF_KIMD_SHA_256; 59 56 return 0; 60 57 } ··· 60 61 static struct shash_alg sha256_alg = { 61 62 .digestsize = SHA256_DIGEST_SIZE, 62 63 .init = s390_sha256_init, 63 - .update = s390_sha_update, 64 - .final = s390_sha_final, 64 + .update = s390_sha_update_blocks, 65 + .finup = s390_sha_finup, 65 66 .export = sha256_export, 66 67 .import = sha256_import, 67 - .descsize = sizeof(struct s390_sha_ctx), 68 - .statesize = sizeof(struct sha256_state), 68 + .descsize = S390_SHA_CTX_SIZE, 69 + .statesize = sizeof(struct crypto_sha256_state), 69 70 .base = { 70 71 .cra_name = "sha256", 71 72 .cra_driver_name= "sha256-s390", 72 73 .cra_priority = 300, 74 + .cra_flags = CRYPTO_AHASH_ALG_BLOCK_ONLY, 73 75 .cra_blocksize = SHA256_BLOCK_SIZE, 74 76 .cra_module = THIS_MODULE, 75 77 } ··· 97 97 static struct shash_alg sha224_alg = { 98 98 .digestsize = SHA224_DIGEST_SIZE, 99 99 .init = s390_sha224_init, 100 - .update = s390_sha_update, 101 - .final = s390_sha_final, 100 + .update = s390_sha_update_blocks, 101 + .finup = s390_sha_finup, 102 102 .export = sha256_export, 103 103 .import = sha256_import, 104 - .descsize = sizeof(struct s390_sha_ctx), 105 - .statesize = sizeof(struct sha256_state), 104 + .descsize = S390_SHA_CTX_SIZE, 105 + .statesize = sizeof(struct crypto_sha256_state), 106 106 .base = { 107 107 .cra_name = "sha224", 108 108 .cra_driver_name= "sha224-s390", 109 109 .cra_priority = 300, 110 + .cra_flags = CRYPTO_AHASH_ALG_BLOCK_ONLY, 110 111 .cra_blocksize = SHA224_BLOCK_SIZE, 111 112 .cra_module = THIS_MODULE, 112 113 }