mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-03-17 20:34:51 +08:00
Add openssl argon2 password hash support for PHP 8.5
This commit is contained in:
parent
9ed3c8b498
commit
5f5d934d58
@ -26,6 +26,14 @@ class openssl extends Extension
|
||||
public function getUnixConfigureArg(bool $shared = false): string
|
||||
{
|
||||
$openssl_dir = $this->builder->getPHPVersionID() >= 80400 ? '' : ' --with-openssl-dir=' . BUILD_ROOT_PATH;
|
||||
return '--with-openssl=' . ($shared ? 'shared,' : '') . BUILD_ROOT_PATH . $openssl_dir;
|
||||
$args = '--with-openssl=' . ($shared ? 'shared,' : '') . BUILD_ROOT_PATH . $openssl_dir;
|
||||
if (
|
||||
$this->builder->getPHPVersionID() >= 80500 &&
|
||||
($ver = $this->builder->getLib('openssl')->getLibVersion()) &&
|
||||
version_compare($ver, '3.2.0', '>=')
|
||||
) {
|
||||
$args .= ' --with-openssl-argon2 OPENSSL_LIBS="-lz"';
|
||||
}
|
||||
return $args;
|
||||
}
|
||||
}
|
||||
|
||||
@ -29,6 +29,8 @@ use SPC\store\FileSystem;
|
||||
|
||||
class openssl extends LinuxLibraryBase
|
||||
{
|
||||
use \SPC\builder\unix\library\openssl;
|
||||
|
||||
public const NAME = 'openssl';
|
||||
|
||||
/**
|
||||
@ -38,8 +40,6 @@ class openssl extends LinuxLibraryBase
|
||||
*/
|
||||
public function build(): void
|
||||
{
|
||||
[,,$destdir] = SEPARATED_PATH;
|
||||
|
||||
$extra = '';
|
||||
$ex_lib = '-ldl -pthread';
|
||||
$arch = getenv('SPC_ARCH');
|
||||
|
||||
@ -28,6 +28,8 @@ use SPC\store\FileSystem;
|
||||
|
||||
class openssl extends MacOSLibraryBase
|
||||
{
|
||||
use \SPC\builder\unix\library\openssl;
|
||||
|
||||
public const NAME = 'openssl';
|
||||
|
||||
/**
|
||||
|
||||
21
src/SPC/builder/unix/library/openssl.php
Normal file
21
src/SPC/builder/unix/library/openssl.php
Normal file
@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace SPC\builder\unix\library;
|
||||
|
||||
trait openssl
|
||||
{
|
||||
public function getLibVersion(): ?string
|
||||
{
|
||||
// get openssl version from source directory
|
||||
if (file_exists("{$this->source_dir}/VERSION.dat")) {
|
||||
// parse as INI
|
||||
$version = parse_ini_file("{$this->source_dir}/VERSION.dat");
|
||||
if ($version !== false) {
|
||||
return "{$version['MAJOR']}.{$version['MINOR']}.{$version['PATCH']}";
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@ -7,3 +7,6 @@ assert(openssl_digest('123456', 'md5') === 'e10adc3949ba59abbe56e057f20f883e');
|
||||
if (file_exists('/etc/ssl/openssl.cnf')) {
|
||||
assert(file_get_contents('https://captive.apple.com/') !== false);
|
||||
}
|
||||
if (PHP_VERSION_ID >= 80500 && defined('OPENSSL_VERSION_NUMBER') && OPENSSL_VERSION_NUMBER >= 0x30200000) {
|
||||
assert(function_exists('openssl_password_hash'));
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user