1 // SPDX-License-Identifier: GPL-2.0-or-later 1 2 /* 3 * Linux/arm64 port of the OpenSSL SHA512 impl 4 * 5 * Copyright (c) 2016 Linaro Ltd. <ard.biesheu 6 */ 7 8 #include <crypto/internal/hash.h> 9 #include <linux/types.h> 10 #include <linux/string.h> 11 #include <crypto/sha2.h> 12 #include <crypto/sha512_base.h> 13 #include <asm/neon.h> 14 15 MODULE_DESCRIPTION("SHA-384/SHA-512 secure has 16 MODULE_AUTHOR("Andy Polyakov <appro@openssl.or 17 MODULE_AUTHOR("Ard Biesheuvel <ard.biesheuvel@ 18 MODULE_LICENSE("GPL v2"); 19 MODULE_ALIAS_CRYPTO("sha384"); 20 MODULE_ALIAS_CRYPTO("sha512"); 21 22 asmlinkage void sha512_block_data_order(u64 *d 23 unsign 24 EXPORT_SYMBOL(sha512_block_data_order); 25 26 static void sha512_arm64_transform(struct sha5 27 int blocks) 28 { 29 sha512_block_data_order(sst->state, sr 30 } 31 32 static int sha512_update(struct shash_desc *de 33 unsigned int len) 34 { 35 return sha512_base_do_update(desc, dat 36 } 37 38 static int sha512_finup(struct shash_desc *des 39 unsigned int len, u8 * 40 { 41 if (len) 42 sha512_base_do_update(desc, da 43 sha512_base_do_finalize(desc, sha512_a 44 45 return sha512_base_finish(desc, out); 46 } 47 48 static int sha512_final(struct shash_desc *des 49 { 50 return sha512_finup(desc, NULL, 0, out 51 } 52 53 static struct shash_alg algs[] = { { 54 .digestsize = SHA512_DIGES 55 .init = sha512_base_ 56 .update = sha512_updat 57 .final = sha512_final 58 .finup = sha512_finup 59 .descsize = sizeof(struc 60 .base.cra_name = "sha512", 61 .base.cra_driver_name = "sha512-arm6 62 .base.cra_priority = 150, 63 .base.cra_blocksize = SHA512_BLOCK 64 .base.cra_module = THIS_MODULE, 65 }, { 66 .digestsize = SHA384_DIGES 67 .init = sha384_base_ 68 .update = sha512_updat 69 .final = sha512_final 70 .finup = sha512_finup 71 .descsize = sizeof(struc 72 .base.cra_name = "sha384", 73 .base.cra_driver_name = "sha384-arm6 74 .base.cra_priority = 150, 75 .base.cra_blocksize = SHA384_BLOCK 76 .base.cra_module = THIS_MODULE, 77 } }; 78 79 static int __init sha512_mod_init(void) 80 { 81 return crypto_register_shashes(algs, A 82 } 83 84 static void __exit sha512_mod_fini(void) 85 { 86 crypto_unregister_shashes(algs, ARRAY_ 87 } 88 89 module_init(sha512_mod_init); 90 module_exit(sha512_mod_fini); 91
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.