1
0
mirror of https://github.com/openbsd/src.git synced 2026-06-18 15:23:33 +02:00

Avoid NULL dereference in password-based CMS decryption

The keyDerivationAlgorithm field is OPTIONAL in the ASN.1 but required
for password-based CMS. Check that the field is present before using it
to avoid a crash.

From Igor Ustinov via OpenSSL
This commit is contained in:
tb
2026-06-09 12:12:34 +00:00
parent 40d99f35c6
commit 3cfdab8ab2
+5 -1
View File
@@ -1,4 +1,4 @@
/* $OpenBSD: cms_pwri.c,v 1.35 2025/09/30 12:51:16 tb Exp $ */
/* $OpenBSD: cms_pwri.c,v 1.36 2026/06/09 12:12:34 tb Exp $ */
/*
* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
* project.
@@ -386,6 +386,10 @@ cms_RecipientInfo_pwri_crypt(CMS_ContentInfo *cms, CMS_RecipientInfo *ri,
}
algtmp = pwri->keyDerivationAlgorithm;
if (algtmp == NULL) {
CMSerror(CMS_R_INVALID_KEY_ENCRYPTION_PARAMETER);
goto err;
}
/* Finish password based key derivation to setup key in "ctx" */