Subject: hifn(4) and openssl
To: None <netbsd-users@netbsd.org>
From: Eric Auge <eau@phear.org>
List: netbsd-users
Date: 02/07/2007 23:40:55
This is an OpenPGP/MIME signed message (RFC 2440 and 3156)
--------------enigF764CD8293D0C9CEEFFC85DA
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

Hello,

I'm playing with a miniPCI hifn card on some embedded hardware (WRAP /
pcengines.ch) currently running NetBSD 4.0_BETA2.

[...]
hifn0 at pci0 dev 13 function 0: Hifn 7955, rev. 0
hifn0: 3DES/AES, 32KB dram, interrupting at irq 12
[...]

I ran openssl speed -engine cryptodev aes-256-cbc (it's just a guess i'm =
not
sure cryptodev is the correct engine, i see ubsec but no hifn engine)

here are the result :

with hifn(4) :

root@earthprout:~ # openssl speed -engine cryptodev aes-256-cbc
engine "cryptodev" set.
To get the most accurate results, try to run this
program when this computer is idle.
Doing aes-256 cbc for 3s on 16 size blocks: 258865 aes-256 cbc's in 3.01s=

Doing aes-256 cbc for 3s on 64 size blocks: 68090 aes-256 cbc's in 3.01s
Doing aes-256 cbc for 3s on 256 size blocks: 17289 aes-256 cbc's in 3.01s=

Doing aes-256 cbc for 3s on 1024 size blocks: 4334 aes-256 cbc's in 3.00s=

Doing aes-256 cbc for 3s on 8192 size blocks: 538 aes-256 cbc's in 3.01s
OpenSSL 0.9.8d 28 Sep 2006
built on: NetBSD 4.0_BETA2
options:bn(32,32) md2(int) rc4(ptr,int) des(ptr,risc2,16,long) aes(partia=
l)
blowfish(ptr2)
compiler: gcc version 4.1.2 20061021 (prerelease) (NetBSD nb3 20061125)
available timing options: USE_TOD HZ=3D100 [sysconf value]
timing function used: getrusage
The 'numbers' are in 1000s of bytes per second processed.
type             16 bytes     64 bytes    256 bytes   1024 bytes   8192 b=
ytes
aes-256 cbc       1378.20k     1449.54k     1472.44k     1477.68k     146=
4.71k


without hifn(4) (on the same hardware configuration) :

root@airprout:~ # openssl speed -engine cryptodev aes-256-cbc
engine "cryptodev" set.
To get the most accurate results, try to run this
program when this computer is idle.
Doing aes-256 cbc for 3s on 16 size blocks: 259050 aes-256 cbc's in 2.99s=

Doing aes-256 cbc for 3s on 64 size blocks: 68226 aes-256 cbc's in 3.00s
Doing aes-256 cbc for 3s on 256 size blocks: 17312 aes-256 cbc's in 3.00s=

Doing aes-256 cbc for 3s on 1024 size blocks: 4343 aes-256 cbc's in 3.00s=

Doing aes-256 cbc for 3s on 8192 size blocks: 538 aes-256 cbc's in 3.00s
OpenSSL 0.9.8d 28 Sep 2006
built on: NetBSD 4.0_BETA2
options:bn(32,32) md2(int) rc4(ptr,int) des(ptr,risc2,16,long) aes(partia=
l)
blowfish(ptr2)
compiler: gcc version 4.1.2 20061021 (prerelease) (NetBSD nb3 20061125)
available timing options: USE_TOD HZ=3D100 [sysconf value]
timing function used: getrusage
The 'numbers' are in 1000s of bytes per second processed.
type             16 bytes     64 bytes    256 bytes   1024 bytes   8192 b=
ytes
aes-256 cbc       1385.46k     1457.41k     1475.07k     1480.83k     147=
0.06k

so without hifn(4) is often faster and there is no "unloading" of the CPU=
 on the
hifn(4) card, the load is identical on both.

checking with ktruss and looking at crypto(4), i see no ioctl(CIOCCRYPT) =
during
the openssl speed test, am i doing things right ? do I miss something ?

Regards,
Eric.


--------------enigF764CD8293D0C9CEEFFC85DA
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (NetBSD)

iD8DBQFFylV6SdZNA80H8MYRAmp1AJsFyDwaOb3jpg7gMVnqqJZJwJzM7wCbBAsm
9QSH429d0D+vKlgALfxX3sg=
=g41K
-----END PGP SIGNATURE-----

--------------enigF764CD8293D0C9CEEFFC85DA--