@@ -50,7 +50,7 @@ Global namespace constants (e.g. `OQS\VERSION_TEXT`) mirror liboqs build info.
5050use OQS\KEM;
5151
5252// Pick an algorithm supported by your liboqs build:
53- $alg = defined('OQS\KEM::ALG_ML_KEM_768') ? OQS\KEM::ALG_ML_KEM_768 : OQS\KEM::ALG_KYBER768;
53+ $alg = defined('OQS\\ KEM::ALG_ML_KEM_768') ? OQS\KEM::ALG_ML_KEM_768 : OQS\KEM::ALG_KYBER768;
5454
5555[$pk, $sk] = KEM::keypair($alg);
5656[$ct, $ss1] = KEM::encapsulate($alg, $pk);
@@ -64,6 +64,32 @@ echo base64_encode($ct), "\n", base64_encode($ss1), "\n";
6464
6565---
6666
67+ ## Installing liboqs
68+
69+ Before building this PHP extension, you need the ** liboqs** C library and headers installed on your system.
70+ You can either build it from source or install it via a package manager if available.
71+
72+ ### Build from source (recommended)
73+ ``` bash
74+ git clone https://github.com/open-quantum-safe/liboqs.git
75+ cd liboqs
76+ mkdir build && cd build
77+ cmake -DCMAKE_INSTALL_PREFIX=/usr/local -DOQS_BUILD_ONLY_LIB=ON ..
78+ make -j$( nproc)
79+ sudo make install
80+ ```
81+ This installs ` liboqs.so ` to ` /usr/local/lib ` and headers to ` /usr/local/include/oqs ` .
82+
83+ ### Verify installation
84+ ``` bash
85+ pkg-config --modversion liboqs
86+ # should report 0.14.0 or newer
87+ ```
88+
89+ Then proceed with the build steps below.
90+
91+ ---
92+
6793## Requirements
6894
6995- PHP dev tools (` phpize ` , ` php-config ` , headers)
@@ -93,8 +119,6 @@ sudo phpenmod oqs
93119php -m | grep oqs
94120```
95121
96-
97-
98122### Using an explicit liboqs prefix
99123
100124If liboqs isn’t in pkg-config, pass the prefix that contains ` include/oqs ` and ` lib/ ` :
@@ -145,4 +169,4 @@ This extension is provided **as-is** without any warranty. It is intended for ex
145169prototyping, and research purposes only. Do ** not** use this software in production environments
146170that require certified or audited cryptographic implementations. The liboqs library itself is
147171not a FIPS-validated module, and the PHP wrapper has not been security reviewed. Use entirely
148- at your own risk.
172+ at your own risk.
0 commit comments