Overview
OpenSSL supports loading and initializing engines via theopenssl.cnf configuration file. This allows you to configure the QAT Engine to load automatically without requiring code changes or command-line options.
Setting the OPENSSL_ENGINES Environment Variable
TheOPENSSL_ENGINES environment variable tells OpenSSL where to find engine shared libraries. Set this to the directory containing qatengine.so:
Loading the Configuration File
By default, OpenSSL does not load theopenssl.cnf file at initialization. You must explicitly load it in your application.
Modern Method (OpenSSL 1.1.0+)
Call this as the first OpenSSL library function in your application:NULL: Uses the defaultopenssl_confsection- Custom: Pass an
OPENSSL_INIT_SETTINGSstructure with theappnamefield set to your section name
Legacy Method (Deprecated)
Older applications may use:Configuration File Setup
Theopenssl.cnf file is typically located in the ssl subdirectory of your OpenSSL installation path.
Step 1: Add Global Section Entry
Add this line in the global section (before the first bracketed section header):openssl_init is the name of the section containing application-specific settings. You can use a different name if preferred.
Step 2: Create the Initialization Section
Add the initialization section (can be placed as the first bracketed section or further down):engines keyword tells OpenSSL to load engines from the specified section.
Step 3: Define Engine List
Create the engine list section:Step 4: Configure the QAT Engine
Create the QAT-specific configuration section:engine_id: The engine name (must beqatengine)dynamic_path: Full path to the engine shared library (optional if installed in the standard OpenSSL engines directory)default_algorithms: Which algorithms to use by default (ALLenables all engine-provided algorithms)
You do not need to specify
dynamic_path if the engine is installed in OpenSSL’s standard engines directory.Engine-Specific Messages
You can configure engine behavior using engine-specific messages in the configuration file. These messages must be specified before thedefault_algorithms setting.
Supported Configuration Messages
The following engine control messages can be set in the configuration file:ENABLE_EVENT_DRIVEN_POLLING_MODEENABLE_EXTERNAL_POLLINGENABLE_INLINE_POLLINGENABLE_SW_FALLBACKSET_INTERNAL_POLL_INTERVALSET_EPOLL_TIMEOUTSET_MAX_RETRY_COUNT
Message Syntax
Set the message toEMPTY if it takes no parameters:
ENGINE_ctrl_cmd() call:
Complete Configuration Example
Here’s a complete working example with common settings:Example with Event-Driven Polling
Example with Software Fallback
Fork Behavior
In forking applications, custom configuration values are inherited by child processes automatically.
Engine Initialization
By default, the engine initializes automatically at the end of the configuration section after all engine-specific messages have been processed. This behavior can be controlled via theinit setting (advanced usage, see OpenSSL documentation).