diff options
| -rw-r--r-- | .github/workflows/ci.yaml | 43 | ||||
| -rw-r--r-- | .gitignore | 1 | ||||
| -rw-r--r-- | .gitleaks.toml | 13 | ||||
| -rw-r--r-- | README.md | 24 | ||||
| -rw-r--r-- | composer.json | 13 | ||||
| -rw-r--r-- | config.w32 | 14 | ||||
| -rw-r--r-- | package.xml | 33 | ||||
| -rw-r--r-- | php_xpass.h | 2 | 
8 files changed, 125 insertions, 18 deletions
diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 502f8fe..9277819 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -5,13 +5,13 @@ on:          - master    pull_request:  jobs: -  Linux_EL: +  Linux_EL9:      runs-on: ubuntu-latest      strategy:        matrix:          distro: ['rockylinux']          el: [9] -        php: [0, '8.1', '8.2', 'remi-8.0', 'remi-8.1', 'remi-8.2', 'remi-8.3'] +        php: [0, '8.2', '8.3', 'remi-8.0', 'remi-8.1', 'remi-8.2', 'remi-8.3', 'remi-8.4']      container:        image: ${{ matrix.distro }}:${{ matrix.el }}      steps: @@ -37,12 +37,47 @@ jobs:            TEST_PHP_ARGS: '-q --show-diff'          run: |            make test +  Linux_EL10: +    runs-on: ubuntu-latest +    strategy: +      matrix: +        distro: ['almalinux'] +        el: [10] +        php: [0, 'remi-8.0', 'remi-8.1', 'remi-8.2', 'remi-8.3', 'remi-8.4'] +    container: +      image: ${{ matrix.distro }}:${{ matrix.el }} +    steps: +      - name: Install gzip +        run: | +          dnf install -y "gzip" +      - name: Checkout +        uses: actions/checkout@v4 +      - name: Setup PHP module +        if: ${{ matrix.php }} +        run: | +          dnf install -y "https://rpms.remirepo.net/enterprise/remi-release-${{ matrix.el }}.rpm" +          dnf module enable -y "php:${{ matrix.php }}" +      - name: Install PHP +        run: | +          dnf install -y "php" "php-devel" "libxcrypt-devel" +      - name: Show PHP version +        run: php -v +      - name: Make php-xpass +        run: | +          phpize +          ./configure +          make -j"$(nproc)" +      - name: Test php-xpass +        env: +          TEST_PHP_ARGS: '-q --show-diff' +        run: | +          make test    Linux_Fedora:      runs-on: ubuntu-latest      strategy:        matrix: -        fedora: [39, 40, 41] -        php: [0, 'remi-8.0', 'remi-8.1', 'remi-8.2', 'remi-8.3'] +        fedora: [41, 42] +        php: [0, 'remi-8.0', 'remi-8.1', 'remi-8.2', 'remi-8.3', 'remi-8.4']      container:        image: fedora:${{ matrix.fedora }}      steps: @@ -42,4 +42,5 @@ tests/**/*.sh  tests/**/*.db  tests/**/*.mem  tmp-php.ini +sendpackagist  xpass-*.tgz diff --git a/.gitleaks.toml b/.gitleaks.toml new file mode 100644 index 0000000..dbc852b --- /dev/null +++ b/.gitleaks.toml @@ -0,0 +1,13 @@ +[allowlist] +  description = "Global Allowlist" + +  # Ignore based on any subset of the file path +  paths = [ +    # Ignore documentation +    '''README.md''', + +    # Ignore tests +    '''tests\/.*\.phpt''', +  ] + + @@ -1,3 +1,6 @@ +[](https://github.com/remicollet/php-xpass/actions/workflows/ci.yaml) + +  # xpass extension for PHP  This extension provides password hashing algorithms used by Linux distributions. @@ -9,11 +12,11 @@ Notices: these can be fast, don't expect improved security level.  It also provides additional functions from libxcrypt missing in core PHP: -* crypt_preferred_method: get the prefix of the preferred hash method -* crypt_gensalt: encode settings for passphrase hashing -* crypt_checksalt: validate a crypt setting string +* `crypt_preferred_method`: get the prefix of the preferred hash method +* `crypt_gensalt`: encode settings for passphrase hashing +* `crypt_checksalt`: validate a crypt setting string -See the Linux man pages. +See the Linux man pages or [PHP Documentation](https://www.php.net/xpass)  **Computation time** @@ -35,7 +38,9 @@ See the Linux man pages.  Compatible with PHP 8.0 or greater. -You need the Extended crypt library development files (libxcrypt-devel) +It is recommended to ensure PHP is built using `--with-external-libcrypt` option. + +You need the Extended crypt library development files (libxcrypt-devel, libcrypt-dev)  version 4.4 or greater.  From the sources tree @@ -45,6 +50,15 @@ From the sources tree      $ make      $ make test +From https://pecl.php.net/ using pecl command + +    $ pecl install xpass + +From https://packagist.org/ using PHP Installer for Extensions + +    $ pie install remi/xpass + +  # Usage  ## password hashing and verifying diff --git a/composer.json b/composer.json new file mode 100644 index 0000000..9e7fd3c --- /dev/null +++ b/composer.json @@ -0,0 +1,13 @@ +{ +    "name": "remi/xpass", +    "type": "php-ext", +    "license": "PHP-3.01", +    "description": "Extended password extension", +    "require": { +        "php": ">= 8.0.0" +    }, +    "php-ext": { +        "extension-name": "xpass", +        "configure-options": [] +    } +} diff --git a/config.w32 b/config.w32 new file mode 100644 index 0000000..5f8b6cf --- /dev/null +++ b/config.w32 @@ -0,0 +1,14 @@ +ARG_ENABLE("xpass", "Enable xpass support", "no"); + +if (PHP_XPASS != "no") { +    if (CHECK_LIB("crypt.lib", "xpass", PHP_XPASS) +     && CHECK_HEADER_ADD_INCLUDE("crypt.h", "CLFAGS_XPASS", PHP_XPASS) +     && CHECK_LIB("bcrypt.lib", "xpass", PHP_XPASS)) { +        AC_DEFINE("HAVE_XPASS", 1, "Have xpass support"); +        EXTENSION("xpass", "xpass.c"); +        AC_DEFINE("HAVE_CRYPT_YESCRYPT", 1, "Have yescrypt hash support"); +        AC_DEFINE("HAVE_CRYPT_SHA512", 1, "Have sha512 hash support"); +    } else { +        WARNING("xpass not enabled; libraries and headers not found"); +    } +} diff --git a/package.xml b/package.xml index f00ea28..cd7789b 100644 --- a/package.xml +++ b/package.xml @@ -15,6 +15,8 @@ It also provides additional functions from libxcrypt missing in core PHP:  * crypt_preferred_method  * crypt_gensalt  * crypt_checksalt + +See PHP documentation on https://www.php.net/xpass  </description>    <lead>      <name>Remi Collet</name> @@ -22,21 +24,18 @@ It also provides additional functions from libxcrypt missing in core PHP:      <email>remi@php.net</email>      <active>yes</active>    </lead> -  <date>2024-09-13</date> +  <date>2024-09-26</date>    <version> -    <release>1.1.0RC1</release> +    <release>1.1.1dev</release>      <api>1.1.0</api>    </version>    <stability> -    <release>beta</release> -    <api>beta</api> +    <release>stable</release> +    <api>stable</api>    </stability>    <license uri="https://www.php.net/license/3_01.txt" filesource="LICENSE">PHP-3.01</license>    <notes><![CDATA[ -- add crypt_gensalt(?string $prefix = null, int $count = 0): ?string {} -- add crypt_preferred_method(): ?string {} -- add crypt_checksalt(string $salt): int {} -- add CRYPT_PREFIX_* and CRYPT_SALT_* constants +-    ]]></notes>    <contents>      <dir name="/"> @@ -76,6 +75,24 @@ It also provides additional functions from libxcrypt missing in core PHP:    <extsrcrelease/>    <changelog>      <release> +      <date>2024-09-26</date> +      <version> +        <release>1.1.0</release> +        <api>1.1.0</api> +      </version> +      <stability> +        <release>stable</release> +        <api>stable</api> +      </stability> +      <license uri="https://www.php.net/license/3_01.txt" filesource="LICENSE">PHP-3.01</license> +      <notes><![CDATA[ +- add crypt_gensalt(?string $prefix = null, int $count = 0): ?string {} +- add crypt_preferred_method(): ?string {} +- add crypt_checksalt(string $salt): int {} +- add CRYPT_PREFIX_* and CRYPT_SALT_* constants +      ]]></notes> +    </release> +    <release>        <date>2024-09-09</date>        <version>          <release>1.0.0</release> diff --git a/php_xpass.h b/php_xpass.h index 56da634..0d10ff2 100644 --- a/php_xpass.h +++ b/php_xpass.h @@ -22,7 +22,7 @@  extern zend_module_entry xpass_module_entry;  #define phpext_xpass_ptr &xpass_module_entry -#define PHP_XPASS_VERSION "1.1.0RC1" +#define PHP_XPASS_VERSION "1.1.0"  #define PHP_XPASS_AUTHOR  "Remi Collet"  #define PHP_XPASS_LICENSE "PHP-3.01"  | 
