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: arm/sha512 - Use API partial block handling

Use the Crypto API partial block handling.

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

+11 -17
+11 -17
arch/arm64/crypto/sha512-glue.c
··· 6 6 */ 7 7 8 8 #include <crypto/internal/hash.h> 9 - #include <linux/kernel.h> 10 - #include <linux/module.h> 11 9 #include <crypto/sha2.h> 12 10 #include <crypto/sha512_base.h> 11 + #include <linux/kernel.h> 12 + #include <linux/module.h> 13 13 14 14 MODULE_DESCRIPTION("SHA-384/SHA-512 secure hash for arm64"); 15 15 MODULE_AUTHOR("Andy Polyakov <appro@openssl.org>"); ··· 20 20 21 21 asmlinkage void sha512_block_data_order(u64 *digest, const void *data, 22 22 unsigned int num_blks); 23 - EXPORT_SYMBOL(sha512_block_data_order); 24 23 25 24 static void sha512_arm64_transform(struct sha512_state *sst, u8 const *src, 26 25 int blocks) ··· 30 31 static int sha512_update(struct shash_desc *desc, const u8 *data, 31 32 unsigned int len) 32 33 { 33 - return sha512_base_do_update(desc, data, len, sha512_arm64_transform); 34 + return sha512_base_do_update_blocks(desc, data, len, 35 + sha512_arm64_transform); 34 36 } 35 37 36 38 static int sha512_finup(struct shash_desc *desc, const u8 *data, 37 39 unsigned int len, u8 *out) 38 40 { 39 - if (len) 40 - sha512_base_do_update(desc, data, len, sha512_arm64_transform); 41 - sha512_base_do_finalize(desc, sha512_arm64_transform); 42 - 41 + sha512_base_do_finup(desc, data, len, sha512_arm64_transform); 43 42 return sha512_base_finish(desc, out); 44 - } 45 - 46 - static int sha512_final(struct shash_desc *desc, u8 *out) 47 - { 48 - return sha512_finup(desc, NULL, 0, out); 49 43 } 50 44 51 45 static struct shash_alg algs[] = { { 52 46 .digestsize = SHA512_DIGEST_SIZE, 53 47 .init = sha512_base_init, 54 48 .update = sha512_update, 55 - .final = sha512_final, 56 49 .finup = sha512_finup, 57 - .descsize = sizeof(struct sha512_state), 50 + .descsize = SHA512_STATE_SIZE, 58 51 .base.cra_name = "sha512", 59 52 .base.cra_driver_name = "sha512-arm64", 60 53 .base.cra_priority = 150, 54 + .base.cra_flags = CRYPTO_AHASH_ALG_BLOCK_ONLY | 55 + CRYPTO_AHASH_ALG_FINUP_MAX, 61 56 .base.cra_blocksize = SHA512_BLOCK_SIZE, 62 57 .base.cra_module = THIS_MODULE, 63 58 }, { 64 59 .digestsize = SHA384_DIGEST_SIZE, 65 60 .init = sha384_base_init, 66 61 .update = sha512_update, 67 - .final = sha512_final, 68 62 .finup = sha512_finup, 69 - .descsize = sizeof(struct sha512_state), 63 + .descsize = SHA512_STATE_SIZE, 70 64 .base.cra_name = "sha384", 71 65 .base.cra_driver_name = "sha384-arm64", 72 66 .base.cra_priority = 150, 67 + .base.cra_flags = CRYPTO_AHASH_ALG_BLOCK_ONLY | 68 + CRYPTO_AHASH_ALG_FINUP_MAX, 73 69 .base.cra_blocksize = SHA384_BLOCK_SIZE, 74 70 .base.cra_module = THIS_MODULE, 75 71 } };