Skip to content

Commit 22c8fec

Browse files
committed
Update README.md with openssl.cnf instructions
Signed-off-by: Steve Linsell <stevenx.linsell@intel.com>
1 parent 67a3101 commit 22c8fec

File tree

1 file changed

+144
-15
lines changed

1 file changed

+144
-15
lines changed

README.md

Lines changed: 144 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ copy files to. Please see the OpenSSL\* INSTALL file for full details on
118118
usage of the `--prefix` option.
119119

120120
The following example is assuming:
121-
121+
122122
* The OpenSSL\* source was cloned from Github\* to its own location at
123123
the root of the drive: `/`.
124124
* You want OpenSSL\* to be installed to `/usr/local/ssl`.
@@ -145,18 +145,18 @@ the engine is used.
145145
Further information on building OpenSSL\* can be found in the INSTALL
146146
file distributed with the OpenSSL\* source code or on the official
147147
OpenSSL\* Wiki in the Compilation and Installation section:
148-
https://wiki.openssl.org/index.php/Compilation_and_Installation
148+
<https://wiki.openssl.org/index.php/Compilation_and_Installation>
149149

150150
### Clone the Intel&reg; Quickassist Technology OpenSSL\* Engine
151151

152152
Clone the Github\* repository containing the Intel&reg; Quickassist
153153
Technology OpenSSL\* Engine:
154154

155155
git clone https://github.com/01org/QAT_Engine.git
156-
156+
157157
The repository can be cloned to either a subdirectory within the OpenSSL\*
158-
repository, for instance if the OpenSSL\* source is located at
159-
`/openssl` then the engine could be cloned at `/openssl/engines`,
158+
repository, for instance if the OpenSSL\* source is located at
159+
`/openssl` then the engine could be cloned at `/openssl/engines`,
160160
or to its own unique location on the file system, for instance within
161161
`/`. In either case the engine will not be built as part of the OpenSSL\*
162162
build and will require building manually.
@@ -204,9 +204,9 @@ As an alternative the Upstream Intel&reg; QuickAssist Technology Driver comes
204204
with its own contiguous pinned memory driver that is compatible with the
205205
Intel&reg; QuickAssist Technology OpenSSL\* Engine. The USDM component is of
206206
a higher quality than the qat\_contig\_mem driver, and is the preferred option.
207-
Unfortunately the USDM component may not be available if using older
207+
Unfortunately the USDM component may not be available if using older
208208
Intel&reg; QuickAssist Technology Driver versions. The USDM component is used
209-
by the Upstream Intel&reg; QuickAssist Technology Driver itself, and also
209+
by the Upstream Intel&reg; QuickAssist Technology Driver itself, and also
210210
has the following additional features:
211211

212212
* Support for virtualization
@@ -273,7 +273,7 @@ options that may be required:
273273
component and that the link should be configured to link in the
274274
userspace library of the usdm component.
275275

276-
An example to build and install the Intel&reg; Quickassist Technology
276+
An example to build and install the Intel&reg; Quickassist Technology
277277
OpenSSL\* Engine based on the example above, but building against the
278278
Upstream Intel&reg; Quickassist Technology Driver, and using the USDM
279279
component would be as follows:
@@ -289,7 +289,7 @@ component would be as follows:
289289
make
290290
make install
291291
```
292-
292+
293293
### Copy the correct Intel&reg; Quickassist Technology Driver config files
294294

295295
The Intel&reg; Quickassist Technology OpenSSL\* Engine comes with some example
@@ -444,7 +444,7 @@ installed. To resolve this it is recommended to add the /lib64
444444
folder to the LD_LIBRARY_PATH environment variable as follows:
445445

446446
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/lib64
447-
447+
448448
If linking against the Upstream Intel&reg; Quickassist
449449
Technology Driver then ensure that the mandatory parameter
450450
`--enable-upstream_driver` has been specified when running
@@ -645,13 +645,13 @@ OpenSSL\* Engine:
645645
646646
Mandatory (when using the Upstream Intel&reg; Quickassist Technology
647647
Driver)
648-
648+
649649
--enable-upstream_driver/--disable-upsteam_driver
650650
Enable/Disable linking against the Upstream Intel&reg; Quickassist
651651
Technology Driver. If linking against the Upstream Intel&reg;
652652
Quickassist Driver then this option must be enabled (disabled by
653653
default).
654-
654+
655655
Optional
656656
657657
--with-qat_build_dir=/path/to/qat_driver/build
@@ -661,16 +661,16 @@ OpenSSL\* Engine:
661661
Quickassist Technology Driver. The default if not specified is to
662662
use the path specified by --with-qat_dir with '/build' appended.
663663
You only need to specify this parameter if the driver library
664-
files have been built somewhere other than the default.
665-
664+
files have been built somewhere other than the default.
665+
666666
--enable-usdm/--disable-usdm
667667
Enable/Disable compiling against the USDM component and that the
668668
link should be configured to link in the userspace library of the
669669
USDM component. The USDM component is a pinned contiguous memory
670670
driver that is distributed with the Upstream Intel&reg;
671671
Quickassist Technology Driver. It can be used instead of the
672672
supplied qat_contig_mem memory driver (disabled by default).
673-
673+
674674
--with-usdm_dir=/path/to/usdm/directory
675675
Specify the path to the location of the USDM component.
676676
The default if not specified is to use the path specified by
@@ -763,6 +763,135 @@ OpenSSL\* Engine:
763763
Sets additional parameters that will be used during linking.
764764
```
765765

