linux/crypto/sha3_generic.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 * Cryptographic API.
 *
 * SHA-3, as specified in
 * https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.202.pdf
 *
 * SHA-3 code by Jeff Garzik <[email protected]>
 *               Ard Biesheuvel <[email protected]>
 */
#include <crypto/internal/hash.h>
#include <linux/init.h>
#include <linux/module.h>
#include <linux/types.h>
#include <crypto/sha3.h>
#include <asm/unaligned.h>

/*
 * On some 32-bit architectures (h8300), GCC ends up using
 * over 1 KB of stack if we inline the round calculation into the loop
 * in keccakf(). On the other hand, on 64-bit architectures with plenty
 * of [64-bit wide] general purpose registers, not inlining it severely
 * hurts performance. So let's use 64-bitness as a heuristic to decide
 * whether to inline or not.
 */
#ifdef CONFIG_64BIT
#define SHA3_INLINE
#else
#define SHA3_INLINE
#endif

#define KECCAK_ROUNDS

static const u64 keccakf_rndc[24] =;

/* update the state with given number of rounds */

static SHA3_INLINE void keccakf_round(u64 st[25])
{}

static void keccakf(u64 st[25])
{}

int crypto_sha3_init(struct shash_desc *desc)
{}
EXPORT_SYMBOL();

int crypto_sha3_update(struct shash_desc *desc, const u8 *data,
		       unsigned int len)
{}
EXPORT_SYMBOL();

int crypto_sha3_final(struct shash_desc *desc, u8 *out)
{}
EXPORT_SYMBOL();

static struct shash_alg algs[] =;

static int __init sha3_generic_mod_init(void)
{}

static void __exit sha3_generic_mod_fini(void)
{}

subsys_initcall(sha3_generic_mod_init);
module_exit(sha3_generic_mod_fini);

MODULE_LICENSE();
MODULE_DESCRIPTION();

MODULE_ALIAS_CRYPTO();
MODULE_ALIAS_CRYPTO();
MODULE_ALIAS_CRYPTO();
MODULE_ALIAS_CRYPTO();
MODULE_ALIAS_CRYPTO();
MODULE_ALIAS_CRYPTO();
MODULE_ALIAS_CRYPTO();
MODULE_ALIAS_CRYPTO();