Added manual install instructions
This commit is contained in:
parent
40bdc3dd79
commit
f4d4423a4a
192
README.md
192
README.md
|
|
@ -12,14 +12,15 @@ to reproduce that format exactly.
|
||||||
|
|
||||||
## Supported Environment
|
## Supported Environment
|
||||||
|
|
||||||
The automated installation currently supports 64-bit Debian and Ubuntu systems.
|
The automated installer currently supports 64-bit Debian and Ubuntu systems.
|
||||||
This includes Ubuntu running through WSL.
|
This includes Ubuntu running through WSL. The modules can also be compiled
|
||||||
|
manually on other Linux distributions.
|
||||||
|
|
||||||
Native modules are tied to the operating system, CPU architecture, and PHP
|
Native modules are tied to the operating system, CPU architecture, and PHP
|
||||||
extension API. They should normally be compiled on the machine where they will
|
extension API. They should normally be compiled on the machine where they will
|
||||||
run.
|
run.
|
||||||
|
|
||||||
## Build Requirements
|
## Debian And Ubuntu Requirements
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
sudo apt update
|
sudo apt update
|
||||||
|
|
@ -29,7 +30,7 @@ sudo apt install -y \
|
||||||
build-essential git pkg-config libssl-dev
|
build-essential git pkg-config libssl-dev
|
||||||
```
|
```
|
||||||
|
|
||||||
## Build
|
## Automated Debian And Ubuntu Build
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
chmod +x build-linux.sh install-linux.sh
|
chmod +x build-linux.sh install-linux.sh
|
||||||
|
|
@ -44,7 +45,7 @@ This downloads and compiles:
|
||||||
|
|
||||||
Building does not install or enable the modules.
|
Building does not install or enable the modules.
|
||||||
|
|
||||||
## Install
|
## Automated Debian And Ubuntu Installation
|
||||||
|
|
||||||
After a successful build:
|
After a successful build:
|
||||||
|
|
||||||
|
|
@ -83,6 +84,186 @@ sudo systemctl restart php8.3-fpm
|
||||||
|
|
||||||
Use the PHP version installed on the server in the service name.
|
Use the PHP version installed on the server in the service name.
|
||||||
|
|
||||||
|
## Manual Build On Other Linux Distributions
|
||||||
|
|
||||||
|
Other distributions can use the same modules but may use different package
|
||||||
|
names and PHP configuration locations.
|
||||||
|
|
||||||
|
The following tools are required:
|
||||||
|
|
||||||
|
- PHP CLI and the matching PHP development package
|
||||||
|
- `phpize` and `php-config`
|
||||||
|
- SWIG
|
||||||
|
- CMake
|
||||||
|
- Ninja
|
||||||
|
- Git
|
||||||
|
- A C and C++ compiler
|
||||||
|
- Make
|
||||||
|
- OpenSSL development headers
|
||||||
|
- `pkg-config`
|
||||||
|
|
||||||
|
The PHP development package must match the PHP installation that will load the
|
||||||
|
modules. For example, an extension built for PHP 8.3 should not be loaded into
|
||||||
|
PHP 8.4.
|
||||||
|
|
||||||
|
### Fedora, RHEL, Rocky Linux, And AlmaLinux
|
||||||
|
|
||||||
|
Package names vary between system repositories and third-party PHP
|
||||||
|
repositories, but a typical installation is:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sudo dnf install \
|
||||||
|
php-cli php-devel \
|
||||||
|
swig cmake ninja-build \
|
||||||
|
gcc gcc-c++ make git pkgconf-pkg-config openssl-devel
|
||||||
|
```
|
||||||
|
|
||||||
|
### Arch Linux
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sudo pacman -S --needed \
|
||||||
|
php swig cmake ninja \
|
||||||
|
base-devel git pkgconf openssl
|
||||||
|
```
|
||||||
|
|
||||||
|
### Alpine Linux
|
||||||
|
|
||||||
|
The exact PHP development package includes the installed PHP version on some
|
||||||
|
Alpine releases:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sudo apk add \
|
||||||
|
php php-dev \
|
||||||
|
swig cmake ninja \
|
||||||
|
build-base git pkgconf openssl-dev
|
||||||
|
```
|
||||||
|
|
||||||
|
Confirm the required PHP build commands exist:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
php --version
|
||||||
|
phpize --version
|
||||||
|
php-config --version
|
||||||
|
swig -version
|
||||||
|
```
|
||||||
|
|
||||||
|
### Build liboqs
|
||||||
|
|
||||||
|
Choose a working directory:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
mkdir -p contractless-php-build
|
||||||
|
cd contractless-php-build
|
||||||
|
```
|
||||||
|
|
||||||
|
Download and compile a minimal liboqs containing the fixed-size Falcon
|
||||||
|
algorithm used by Contractless:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
git clone --depth 1 https://github.com/open-quantum-safe/liboqs.git
|
||||||
|
|
||||||
|
cmake -S liboqs -B liboqs/build -GNinja \
|
||||||
|
-DBUILD_SHARED_LIBS=OFF \
|
||||||
|
-DOQS_BUILD_ONLY_LIB=ON \
|
||||||
|
-DOQS_MINIMAL_BUILD="SIG_falcon_padded_512"
|
||||||
|
|
||||||
|
ninja -C liboqs/build
|
||||||
|
```
|
||||||
|
|
||||||
|
Do not substitute `Falcon-512`. Contractless requires
|
||||||
|
`Falcon-padded-512`, which produces fixed 666-byte signatures.
|
||||||
|
|
||||||
|
### Build The Contractless liboqs-php Module
|
||||||
|
|
||||||
|
Clone the PHP wrapper:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
git clone --depth 1 https://github.com/Muzosh/liboqs-php.git
|
||||||
|
```
|
||||||
|
|
||||||
|
Apply `oqsphp-contractless.patch` from this repository:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cd liboqs-php
|
||||||
|
git apply /full/path/to/Contractless-PHP-Modules/oqsphp-contractless.patch
|
||||||
|
```
|
||||||
|
|
||||||
|
Build the PHP extension against the liboqs copy compiled above:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
LIBOQS_ROOT="$(cd ../liboqs && pwd)" bash build.sh
|
||||||
|
cd ..
|
||||||
|
```
|
||||||
|
|
||||||
|
The resulting module is:
|
||||||
|
|
||||||
|
```text
|
||||||
|
liboqs-php/build/oqsphp.so
|
||||||
|
```
|
||||||
|
|
||||||
|
### Build The Skein Module
|
||||||
|
|
||||||
|
```bash
|
||||||
|
git clone --depth 1 https://github.com/jedisct1/PHP-Skein-Hash.git php-skein
|
||||||
|
cd php-skein
|
||||||
|
phpize
|
||||||
|
./configure
|
||||||
|
make
|
||||||
|
cd ..
|
||||||
|
```
|
||||||
|
|
||||||
|
The resulting module is:
|
||||||
|
|
||||||
|
```text
|
||||||
|
php-skein/modules/skein.so
|
||||||
|
```
|
||||||
|
|
||||||
|
### Install The Modules Manually
|
||||||
|
|
||||||
|
Find the extension directory used by the active PHP installation:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
php-config --extension-dir
|
||||||
|
```
|
||||||
|
|
||||||
|
Copy both modules into that directory:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sudo install -m 0755 \
|
||||||
|
liboqs-php/build/oqsphp.so \
|
||||||
|
"$(php-config --extension-dir)/oqsphp.so"
|
||||||
|
|
||||||
|
sudo install -m 0755 \
|
||||||
|
php-skein/modules/skein.so \
|
||||||
|
"$(php-config --extension-dir)/skein.so"
|
||||||
|
```
|
||||||
|
|
||||||
|
Find the PHP configuration files:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
php --ini
|
||||||
|
```
|
||||||
|
|
||||||
|
Add these lines to the appropriate `php.ini` or extension configuration file:
|
||||||
|
|
||||||
|
```ini
|
||||||
|
extension=skein.so
|
||||||
|
extension=oqsphp.so
|
||||||
|
```
|
||||||
|
|
||||||
|
CLI PHP, Apache, and PHP-FPM can use different configuration directories. The
|
||||||
|
modules must be enabled for every PHP runtime that uses
|
||||||
|
`php-contractless-rpc`.
|
||||||
|
|
||||||
|
Restart Apache or PHP-FPM after changing its configuration. Service names vary
|
||||||
|
by distribution and installed PHP version.
|
||||||
|
|
||||||
|
Verify the manual installation:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
php -m | grep -E '^(skein|oqsphp)$'
|
||||||
|
```
|
||||||
|
|
||||||
## Compatibility Test
|
## Compatibility Test
|
||||||
|
|
||||||
The compatibility test proves that PHP and Contractless Rust produce matching
|
The compatibility test proves that PHP and Contractless Rust produce matching
|
||||||
|
|
@ -112,3 +293,4 @@ $digest = skein_hash($data, 256);
|
||||||
Direct Contractless Falcon handling requires the public-key SHAKE256 prefix and
|
Direct Contractless Falcon handling requires the public-key SHAKE256 prefix and
|
||||||
raw-message marker. `php-contractless-rpc` applies that format automatically,
|
raw-message marker. `php-contractless-rpc` applies that format automatically,
|
||||||
so application developers should use its `NativeCrypto` class.
|
so application developers should use its `NativeCrypto` class.
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue