lkml.org 
[lkml]   [2026]   [Feb]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[RFC v3 26/27] rust: add bindings for hash_info
Date
From: Alistair Francis <alistair.francis@wdc.com>

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@wdc.com>
---
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

\
 
 \ /
  Last update: 2026-02-11 04:44    [from the cache]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and my Meterkast|Read the blog