From b0654d5613980228e6fd694ffeeeecb5aa0d41b1 Mon Sep 17 00:00:00 2001 From: Martin Krisell Date: Mon, 20 Dec 2021 10:37:21 +0100 Subject: [PATCH] Skip unnecessary check before calling openssl_encrypt --- src/Illuminate/Encryption/Encrypter.php | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/src/Illuminate/Encryption/Encrypter.php b/src/Illuminate/Encryption/Encrypter.php index 6e5880a29e9f..856e6bae8d39 100755 --- a/src/Illuminate/Encryption/Encrypter.php +++ b/src/Illuminate/Encryption/Encrypter.php @@ -99,17 +99,10 @@ public function encrypt($value, $serialize = true) { $iv = random_bytes(openssl_cipher_iv_length(strtolower($this->cipher))); - $tag = ''; - - $value = self::$supportedCiphers[strtolower($this->cipher)]['aead'] - ? \openssl_encrypt( - $serialize ? serialize($value) : $value, - strtolower($this->cipher), $this->key, 0, $iv, $tag - ) - : \openssl_encrypt( - $serialize ? serialize($value) : $value, - strtolower($this->cipher), $this->key, 0, $iv - ); + $value = \openssl_encrypt( + $serialize ? serialize($value) : $value, + strtolower($this->cipher), $this->key, 0, $iv, $tag + ); if ($value === false) { throw new EncryptException('Could not encrypt the data.');