Skip to content

Commit fe303a2

Browse files
committed
zfs: wolfZFS port for OpenZFS 2.4.2 (FIPS fixes; supersedes #341)
Rebase the wolfZFS port to the zfs-2.4.2 release tag and fold in the FIPS fixes (-287 private-key unlock, GCM-IV approved-DRBG upgrade, provider-native EVP_KDF userspace key-derivation). Link the userspace ICP checksum test programs (sha2_test, blake3_test) against libwolfssl. Quote MODULE_IMPORT_NS("WOLFSSL") for kernel >= 6.13. RNG: rely on ZFS's native random_get_bytes() for all key/salt/IV material (it is the wolfCrypt FIPS DRBG once the CRNG kernel patch is installed). The only delta vs vanilla ZFS is upgrading the two GCM-IV sites in zio_crypt.c (zio_crypt_key_wrap, zio_crypt_generate_iv) from random_get_pseudo_bytes to random_get_bytes, so GCM IVs come from an approved DRBG (SP 800-38D requires it; the xorshift pseudo-RNG is not approved). No direct wc_RNG calls remain; wolfZFS owns the crypto primitives and the CRNG patch owns RNG. Validated on Proxmox VE 9.2 (zfs-2.4.2-pve1, kernel 7.0.12-1-pve) and the OpenZFS test suite: run_crypto 2/2, run_sanity with all failures within the known vanilla-ZFS environmental baseline, zero regressions.
1 parent e216394 commit fe303a2

2 files changed

Lines changed: 309 additions & 168 deletions

File tree

zfs/README.md

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,32 @@ that replaces its native crypto implementation (used on linux) with wolfCrypt
55
API calls. It links against `libwolfssl.so` and `libwolfssl.ko` in user and
66
kernel space.
77

8-
The patch was written for this commit:
8+
The patch was written for the OpenZFS `zfs-2.4.2` release tag:
99
```
10-
commit cd06f79e2949b6255f5e8bf621c1b9497ad97b02 (HEAD)
11-
Author: Christos Longros <98426896+chrislongros@users.noreply.github.com>
12-
Date: Sun Apr 26 00:24:38 2026 +0200
10+
commit 59f46c509be4... (tag: zfs-2.4.2)
1311
```
14-
This patch inserts only a modest line count for wolfCrypt API calls, while
15-
removing zfs internal crypto implementations:
12+
It applies cleanly to both upstream `zfs-2.4.2` and the Proxmox `zfs-2.4.2-pve1`
13+
package. This patch inserts only a modest line count for wolfCrypt API calls,
14+
while removing zfs internal crypto implementations:
1615
```
1716
$ git diff --stat | tail -n1
18-
38 files changed, 821 insertions(+), 28583 deletions(-)
19-
```
17+
42 files changed, 885 insertions(+), 28608 deletions(-)
18+
```
19+
20+
In addition to the ICP routing, this revision folds in the FIPS-related fixes
21+
(previously proposed in PR #341, which this supersedes):
22+
- `module/zfs/hkdf.c`: `PRIVATE_KEY_UNLOCK` bracket fixes
23+
`FIPS_PRIVATE_KEY_LOCKED_E` (-287) on encrypted dataset creation under
24+
wolfCrypt FIPS.
25+
- RNG: key, salt, and IV material use the kernel's native `random_get_bytes()`,
26+
which is the wolfCrypt FIPS DRBG when the CRNG kernel patch is installed. The
27+
only change vs vanilla ZFS is upgrading the two GCM-IV sites in `zio_crypt.c`
28+
(`zio_crypt_key_wrap`, `zio_crypt_generate_iv`) from `random_get_pseudo_bytes`
29+
to `random_get_bytes`, so the IVs come from the approved DRBG (SP 800-38D
30+
requires GCM IVs from an approved RBG; the xorshift pseudo-RNG is not approved).
31+
- Userspace key-derivation uses the provider-native `EVP_KDF "PBKDF2"` with a
32+
`RAND_bytes` salt, so it routes through an OpenSSL 3.x provider.
33+
- `MODULE_IMPORT_NS("WOLFSSL")` is quoted for kernel >= 6.13.
2034

2135
![wolfZFS Architecture Diagram](doc/wolfzfs_diagram.png)
2236

@@ -151,8 +165,8 @@ git clone https://github.com/openzfs/zfs.git
151165
2. Patch OpenZFS:
152166
```
153167
cd zfs
154-
git co cd06f79e2
155-
git apply ../patches/cd06f79e2_wolfzfs.patch
168+
git checkout zfs-2.4.2
169+
git apply ../patches/zfs-2.4.2_wolfzfs.patch
156170
cd ../
157171
```
158172

0 commit comments

Comments
 (0)