[PadLock] PadLock engine update for VIA C7 with SHA1/SHA256

Michal Ludvig michal at logix.cz
Tue Jun 27 08:26:46 CEST 2006

Hi all,

as I'm getting more and more questions about OpenSSL and Linux kernel
support for the new VIA C7 processors I decided to release some code.
Finally ;-)

First one is OpenSSL engine update that brings SHA1, SHA224 and SHA256
support. Due to some hardware limitations the maximum size of data
actually hashed by the hardware is currently limited to 2^13 bytes,
i.e. 8kB. Once the input buffer is full the engine automatically falls
back to the appropriate software SHA implementation.

You can change this buffer size in the patch to anything that fits your
needs. Look for PADLOCK_SHA_{INIT,MAX}_ORD defines. The default is 8kB
just because it's big enough for most network-related stuff (OpenVPN,

Check out http://www.logix.cz/michal/devel/padlock/phe_sum.xp for more
information on the mentioned HW limitations. I plan to incorporate the
workaround described there into the OpenSSL PadLock patch asap.

The patch is verified to work in OpenSSL 0.9.8b. It should be easily
possible to use it in 0.9.7 branch as well but I haven't tested it.

Some benchmark results from 'openssl speed':

            16 bytes     64 bytes    256 bytes   1024 bytes   8192 bytes
sha1-sw      6662.24k   20032.34k    44140.20k    62691.67k    71969.45k
sha1-padlock 4961.99k   19048.80k    66748.99k   173627.53k   329788.07k

sha256-sw    3257.00k    8053.23k    14734.17k    18590.53k    20193.28k
sha256-padlk 4885.37k   18913.91k    65156.34k   169889.13k   319386.97k

Download from: http://www.logix.cz/michal/devel/padlock/

FYI Still in my queue are:
- Linux kernel support for SHA
- OpenSSL support for RSA
- OpenSSL support for SHA without fallbacks

Enjoy ;-)

Michal Ludvig
* Homepage: http://www.logix.cz/michal

More information about the PadLock mailing list