Offloading SHA-1 to the PKCS11 Hardware

Christopher Ivory sadronmeldir at gmail.com
Tue Jul 22 12:46:48 PDT 2008


Hello all,

I'm having a bit of trouble and people suggested I post my dilema here. I'm
new to OpenSSL and the PKCS so it's quite possible I'm making a very simple
mistake.

I'm been trying to get a measure of how effective the PKCS11 engine is for
OpenSSL on an UltraSPARC machine. When I've run some tests, it seems that
it's faring worse for SHA-1.

The processor information ( with the command "uname -a") is:
SunOS t5200tx 5.10 Generic_120011-14 sun4v sparc SUNW,SPARC-Enterprise-T5220

If I'm understanding that correctly, that's a T2 server and should support
SHA-1 for the PKCS11. Next I test in OpenSSL the speed of SHA-1 without the
engine initialized. Using the command line "speed sha1 -elapsed", I get the
following results:
The 'numbers' are in 1000s of bytes per second processed.
type             16 bytes     64 bytes    256 bytes   1024 bytes   8192
bytes
sha1              1926.48k     6620.76k    15225.43k    29633.54k
40222.72k

I then run the test again with the PKCS11 engine initialized ("speed sha1
-elapsed -engine pkcs11"):
The 'numbers' are in 1000s of bytes per second processed.
type             16 bytes     64 bytes    256 bytes   1024 bytes   8192
bytes
sha1               323.71k     1214.78k     4460.46k    13598.04k
32486.74k

Before and after initializine the PKCS11 engine and running the test, I
checked the kstat counters ("kstat -m n2cp | grep sha1"). Both times, they
read:
sha1                            0
sha1hmac                        0
ssl3sha1mac                     0

I also checked the cryptoadm ("cryptoadm list -m"):
User-level providers:
=====================

Provider: /usr/lib/security/$ISA/pkcs11_kernel.so
Mechanisms:
CKM_DES_CBC
CKM_DES_ECB
CKM_DES3_CBC
CKM_DES3_ECB
CKM_AES_CBC
CKM_AES_ECB
CKM_RC4
Mechanisms:
CKM_DSA
CKM_RSA_X_509
CKM_RSA_PKCS

Provider: /usr/lib/security/$ISA/pkcs11_softtoken_extra.so
Mechanisms:
CKM_DES_CBC
CKM_DES_CBC_PAD
CKM_DES_ECB
CKM_DES_KEY_GEN
CKM_DES_MAC_GENERAL
CKM_DES_MAC
CKM_DES3_CBC
CKM_DES3_CBC_PAD
CKM_DES3_ECB
CKM_DES3_KEY_GEN
CKM_AES_CBC
CKM_AES_CBC_PAD
CKM_AES_ECB
CKM_AES_KEY_GEN
CKM_BLOWFISH_CBC
CKM_BLOWFISH_KEY_GEN
CKM_SHA_1
CKM_SHA_1_HMAC
CKM_SHA_1_HMAC_GENERAL
CKM_SHA256
CKM_SHA256_HMAC
CKM_SHA256_HMAC_GENERAL
CKM_SHA384
CKM_SHA384_HMAC
CKM_SHA384_HMAC_GENERAL
CKM_SHA512
CKM_SHA512_HMAC
CKM_SHA512_HMAC_GENERAL
CKM_SSL3_SHA1_MAC
CKM_MD5
CKM_MD5_HMAC
CKM_MD5_HMAC_GENERAL
CKM_SSL3_MD5_MAC
CKM_RC4
CKM_RC4_KEY_GEN
CKM_DSA
CKM_DSA_SHA1
CKM_DSA_KEY_PAIR_GEN
CKM_RSA_PKCS
CKM_RSA_PKCS_KEY_PAIR_GEN
CKM_RSA_X_509
CKM_MD5_RSA_PKCS
CKM_SHA1_RSA_PKCS
CKM_SHA256_RSA_PKCS
CKM_SHA384_RSA_PKCS
CKM_SHA512_RSA_PKCS
CKM_DH_PKCS_KEY_PAIR_GEN
CKM_DH_PKCS_DERIVE
CKM_MD5_KEY_DERIVATION
CKM_SHA1_KEY_DERIVATION
CKM_SHA256_KEY_DERIVATION
CKM_SHA384_KEY_DERIVATION
CKM_SHA512_KEY_DERIVATION
CKM_PBE_SHA1_RC4_128
CKM_PKCS5_PBKD2
CKM_SSL3_PRE_MASTER_KEY_GEN
CKM_TLS_PRE_MASTER_KEY_GEN
CKM_SSL3_MASTER_KEY_DERIVE
CKM_TLS_MASTER_KEY_DERIVE
CKM_SSL3_MASTER_KEY_DERIVE_DH
CKM_TLS_MASTER_KEY_DERIVE_DH
CKM_SSL3_KEY_AND_MAC_DERIVE
CKM_TLS_KEY_AND_MAC_DERIVE
CKM_TLS_PRF

Kernel software providers:
==========================
des: CKM_DES_ECB,CKM_DES_CBC,CKM_DES3_ECB,CKM_DES3_CBC
aes256: CKM_AES_ECB,CKM_AES_CBC,CKM_AES_CTR
arcfour2048: CKM_RC4
blowfish448: CKM_BLOWFISH_ECB,CKM_BLOWFISH_CBC
sha1: CKM_SHA_1,CKM_SHA_1_HMAC,CKM_SHA_1_HMAC_GENERAL
sha2:
CKM_SHA256,CKM_SHA256_HMAC,CKM_SHA256_HMAC_GENERAL,CKM_SHA384,CKM_SHA384_HMAC,CKM_SHA384_HMAC_GENERAL,CKM_SHA512,CKM_SHA512_HMAC,CKM_SHA512_HMAC_GENERAL
md5: CKM_MD5,CKM_MD5_HMAC,CKM_MD5_HMAC_GENERAL
rsa:
CKM_RSA_PKCS,CKM_RSA_X_509,CKM_MD5_RSA_PKCS,CKM_SHA1_RSA_PKCS,CKM_SHA256_RSA_PKCS,CKM_SHA384_RSA_PKCS,CKM_SHA512_RSA_PKCS
swrand: No mechanisms presented.

Kernel hardware providers:
==========================
n2cp/0:
CKM_DES_CBC,CKM_DES_ECB,CKM_DES3_CBC,CKM_DES3_ECB,CKM_AES_CBC,CKM_AES_ECB,CKM_AES_CTR,CKM_RC4,CKM_MD5,CKM_SHA_1,CKM_SHA256,CKM_MD5_HMAC,CKM_SHA_1_HMAC,CKM_SHA256_HMAC,CKM_MD5_HMAC_GENERAL,CKM_SHA_1_HMAC_GENERAL,CKM_SHA256_HMAC_GENERAL,CKM_SSL3_MD5_MAC,CKM_SSL3_SHA1_MAC
ncp/0: CKM_DSA,CKM_RSA_X_509,CKM_RSA_PKCS
n2rng/0: No mechanisms presented.

It feels to me that the PKCS11 engine isn't handling the SHA-1 like it
should, but it's very likely I'm misunderstanding how it's used or not
implementing it correctly. Can anyone confirm or deny this?

-Chris
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.opensolaris.org/pipermail/crypto-discuss/attachments/20080722/f4560dc9/attachment-0001.html 


More information about the crypto-discuss mailing list