diff options
Diffstat (limited to 'vendor/paragonie/sodium_compat')
-rw-r--r-- | vendor/paragonie/sodium_compat/.github/workflows/ci.yml | 96 | ||||
-rw-r--r-- | vendor/paragonie/sodium_compat/.gitignore | 9 | ||||
-rw-r--r-- | vendor/paragonie/sodium_compat/appveyor.yml | 27 | ||||
-rw-r--r-- | vendor/paragonie/sodium_compat/autoload-fast.php | 4 | ||||
-rw-r--r-- | vendor/paragonie/sodium_compat/autoload-pedantic.php | 6 | ||||
-rw-r--r-- | vendor/paragonie/sodium_compat/autoload-phpunit.php | 8 | ||||
-rw-r--r-- | vendor/paragonie/sodium_compat/build-phar.sh | 8 | ||||
-rw-r--r-- | vendor/paragonie/sodium_compat/dist/Makefile | 39 | ||||
-rw-r--r-- | vendor/paragonie/sodium_compat/dist/box.json | 32 | ||||
-rw-r--r-- | vendor/paragonie/sodium_compat/phpunit.xml.dist | 16 | ||||
-rw-r--r-- | vendor/paragonie/sodium_compat/psalm-above-3.xml | 57 | ||||
-rw-r--r-- | vendor/paragonie/sodium_compat/psalm-below-3.xml | 43 | ||||
-rw-r--r-- | vendor/paragonie/sodium_compat/src/Core/Base64/Common.php | 213 |
13 files changed, 0 insertions, 558 deletions
diff --git a/vendor/paragonie/sodium_compat/.github/workflows/ci.yml b/vendor/paragonie/sodium_compat/.github/workflows/ci.yml deleted file mode 100644 index f570b84..0000000 --- a/vendor/paragonie/sodium_compat/.github/workflows/ci.yml +++ /dev/null @@ -1,96 +0,0 @@ -name: CI
-
-on: [push]
-
-jobs:
- old:
- name: PHP ${{ matrix.php-versions }} Test on ${{ matrix.operating-system }}
- runs-on: ${{ matrix.operating-system }}
- strategy:
- matrix:
- operating-system: ['ubuntu-16.04']
- php-versions: ['5.3', '5.4', '5.5', '5.6', '7.0']
- phpunit-versions: ['7.5.20']
- steps:
- - name: Checkout
- uses: actions/checkout@v2
-
- - name: Setup PHP
- uses: shivammathur/setup-php@v2
- with:
- php-version: ${{ matrix.php-versions }}
- extensions: mbstring, intl
- ini-values: post_max_size=256M, max_execution_time=180
- tools: psalm, phpunit:${{ matrix.phpunit-versions }}
-
- - name: Install dependencies
- run: composer self-update --1; composer install
-
- - name: PHPUnit tests
- uses: php-actions/phpunit@v2
- with:
- memory_limit: 256M
-
- moderate:
- name: PHP ${{ matrix.php-versions }} Test on ${{ matrix.operating-system }}
- runs-on: ${{ matrix.operating-system }}
- strategy:
- matrix:
- operating-system: ['ubuntu-latest']
- php-versions: ['7.1', '7.2', '7.3']
- phpunit-versions: ['latest']
- steps:
- - name: Checkout
- uses: actions/checkout@v2
-
- - name: Setup PHP
- uses: shivammathur/setup-php@v2
- with:
- php-version: ${{ matrix.php-versions }}
- extensions: mbstring, intl, sodium
- ini-values: post_max_size=256M, max_execution_time=180
- tools: psalm, phpunit:${{ matrix.phpunit-versions }}
-
- - name: Install dependencies
- run: composer install
-
- - name: PHPUnit tests
- uses: php-actions/phpunit@v2
- timeout-minutes: 30
- with:
- memory_limit: 256M
-
- modern:
- name: PHP ${{ matrix.php-versions }} Test on ${{ matrix.operating-system }}
- runs-on: ${{ matrix.operating-system }}
- strategy:
- matrix:
- operating-system: ['ubuntu-latest']
- php-versions: ['7.4', '8.0']
- phpunit-versions: ['latest']
- steps:
- - name: Checkout
- uses: actions/checkout@v2
-
- - name: Setup PHP
- uses: shivammathur/setup-php@v2
- with:
- php-version: ${{ matrix.php-versions }}
- extensions: mbstring, intl, sodium
- ini-values: post_max_size=256M, max_execution_time=180
- tools: psalm, phpunit:${{ matrix.phpunit-versions }}
-
- - name: Install dependencies
- run: composer install
-
- - name: PHPUnit tests
- uses: php-actions/phpunit@v2
- timeout-minutes: 30
- with:
- memory_limit: 256M
-
- - name: Install Psalm
- run: composer require --dev vimeo/psalm:^4; cp psalm-above-3.xml psalm.xml
-
- - name: Static Analysis
- run: vendor/bin/psalm
diff --git a/vendor/paragonie/sodium_compat/.gitignore b/vendor/paragonie/sodium_compat/.gitignore deleted file mode 100644 index 0df5a6d..0000000 --- a/vendor/paragonie/sodium_compat/.gitignore +++ /dev/null @@ -1,9 +0,0 @@ -/.idea/ -/.php_cs.cache -/.phpunit.result.cache -/box/ -/dist/sodium-compat.phar -/dist/sodium-compat.phar.sig -/composer.lock -/vendor/ -/psalm.xml diff --git a/vendor/paragonie/sodium_compat/appveyor.yml b/vendor/paragonie/sodium_compat/appveyor.yml deleted file mode 100644 index 9621e9a..0000000 --- a/vendor/paragonie/sodium_compat/appveyor.yml +++ /dev/null @@ -1,27 +0,0 @@ -build: false -shallow_clone: false -platform: - - x86 - - x64 -clone_folder: C:\projects\sodium_compat -image: Visual Studio 2017 - -install: - - cinst -y OpenSSL.Light - - SET PATH=C:\Program Files\OpenSSL;%PATH% - - sc config wuauserv start= auto - - net start wuauserv - - cinst -y php --version 5.6.30 - - cd c:\tools\php56 - - copy php.ini-production php.ini - - echo date.timezone="UTC" >> php.ini - - echo extension_dir=ext >> php.ini - - echo extension=php_openssl.dll >> php.ini - - cd C:\projects\sodium_compat - - SET PATH=C:\tools\php56;%PATH% - - php.exe -r "readfile('http://getcomposer.org/installer');" | php.exe - - php.exe composer.phar install --prefer-source --no-interaction - -test_script: - - cd C:\projects\sodium_compat - - vendor\bin\phpunit.bat tests/Windows32Test.php diff --git a/vendor/paragonie/sodium_compat/autoload-fast.php b/vendor/paragonie/sodium_compat/autoload-fast.php deleted file mode 100644 index 08724d1..0000000 --- a/vendor/paragonie/sodium_compat/autoload-fast.php +++ /dev/null @@ -1,4 +0,0 @@ -<?php - -require_once 'autoload.php'; -ParagonIE_Sodium_Compat::$fastMult = true; diff --git a/vendor/paragonie/sodium_compat/autoload-pedantic.php b/vendor/paragonie/sodium_compat/autoload-pedantic.php deleted file mode 100644 index e4646ca..0000000 --- a/vendor/paragonie/sodium_compat/autoload-pedantic.php +++ /dev/null @@ -1,6 +0,0 @@ -<?php - -require_once 'autoload.php'; -define('DO_PEDANTIC_TEST', true); - -ParagonIE_Sodium_Compat::$fastMult = true; diff --git a/vendor/paragonie/sodium_compat/autoload-phpunit.php b/vendor/paragonie/sodium_compat/autoload-phpunit.php deleted file mode 100644 index 05b003a..0000000 --- a/vendor/paragonie/sodium_compat/autoload-phpunit.php +++ /dev/null @@ -1,8 +0,0 @@ -<?php
-
-require_once (dirname(__FILE__) . '/vendor/autoload.php');
-
-if (PHP_VERSION_ID >= 50300) {
- require_once (dirname(__FILE__) . '/tests/phpunit-shim.php');
-}
-require_once (dirname(__FILE__) . '/autoload.php');
diff --git a/vendor/paragonie/sodium_compat/build-phar.sh b/vendor/paragonie/sodium_compat/build-phar.sh deleted file mode 100644 index 380eee6..0000000 --- a/vendor/paragonie/sodium_compat/build-phar.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/env bash - -curl -LSs https://box-project.github.io/box2/installer.php | php -mkdir ~/box -mv box.phar ~/box/box -PATH=$PATH:~/box/ make -C dist/ build-phar -# PATH=$PATH:~/box/ make -C dist/ sign-phar - diff --git a/vendor/paragonie/sodium_compat/dist/Makefile b/vendor/paragonie/sodium_compat/dist/Makefile deleted file mode 100644 index f30a25d..0000000 --- a/vendor/paragonie/sodium_compat/dist/Makefile +++ /dev/null @@ -1,39 +0,0 @@ -# This builds sodium-compat.phar. To run this Makefile, `box` and `composer` -# must be installed and in your $PATH. Run it from inside the dist/ directory. - -box := $(shell which box) -composer := "composer" -gitcommit := $(shell git rev-parse HEAD) - -.PHONY: all -all: build-phar - -.PHONY: sign-phar -sign-phar: - gpg -u 7F52D5C61D1255C731362E826B97A1C2826404DA --armor --output sodium-compat.phar.sig --detach-sig sodium-compat.phar - -# ensure we run in clean tree. export git tree and run there. -.PHONY: build-phar -build-phar: - @echo "Creating .phar from revision $(shell git rev-parse HEAD)." - rm -rf worktree - install -d worktree - (cd $(CURDIR)/..; git archive HEAD) | tar -x -C worktree - $(MAKE) -f $(CURDIR)/Makefile -C worktree sodium-compat.phar - mv worktree/*.phar . - rm -rf worktree - -.PHONY: clean -clean: - rm -vf sodium-compat.phar sodium-compat.phar.sig - -# Inside workdir/: - -sodium-compat.phar: dist/box.json composer.lock - cp dist/box.json . - php -d phar.readonly=0 $(box) build -c box.json -v - -composer.lock: - $(composer) config autoloader-suffix $(gitcommit) - $(composer) install --no-dev - diff --git a/vendor/paragonie/sodium_compat/dist/box.json b/vendor/paragonie/sodium_compat/dist/box.json deleted file mode 100644 index 5f7827e..0000000 --- a/vendor/paragonie/sodium_compat/dist/box.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "chmod": "0755", - "finder": [ - { - "in": "", - "name": "autoload.php" - }, - { - "in": "src", - "name": "*.php" - }, - { - "in": "lib", - "name": "*.php" - }, - { - "in": "vendor/composer", - "name": "*.php" - }, - { - "in": "vendor/paragonie", - "name": "*.php" - } - ], - "compactors": [ - "Herrera\\Box\\Compactor\\Php" - ], - "main": "vendor/autoload.php", - "output": "sodium-compat.phar", - "shebang": false, - "stub": true -} diff --git a/vendor/paragonie/sodium_compat/phpunit.xml.dist b/vendor/paragonie/sodium_compat/phpunit.xml.dist deleted file mode 100644 index a705527..0000000 --- a/vendor/paragonie/sodium_compat/phpunit.xml.dist +++ /dev/null @@ -1,16 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" backupGlobals="true" backupStaticAttributes="false" bootstrap="autoload-phpunit.php" colors="true" convertErrorsToExceptions="true" convertNoticesToExceptions="true" convertWarningsToExceptions="true" processIsolation="false" stopOnError="false" stopOnFailure="false" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
- <coverage processUncoveredFiles="true">
- <include>
- <directory suffix=".php">./src</directory>
- </include>
- </coverage>
- <testsuites>
- <testsuite name="Unit Tests">
- <directory suffix="Test.php">./tests/unit</directory>
- </testsuite>
- <testsuite name="Libsodium Compatibility Tests">
- <directory suffix="Test.php">./tests/compat</directory>
- </testsuite>
- </testsuites>
-</phpunit>
diff --git a/vendor/paragonie/sodium_compat/psalm-above-3.xml b/vendor/paragonie/sodium_compat/psalm-above-3.xml deleted file mode 100644 index 63b8c80..0000000 --- a/vendor/paragonie/sodium_compat/psalm-above-3.xml +++ /dev/null @@ -1,57 +0,0 @@ -<?xml version="1.0"?>
-<psalm
- useDocblockTypes="true"
- totallyTyped="true"
->
- <projectFiles>
- <directory name="src" />
- </projectFiles>
- <issueHandlers>
- <InvalidFunctionCall errorLevel="suppress" />
- <!--
- Previous issue type is suppressed because we have to use a string
- as a function name for PHP 5.2 compatibility. When testing, be sure
- to change this to "info".
- -->
-
- <UndefinedFunction errorLevel="info" />
- <!--
- Inconsistently erroneous.
- -->
-
- <DuplicateClass errorLevel="info" />
- <!--
- Psalm isn't correctly identifying the guard conditions that return
- early if a class already exists.
- -->
- <RedundantConditionGivenDocblockType errorLevel="suppress" />
-
- <TooFewArguments errorLevel="info" />
-
- <DocblockTypeContradiction errorLevel="suppress" />
- <RedundantCondition errorLevel="info" />
- <!--
- Redundancy is good for PHP <7
- -->
-
- <TypeDoesNotContainType errorLevel="info" />
- <!--
- This mostly fails on `PHP_INT_SIZE === 4`
- -->
-
- <InternalMethod errorLevel="suppress" />
- <!--
- We mark methods as internal.
- -->
- <PossiblyNullArgument errorLevel="suppress" />
- <!--
- Not interesting
- -->
-
- <RedundantCast errorLevel="info" />
- <UnnecessaryVarAnnotation errorLevel="suppress" />
- <UnusedVariable errorLevel="info" />
- <UnusedFunctionCall errorLevel="info" />
-
- </issueHandlers>
-</psalm>
diff --git a/vendor/paragonie/sodium_compat/psalm-below-3.xml b/vendor/paragonie/sodium_compat/psalm-below-3.xml deleted file mode 100644 index 0da3cd9..0000000 --- a/vendor/paragonie/sodium_compat/psalm-below-3.xml +++ /dev/null @@ -1,43 +0,0 @@ -<?xml version="1.0"?> -<psalm - useDocblockTypes="true" - totallyTyped="true" -> - <projectFiles> - <directory name="src" /> - </projectFiles> - <issueHandlers> - <InvalidFunctionCall errorLevel="suppress" /> - <!-- - Previous issue type is suppressed because we have to use a string - as a function name for PHP 5.2 compatibility. When testing, be sure - to change this to "info". - --> - - <UndefinedFunction errorLevel="info" /> - <!-- - Inconsistently erroneous. - --> - - <DuplicateClass errorLevel="info" /> - <!-- - Psalm isn't correctly identifying the guard conditions that return - early if a class already exists. - --> - <RedundantConditionGivenDocblockType errorLevel="suppress" /> - - <TooFewArguments errorLevel="info" /> - - <DocblockTypeContradiction errorLevel="info" /> - <RedundantCondition errorLevel="info" /> - <!-- - Redundancy is good for PHP <7 - --> - - <TypeDoesNotContainType errorLevel="info" /> - <!-- - This mostly fails on `PHP_INT_SIZE === 4` - --> - - </issueHandlers> -</psalm> diff --git a/vendor/paragonie/sodium_compat/src/Core/Base64/Common.php b/vendor/paragonie/sodium_compat/src/Core/Base64/Common.php deleted file mode 100644 index 94b2e8f..0000000 --- a/vendor/paragonie/sodium_compat/src/Core/Base64/Common.php +++ /dev/null @@ -1,213 +0,0 @@ -<?php - -/** - * Class ParagonIE_Sodium_Core_Base64 - * - * Copyright (c) 2016 - 2018 Paragon Initiative Enterprises. - * Copyright (c) 2014 Steve "Sc00bz" Thomas (steve at tobtu dot com) - * - * We have to copy/paste the contents into the variant files because PHP 5.2 - * doesn't support late static binding, and we have no better workaround - * available that won't break PHP 7+. Therefore, we're forced to duplicate code. - */ -abstract class ParagonIE_Sodium_Core_Base64_Common -{ - /** - * Encode into Base64 - * - * Base64 character set "[A-Z][a-z][0-9]+/" - * - * @param string $src - * @return string - * @throws TypeError - */ - public static function encode($src) - { - return self::doEncode($src, true); - } - - /** - * Encode into Base64, no = padding - * - * Base64 character set "[A-Z][a-z][0-9]+/" - * - * @param string $src - * @return string - * @throws TypeError - */ - public static function encodeUnpadded($src) - { - return self::doEncode($src, false); - } - - /** - * @param string $src - * @param bool $pad Include = padding? - * @return string - * @throws TypeError - */ - protected static function doEncode($src, $pad = true) - { - $dest = ''; - $srcLen = ParagonIE_Sodium_Core_Util::strlen($src); - // Main loop (no padding): - for ($i = 0; $i + 3 <= $srcLen; $i += 3) { - /** @var array<int, int> $chunk */ - $chunk = unpack('C*', ParagonIE_Sodium_Core_Util::substr($src, $i, 3)); - $b0 = $chunk[1]; - $b1 = $chunk[2]; - $b2 = $chunk[3]; - - $dest .= - self::encode6Bits( $b0 >> 2 ) . - self::encode6Bits((($b0 << 4) | ($b1 >> 4)) & 63) . - self::encode6Bits((($b1 << 2) | ($b2 >> 6)) & 63) . - self::encode6Bits( $b2 & 63); - } - // The last chunk, which may have padding: - if ($i < $srcLen) { - /** @var array<int, int> $chunk */ - $chunk = unpack('C*', ParagonIE_Sodium_Core_Util::substr($src, $i, $srcLen - $i)); - $b0 = $chunk[1]; - if ($i + 1 < $srcLen) { - $b1 = $chunk[2]; - $dest .= - self::encode6Bits($b0 >> 2) . - self::encode6Bits((($b0 << 4) | ($b1 >> 4)) & 63) . - self::encode6Bits(($b1 << 2) & 63); - if ($pad) { - $dest .= '='; - } - } else { - $dest .= - self::encode6Bits( $b0 >> 2) . - self::encode6Bits(($b0 << 4) & 63); - if ($pad) { - $dest .= '=='; - } - } - } - return $dest; - } - - /** - * decode from base64 into binary - * - * Base64 character set "./[A-Z][a-z][0-9]" - * - * @param string $src - * @param bool $strictPadding - * @return string - * @throws RangeException - * @throws TypeError - * @psalm-suppress RedundantCondition - */ - public static function decode($src, $strictPadding = false) - { - // Remove padding - $srcLen = ParagonIE_Sodium_Core_Util::strlen($src); - if ($srcLen === 0) { - return ''; - } - - if ($strictPadding) { - if (($srcLen & 3) === 0) { - if ($src[$srcLen - 1] === '=') { - $srcLen--; - if ($src[$srcLen - 1] === '=') { - $srcLen--; - } - } - } - if (($srcLen & 3) === 1) { - throw new RangeException( - 'Incorrect padding' - ); - } - if ($src[$srcLen - 1] === '=') { - throw new RangeException( - 'Incorrect padding' - ); - } - } else { - $src = rtrim($src, '='); - $srcLen = ParagonIE_Sodium_Core_Util::strlen($src); - } - - $err = 0; - $dest = ''; - // Main loop (no padding): - for ($i = 0; $i + 4 <= $srcLen; $i += 4) { - /** @var array<int, int> $chunk */ - $chunk = unpack('C*', ParagonIE_Sodium_Core_Util::substr($src, $i, 4)); - $c0 = self::decode6Bits($chunk[1]); - $c1 = self::decode6Bits($chunk[2]); - $c2 = self::decode6Bits($chunk[3]); - $c3 = self::decode6Bits($chunk[4]); - - $dest .= pack( - 'CCC', - ((($c0 << 2) | ($c1 >> 4)) & 0xff), - ((($c1 << 4) | ($c2 >> 2)) & 0xff), - ((($c2 << 6) | $c3 ) & 0xff) - ); - $err |= ($c0 | $c1 | $c2 | $c3) >> 8; - } - // The last chunk, which may have padding: - if ($i < $srcLen) { - /** @var array<int, int> $chunk */ - $chunk = unpack('C*', ParagonIE_Sodium_Core_Util::substr($src, $i, $srcLen - $i)); - $c0 = self::decode6Bits($chunk[1]); - - if ($i + 2 < $srcLen) { - $c1 = self::decode6Bits($chunk[2]); - $c2 = self::decode6Bits($chunk[3]); - $dest .= pack( - 'CC', - ((($c0 << 2) | ($c1 >> 4)) & 0xff), - ((($c1 << 4) | ($c2 >> 2)) & 0xff) - ); - $err |= ($c0 | $c1 | $c2) >> 8; - } elseif ($i + 1 < $srcLen) { - $c1 = self::decode6Bits($chunk[2]); - $dest .= pack( - 'C', - ((($c0 << 2) | ($c1 >> 4)) & 0xff) - ); - $err |= ($c0 | $c1) >> 8; - } elseif ($i < $srcLen && $strictPadding) { - $err |= 1; - } - } - /** @var bool $check */ - $check = ($err === 0); - if (!$check) { - throw new RangeException( - 'Base64::decode() only expects characters in the correct base64 alphabet' - ); - } - return $dest; - } - - /** - * Uses bitwise operators instead of table-lookups to turn 6-bit integers - * into 8-bit integers. - * - * Base64 character set: - * [A-Z] [a-z] [0-9] + / - * 0x41-0x5a, 0x61-0x7a, 0x30-0x39, 0x2b, 0x2f - * - * @param int $src - * @return int - */ - abstract protected static function decode6Bits($src); - - /** - * Uses bitwise operators instead of table-lookups to turn 8-bit integers - * into 6-bit integers. - * - * @param int $src - * @return string - */ - abstract protected static function encode6Bits($src); -} |