766+
## Using the OpenSSL\* Configuration File to Load/Initialize Engines
767+
768+
OpenSSL\* includes support for loading and initializing engines via the
769+
openssl.cnf file. The openssl.cnf file is contained in the `ssl`
770+
subdirectory of the path you install OpenSSL\* to.
771+
By default OpenSSL\* does not load the openssl.cnf file at initialization
772+
time. In order to load the file you need to make the following function
773+
call from your application as the first call to the OpenSSL\* library:
774+
775+
```
776+
OPENSSL_init_crypto(OPENSSL_INIT_LOAD_CONFIG, NULL);
777+
```
778+
779+
The second parameter determines the name of the section containing the
780+
application specific initialization settings. If you set the parameter
781+
to NULL as in the example above it will default to look for the
782+
`openssl_conf` section. If you want to use your own section you should
783+
declare a structure of type `OPENSSL_INIT_SETTINGS` and set the `appname`
784+
field to a string containing the section name you wish to use. The example
785+
config file sections below assume you are using the default `openssl_conf`
786+
section name.
787+
788+
If converting an existing application to use the Intel&reg; Quickassist
789+
Technology OpenSSL\* Engine you may find that the application instead
790+
makes the now deprecated call to:
791+
792+
```
793+
OPENSSL_config(NULL);
794+
```
795+
796+
Where the parameter is a const char* pointer to the `appname` section
797+
you want to use, or NULL to use the default `openssl_conf` section.
798+
799+
Currently this will give the same behaviour as the
800+
`OPENSSL_init_crypto(OPENSSL_INIT_LOAD_CONFIG, NULL)` call but as it is
801+
deprecated it should not be relied upon for future use.
802+
803+
For further details on using the OPENSSL_init_crypto
804+
function please see the OpenSSL\* online documentation located at:
805+
<https://www.openssl.org/docs/man1.1.0/crypto/OPENSSL_init_crypto.html>
806+
807+
In order to start using the openssl.cnf file it needs some additional
808+
lines adding. You should add the following statement in the global section
809+
(this is the section before the first bracketed section header):
810+
811+
```
812+
openssl_conf = openssl_init
813+
```
814+
815+
The string `openssl_init` is the name of the section in the configuration
816+
file which describes the application specific settings. You do not need
817+
to stick to the naming convention here if you prefer to use a different
818+
name.
819+
820+
The `openssl_init` section can be located at the end of the global
821+
section (as the first bracketed section), or further down the
822+
configuration file. It should have the following added:
823+
824+
```
825+
[ openssl_init ]
826+
engines = engine_section
827+
```
828+
829+
The `engines` string is a keyword that OpenSSL\* recognises as a
830+
configuration module. It should be set to a string which is the
831+
section name containing a list of the engines to be
832+
loaded. So for the Intel&reg; Quickassist Technology OpenSSL\*
833+
Engine the section should contain:
834+
835+
```
836+
[ engine_section ]
837+
qat = qat_section
838+
```
839+
840+
The `qat_section` contains all the settings relating to that
841+
particular engine. For instance it may contain:
842+
843+
```
844+
[ qat_section ]
845+
engine_id = qat
846+
dynamic_path = /usr/local/ssl/lib/engines_1_1/qat.so
847+
default_algorithms = ALL
848+
```
849+
850+
Where `engine_id` specifies the name of engine to load (should be `qat`).
851+
852+
Where `dynamic_path` is the location of the loadable shared library
853+
implementing the engine. There is no need to specify this line if the engine
854+
is located within the standard path that OpenSSL\* was installed to.
855+
856+
Where `default_algorithms` specifies which algorithms supplied by the engine
857+
should be used by default. Specify `ALL` to make all algorithms supplied
858+
by the engine be used by default.
859+
860+
In addition the `qat_section` may contain settings that call custom
861+
engine specific messages. For instance:
862+
863+
```
864+
ENABLE_EVENT_DRIVEN_MODE = EMPTY
865+
```
866+
867+
is functionally equivalent of making the following engine specific
868+
message function call:
869+
870+
```
871+
ENGINE_ctrl_cmd(e, "ENABLE_EVENT_DRIVEN_MODE", 0, NULL, NULL, 0);
872+
```
873+
874+
You should set the setting to `EMPTY` if there are no parameters to pass,
875+
or assign the value that would be passed as the 4th parameter of the
876+
equivalent ENGINE_ctrl_cmd call. It should be noted that this mechanism
877+
is only useful for passing simple values at engine initialization time.
878+
You cannot pass 3rd parameter values, pass complex structures or deal
879+
with return values via this mechanism. Engine specific messages should
880+
be specified before the `default_algorithms` setting or incorrect
881+
behaviour may result. By default the engine will get initialized at the
882+
end of this section (after all the custom engine specific messages have
883+
been sent). This can be controlled via an additional `init` setting that
884+
is out of scope of the documentation here.
885+
886+
For further details on using the OpenSSL\* configuration file please
887+
see the OpenSSL\* online documentation located at:
888+
<https://www.openssl.org/docs/man1.1.0/apps/config.html>
889+
890+
By setting up the configuration file as above it is possible for instance
891+
to run the OpenSSL\* speed application to use the Intel&reg; Quickassist
892+
Technology OpenSSL\* Engine without needing to specify `-engine qat` as
893+
a command line option.
894+
766895
## Legal
767896

768897
Intel, and Intel Atom are trademarks of

0 commit comments

Comments
 (0)