10000 Skip unnecessary check before calling openssl_encrypt (#40108) · laravel/framework@61e3e25 · GitHub
[go: up one dir, main page]

Skip to content

Commit 61e3e25

Browse files
Kriselltaylorotwell
authored andcommitted
Skip unnecessary check before calling openssl_encrypt (#40108)
1 parent ca53127 commit 61e3e25

File tree

1 file changed

+4
-11
lines changed

1 file changed

+4
-11
lines changed

src/Illuminate/Encryption/Encrypter.php

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -99,17 +99,10 @@ public function encrypt($value, $serialize = true)
9999
{
100100
$iv = random_bytes(openssl_cipher_iv_length(strtolower($this->cipher)));
101101

102-
$tag = '';
103-
104-
$value = self::$supportedCiphers[strtolower($this->cipher)]['aead']
105-
? \openssl_encrypt(
106-
$serialize ? serialize($value) : $value,
107-
strtolower($this->cipher), $this->key, 0, $iv, $tag
108-
)
109-
: \openssl_encrypt(
110-
$serialize ? serialize($value) : $value,
111-
strtolower($this->cipher), $this->key, 0, $iv
112-
);
102+
$value = \openssl_encrypt(
103+
$serialize ? serialize($value) : $value,
104+
strtolower($this->cipher), $this->key, 0, $iv, $tag
105+
);
113106

114107
if ($value === false) {
115108
throw new EncryptException('Could not encrypt the data.');

0 commit comments

Comments
 (0)
0