^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) // SPDX-License-Identifier: GPL-2.0-or-later
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) * Cryptographic API.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) * SHA1 Secure Hash Algorithm.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) * Adapted for OCTEON by Aaro Koskinen <aaro.koskinen@iki.fi>.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) * Based on crypto/sha1_generic.c, which is:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) * Copyright (c) Alan Smithee.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) * Copyright (c) Andrew McDonald <andrew@mcdonald.org.uk>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) * Copyright (c) Jean-Francois Dive <jef@linuxbe.org>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) #include <linux/mm.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) #include <crypto/sha.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) #include <linux/init.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) #include <linux/types.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) #include <linux/module.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) #include <asm/byteorder.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) #include <asm/octeon/octeon.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) #include <crypto/internal/hash.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) #include "octeon-crypto.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) * We pass everything as 64-bit. OCTEON can handle misaligned data.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) static void octeon_sha1_store_hash(struct sha1_state *sctx)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) u64 *hash = (u64 *)sctx->state;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) union {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) u32 word[2];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) u64 dword;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) } hash_tail = { { sctx->state[4], } };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) write_octeon_64bit_hash_dword(hash[0], 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) write_octeon_64bit_hash_dword(hash[1], 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) write_octeon_64bit_hash_dword(hash_tail.dword, 2);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) memzero_explicit(&hash_tail.word[0], sizeof(hash_tail.word[0]));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) static void octeon_sha1_read_hash(struct sha1_state *sctx)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) u64 *hash = (u64 *)sctx->state;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) union {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) u32 word[2];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) u64 dword;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) } hash_tail;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) hash[0] = read_octeon_64bit_hash_dword(0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) hash[1] = read_octeon_64bit_hash_dword(1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) hash_tail.dword = read_octeon_64bit_hash_dword(2);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) sctx->state[4] = hash_tail.word[0];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) memzero_explicit(&hash_tail.dword, sizeof(hash_tail.dword));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) static void octeon_sha1_transform(const void *_block)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) const u64 *block = _block;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) write_octeon_64bit_block_dword(block[0], 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) write_octeon_64bit_block_dword(block[1], 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) write_octeon_64bit_block_dword(block[2], 2);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) write_octeon_64bit_block_dword(block[3], 3);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) write_octeon_64bit_block_dword(block[4], 4);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) write_octeon_64bit_block_dword(block[5], 5);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) write_octeon_64bit_block_dword(block[6], 6);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) octeon_sha1_start(block[7]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) static int octeon_sha1_init(struct shash_desc *desc)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) struct sha1_state *sctx = shash_desc_ctx(desc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) sctx->state[0] = SHA1_H0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) sctx->state[1] = SHA1_H1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) sctx->state[2] = SHA1_H2;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) sctx->state[3] = SHA1_H3;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) sctx->state[4] = SHA1_H4;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) sctx->count = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) static void __octeon_sha1_update(struct sha1_state *sctx, const u8 *data,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) unsigned int len)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) unsigned int partial;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) unsigned int done;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) const u8 *src;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) partial = sctx->count % SHA1_BLOCK_SIZE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96) sctx->count += len;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) done = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98) src = data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) if ((partial + len) >= SHA1_BLOCK_SIZE) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) if (partial) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) done = -partial;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) memcpy(sctx->buffer + partial, data,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) done + SHA1_BLOCK_SIZE);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) src = sctx->buffer;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) do {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) octeon_sha1_transform(src);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) done += SHA1_BLOCK_SIZE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) src = data + done;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) } while (done + SHA1_BLOCK_SIZE <= len);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) partial = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) memcpy(sctx->buffer + partial, src, len - done);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) static int octeon_sha1_update(struct shash_desc *desc, const u8 *data,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) unsigned int len)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) struct sha1_state *sctx = shash_desc_ctx(desc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) struct octeon_cop2_state state;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) unsigned long flags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) * Small updates never reach the crypto engine, so the generic sha1 is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) * faster because of the heavyweight octeon_crypto_enable() /
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) * octeon_crypto_disable().
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) if ((sctx->count % SHA1_BLOCK_SIZE) + len < SHA1_BLOCK_SIZE)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) return crypto_sha1_update(desc, data, len);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) flags = octeon_crypto_enable(&state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) octeon_sha1_store_hash(sctx);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) __octeon_sha1_update(sctx, data, len);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) octeon_sha1_read_hash(sctx);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) octeon_crypto_disable(&state, flags);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) static int octeon_sha1_final(struct shash_desc *desc, u8 *out)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) struct sha1_state *sctx = shash_desc_ctx(desc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) static const u8 padding[64] = { 0x80, };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) struct octeon_cop2_state state;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) __be32 *dst = (__be32 *)out;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) unsigned int pad_len;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) unsigned long flags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) unsigned int index;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) __be64 bits;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) int i;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) /* Save number of bits. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) bits = cpu_to_be64(sctx->count << 3);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) /* Pad out to 56 mod 64. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) index = sctx->count & 0x3f;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) pad_len = (index < 56) ? (56 - index) : ((64+56) - index);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) flags = octeon_crypto_enable(&state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) octeon_sha1_store_hash(sctx);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) __octeon_sha1_update(sctx, padding, pad_len);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) /* Append length (before padding). */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) __octeon_sha1_update(sctx, (const u8 *)&bits, sizeof(bits));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) octeon_sha1_read_hash(sctx);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) octeon_crypto_disable(&state, flags);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) /* Store state in digest */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) for (i = 0; i < 5; i++)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) dst[i] = cpu_to_be32(sctx->state[i]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) /* Zeroize sensitive information. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) memset(sctx, 0, sizeof(*sctx));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) static int octeon_sha1_export(struct shash_desc *desc, void *out)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) struct sha1_state *sctx = shash_desc_ctx(desc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) memcpy(out, sctx, sizeof(*sctx));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) static int octeon_sha1_import(struct shash_desc *desc, const void *in)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) struct sha1_state *sctx = shash_desc_ctx(desc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) memcpy(sctx, in, sizeof(*sctx));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) static struct shash_alg octeon_sha1_alg = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) .digestsize = SHA1_DIGEST_SIZE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) .init = octeon_sha1_init,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) .update = octeon_sha1_update,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) .final = octeon_sha1_final,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) .export = octeon_sha1_export,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) .import = octeon_sha1_import,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) .descsize = sizeof(struct sha1_state),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) .statesize = sizeof(struct sha1_state),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) .base = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) .cra_name = "sha1",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) .cra_driver_name= "octeon-sha1",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) .cra_priority = OCTEON_CR_OPCODE_PRIORITY,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) .cra_blocksize = SHA1_BLOCK_SIZE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) .cra_module = THIS_MODULE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) static int __init octeon_sha1_mod_init(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) if (!octeon_has_crypto())
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) return -ENOTSUPP;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) return crypto_register_shash(&octeon_sha1_alg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) static void __exit octeon_sha1_mod_fini(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) crypto_unregister_shash(&octeon_sha1_alg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) module_init(octeon_sha1_mod_init);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) module_exit(octeon_sha1_mod_fini);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) MODULE_LICENSE("GPL");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) MODULE_DESCRIPTION("SHA1 Secure Hash Algorithm (OCTEON)");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) MODULE_AUTHOR("Aaro Koskinen <aaro.koskinen@iki.fi>");