aesdec: Fix padding removal for per-buffer-padding=FALSE
authorJan Schmidt <jan@centricular.com>
Mon, 14 Nov 2022 13:11:15 +0000 (00:11 +1100)
committerJan Schmidt <jan@centricular.com>
Mon, 14 Nov 2022 13:13:15 +0000 (00:13 +1100)
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: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3406>

subprojects/gst-plugins-bad/ext/aes/gstaesdec.c

index 9383f04..66bd327 100644 (file)
@@ -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;