如何在 nginx 中配置 openssl 引擎 aes-ni

How to config openssl engine aes-ni in nginx

我使用引擎 AES-NI 提高 openssl 速度(硬件加速)的性能,我的芯片支持引擎 AES-NI(英特尔(R)至强(R)CPU E5620 @ 2.40GHz)。

我试试安装openssl版本1.0.2-chacha and 1.0.1l

版本1.0.2 chacha 测试速度openssl时使用命令:

openssl speed aes-256-cbc

然后错误:

Error: bad option or value

版本 1.0.1 使用 nginx 配置时出现错误:

nginx: [warn] ENGINE_by_id("aesni") failed (SSL: error:25066067:DSO support routines:DLFCN_LOAD:could not load the shared library:filename(/usr/lib/x86_64-linux-gnu/openssl-1.0.1/engines/libaesni.so): /usr/lib/x86_64-linux-gnu/openssl-1.0.1/engines/libaesni.so: cannot open shared object file: No such file or directory error:25070067:DSO support routines:DSO_load:could not load the shared library error:260B6084:engine routines:DYNAMIC_LOAD:dso not found error:2606A074:engine routines:ENGINE_by_id:no such engine:id=aesni)

我知道对于 openssl >= 1.0.1 的版本,AES-NI 不能通过引擎工作并且不会出现在 openssl 引擎命令中。它在支持的硬件上默认处于活动状态。

我在 https://www.ruby-forum.com/topic/6873426#1168394 中看到一个命令说 "no configuration option and it will work as long as your cpu supports it"。

但我没有找到官方来源。

请提出使用版本 openssl 和配置 nginx 的解决方案。

在OpenSSL >= 1.0.1中EVP界面默认开启AES-NI,没有aesni引擎。所以在 nginx 中没有为 OpenSSL 版本启用 AES-NI 的配置选项 >= 1.0.1 因为它在 OpenSSL 中默认启用(只要你的 CPU 支持它)。对于 1.0.1 以下的 OpenSSL 版本,虽然有可用的补丁,但没有对 AES-NI 的官方支持。

[http://openssl.6102.n7.nabble.com/having-a-lot-of-troubles-trying-to-get-AES-NI-working-tp44285p44301.html]