Repository navigation
linuxkm: instantiate cts over wolfCrypt cbc(aes) - #11613
MarkAtwood wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
The persistent CTS instance prevents the existing CBC deinstallation path from unregistering the algorithm, and one error log has a format mismatch.
Review effort: Balanced
Findings: 2
Open (2)
What changed in this PR
Instantiates Linux kernel CTS over wolfCrypt AES-CBC so Kerberos AES-SHA2 traffic selects wolfCrypt.
Changes:
- Creates and self-tests a CTS template instance.
- Verifies generic CTS lookup selects the wolfCrypt-backed driver.
| File | Description |
|---|---|
linuxkm/lkcapi_glue.c |
Adds CTS-over-AES-CBC registration and masking validation. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| struct crypto_skcipher *cts_tfm = | ||
| crypto_alloc_skcipher("cts(cbc-aes" WOLFKM_AES_DRIVER_SUFFIX ")", 0, 0); |
There was a problem hiding this comment.
not a bug, registered instances drop their spawn ref. on 7.0 idle rmmod deregisters clean, rmmod with a live cts tfm refuses
| crypto_alloc_skcipher("cts(cbc-aes" WOLFKM_AES_DRIVER_SUFFIX ")", 0, 0); | ||
| if (IS_ERR(cts_tfm)) { | ||
| pr_err("ERROR: instantiating cts(cbc-aes" WOLFKM_AES_DRIVER_SUFFIX | ||
| ") failed: %d\n", PTR_ERR(cts_tfm)); |
There was a problem hiding this comment.
PTR_ERR is redefined to int in linuxkm_wc_port.h, %ld breaks -Werror. added an explicit cast
|
c691030 to
47b7e7f
Compare
47b7e7f to
f3ad68c
Compare
f3ad68c to
ee30459
Compare
ee30459 to
74c8766
Compare
74c8766 to
9ea6350
Compare

Description
Instantiate the kernel
ctstemplate over the wolfCryptcbc(aes)in linuxkm.The krb5 aes-sha2 enctypes (RFC 8009, e.g. libceph's AES256KRB5 cephx keys) allocate
authenc(hmac(sha384),cts(cbc(aes))). linuxkm registerscbc(aes)but nocts.crypto_larval_lookup()returns any alg already registered under a cra_name and only asks cryptomgr to build a template instance when none exists, and aesni registers a nativects(cbc(aes))(cts-cbc-aes-aesni, priority 400). So acts(cbc(aes))lookup never builds cts over the wolfCrypt cbc, and that traffic never reaches wolfCrypt.After
cbcAesAlgregisters, allocatects(cbc-aes<suffix>)once by driver name. The kernel instantiates and self-tests (cts_mode_tv_template, fips_allowed) the template instance, which inherits the cbc priority (WOLFSSL_LINUXKM_LKCAPI_PRIORITY) and wins every latercts(cbc(aes))lookup;check_skcipher_driver_masking()then confirms that. The ciphertext-stealing step is the kernel template; the AES-CBC under it is wolfCrypt. The instance persists after the probe tfm is freed, is torn down withcbcAesAlgon unregister, and does not pin the module. Skipped when the target kernel lacksCONFIG_CRYPTO_CTS.Testing
CONFIG_CRYPTO_SELFTESTS=y):/proc/cryptoshowscts(cbc(aes))->cts(cbc-aes-*-wolfcrypt), priority 100000,selftest: passed; before load it resolves tocts-cbc-aes-aesni.deinstall_algs.Checklist