From: Keisuke Tsukuda <redacted>
get_pkey_options() returns -EINVAL for invalid protected key options,
such as "key_enc_algo=GG". trusted_caam_seal() and trusted_caam_unseal()
ignore this error and return 0. The trusted key core then instantiates
a key without a blob for "new", or with a zero-length key for "load".
On an i.MX6Q running a 7.4.0-rc2-based kernel, adding a key with
"new 32 pk key_enc_algo=GG" succeeds, but KEYCTL_READ returns zero
bytes because no blob was created. The key cannot be saved and
reloaded.
Return the parsing error from both paths. On the patched kernel,
"new" and "load" with "key_enc_algo=GG" both fail with -EINVAL, while
valid requests succeed.
Fixes: a703a4c2a328 ("KEYS: trusted: caam based protected key")
Signed-off-by: Keisuke Tsukuda <redacted>
Sashiko has reviewed this patch and found no issues.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261124155310.32044-1-tkdkei@outlook.jp?part=1