From ced24933a1bd04fe715b760076418635afc10f46 Mon Sep 17 00:00:00 2001
From: Francois Cartegnie <fcvlcdev@free.fr>
Date: Sun, 12 May 2019 15:36:34 +0200
Subject: [PATCH] demux: adaptive: fix build without gcrypt (#22298)

---
 modules/demux/adaptive/encryption/CommonEncryption.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/modules/demux/adaptive/encryption/CommonEncryption.cpp b/modules/demux/adaptive/encryption/CommonEncryption.cpp
index 990016d2c784..4b4d486bd2d4 100644
--- a/modules/demux/adaptive/encryption/CommonEncryption.cpp
+++ b/modules/demux/adaptive/encryption/CommonEncryption.cpp
@@ -97,8 +97,8 @@ bool CommonEncryptionSession::start(SharedResources *res, const CommonEncryption
 
 void CommonEncryptionSession::close()
 {
-    gcry_cipher_hd_t handle = reinterpret_cast<gcry_cipher_hd_t>(ctx);
 #ifdef HAVE_GCRYPT
+    gcry_cipher_hd_t handle = reinterpret_cast<gcry_cipher_hd_t>(ctx);
     if(ctx)
         gcry_cipher_close(handle);
     ctx = NULL;
@@ -107,12 +107,12 @@ void CommonEncryptionSession::close()
 
 size_t CommonEncryptionSession::decrypt(void *inputdata, size_t inputbytes, bool last)
 {
-    gcry_cipher_hd_t handle = reinterpret_cast<gcry_cipher_hd_t>(ctx);
 #ifndef HAVE_GCRYPT
     (void)data;
     (void)bytes;
     (void)last;
 #else
+    gcry_cipher_hd_t handle = reinterpret_cast<gcry_cipher_hd_t>(ctx);
     if(encryption.method == CommonEncryption::Method::AES_128 && ctx)
     {
         if ((inputbytes % 16) != 0 || inputbytes < 16 ||
-- 
GitLab