~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/arch/arm64/crypto/sha512-glue.c

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 // SPDX-License-Identifier: GPL-2.0-or-later
  2 /*
  3  * Linux/arm64 port of the OpenSSL SHA512 implementation for AArch64
  4  *
  5  * Copyright (c) 2016 Linaro Ltd. <ard.biesheuvel@linaro.org>
  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 hash for arm64");
 16 MODULE_AUTHOR("Andy Polyakov <appro@openssl.org>");
 17 MODULE_AUTHOR("Ard Biesheuvel <ard.biesheuvel@linaro.org>");
 18 MODULE_LICENSE("GPL v2");
 19 MODULE_ALIAS_CRYPTO("sha384");
 20 MODULE_ALIAS_CRYPTO("sha512");
 21 
 22 asmlinkage void sha512_block_data_order(u64 *digest, const void *data,
 23                                         unsigned int num_blks);
 24 EXPORT_SYMBOL(sha512_block_data_order);
 25 
 26 static void sha512_arm64_transform(struct sha512_state *sst, u8 const *src,
 27                                    int blocks)
 28 {
 29         sha512_block_data_order(sst->state, src, blocks);
 30 }
 31 
 32 static int sha512_update(struct shash_desc *desc, const u8 *data,
 33                          unsigned int len)
 34 {
 35         return sha512_base_do_update(desc, data, len, sha512_arm64_transform);
 36 }
 37 
 38 static int sha512_finup(struct shash_desc *desc, const u8 *data,
 39                         unsigned int len, u8 *out)
 40 {
 41         if (len)
 42                 sha512_base_do_update(desc, data, len, sha512_arm64_transform);
 43         sha512_base_do_finalize(desc, sha512_arm64_transform);
 44 
 45         return sha512_base_finish(desc, out);
 46 }
 47 
 48 static int sha512_final(struct shash_desc *desc, u8 *out)
 49 {
 50         return sha512_finup(desc, NULL, 0, out);
 51 }
 52 
 53 static struct shash_alg algs[] = { {
 54         .digestsize             = SHA512_DIGEST_SIZE,
 55         .init                   = sha512_base_init,
 56         .update                 = sha512_update,
 57         .final                  = sha512_final,
 58         .finup                  = sha512_finup,
 59         .descsize               = sizeof(struct sha512_state),
 60         .base.cra_name          = "sha512",
 61         .base.cra_driver_name   = "sha512-arm64",
 62         .base.cra_priority      = 150,
 63         .base.cra_blocksize     = SHA512_BLOCK_SIZE,
 64         .base.cra_module        = THIS_MODULE,
 65 }, {
 66         .digestsize             = SHA384_DIGEST_SIZE,
 67         .init                   = sha384_base_init,
 68         .update                 = sha512_update,
 69         .final                  = sha512_final,
 70         .finup                  = sha512_finup,
 71         .descsize               = sizeof(struct sha512_state),
 72         .base.cra_name          = "sha384",
 73         .base.cra_driver_name   = "sha384-arm64",
 74         .base.cra_priority      = 150,
 75         .base.cra_blocksize     = SHA384_BLOCK_SIZE,
 76         .base.cra_module        = THIS_MODULE,
 77 } };
 78 
 79 static int __init sha512_mod_init(void)
 80 {
 81         return crypto_register_shashes(algs, ARRAY_SIZE(algs));
 82 }
 83 
 84 static void __exit sha512_mod_fini(void)
 85 {
 86         crypto_unregister_shashes(algs, ARRAY_SIZE(algs));
 87 }
 88 
 89 module_init(sha512_mod_init);
 90 module_exit(sha512_mod_fini);
 91 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php