Hi Geoff,

I actually tried the same approach, I had a small test function that I call
at the start of each thread that initializes, locks, unlocks and destroys
the dyn locks.. and the functions are properly called.

        unsigned long lock, lock2 = 0;

        printf("About to test\n");
        lock = CRYPTO_get_new_dynlockid();
        lock2 = CRYPTO_get_new_dynlockid();
        printf("Got new locks %lu, %lu\n", lock, lock2);
        CRYPTO_w_lock(lock);
        printf("Locked the lock\n");
        CRYPTO_w_unlock(lock);
        printf("Unlocked the lock\n");
        CRYPTO_destroy_dynlockid(lock);
        CRYPTO_destroy_dynlockid(lock2);
        printf("Destroyed the locks, DONE\n");

the result, for each new thread is:

   Got new locks 4294967283, 4294967295
   Locked the lock
   Unlocked the lock
   Destroyed the locks, DONE

and in the logs, the functions properly log the start and end of each _dyn_
function, that is:

   ...
   Nov 21 17:36:19 ncipher168 ocspd[26357]: _dyn_create_callback() start
   Nov 21 17:36:19 ncipher168 ocspd[26357]: _dyn_create_callback() stop
   Nov 21 17:36:19 ncipher168 ocspd[26357]: _dyn_lock_callback() start
   Nov 21 17:36:19 ncipher168 ocspd[26357]: _dyn_lock_callback() end
   ...

Therefore it seems that the callbacks are properly registered!

The problem is that they are not called by the nCipher driver - no sign
at all in the logs... :( How come they are not called ???

Later,
Max


Geoff Thorpe wrote:
On Friday 21 November 2008 03:01:33 Massimiliano Pala wrote:
Hi David,

that is really nice.. although.. after I gave it a try... it does not
really work :(

Actually, it seems that the dynamic functions are never called... :(

Investigating...

The attached example seems to work. I put it in the top-level directory of the (built) openssl tree and compiled with;
   gcc -Wall -Iinclude -o foobar foobar.c -L. -lcrypto

The output shows that dynamic lockids are negative;
About to test
Created lock 'dyn_lck.c:257'
Created lock 'dyn_lck.c:257'
Got new locks -1, -2
Doing mode 9 lock on 'dyn_lck.c:257' from foobar.c:47
Locked the lock
Doing mode 10 lock on 'dyn_lck.c:257' from foobar.c:49
Unlocked the lock
Destroying lock 'dyn_lck.c:257' from dyn_lck.c:329
Destroying lock 'dyn_lck.c:257' from dyn_lck.c:329
Destroyed the locks, DONE

Perhaps that'll help distinguish what's going on in your code?

Cheers,
Geoff



______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    openssl-users@openssl.org
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to