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.

at v6.16 75 lines 1.9 kB view raw
1// SPDX-License-Identifier: GPL-2.0-or-later 2/* 3 * Cryptographic API. 4 * Glue code for the SHA1 Secure Hash Algorithm assembler implementation 5 * 6 * This file is based on sha1_generic.c and sha1_ssse3_glue.c 7 * 8 * Copyright (c) Alan Smithee. 9 * Copyright (c) Andrew McDonald <andrew@mcdonald.org.uk> 10 * Copyright (c) Jean-Francois Dive <jef@linuxbe.org> 11 * Copyright (c) Mathias Krause <minipli@googlemail.com> 12 */ 13 14#include <crypto/internal/hash.h> 15#include <crypto/sha1.h> 16#include <crypto/sha1_base.h> 17#include <linux/kernel.h> 18#include <linux/module.h> 19 20asmlinkage void sha1_block_data_order(struct sha1_state *digest, 21 const u8 *data, int rounds); 22 23static int sha1_update_arm(struct shash_desc *desc, const u8 *data, 24 unsigned int len) 25{ 26 /* make sure signature matches sha1_block_fn() */ 27 BUILD_BUG_ON(offsetof(struct sha1_state, state) != 0); 28 29 return sha1_base_do_update_blocks(desc, data, len, 30 sha1_block_data_order); 31} 32 33static int sha1_finup_arm(struct shash_desc *desc, const u8 *data, 34 unsigned int len, u8 *out) 35{ 36 sha1_base_do_finup(desc, data, len, sha1_block_data_order); 37 return sha1_base_finish(desc, out); 38} 39 40static struct shash_alg alg = { 41 .digestsize = SHA1_DIGEST_SIZE, 42 .init = sha1_base_init, 43 .update = sha1_update_arm, 44 .finup = sha1_finup_arm, 45 .descsize = SHA1_STATE_SIZE, 46 .base = { 47 .cra_name = "sha1", 48 .cra_driver_name= "sha1-asm", 49 .cra_priority = 150, 50 .cra_flags = CRYPTO_AHASH_ALG_BLOCK_ONLY, 51 .cra_blocksize = SHA1_BLOCK_SIZE, 52 .cra_module = THIS_MODULE, 53 } 54}; 55 56 57static int __init sha1_mod_init(void) 58{ 59 return crypto_register_shash(&alg); 60} 61 62 63static void __exit sha1_mod_fini(void) 64{ 65 crypto_unregister_shash(&alg); 66} 67 68 69module_init(sha1_mod_init); 70module_exit(sha1_mod_fini); 71 72MODULE_LICENSE("GPL"); 73MODULE_DESCRIPTION("SHA1 Secure Hash Algorithm (ARM)"); 74MODULE_ALIAS_CRYPTO("sha1"); 75MODULE_AUTHOR("David McCullough <ucdevel@gmail.com>");