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
50
51
// SPDX-FileCopyrightText: 2026 JC-Lab <joseph@jc-lab.net>
//
// SPDX-License-Identifier: Apache-2.0
//! `EFI_BLOCK_IO2_PROTOCOL` hooking (`ReadBlocksEx`).
//!
//! Mirrors [`block_io`](crate::hook::block_io) but for the asynchronous
//! `EFI_BLOCK_IO2_PROTOCOL`. Saves the original `ReadBlocksEx` pointer, patches
//! the vtable with [`hooked_read_blocks_ex`], and restores it on uninstall.
use VckResult;
/// Saved state for a single hooked `EFI_BLOCK_IO2_PROTOCOL` instance.
/// Replacement `ReadBlocksEx` (`EFI_BLOCK_IO2_PROTOCOL.ReadBlocksEx`).
///
/// Asynchronous variant: the EFI ABI adds an `EFI_BLOCK_IO2_TOKEN` so the read
/// may complete later. The decryption decision must run after the underlying
/// read has actually completed (e.g. by chaining the token's event), then call
/// the engine's per-sector AES-XTS decision.
// TODO(loader): give this the exact `extern "efiapi"` signature
// `(This, MediaId, Lba, Token, BufferSize, Buffer) -> Status`, hook the token
// completion to run decrypt_after_read before signaling the caller's event.
pub extern "efiapi"