Subject: Re: lib/28935: libcrypto does not use 64bit longs on 64 bit archs
To: None <martin@duskware.de>
From: Simon Burge <simonb@wasabisystems.com>
List: netbsd-bugs
Date: 01/20/2005 18:52:16
Martin Husemann wrote:

> >Number:         28935
> >Category:       lib
> >Synopsis:       libcrypto does not use 64bit longs on 64 bit archs
> 
> While openssl can use 64bit longs on archs that have it (by defining 
> SIXTY_FOUR_BIT and SIXTY_FOUR_BIT_LONG), it does apparently
> not configure them for any NetBSD arch. The integrated version of openssl
> does not support these defines at all, crypto/dist/openssl/crypto/bn/bn.h 
> unconditionally undefines them.
> 
> >How-To-Repeat:
> Code inspection - or run "openssl speed rsa" on NetBSD/alpha, sparc64 or amd64.

I get mixed results comparing the in-source-tree OpenSSL 0.9.7c and
pkgsrc OpenSSL 0.9.7e on a 500MHz Alpha PC164 running 2.0BETA.

Here's the output of "openssl speed" on in-src OpenSSL 0.9.7c:

The 'numbers' are in 1000s of bytes per second processed.
type             16 bytes     64 bytes    256 bytes   1024 bytes   8192 bytes
md2                198.41k      436.01k      622.59k      698.74k      726.01k
mdc2                 0.00         0.00         0.00         0.00         0.00 
md4               1493.64k     5561.75k    17945.84k    40952.00k    64370.41k
md5               1042.62k     3819.85k    12051.62k    26168.21k    39795.07k
hmac(md5)         2307.34k     7611.69k    19916.70k    33422.74k    41687.34k
sha1              1226.44k     3960.68k    10414.12k    17554.31k    21831.62k
rmd160            1083.33k     3378.59k     8146.53k    12666.48k    15041.52k
rc4              22797.02k    24624.11k    25057.51k    25143.94k    24783.38k
des cbc           4794.91k     5226.44k     5348.26k     5376.26k     5372.52k
des ede3          1974.08k     2030.53k     2047.20k     2050.99k     2049.24k
idea cbc             0.00         0.00         0.00         0.00         0.00 
rc2 cbc           5375.34k     5755.80k     5862.41k     5885.34k     5880.61k
rc5-32/12 cbc        0.00         0.00         0.00         0.00         0.00 
blowfish cbc      9654.28k    11033.53k    11497.54k    11642.84k    11783.75k
cast cbc          6730.75k     7387.51k     7604.83k     7664.76k     7668.52k
aes-128 cbc       5135.79k     6724.36k     7405.16k     7590.70k     7636.82k
aes-192 cbc       6966.60k     6825.35k     6910.73k     6936.15k     6926.58k
aes-256 cbc       6365.18k     6321.86k     6401.56k     6415.69k     6406.57k
                  sign    verify    sign/s verify/s
rsa  512 bits   0.0032s   0.0003s    315.4   3451.9
rsa 1024 bits   0.0118s   0.0007s     84.9   1406.1
rsa 2048 bits   0.0657s   0.0021s     15.2    476.9
rsa 4096 bits   0.4326s   0.0070s      2.3    141.9
                  sign    verify    sign/s verify/s
dsa  512 bits   0.0021s   0.0026s    473.4    391.1
dsa 1024 bits   0.0058s   0.0071s    171.9    140.6
dsa 2048 bits   0.0184s   0.0223s     54.3     44.8

Here's the output of "openssl speed" on pkgsrc OpenSSL 0.9.7e:

The 'numbers' are in 1000s of bytes per second processed.
type             16 bytes     64 bytes    256 bytes   1024 bytes   8192 bytes
md2                202.18k      441.73k      626.62k      698.97k      723.84k
mdc2                 0.00         0.00         0.00         0.00         0.00 
md4               1041.21k     3547.05k    11660.18k    27799.45k    45927.44k
md5               1196.18k     3944.48k    11568.67k    22334.35k    30522.78k
hmac(md5)          723.49k     2579.22k     8339.52k    18831.72k    29576.51k
sha1              1214.94k     3886.29k     9920.27k    16271.31k    19895.68k
rmd160            1081.20k     3182.08k     7464.26k    11277.43k    13173.15k
rc4              32333.46k    37888.72k    39785.51k    40342.45k    40022.00k
des cbc           4849.41k     5251.23k     5363.72k     5390.56k     5370.66k
des ede3          1975.25k     2044.15k     2060.15k     2067.72k     2057.25k
idea cbc             0.00         0.00         0.00         0.00         0.00 
rc2 cbc           5283.03k     5632.76k     5720.52k     5744.53k     5729.82k
rc5-32/12 cbc        0.00         0.00         0.00         0.00         0.00 
blowfish cbc      9608.00k    10962.25k    11403.52k    11508.92k    11629.78k
cast cbc          7079.47k     7947.91k     8198.95k     8266.78k     8179.22k
aes-128 cbc       7426.10k     7639.94k     7701.23k     7724.17k     7570.65k
aes-192 cbc       6802.83k     6967.03k     7016.89k     7028.19k     6904.39k
aes-256 cbc       6345.07k     6485.01k     6532.10k     6540.89k     6436.20k
                  sign    verify    sign/s verify/s
rsa  512 bits   0.0096s   0.0010s    104.2   1030.3
rsa 1024 bits   0.0543s   0.0031s     18.4    323.9
rsa 2048 bits   0.3548s   0.0109s      2.8     91.4
rsa 4096 bits   2.5054s   0.0411s      0.4     24.3
                  sign    verify    sign/s verify/s
dsa  512 bits   0.0087s   0.0107s    115.2     93.3
dsa 1024 bits   0.0289s   0.0353s     34.6     28.3
dsa 2048 bits   0.1040s   0.1284s      9.6      7.8

For example, md4 is faster with in-src OpenSSL, while rc4 is faster with
pkgsrc OpenSSL.

Simon.
--
Simon Burge                            <simonb@wasabisystems.com>
NetBSD Support and Service:         http://www.wasabisystems.com/