← Back to section · Tutorials & Labs
oqs-provider: Plugging Post-Quantum Algorithms into OpenSSL 3
Without patching OpenSSL itself, one provider plug-in lets existing OpenSSL 3 applications use ML-KEM, ML-DSA and hybrid key exchange: the provider mechanism, build and install, configuration, and a layered verification routine.
The previous article showed how to compile liboqs itself. But there is a practical problem: most existing software does not call liboqs directly — it calls OpenSSL. Command-line tools, the TLS bindings of many languages, and servers such as Nginx ultimately land on OpenSSL’s EVP interface. Patching each of them to add post-quantum algorithms is unrealistic. The Open Quantum Safe project’s answer is oqs-provider: a plug-in that follows the OpenSSL 3 provider mechanism and registers the algorithms from liboqs as key-exchange and signature algorithms visible to OpenSSL. This tutorial explains how it works, how to enable it, and how to verify that it is really doing its job.
First, understand the provider mechanism
OpenSSL 3 moved algorithm implementations out of the core library and into runtime modules called providers. The bundled default provider supplies the classical algorithms; third parties can write their own provider as a shared library, declare it in the configuration file, and OpenSSL will expose its algorithms to applications on equal footing with the built-in ones. For users this buys two things. First, there is no need to recompile OpenSSL, let alone maintain a fork. Second, any application that goes through the standard EVP interface and looks algorithms up by name can, in principle, “see” the new algorithms. oqs-provider links liboqs internally and wraps each of its KEM and signature algorithms as a provider algorithm object. One caution: visibility is not the same as painless use — applications that hard-code algorithm names or assume fixed key and signature sizes may still need adjustments, and the verification stage below is designed to surface exactly those issues.
Building and installing
The oqs-provider source lives in its own repository under the Open Quantum Safe GitHub organization and also builds with CMake. It needs an installed liboqs and the OpenSSL 3 development files; the install prefix can be set at configure time, and the build product is a single provider shared library. Placement is the critical detail: the library must end up in the provider module directory that OpenSSL searches, which you can confirm via the openssl list -providers family of commands or the OPENSSL_MODULES environment variable; if it lands elsewhere, the configuration must give its full path. Another detail worth knowing: much of oqs-provider’s algorithm registration code is generated from templates. The repository maintains an algorithm list template, and a generator script produces the registration and encoding code for each algorithm from it. The benefit is that adding an algorithm means editing the template; the downside is that when you trace an algorithm through this source tree you are reading generated code — the real logic lives in liboqs.
Activating it in openssl.cnf
With the shared library in place, declare it in the OpenSSL configuration file. Add a section to the provider part of openssl.cnf giving the provider’s name, the module path, and activate = 1 — while keeping the existing default provider and activating it as well, so that classical and post-quantum algorithms are available side by side. Then verify immediately: openssl list -providers should show both default and oqsprovider, and openssl list -kem-algorithms together with openssl list -signature-algorithms should show ML-KEM, ML-DSA, SLH-DSA and the hybrid combinations. Only if they appear in the lists is registration successful; if not, go back to the module path and activation flag instead of proceeding on hope.
A troubleshooting order for common failures
When activation fails, do not reinstall blindly; a fixed inspection order saves hours. Step one: confirm the provider itself is loaded — if openssl list -providers shows no oqsprovider, the configuration file is not taking effect or the module path is wrong, so first check which openssl.cnf is actually being read; a system may hold several configuration files (the distribution’s and your own), and the OPENSSL_CONF environment variable can point at one explicitly. Step two: confirm the algorithms are registered — if the provider is listed but a particular algorithm is missing from the algorithm lists, the liboqs that oqs-provider was built against usually does not have that algorithm enabled, so revisit the liboqs build options. Step three: confirm the application really fetches from the provider — some applications draw algorithms only from the default provider and need their provider selection widened in configuration, which presents as the command-line tools working perfectly while the application reports the algorithm as unsupported. If all three steps check out, search the project’s issue tracker for the same symptoms; most known oqs-provider problems come down to paths and version matching.
Verification: from key generation to a hybrid TLS handshake
Verify in three layers. Layer one is algorithmic self-consistency: generate an ML-DSA key pair with openssl genpkey, then sign and verify a small piece of data to confirm the provider’s signature path works end to end; for ML-KEM, use the command-line key encapsulation operations to complete an encapsulate/decapsulate round and compare the shared secrets. Layer two is certificates: self-sign an X.509 certificate with the ML-DSA key and check that it parses and verifies normally — this layer exposes encoding problems. Layer three is the protocol itself: run openssl s_server and openssl s_client as a local pair, set the TLS 1.3 key-exchange group to a hybrid group (for example the combination of X25519 with ML-KEM-768), and after connecting, confirm from the session information that the group actually negotiated is the intended hybrid group rather than a fallback to a classical one. Layer three is the easiest place to get a “false success” — the handshake completes, but on a classical group — so always inspect the negotiated result instead of mere connectivity.
Where it fits
oqs-provider earns its keep in interoperability experiments and in assessing retrofits of existing systems: it lets a team measure, with minimal code changes, what hybrid handshakes do to sizes and latency, and how each link in the chain reacts to larger certificate chains. Be clear-eyed about its positioning, though: it inherits the research character of liboqs, and its algorithm list includes candidates that are not yet standardized, so enable it deliberately and stick to combinations that are standardized or close to it. At the same time, mainstream TLS stacks are progressively shipping standardized post-quantum algorithms natively, so when planning for production, first check whether the official release of OpenSSL or your TLS library already supports ML-KEM and ML-DSA natively before deciding you still need the provider route. Treating oqs-provider as the test bench and native support as the production road is the sound division of labour.
Tags: oqs-providerOpenSSLTLS