X-Git-Url: https://reisub.nsupdate.info/git/?a=blobdiff_plain;f=securemail%2Fvendor%2Fphpseclib%2Fphpseclib%2Fphpseclib%2FCrypt%2FRSA.php;h=19dcfea3ffb266543a26eb6ac89a457c058952e1;hb=0a69c66d0920cad86e56cf6d068b3536344a3cf0;hp=7b935cc2dc4d2be7bf40a919fa44b5fc70f96efe;hpb=7bff983d215650cd2c732fbeaf6daea7aa96fbab;p=friendica-addons.git%2F.git diff --git a/securemail/vendor/phpseclib/phpseclib/phpseclib/Crypt/RSA.php b/securemail/vendor/phpseclib/phpseclib/phpseclib/Crypt/RSA.php index 7b935cc2..19dcfea3 100644 --- a/securemail/vendor/phpseclib/phpseclib/phpseclib/Crypt/RSA.php +++ b/securemail/vendor/phpseclib/phpseclib/phpseclib/Crypt/RSA.php @@ -332,6 +332,7 @@ abstract class RSA extends AsymmetricKey openssl_pkey_export($rsa, $privatekeystr, null, $config); // clear the buffer of error strings stemming from a minimalistic openssl.cnf + // https://github.com/php/php-src/issues/11054 talks about other errors this'll pick up while (openssl_error_string() !== false) { } @@ -841,15 +842,15 @@ abstract class RSA extends AsymmetricKey self::ENCRYPTION_PKCS1, self::ENCRYPTION_NONE ]; - $numSelected = 0; + $encryptedCount = 0; $selected = 0; foreach ($masks as $mask) { if ($padding & $mask) { $selected = $mask; - $numSelected++; + $encryptedCount++; } } - if ($numSelected > 1) { + if ($encryptedCount > 1) { throw new InconsistentSetupException('Multiple encryption padding modes have been selected; at most only one should be selected'); } $encryptionPadding = $selected; @@ -859,22 +860,26 @@ abstract class RSA extends AsymmetricKey self::SIGNATURE_RELAXED_PKCS1, self::SIGNATURE_PKCS1 ]; - $numSelected = 0; + $signatureCount = 0; $selected = 0; foreach ($masks as $mask) { if ($padding & $mask) { $selected = $mask; - $numSelected++; + $signatureCount++; } } - if ($numSelected > 1) { + if ($signatureCount > 1) { throw new InconsistentSetupException('Multiple signature padding modes have been selected; at most only one should be selected'); } $signaturePadding = $selected; $new = clone $this; - $new->encryptionPadding = $encryptionPadding; - $new->signaturePadding = $signaturePadding; + if ($encryptedCount) { + $new->encryptionPadding = $encryptionPadding; + } + if ($signatureCount) { + $new->signaturePadding = $signaturePadding; + } return $new; }