summaryrefslogtreecommitdiff
path: root/linux/crypto/sha256_generic.c
diff options
context:
space:
mode:
authorThomas Bertschinger <tahbertschinger@gmail.com>2024-01-15 23:41:02 -0700
committerKent Overstreet <kent.overstreet@linux.dev>2024-01-16 01:47:05 -0500
commitf5baaf48e3e82b1caf9f5cd1207d4d6feba3a2e5 (patch)
tree59f7b0e4667df7a9d3d5a45725f2aaab3e79b4c5 /linux/crypto/sha256_generic.c
parentfb35dbfdc5a9446fbb856dae5542b23963e28b89 (diff)
move Rust sources to top level, C sources into c_src
This moves the Rust sources out of rust_src/ and into the top level. Running the bcachefs executable out of the development tree is now: $ ./target/release/bcachefs command or $ cargo run --profile release -- command instead of "./bcachefs command". Building and installing is still: $ make && make install Signed-off-by: Thomas Bertschinger <tahbertschinger@gmail.com> Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'linux/crypto/sha256_generic.c')
-rw-r--r--linux/crypto/sha256_generic.c81
1 files changed, 0 insertions, 81 deletions
diff --git a/linux/crypto/sha256_generic.c b/linux/crypto/sha256_generic.c
deleted file mode 100644
index 9326bfe7..00000000
--- a/linux/crypto/sha256_generic.c
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * Cryptographic API.
- *
- * SHA-256, as specified in
- * http://csrc.nist.gov/groups/STM/cavp/documents/shs/sha256-384-512.pdf
- *
- * SHA-256 code by Jean-Luc Cooke <jlcooke@certainkey.com>.
- *
- * Copyright (c) Jean-Luc Cooke <jlcooke@certainkey.com>
- * Copyright (c) Andrew McDonald <andrew@mcdonald.org.uk>
- * Copyright (c) 2002 James Morris <jmorris@intercode.com.au>
- * SHA224 Support Copyright 2007 Intel Corporation <jonathan.lynch@intel.com>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the Free
- * Software Foundation; either version 2 of the License, or (at your option)
- * any later version.
- *
- */
-
-#include <linux/bitops.h>
-#include <linux/byteorder.h>
-#include <linux/types.h>
-#include <asm/unaligned.h>
-
-#include <linux/crypto.h>
-#include <crypto/hash.h>
-
-#include <sodium/crypto_hash_sha256.h>
-
-static struct shash_alg sha256_alg;
-
-static int sha256_init(struct shash_desc *desc)
-{
- crypto_hash_sha256_state *state = (void *) desc->ctx;
-
- return crypto_hash_sha256_init(state);
-}
-
-static int sha256_update(struct shash_desc *desc, const u8 *data,
- unsigned int len)
-{
- crypto_hash_sha256_state *state = (void *) desc->ctx;
-
- return crypto_hash_sha256_update(state, data, len);
-}
-
-static int sha256_final(struct shash_desc *desc, u8 *out)
-{
- crypto_hash_sha256_state *state = (void *) desc->ctx;
-
- return crypto_hash_sha256_final(state, out);
-}
-
-static void *sha256_alloc_tfm(void)
-{
- struct crypto_shash *tfm = kzalloc(sizeof(*tfm), GFP_KERNEL);
-
- if (!tfm)
- return NULL;
-
- tfm->base.alg = &sha256_alg.base;
- tfm->descsize = sizeof(crypto_hash_sha256_state);
- return tfm;
-}
-
-static struct shash_alg sha256_alg = {
- .digestsize = crypto_hash_sha256_BYTES,
- .init = sha256_init,
- .update = sha256_update,
- .final = sha256_final,
- .descsize = sizeof(crypto_hash_sha256_state),
- .base.cra_name = "sha256",
- .base.alloc_tfm = sha256_alloc_tfm,
-};
-
-__attribute__((constructor(110)))
-static int __init sha256_generic_mod_init(void)
-{
- return crypto_register_shash(&sha256_alg);
-}