Commit 5db5519376 for strongswan.org

commit 5db5519376e3de538cd6eb80ddb6db81b5b4bc0f
Author: raghu netrakar <raghu@security.bugqore.com>
Date:   Sat Nov 21 16:48:29 2026 +0530

    openssl: Verify length of encrypted PKCS#7 content before decrypting it

    The crypter used to decrypt enveloped-data is not necessarily provided by
    the openssl plugin (e.g. if the aes or des plugins are loaded before it),
    so make sure the length of the encrypted content is a multiple of the
    block size before passing it to the crypter.

diff --git a/src/libstrongswan/plugins/openssl/openssl_pkcs7.c b/src/libstrongswan/plugins/openssl/openssl_pkcs7.c
index a606716f5e..17666704c5 100644
--- a/src/libstrongswan/plugins/openssl/openssl_pkcs7.c
+++ b/src/libstrongswan/plugins/openssl/openssl_pkcs7.c
@@ -574,6 +574,13 @@ static bool decrypt_symmetric(private_openssl_pkcs7_t *this, chunk_t key,
 		crypter->destroy(crypter);
 		return FALSE;
 	}
+	if (encrypted.len % crypter->get_block_size(crypter))
+	{
+		DBG1(DBG_LIB, "encrypted content length is not a multiple of the "
+			 "block size");
+		crypter->destroy(crypter);
+		return FALSE;
+	}
 	if (!crypter->set_key(crypter, key) ||
 		!crypter->decrypt(crypter, encrypted, iv, plain))
 	{