From 9566a40bcf357a8ecc8e6d791df6d3763817650b Mon Sep 17 00:00:00 2001 From: Ivan Enderlin Date: Wed, 7 Nov 2018 15:37:03 +0100 Subject: [PATCH 1/2] Fix a type issue with `openssl_decrypt` (#8) `openssl_decrypt` expects `$A` to be a string. `$A` can be `null` (which is the default value), which is incorrect. Thanks for the library :-). --- src/AESGCM.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/AESGCM.php b/src/AESGCM.php index ce7a7d7..7b7b1c5 100644 --- a/src/AESGCM.php +++ b/src/AESGCM.php @@ -192,7 +192,7 @@ public static function decryptWithAppendedTag($K, $IV, $Ciphertext = null, $A = private static function decryptWithPHP71($K, $key_length, $IV, $C, $A, $T) { $mode = 'aes-'.($key_length).'-gcm'; - $P = openssl_decrypt(null === $C ? '' : $C, $mode, $K, OPENSSL_RAW_DATA, $IV, $T, $A); + $P = openssl_decrypt(null === $C ? '' : $C, $mode, $K, OPENSSL_RAW_DATA, $IV, $T, null === $A ? '' : $A); Assertion::true(false !== $P, 'Unable to decrypt or to verify the tag.'); return $P; From afcaedff2b07494265ef6e0b6c6da30a5ccc2faa Mon Sep 17 00:00:00 2001 From: "guardrails[bot]" Date: Wed, 7 Nov 2018 15:37:34 +0100 Subject: [PATCH 2/2] docs(readme): add GuardRails badge (#7) --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 9b1c06b..2e9c09b 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ Help me out for a couple of :beers:! [![Latest Stable Version](https://poser.pugx.org/Spomky-Labs/php-aes-gcm/v/stable.png)](https://packagist.org/packages/Spomky-Labs/php-aes-gcm) [![Total Downloads](https://poser.pugx.org/Spomky-Labs/php-aes-gcm/downloads.png)](https://packagist.org/packages/Spomky-Labs/php-aes-gcm) [![Latest Unstable Version](https://poser.pugx.org/Spomky-Labs/php-aes-gcm/v/unstable.png)](https://packagist.org/packages/Spomky-Labs/php-aes-gcm) -[![License](https://poser.pugx.org/Spomky-Labs/php-aes-gcm/license.png)](https://packagist.org/packages/Spomky-Labs/php-aes-gcm) +[![License](https://poser.pugx.org/Spomky-Labs/php-aes-gcm/license.png)](https://packagist.org/packages/Spomky-Labs/php-aes-gcm) [![GuardRails badge](https://badges.production.guardrails.io/Spomky-Labs/php-aes-gcm.svg)](https://www.guardrails.io) # The Release Process