Re: Disabling the PKCS #11 on Solaris 10
Jan, Thanks for the information! How can I explicitly initialize the PKCS11 engine when writing in C? I've looked at examples, but I think I'm missing a step because when I verify or sign using OpenSSL, I'm seeing no improvement in performance. -Chris On Tue, Jul 22, 2008 at 8:38 AM, Jan Pechanec [EMAIL PROTECTED] wrote: On Tue, 22 Jul 2008, sadronmeldir wrote: I'm aware that the default installation of the Solaris 10 OS provides a PKCS#11-based OpenSSL implementation. I'm trying to take some metrics to figure out how much more efficient certain processes are with the PKCS engine. How would I disable the PKCS engine on an UltraSPARC T1 processor? an application must explicitly initialize the engine so that it can use it. The only app that uses the engine by default on S10 is Apache. You can also use -engine pkcs11 with openssl(1) command. J. -- Jan Pechanec __ OpenSSL Project http://www.openssl.org User Support Mailing Listopenssl-users@openssl.org Automated List Manager [EMAIL PROTECTED]
Re: Disabling the PKCS #11 on Solaris 10
I'm afraid I don't quite follow. I'm compiling my code with the command lines below: gcc -Wall -ggdb -DDEBUG LoadDataFromFile.c -c LoadDataFromFile.o gcc -Wall -ggdb -DDEBUG WriteDataToFile.c -c WriteDataToFile.o gcc -Wall -ggdb -DDEBUG sign.c -c sign.o gcc -I /usr/sfw/include -L /usr/sfw/lib -lcrypto LoadDataFromFile.o WriteDataToFile.o sign.o -o sign Does this initialize the PKCS11 engine? Or do I need to implement it inside sign.c? If so, how? And if I am already initializing it, how do I stop? Thanks for all your help so far. I'm new to OpenSSL and the PKCS11 and I'm trying to pick up on a project where someone else left off. -Chris On Tue, Jul 22, 2008 at 9:26 AM, Jan Pechanec [EMAIL PROTECTED] wrote: On Tue, 22 Jul 2008, Christopher Ivory wrote: Jan, Thanks for the information! How can I explicitly initialize the PKCS11 engine when writing in C? I've looked at examples, but I think I'm missing a step because when I verify or sign using OpenSSL, I'm seeing no improvement in performance. see how openssl does that in apps/ subdirectory in the OpenSSL tarball. You can see what is going on by trussing your app with -ulibcrypto:: and -ulibpkcs11::. J. -- Jan Pechanec __ OpenSSL Project http://www.openssl.org User Support Mailing Listopenssl-users@openssl.org Automated List Manager [EMAIL PROTECTED]
Re: Disabling the PKCS #11 on Solaris 10
I think I figured out my problem but I'd like someone to confirm for me that this seems like a reasonable conclusion. I've been wondering whether or not I had properly initiated the PKCS11 chip for OpenSSL because I wasn't seeing much improvement in processing time. I'm trying to sign using the following seciton of code: EVP_MD_CTX_init( ctx ); EVP_SignInit_ex( ctx, EVP_sha1(), NULL ); /*update*/ EVP_SignUpdate( ctx, signedData, dataLength); /*Finalize*/ signatureLength = EVP_PKEY_size( pkey ); signatureData = (unsigned char *) calloc( signatureLength, sizeof( unsigned char ) ); EVP_SignFinal( ctx, signatureData, signatureLength, pkey); EVP_MD_CTX_cleanup( ctx ); I decided to test the speeds of the processor for OpenSSL with SHA-1. When I ran the speed tests without the pkcs11 initialized (speed sha1), I recieved the following: The 'numbers' are in 1000s of bytes per second processed. type 16 bytes 64 bytes256 bytes 1024 bytes 8192 bytes sha1 1927.00k 6624.70k15229.53k29638.31k 40211.80k When I ran the same test with the pkcs chip initialized (speed sha1 -engine pkcs11) the results were: The 'numbers' are in 1000s of bytes per second processed. type 16 bytes 64 bytes256 bytes 1024 bytes 8192 bytes sha1 408.02k 1508.91k 5448.41k15804.53k 34058.17k This leads me to believe that while the pkcs11 might not improve the performance of SHA-1. Would this be a fair assessment, or am I missing something? -C On Tue, Jul 22, 2008 at 9:44 AM, Christopher Ivory [EMAIL PROTECTED] wrote: I'm afraid I don't quite follow. I'm compiling my code with the command lines below: gcc -Wall -ggdb -DDEBUG LoadDataFromFile.c -c LoadDataFromFile.o gcc -Wall -ggdb -DDEBUG WriteDataToFile.c -c WriteDataToFile.o gcc -Wall -ggdb -DDEBUG sign.c -c sign.o gcc -I /usr/sfw/include -L /usr/sfw/lib -lcrypto LoadDataFromFile.o WriteDataToFile.o sign.o -o sign Does this initialize the PKCS11 engine? Or do I need to implement it inside sign.c? If so, how? And if I am already initializing it, how do I stop? Thanks for all your help so far. I'm new to OpenSSL and the PKCS11 and I'm trying to pick up on a project where someone else left off. -Chris On Tue, Jul 22, 2008 at 9:26 AM, Jan Pechanec [EMAIL PROTECTED] wrote: On Tue, 22 Jul 2008, Christopher Ivory wrote: Jan, Thanks for the information! How can I explicitly initialize the PKCS11 engine when writing in C? I've looked at examples, but I think I'm missing a step because when I verify or sign using OpenSSL, I'm seeing no improvement in performance. see how openssl does that in apps/ subdirectory in the OpenSSL tarball. You can see what is going on by trussing your app with -ulibcrypto:: and -ulibpkcs11::. J. -- Jan Pechanec __ OpenSSL Project http://www.openssl.org User Support Mailing Listopenssl-users@openssl.org Automated List Manager [EMAIL PROTECTED]
Re: Disabling the PKCS #11 on Solaris 10
I see what you mean, however, when I get the processor info with the command uname -a it returns: SunOS t5200tx 5.10 Generic_120011-14 sun4v sparc SUNW,SPARC-Enterprise-T5220 I was working under the impression that this is a T2. Was I misinformed? -Chris PS - Thanks for your conitnued help! On Tue, Jul 22, 2008 at 2:22 PM, Jan Pechanec [EMAIL PROTECTED] wrote: On Tue, 22 Jul 2008, Jan Pechanec wrote: in OpenSolaris, there is a project that mechanisms that are not implemented in hw will stay in the soft token. of course, I meant will stay in OpenSSL -- Jan Pechanec __ OpenSSL Project http://www.openssl.org User Support Mailing Listopenssl-users@openssl.org Automated List Manager [EMAIL PROTECTED]
Re: Disabling the PKCS #11 on Solaris 10
If it helps, I ran the cryptoadm and got the following results: 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. On Tue, Jul 22, 2008 at 2:44 PM, Christopher Ivory [EMAIL PROTECTED] wrote: I see what you mean, however, when I get the processor info with the command uname -a it returns: SunOS t5200tx 5.10 Generic_120011-14 sun4v sparc SUNW,SPARC-Enterprise-T5220 I was working under the impression that this is a T2. Was I misinformed? -Chris PS - Thanks for your conitnued help! On Tue, Jul 22, 2008 at 2:22 PM, Jan Pechanec [EMAIL PROTECTED] wrote: On Tue, 22 Jul 2008, Jan Pechanec wrote: in OpenSolaris, there is a project that mechanisms that are not implemented in hw will stay in the soft token. of course, I meant will stay in OpenSSL -- Jan Pechanec __ OpenSSL Project http://www.openssl.org User Support Mailing Listopenssl-users@openssl.org Automated List Manager [EMAIL PROTECTED]
Configuring Signing through the PKCS#11
Hello, I'm currently trying to configure some pre-existing code using EVP signing to offload work to the PKCS #11 engine on an OpenSPARC T2. Since I'm new to this, I tried initializing the PKCS11 engine two different ways which can be triggered by command line argument. By default, the program will run without the PKCS11 engine initialized. Here are the two ways I attempt to initialize the PKCS11 engine. if (usePKCS == 1){ ENGINE_load_builtin_engines(); ENGINE_register_all_complete(); ENGINE_set_default_RSA(ENGINE_by_id(pkcs11)); } else if (usePKCS2 == 1){ ENGINE_load_builtin_engines(); ENGINE *e = ENGINE_by_id(pkcs11); ENGINE_init(e); ENGINE_set_default_RSA(e); } Below is the section of code in which the actual signing takes place. /*initialize*/ EVP_MD_CTX_init( ctx ); EVP_SignInit_ex( ctx, EVP_sha1(), NULL ); /*update*/ EVP_SignUpdate( ctx, signedData, dataLength); /*Finalize*/ signatureLength = EVP_PKEY_size( pkey ); signatureData = (unsigned char *) calloc( signatureLength, sizeof( unsigned char ) ); EVP_SignFinal( ctx, signatureData, signatureLength, pkey); EVP_MD_CTX_cleanup( ctx ); However, I'm seeing no significant change in processing time regardless of whether or not I execute the program with or without the PKCS11 engines initialized as I have above. Is it possible that I'm missing a step? Or did I misunderstand the function of the PKCS11 engine and incorrectly assume that I should see significant improvement in my processing time? -Chris
PKCS12_parse Issue?
Hello all, I'm trying to run a loop to parse the same p12 multple times to take some metrics. However, after the loop completes twice succesfully, PKCS12_parse fails. Any suggestions as to why this is happening? -Chris while(count 0){ /* Parse the PKCS #12 file with password */ ca = (STACK_OF(X509) *)NULL; if (!PKCS12_parse(p12, password, pkey, cert, ca)) { printf(Error parsing file\n); return -3; } /* Find PKey */ if ( (EVP_PKEY *)NULL == pkey ){ //printf(No private key!\n); } else{ //printf(Private key found!\n); } /* Find Cert */ if ( (X509 *)NULL == cert ){ //printf(No X509!\n); } else{ //printf(X509 found!\n); } /* Find CA */ if ( (STACK_OF(X509) *)NULL == ca ){ //printf(No CA!\n); } else{ //printf(CA found!\n); } count--; EVP_PKEY_free(pkey); X509_free(cert); sk_X509_pop_free(ca, X509_free); }//end while