Re: Speed problems with both system openssl and security/openssl-devel

From: Lev Serebryakov <lev_at_FreeBSD.org>
Date: Mon, 17 Sep 2018 23:52:20 +0300
Hello Lev,

Thursday, September 13, 2018, 2:46:46 AM, you wrote:

>   Linux have openssl 1.1.0f, and  I've tried both system /usr/bin/openssl (1.0.2p)
> and /usr/local/bin/openssl from security/openssl-devel port (1.1.0i), results are
> virtually the same. I have "ASM" and "SSE2" options enabled in port.

>  What happens here? Why does FreeBSD's build of openssl use AES-NI so
> inefficient?
 More datapoints.

(1) aes-256-cbc behaves really wired. Time output is
completely bogus without "-elapsed" and speed is unbelievably low with
"-elapsed". aes-256-gcm doesn't have this anomaly

without "-elapsed" (please note "in 0.xxs" here):

Doing aes-256-cbc for 3s on 16 size blocks: 503555 aes-256-cbc's in 0.60s
Doing aes-256-cbc for 3s on 64 size blocks: 520386 aes-256-cbc's in 0.54s
Doing aes-256-cbc for 3s on 256 size blocks: 435106 aes-256-cbc's in 0.44s
Doing aes-256-cbc for 3s on 1024 size blocks: 242832 aes-256-cbc's in 0.38s
Doing aes-256-cbc for 3s on 8192 size blocks: 49087 aes-256-cbc's in 0.09s
...
aes-256-cbc      13393.26k    61782.64k   254599.17k   663093.25k  4289287.51k

Doing aes-256-gcm for 3s on 16 size blocks: 12051311 aes-256-gcm's in 3.03s
Doing aes-256-gcm for 3s on 64 size blocks: 6428598 aes-256-gcm's in 3.04s
Doing aes-256-gcm for 3s on 256 size blocks: 2122316 aes-256-gcm's in 3.00s
Doing aes-256-gcm for 3s on 1024 size blocks: 610443 aes-256-gcm's in 3.13s
Doing aes-256-gcm for 3s on 8192 size blocks: 75836 aes-256-gcm's in 3.03s
...
aes-256-gcm      63611.04k   135380.66k   181104.30k   199531.13k   204947.96k

with "-elapsed":

Doing aes-256-cbc for 3s on 16 size blocks: 493829 aes-256-cbc's in 3.01s
Doing aes-256-cbc for 3s on 64 size blocks: 530550 aes-256-cbc's in 3.06s
Doing aes-256-cbc for 3s on 256 size blocks: 426699 aes-256-cbc's in 3.01s
Doing aes-256-cbc for 3s on 1024 size blocks: 243305 aes-256-cbc's in 3.03s
Doing aes-256-cbc for 3s on 8192 size blocks: 48069 aes-256-cbc's in 3.01s
...
aes-256-cbc       2626.91k    11087.41k    36317.07k    82191.94k   130919.48k

Doing aes-256-gcm for 3s on 16 size blocks: 12041385 aes-256-gcm's in 3.08s
Doing aes-256-gcm for 3s on 64 size blocks: 6445757 aes-256-gcm's in 3.05s
Doing aes-256-gcm for 3s on 256 size blocks: 2129499 aes-256-gcm's in 3.01s
Doing aes-256-gcm for 3s on 1024 size blocks: 587396 aes-256-gcm's in 3.01s
Doing aes-256-gcm for 3s on 8192 size blocks: 75806 aes-256-gcm's in 3.03s
...
aes-256-gcm      62590.75k   135047.68k   181245.26k   199977.06k   204866.89k

(2) I've added debug output to 'crypto/evp/e_aes.c' and it shows, that
AES-NIU should be used.

(3) openssl111 from ports doesn't show these problems.

-- 
Best regards,
 Lev                            mailto:lev_at_FreeBSD.org
Received on Mon Sep 17 2018 - 18:52:24 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:41:18 UTC