From a44530df5725a7c6dae95213dccb980dddf46b17 Mon Sep 17 00:00:00 2001 From: Jan Schmidt Date: Tue, 15 Nov 2022 00:11:15 +1100 Subject: [PATCH] aesdec: Fix padding removal for per-buffer-padding=FALSE When per-buffer-padding is FALSE, the OpenSSL context needs to be told to remove any padding at the end of the ciphertext Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/1243 Part-of: --- subprojects/gst-plugins-bad/ext/aes/gstaesdec.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/subprojects/gst-plugins-bad/ext/aes/gstaesdec.c b/subprojects/gst-plugins-bad/ext/aes/gstaesdec.c index 9383f047af..66bd327c0b 100644 --- a/subprojects/gst-plugins-bad/ext/aes/gstaesdec.c +++ b/subprojects/gst-plugins-bad/ext/aes/gstaesdec.c @@ -583,11 +583,10 @@ gst_aes_dec_init_cipher (GstAesDec * filter) GST_ERROR_OBJECT (filter, "Could not initialize openssl cipher"); return FALSE; } - if (filter->per_buffer_padding) { - if (!EVP_CIPHER_CTX_set_padding (filter->evp_ctx, 0)) { - GST_ERROR_OBJECT (filter, "Could not set padding"); - return FALSE; - } + if (!EVP_CIPHER_CTX_set_padding (filter->evp_ctx, + filter->per_buffer_padding ? 0 : 1)) { + GST_ERROR_OBJECT (filter, "Could not set padding"); + return FALSE; } return TRUE;