Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 15 Aug 2004 17:04:45 +0900 (JST)
From:      Norikatsu Shigemura <nork@FreeBSD.org>
To:        Sam Leffler <sam@errno.com>
Cc:        freebsd-stable@FreeBSD.org
Subject:   Re: OpenSSL with hifn(4) (cryptodev)
Message-ID:  <200408150804.i7F84jCB010066@sakura.ninth-nine.com>
In-Reply-To: <200408030902.59349.sam@errno.com>
References:  <20040803214133.31dd9b03.nork@FreeBSD.org> <200408030902.59349.sam@errno.com>

index | next in thread | previous in thread | raw e-mail

[-- Attachment #1 --]
	sam, Mike Tancsa, Doug White! Thank you for hints!

On Tue, 3 Aug 2004 09:02:59 -0700
Sam Leffler <sam@errno.com> wrote:
> On Tuesday 03 August 2004 05:41 am, Norikatsu Shigemura wrote:
> > Hi sam!
> > 	I have two Soekris vpn1401 crypto accelerator cards.  I installed
> > 	these to 4-stable machine and 5-current machine.
> 	...
> > 	I confirmed `openssl speed -engine cryptodev', but it looks not
> > 	works.  Because 1st: same speed (before/after install it), 2nd: CPU
> > 	loadavg is always high. So I consider that openssl didn't use
> > 	cryptodev.  Do you have any idea?
> Look in /usr/src/tools/tools/crypto for the cryptostats and hifnstats 
> programs; they will tell you if the h/w is operating correctly.

	I and my friends, Naoki Fukaumi, inverstigated about this
	behavior.  As the result, we confirmed that h/w accerator
	is good works but some limited.

	1. `openssl speed' is not so good:-(.
	   openssl speed -evp aes128(/des/3des) is good.  I saw
	   *Giant and crydev in top(1).

	2. /usr/src/tools/tools/crypto/cryptotest.c clarified the problem.
	   According to cryptotest(I tested ./cyrptotest -z 1000),
	   hifn(4) (=vpn1401) supports des_cbc, 3des_cbc, aes_cbc,
	   aes192_cbc, aes256_cbc, md5_hmac and sha1_hmac. (Of course,
	   I saw ones in top(1))

	3. I read /usr/src/crypto/openssl/crypto/engine/hw_cryptodev.c.
	   Accoring to it, cryptodev engine supports des_cbc, 3des_cbc,
	   aes_cbc, blf_cbc, cast5_cbc, skipjack_cbc(?), sha1_hmac,
	   ripemd160_hmac, md5_kpdk(?), sha1_kpdk(?), md5 and sha1(?).
	   However, we can use these cifers by cryptodev_usable_ciphers,
	   but cannot use these digests by cryptodev_usable_digests,
	   in hw_cryptodev.c.  According to comments:

	* XXXX just disable all digests for now, because it sucks.
	* we need a better way to decide this - i.e. I may not
	* want digests on slow cards like hifn on fast machines,
	* but might want them on slow or loaded machines, etc.
	* will also want them when using crypto cards that don't
	* suck moose gonads - would be nice to be able to decide something
	* as reasonable default without having hackery that's card dependent.
	* of course, the default should probably be just do everything,
	* with perhaps a sysctl to turn algoritms off (or have them off
	* by default) on cards that generally suck like the hifn.

	Hum.....  By union set, so we can use only des_cbc, 3des_cbc
	and aes_cbc.

[SEE ALSO] BenchMark1:  openssl speed -elapsed -evp aes128
			openssl speed -elapsed -evp des3
>>In 5-current with WITNESS
aes-128-cbc         33.20k      211.17k     1184.66k     2574.12k     4918.85k
des-ede3-cbc        70.37k      315.16k      901.09k     1643.15k     6840.56k

>>In 5-current w/o  WITNESS
aes-128-cbc        324.79k     1264.01k     4650.77k    13378.57k    22098.25k
des-ede3-cbc       324.65k     1278.52k     4645.58k    13392.40k    22017.54k

>>In 4-stable
aes-128-cbc        462.81k     1795.23k     6329.75k    16686.62k    29833.64k
des-ede3-cbc       463.48k     1757.60k     1889.31k    16679.92k    29766.37k

>>In 5-current w/o  WITNESS  w/o hifn(4) (PentiumIII-M 1.0GHz x1)
aes-128-cbc      17732.99k    19308.65k    23740.17k    25805.46k    25179.36k
des-ede3-cbc      7347.27k     5895.96k     7762.44k     7755.75k     7824.37k

	And also, I attached results of `./cryptotest -z 1000'.

[-- Attachment #2 --]
 0.125 sec,    2000    des crypts,       8 bytes,   127895 byte/sec,     1.0 Mb/sec
 0.120 sec,    2000    des crypts,      16 bytes,   265668 byte/sec,     2.0 Mb/sec
 0.123 sec,    2000    des crypts,      32 bytes,   520304 byte/sec,     4.0 Mb/sec
 0.126 sec,    2000    des crypts,      64 bytes,  1017658 byte/sec,     7.8 Mb/sec
 0.128 sec,    2000    des crypts,     128 bytes,  1999844 byte/sec,    15.3 Mb/sec
 0.136 sec,    2000    des crypts,     256 bytes,  3752180 byte/sec,    28.6 Mb/sec
 0.151 sec,    2000    des crypts,     512 bytes,  6760906 byte/sec,    51.6 Mb/sec
 0.185 sec,    2000    des crypts,    1024 bytes, 11095340 byte/sec,    84.7 Mb/sec
 0.260 sec,    2000    des crypts,    2048 bytes, 15726748 byte/sec,   120.0 Mb/sec
 0.398 sec,    2000    des crypts,    4096 bytes, 20564262 byte/sec,   156.9 Mb/sec
 0.713 sec,    2000    des crypts,    8192 bytes, 22993958 byte/sec,   175.4 Mb/sec
 0.120 sec,    2000   3des crypts,       8 bytes,   133036 byte/sec,     1.0 Mb/sec
 0.121 sec,    2000   3des crypts,      16 bytes,   264362 byte/sec,     2.0 Mb/sec
 0.122 sec,    2000   3des crypts,      32 bytes,   525952 byte/sec,     4.0 Mb/sec
 0.125 sec,    2000   3des crypts,      64 bytes,  1024754 byte/sec,     7.8 Mb/sec
 0.127 sec,    2000   3des crypts,     128 bytes,  2011567 byte/sec,    15.3 Mb/sec
 0.139 sec,    2000   3des crypts,     256 bytes,  3673332 byte/sec,    28.0 Mb/sec
 0.151 sec,    2000   3des crypts,     512 bytes,  6783793 byte/sec,    51.8 Mb/sec
 0.183 sec,    2000   3des crypts,    1024 bytes, 11201540 byte/sec,    85.5 Mb/sec
 0.255 sec,    2000   3des crypts,    2048 bytes, 16079392 byte/sec,   122.7 Mb/sec
 0.398 sec,    2000   3des crypts,    4096 bytes, 20590520 byte/sec,   157.1 Mb/sec
 0.712 sec,    2000   3des crypts,    8192 bytes, 23011559 byte/sec,   175.6 Mb/sec
 0.121 sec,    2000    aes crypts,      16 bytes,   265131 byte/sec,     2.0 Mb/sec
 0.121 sec,    2000    aes crypts,      32 bytes,   529683 byte/sec,     4.0 Mb/sec
 0.128 sec,    2000    aes crypts,      64 bytes,  1003402 byte/sec,     7.7 Mb/sec
 0.126 sec,    2000    aes crypts,     128 bytes,  2024660 byte/sec,    15.4 Mb/sec
 0.135 sec,    2000    aes crypts,     256 bytes,  3786534 byte/sec,    28.9 Mb/sec
 0.150 sec,    2000    aes crypts,     512 bytes,  6821119 byte/sec,    52.0 Mb/sec
 0.184 sec,    2000    aes crypts,    1024 bytes, 11152680 byte/sec,    85.1 Mb/sec
 0.253 sec,    2000    aes crypts,    2048 bytes, 16165826 byte/sec,   123.3 Mb/sec
 0.397 sec,    2000    aes crypts,    4096 bytes, 20618349 byte/sec,   157.3 Mb/sec
 0.715 sec,    2000    aes crypts,    8192 bytes, 22919045 byte/sec,   174.9 Mb/sec
 0.121 sec,    2000 aes192 crypts,      16 bytes,   263702 byte/sec,     2.0 Mb/sec
 0.121 sec,    2000 aes192 crypts,      32 bytes,   528157 byte/sec,     4.0 Mb/sec
 0.124 sec,    2000 aes192 crypts,      64 bytes,  1029899 byte/sec,     7.9 Mb/sec
 0.126 sec,    2000 aes192 crypts,     128 bytes,  2033166 byte/sec,    15.5 Mb/sec
 0.134 sec,    2000 aes192 crypts,     256 bytes,  3812020 byte/sec,    29.1 Mb/sec
 0.150 sec,    2000 aes192 crypts,     512 bytes,  6819166 byte/sec,    52.0 Mb/sec
 0.184 sec,    2000 aes192 crypts,    1024 bytes, 11143334 byte/sec,    85.0 Mb/sec
 0.253 sec,    2000 aes192 crypts,    2048 bytes, 16213178 byte/sec,   123.7 Mb/sec
 0.397 sec,    2000 aes192 crypts,    4096 bytes, 20609738 byte/sec,   157.2 Mb/sec
 0.715 sec,    2000 aes192 crypts,    8192 bytes, 22900977 byte/sec,   174.7 Mb/sec
 0.120 sec,    2000 aes256 crypts,      16 bytes,   265891 byte/sec,     2.0 Mb/sec
 0.121 sec,    2000 aes256 crypts,      32 bytes,   528249 byte/sec,     4.0 Mb/sec
 0.130 sec,    2000 aes256 crypts,      64 bytes,   982612 byte/sec,     7.5 Mb/sec
 0.126 sec,    2000 aes256 crypts,     128 bytes,  2036887 byte/sec,    15.5 Mb/sec
 0.135 sec,    2000 aes256 crypts,     256 bytes,  3804966 byte/sec,    29.0 Mb/sec
 0.150 sec,    2000 aes256 crypts,     512 bytes,  6834321 byte/sec,    52.1 Mb/sec
 0.183 sec,    2000 aes256 crypts,    1024 bytes, 11197804 byte/sec,    85.4 Mb/sec
 0.252 sec,    2000 aes256 crypts,    2048 bytes, 16242946 byte/sec,   123.9 Mb/sec
 0.399 sec,    2000 aes256 crypts,    4096 bytes, 20546571 byte/sec,   156.8 Mb/sec
 0.712 sec,    2000 aes256 crypts,    8192 bytes, 23001641 byte/sec,   175.5 Mb/sec
 0.061 sec,    1000    md5 crypts,       8 bytes,   130187 byte/sec,     1.0 Mb/sec
 0.061 sec,    1000    md5 crypts,      16 bytes,   262188 byte/sec,     2.0 Mb/sec
 0.060 sec,    1000    md5 crypts,      32 bytes,   530495 byte/sec,     4.0 Mb/sec
 0.062 sec,    1000    md5 crypts,      64 bytes,  1037580 byte/sec,     7.9 Mb/sec
 0.063 sec,    1000    md5 crypts,     128 bytes,  2032520 byte/sec,    15.5 Mb/sec
 0.067 sec,    1000    md5 crypts,     256 bytes,  3848640 byte/sec,    29.4 Mb/sec
 0.074 sec,    1000    md5 crypts,     512 bytes,  6908929 byte/sec,    52.7 Mb/sec
 0.091 sec,    1000    md5 crypts,    1024 bytes, 11241259 byte/sec,    85.8 Mb/sec
 0.124 sec,    1000    md5 crypts,    2048 bytes, 16492056 byte/sec,   125.8 Mb/sec
 0.195 sec,    1000    md5 crypts,    4096 bytes, 20960734 byte/sec,   159.9 Mb/sec
 0.352 sec,    1000    md5 crypts,    8192 bytes, 23274777 byte/sec,   177.6 Mb/sec
 0.060 sec,    1000   sha1 crypts,       8 bytes,   132319 byte/sec,     1.0 Mb/sec
 0.063 sec,    1000   sha1 crypts,      16 bytes,   252207 byte/sec,     1.9 Mb/sec
 0.061 sec,    1000   sha1 crypts,      32 bytes,   527244 byte/sec,     4.0 Mb/sec
 0.062 sec,    1000   sha1 crypts,      64 bytes,  1038843 byte/sec,     7.9 Mb/sec
 0.064 sec,    1000   sha1 crypts,     128 bytes,  1990885 byte/sec,    15.2 Mb/sec
 0.068 sec,    1000   sha1 crypts,     256 bytes,  3746908 byte/sec,    28.6 Mb/sec
 0.075 sec,    1000   sha1 crypts,     512 bytes,  6813222 byte/sec,    52.0 Mb/sec
 0.092 sec,    1000   sha1 crypts,    1024 bytes, 11184290 byte/sec,    85.3 Mb/sec
 0.124 sec,    1000   sha1 crypts,    2048 bytes, 16464743 byte/sec,   125.6 Mb/sec
 0.196 sec,    1000   sha1 crypts,    4096 bytes, 20918771 byte/sec,   159.6 Mb/sec
 0.352 sec,    1000   sha1 crypts,    8192 bytes, 23274182 byte/sec,   177.6 Mb/sec

[-- Attachment #3 --]
 0.101 sec,    2000    des crypts,       8 bytes,   159107 byte/sec,     1.2 Mb/sec
 0.098 sec,    2000    des crypts,      16 bytes,   327242 byte/sec,     2.5 Mb/sec
 0.099 sec,    2000    des crypts,      32 bytes,   648548 byte/sec,     4.9 Mb/sec
 0.100 sec,    2000    des crypts,      64 bytes,  1285838 byte/sec,     9.8 Mb/sec
 0.103 sec,    2000    des crypts,     128 bytes,  2484303 byte/sec,    19.0 Mb/sec
 0.110 sec,    2000    des crypts,     256 bytes,  4646646 byte/sec,    35.5 Mb/sec
 0.125 sec,    2000    des crypts,     512 bytes,  8210128 byte/sec,    62.6 Mb/sec
 0.153 sec,    2000    des crypts,    1024 bytes, 13393149 byte/sec,   102.2 Mb/sec
 0.212 sec,    2000    des crypts,    2048 bytes, 19327501 byte/sec,   147.5 Mb/sec
 0.336 sec,    2000    des crypts,    4096 bytes, 24382186 byte/sec,   186.0 Mb/sec
 0.667 sec,    2000    des crypts,    8192 bytes, 24576283 byte/sec,   187.5 Mb/sec
 0.098 sec,    2000   3des crypts,       8 bytes,   163718 byte/sec,     1.2 Mb/sec
 0.098 sec,    2000   3des crypts,      16 bytes,   327429 byte/sec,     2.5 Mb/sec
 0.099 sec,    2000   3des crypts,      32 bytes,   649634 byte/sec,     5.0 Mb/sec
 0.100 sec,    2000   3des crypts,      64 bytes,  1283890 byte/sec,     9.8 Mb/sec
 0.103 sec,    2000   3des crypts,     128 bytes,  2484496 byte/sec,    19.0 Mb/sec
 0.110 sec,    2000   3des crypts,     256 bytes,  4643949 byte/sec,    35.4 Mb/sec
 0.124 sec,    2000   3des crypts,     512 bytes,  8251543 byte/sec,    63.0 Mb/sec
 0.153 sec,    2000   3des crypts,    1024 bytes, 13361343 byte/sec,   101.9 Mb/sec
 0.213 sec,    2000   3des crypts,    2048 bytes, 19244955 byte/sec,   146.8 Mb/sec
 0.340 sec,    2000   3des crypts,    4096 bytes, 24123989 byte/sec,   184.1 Mb/sec
 0.667 sec,    2000   3des crypts,    8192 bytes, 24556502 byte/sec,   187.4 Mb/sec
 0.098 sec,    2000    aes crypts,      16 bytes,   326574 byte/sec,     2.5 Mb/sec
 0.100 sec,    2000    aes crypts,      32 bytes,   638302 byte/sec,     4.9 Mb/sec
 0.100 sec,    2000    aes crypts,      64 bytes,  1281115 byte/sec,     9.8 Mb/sec
 0.103 sec,    2000    aes crypts,     128 bytes,  2481438 byte/sec,    18.9 Mb/sec
 0.110 sec,    2000    aes crypts,     256 bytes,  4645676 byte/sec,    35.4 Mb/sec
 0.124 sec,    2000    aes crypts,     512 bytes,  8228270 byte/sec,    62.8 Mb/sec
 0.154 sec,    2000    aes crypts,    1024 bytes, 13319199 byte/sec,   101.6 Mb/sec
 0.212 sec,    2000    aes crypts,    2048 bytes, 19284097 byte/sec,   147.1 Mb/sec
 0.339 sec,    2000    aes crypts,    4096 bytes, 24166118 byte/sec,   184.4 Mb/sec
 0.667 sec,    2000    aes crypts,    8192 bytes, 24552307 byte/sec,   187.3 Mb/sec
 0.098 sec,    2000 aes192 crypts,      16 bytes,   326771 byte/sec,     2.5 Mb/sec
 0.100 sec,    2000 aes192 crypts,      32 bytes,   640474 byte/sec,     4.9 Mb/sec
 0.100 sec,    2000 aes192 crypts,      64 bytes,  1285902 byte/sec,     9.8 Mb/sec
 0.103 sec,    2000 aes192 crypts,     128 bytes,  2477595 byte/sec,    18.9 Mb/sec
 0.110 sec,    2000 aes192 crypts,     256 bytes,  4642475 byte/sec,    35.4 Mb/sec
 0.124 sec,    2000 aes192 crypts,     512 bytes,  8250546 byte/sec,    62.9 Mb/sec
 0.154 sec,    2000 aes192 crypts,    1024 bytes, 13326393 byte/sec,   101.7 Mb/sec
 0.212 sec,    2000 aes192 crypts,    2048 bytes, 19280375 byte/sec,   147.1 Mb/sec
 0.340 sec,    2000 aes192 crypts,    4096 bytes, 24114828 byte/sec,   184.0 Mb/sec
 0.666 sec,    2000 aes192 crypts,    8192 bytes, 24606586 byte/sec,   187.7 Mb/sec
 0.098 sec,    2000 aes256 crypts,      16 bytes,   326667 byte/sec,     2.5 Mb/sec
 0.100 sec,    2000 aes256 crypts,      32 bytes,   640038 byte/sec,     4.9 Mb/sec
 0.100 sec,    2000 aes256 crypts,      64 bytes,  1280499 byte/sec,     9.8 Mb/sec
 0.103 sec,    2000 aes256 crypts,     128 bytes,  2482015 byte/sec,    18.9 Mb/sec
 0.110 sec,    2000 aes256 crypts,     256 bytes,  4646140 byte/sec,    35.4 Mb/sec
 0.124 sec,    2000 aes256 crypts,     512 bytes,  8232173 byte/sec,    62.8 Mb/sec
 0.153 sec,    2000 aes256 crypts,    1024 bytes, 13370503 byte/sec,   102.0 Mb/sec
 0.213 sec,    2000 aes256 crypts,    2048 bytes, 19272392 byte/sec,   147.0 Mb/sec
 0.340 sec,    2000 aes256 crypts,    4096 bytes, 24100072 byte/sec,   183.9 Mb/sec
 0.666 sec,    2000 aes256 crypts,    8192 bytes, 24614312 byte/sec,   187.8 Mb/sec
 0.048 sec,    1000    md5 crypts,       8 bytes,   167410 byte/sec,     1.3 Mb/sec
 0.048 sec,    1000    md5 crypts,      16 bytes,   335359 byte/sec,     2.6 Mb/sec
 0.048 sec,    1000    md5 crypts,      32 bytes,   669428 byte/sec,     5.1 Mb/sec
 0.050 sec,    1000    md5 crypts,      64 bytes,  1279872 byte/sec,     9.8 Mb/sec
 0.052 sec,    1000    md5 crypts,     128 bytes,  2444241 byte/sec,    18.6 Mb/sec
 0.054 sec,    1000    md5 crypts,     256 bytes,  4708739 byte/sec,    35.9 Mb/sec
 0.062 sec,    1000    md5 crypts,     512 bytes,  8270737 byte/sec,    63.1 Mb/sec
 0.077 sec,    1000    md5 crypts,    1024 bytes, 13352632 byte/sec,   101.9 Mb/sec
 0.105 sec,    1000    md5 crypts,    2048 bytes, 19491953 byte/sec,   148.7 Mb/sec
 0.162 sec,    1000    md5 crypts,    4096 bytes, 25216551 byte/sec,   192.4 Mb/sec
 0.329 sec,    1000    md5 crypts,    8192 bytes, 24927882 byte/sec,   190.2 Mb/sec
 0.049 sec,    1000   sha1 crypts,       8 bytes,   162433 byte/sec,     1.2 Mb/sec
 0.049 sec,    1000   sha1 crypts,      16 bytes,   325799 byte/sec,     2.5 Mb/sec
 0.049 sec,    1000   sha1 crypts,      32 bytes,   659413 byte/sec,     5.0 Mb/sec
 0.052 sec,    1000   sha1 crypts,      64 bytes,  1225373 byte/sec,     9.3 Mb/sec
 0.052 sec,    1000   sha1 crypts,     128 bytes,  2473956 byte/sec,    18.9 Mb/sec
 0.055 sec,    1000   sha1 crypts,     256 bytes,  4622524 byte/sec,    35.3 Mb/sec
 0.062 sec,    1000   sha1 crypts,     512 bytes,  8281440 byte/sec,    63.2 Mb/sec
 0.077 sec,    1000   sha1 crypts,    1024 bytes, 13222799 byte/sec,   100.9 Mb/sec
 0.106 sec,    1000   sha1 crypts,    2048 bytes, 19245950 byte/sec,   146.8 Mb/sec
 0.165 sec,    1000   sha1 crypts,    4096 bytes, 24767502 byte/sec,   189.0 Mb/sec
 0.328 sec,    1000   sha1 crypts,    8192 bytes, 24942910 byte/sec,   190.3 Mb/sec
help

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200408150804.i7F84jCB010066>