[RFC v3 26/27] rust: add bindings for hash_info
From: alistair23
Date: Tue Feb 10 2026 - 22:39:27 EST
From: Alistair Francis <alistair.francis@xxxxxxx>
C code can get the hash_digest_size by indexing into the global
hash_digest_size array. We can't do that in the Rust code, so let's add
a Rust helper function to allow us to get the hash_digest_size.
Signed-off-by: Alistair Francis <alistair.francis@xxxxxxx>
---
rust/helpers/hash_info.c | 8 ++++++++
rust/helpers/helpers.c | 1 +
2 files changed, 9 insertions(+)
create mode 100644 rust/helpers/hash_info.c
diff --git a/rust/helpers/hash_info.c b/rust/helpers/hash_info.c
new file mode 100644
index 000000000000..d2cbc08b57d1
--- /dev/null
+++ b/rust/helpers/hash_info.c
@@ -0,0 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0
+
+#include <crypto/hash_info.h>
+
+int rust_helper_get_hash_digest_size(uint32_t offset)
+{
+ return hash_digest_size[offset];
+}
diff --git a/rust/helpers/helpers.c b/rust/helpers/helpers.c
index 4b08b4f1d3a3..34db9eb5e43e 100644
--- a/rust/helpers/helpers.c
+++ b/rust/helpers/helpers.c
@@ -31,6 +31,7 @@
#include "drm.c"
#include "err.c"
#include "hash.c"
+#include "hash_info.c"
#include "irq.c"
#include "fs.c"
#include "io.c"
--
2.52.0