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-asm - Use API partial block handling

Use the Crypto API partial block handling.

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

+16 -26
+16 -20
arch/arm/crypto/sha512-glue.c
··· 5 5 * Copyright (C) 2015 Linaro Ltd <ard.biesheuvel@linaro.org> 6 6 */ 7 7 8 + #include <asm/hwcap.h> 9 + #include <asm/neon.h> 8 10 #include <crypto/internal/hash.h> 9 11 #include <crypto/sha2.h> 10 12 #include <crypto/sha512_base.h> 11 - #include <linux/crypto.h> 13 + #include <linux/kernel.h> 12 14 #include <linux/module.h> 13 - 14 - #include <asm/hwcap.h> 15 - #include <asm/neon.h> 16 15 17 16 #include "sha512.h" 18 17 ··· 27 28 asmlinkage void sha512_block_data_order(struct sha512_state *state, 28 29 u8 const *src, int blocks); 29 30 30 - int sha512_arm_update(struct shash_desc *desc, const u8 *data, 31 - unsigned int len) 31 + static int sha512_arm_update(struct shash_desc *desc, const u8 *data, 32 + unsigned int len) 32 33 { 33 - return sha512_base_do_update(desc, data, len, sha512_block_data_order); 34 + return sha512_base_do_update_blocks(desc, data, len, 35 + sha512_block_data_order); 34 36 } 35 37 36 - static int sha512_arm_final(struct shash_desc *desc, u8 *out) 38 + static int sha512_arm_finup(struct shash_desc *desc, const u8 *data, 39 + unsigned int len, u8 *out) 37 40 { 38 - sha512_base_do_finalize(desc, sha512_block_data_order); 41 + sha512_base_do_finup(desc, data, len, sha512_block_data_order); 39 42 return sha512_base_finish(desc, out); 40 - } 41 - 42 - int sha512_arm_finup(struct shash_desc *desc, const u8 *data, 43 - unsigned int len, u8 *out) 44 - { 45 - sha512_base_do_update(desc, data, len, sha512_block_data_order); 46 - return sha512_arm_final(desc, out); 47 43 } 48 44 49 45 static struct shash_alg sha512_arm_algs[] = { { 50 46 .init = sha384_base_init, 51 47 .update = sha512_arm_update, 52 - .final = sha512_arm_final, 53 48 .finup = sha512_arm_finup, 54 - .descsize = sizeof(struct sha512_state), 49 + .descsize = SHA512_STATE_SIZE, 55 50 .digestsize = SHA384_DIGEST_SIZE, 56 51 .base = { 57 52 .cra_name = "sha384", 58 53 .cra_driver_name = "sha384-arm", 59 54 .cra_priority = 250, 55 + .cra_flags = CRYPTO_AHASH_ALG_BLOCK_ONLY | 56 + CRYPTO_AHASH_ALG_FINUP_MAX, 60 57 .cra_blocksize = SHA512_BLOCK_SIZE, 61 58 .cra_module = THIS_MODULE, 62 59 } 63 60 }, { 64 61 .init = sha512_base_init, 65 62 .update = sha512_arm_update, 66 - .final = sha512_arm_final, 67 63 .finup = sha512_arm_finup, 68 - .descsize = sizeof(struct sha512_state), 64 + .descsize = SHA512_STATE_SIZE, 69 65 .digestsize = SHA512_DIGEST_SIZE, 70 66 .base = { 71 67 .cra_name = "sha512", 72 68 .cra_driver_name = "sha512-arm", 73 69 .cra_priority = 250, 70 + .cra_flags = CRYPTO_AHASH_ALG_BLOCK_ONLY | 71 + CRYPTO_AHASH_ALG_FINUP_MAX, 74 72 .cra_blocksize = SHA512_BLOCK_SIZE, 75 73 .cra_module = THIS_MODULE, 76 74 }
-6
arch/arm/crypto/sha512.h
··· 1 1 /* SPDX-License-Identifier: GPL-2.0 */ 2 2 3 - int sha512_arm_update(struct shash_desc *desc, const u8 *data, 4 - unsigned int len); 5 - 6 - int sha512_arm_finup(struct shash_desc *desc, const u8 *data, 7 - unsigned int len, u8 *out); 8 - 9 3 extern struct shash_alg sha512_neon_algs[2];