Additional Information:
I can reproduce the error by including this short code into any place of the engine
init function:
{ RSA *rsa = NULL;
rsa = RSA_new();
RSA_free(rsa);
}
When I include this code in another engine function that is loaded dynamicaly
everything works still
fine. Is there a possibility to run this code in the init function correct as well?
Jan
Jan Tschirschwitz wrote:
>
>
> Richard Levitte - VMS Whacker wrote:
>
>> In message <[EMAIL PROTECTED]> on Thu, 08 Aug 2002
>> 13:19:03 +0200, Jan Tschirschwitz <[EMAIL PROTECTED]>
>> said:
>>
>> Jan.Tschirschwitz> We have implemented our engine into
>> Jan.Tschirschwitz> openssl-0.9.7beta2 & beta3. When I use the function
>> Jan.Tschirschwitz> PEM_read_PrivateKey() during engine initialization
>> Jan.Tschirschwitz> to read a private RSA key from file I get the
>> Jan.Tschirschwitz> following error message:
>> Jan.Tschirschwitz> Jan.Tschirschwitz>
>> /home/jan/download/openssl-0.9.7-beta3/apps/openssl speed rsa1024
>> -engine cluster_labs
>> Jan.Tschirschwitz> openssl (lock_dbg_cb): already locked (mode=9,
>> type=29) at eng_table.c:265
>> Jan.Tschirschwitz> Segmentation fault
>> Jan.Tschirschwitz> Jan.Tschirschwitz> The function
>> PEM_read_PrivateKey() is called in
>> Jan.Tschirschwitz> hw_engine_init(). The hw_engine_init() is loaded
>> Jan.Tschirschwitz> dynamicaly from /usr/lib/libcluster_labs.so.
>>
>> The lock that gets into trouble is CRYPTO_LOCK_ENGINE. You don't
>> happen to try to set lock, do you?
>
>
>
> No I didn't lock anything on my own.
>
>
>> I suggest you show us a backtrace, so we have a chance to see the
>> sequence of events that lead to the error...
>
>
>
> The only functions I use from OpenSSL-Library are:
>
> ...
> OpenSSL_add_all_algorithms();
> ERR_load_crypto_strings();
> ...
> PEM_read_PrivateKey()
> ...
>
> I have enabled the option "ENGINE_TABLE_DEBUG" and make some debug
> information to the functions that are called before the engine lock
> message. Here is the result:
>
> [root@CL2 openssl-0.9.7-beta3]#
> /home/jan/download/openssl-0.9.7-beta3/apps/openssl speed rsa1024
> -engine cluster_labs
> PEM_read_PrivateKey()
> PEM_read_bio_PrivateKey()
> PEM_bytes_read_bio()
> engine_table_select()
> engine_table_dbg: tb_digest.c:117, nid=4, no registered for anything!
> engine_table_select()
> engine_table_dbg: tb_digest.c:117, nid=4, no registered for anything!
> engine_table_select()
> engine_table_dbg: tb_cipher.c:117, nid=44, no registered for
> anything!
> PEM_bytes_read_bio() ret = 1
> d2i_PrivateKey()
> d2i_PrivateKey(); EVP_PKEY_RSA
> d2i_RSAPrivateKey()
> rsa_cb()
> rsa_cb(); ASN1_OP_NEW_PRE
> RSA_new
> RSA_new_method() get default method
> RSA_new_method(); ENGINE_get_default_RSA()
> ENGINE_get_default_RSA()
> engine_table_select()
> openssl (lock_dbg_cb): already locked (mode=9, type=29) at
> eng_table.c:267
> engine_table_dbg: tb_rsa.c:108, nid=1, no registered
> implementations would initialise
> engine_table_dbg: tb_rsa.c:108, nid=1, caching 'no matching
> ENGINE'
> rsa_cb(); ASN1_OP_NEW_PRE_END
> rsa_cb()
> rsa_cb()
> Segmentation fault
>
> This is the backtrace of the function call PEM_read_PrivateKey(). From
> d2i_RSAPrivateKey() the application will not return.
>
>
> Jan
>
>
> ______________________________________________________________________
> OpenSSL Project http://www.openssl.org
> Development Mailing List [EMAIL PROTECTED]
> Automated List Manager [EMAIL PROTECTED]
>
--
------------------------------------------------------------------------
[EMAIL PROTECTED]
Software Development
Cluster Labs GmbH
Potsdamer Strasse 88
10785 Berlin
Germany
Tel: +49-30-306940-52 Fax: +49-30-306940-31
PGP ID: 0xCDC217EC
PGP Fingerprint: FB87 E16D 8CCF 2A1C 440B C639 3B4F E31E CDC2 17E
----------------------------------------------------------------------
______________________________________________________________________
OpenSSL Project http://www.openssl.org
Development Mailing List [EMAIL PROTECTED]
Automated List Manager [EMAIL PROTECTED]