1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
// ---------------- [ File: bitcoin-sha256/src/sha256_write_ffi.rs ]
crateix!;
/// FFI‑compatible front‑end to [`Sha256::write_ptr`].
///
/// # Safety
/// * **`hash`** must be a valid, writable pointer to a live [`Sha256`] value.
/// * **`data`** must be either
/// * a valid, readable pointer to at least `len` bytes **or**
/// * *null* **iff** `len == 0`.
///
/// These pre‑conditions mirror those enforced by the original C reference
/// implementation and are **not** re‑validated internally (aside from a
/// debug‑assert). Violating them results in *undefined behaviour*.
///
/// # Behaviour
/// Delegates the entire write operation to [`Sha256::write_ptr`], providing a
/// thin, zero‑copy bridge for C‑style callers while preserving all batching,
/// buffering, and block‑processing semantics implemented in Rust.
///
/// The function logs its invocation and completion via the `tracing` crate
/// under the `sha256` target.
pub unsafe