creds-util: add a check in decrypting credentials

... and avoid continuing decryption in case of failure.
This commit is contained in:
Siteshwar Vashisht
2026-09-04 03:29:27 +09:00
committed by Yu Watanabe
parent b4f2262be8
commit 504ebbe826
+3 -1
View File
@@ -1558,7 +1558,9 @@ int decrypt_credential_and_warn(
if (sd_id128_equal(h->id, CRED_AES256_GCM_BY_NULL) && !FLAGS_SET(flags, CREDENTIAL_ALLOW_NULL))
log_warning("Warning: using a null key for decryption and authentication. Confidentiality or authenticity are not provided.");
sha256_hash_host_and_tpm2_key(&host_key, &tpm2_key, md);
r = sha256_hash_host_and_tpm2_key(&host_key, &tpm2_key, md);
if (r < 0)
return r;
if (CRED_KEY_IS_SCOPED(h->id)) {
r = mangle_uid_into_key(uid, md);