Re: sha_block_data_order Crash

2010-08-24 Thread Sayan Chaliha
Hey Sam,

Thanks for the response. I think that is the issue here. I was under the
impression that configuring using the 'threads' option would be enough to
make OpenSSL thread-safe. That was really helpful!!

On Tue, Aug 24, 2010 at 9:23 PM, Sam Jantz  wrote:

> Have you explicitly made your application thread safe?  There are four
> functions that you need to implement to make the OpenSSL libraries
> themselves thread safe.  These are:
>
> static void locking_function(int mode, int n, const char * file, int line)
> static unsigned long id_function(void)
> int THREAD_setup(void)
> and int THREAD_cleanup
>
> Once you have these implemented, you call THREAD_setup in the main thread
> before you start spawning sub threads, and THREAD_cleanup during shutdown.
>  This will allow openssl to successfully run the multi threaded.
>
> For more information on how to implement these functions see the man page
> for CRYPTO_set_locking_callback, and CRYPTO_set_id_callback
>
> I hope that this is new information, and not something you already knew.
>
> Cheers,
>
>   Sam
>
> On Tue, Aug 24, 2010 at 6:37 AM, Sayan Chaliha 
> wrote:
>
>> Hey all,
>>
>> Under stressed conditions (multi-threaded apps with several threads using
>> OpenSSL at the same time) the function RAND_bytes crashes consistently.
>> Anybody have any idea why this is caused and if there's any solution for it?
>>
>> Attached:
>> GDB `disassemble $rip` ourput from core dump.
>>
>> Stack trace:
>> #0  sha1_block_data_order (c=0x2aab118ab4c0, p=,
>> num=288230376151706362) at sha_locl.h:256
>> #1  0x2b302f4a1e13 in SHA1_Update (c=0x2aab118ab4c0, data_=> optimized out>, len=18446744073709551592) at ../md32_common.h:325
>> #2  0x2b302f5034ed in ssleay_rand_bytes (buf=0x46d25860 "", num=0) at
>> md_rand.c:489
>> #3  0x2b302f502df6 in ssleay_rand_pseudo_bytes (buf=0x2022a54d0
>> , num=1933866968) at md_rand.c:533
>>
>> OpenSSL version: 1.0.0a
>>
>> OS: CentOS 5.4 x86_64
>>
>> --
>> Regards,
>> Sayan Chaliha
>> Webyog Softworks Private Limited
>> 2nd Floor, Novel Team Building
>> #10, 100 Feet Ring Road
>> BTM Layout 1st Stage
>> Bangalore - 560068
>>
>> +91-9743357501
>>
>
>
>
> --
> Sam Jantz
> Software Engineer
>
>


-- 
Regards,
Sayan Chaliha
Webyog Softworks Private Limited
2nd Floor, Novel Team Building
#10, 100 Feet Ring Road
BTM Layout 1st Stage
Bangalore - 560068

+91-9743357501


Re: sha_block_data_order Crash

2010-08-24 Thread Jakob Bohm

I am afraid I cannot match your stack trace to the disassembly without
either line numbers in the disassembly or a numeric value for the $rip
register.

On 24-08-2010 13:37, Sayan Chaliha wrote:

Hey all,
Under stressed conditions (multi-threaded apps with several threads
using OpenSSL at the same time) the function RAND_bytes crashes
consistently. Anybody have any idea why this is caused and if there's
any solution for it?
Attached:
GDB `disassemble $rip` ourput from core dump.
Stack trace:
#0  sha1_block_data_order (c=0x2aab118ab4c0, p=,
num=288230376151706362) at sha_locl.h:256
#1  0x2b302f4a1e13 in SHA1_Update (c=0x2aab118ab4c0, data_=, len=18446744073709551592) at ../md32_common.h:325
#2  0x2b302f5034ed in ssleay_rand_bytes (buf=0x46d25860 "", num=0)
at md_rand.c:489
#3  0x2b302f502df6 in ssleay_rand_pseudo_bytes (buf=0x2022a54d0
, num=1933866968) at md_rand.c:533
OpenSSL version: 1.0.0a
OS: CentOS 5.4 x86_64

--
Regards,
Sayan Chaliha
Webyog Softworks Private Limited
2nd Floor, Novel Team Building
#10, 100 Feet Ring Road
BTM Layout 1st Stage
Bangalore - 560068

+91-9743357501


__
OpenSSL Project http://www.openssl.org
User Support Mailing Listopenssl-users@openssl.org
Automated List Manager   majord...@openssl.org


Re: sha_block_data_order Crash

2010-08-24 Thread Sam Jantz
Have you explicitly made your application thread safe?  There are four
functions that you need to implement to make the OpenSSL libraries
themselves thread safe.  These are:

static void locking_function(int mode, int n, const char * file, int line)
static unsigned long id_function(void)
int THREAD_setup(void)
and int THREAD_cleanup

Once you have these implemented, you call THREAD_setup in the main thread
before you start spawning sub threads, and THREAD_cleanup during shutdown.
 This will allow openssl to successfully run the multi threaded.

For more information on how to implement these functions see the man page
for CRYPTO_set_locking_callback, and CRYPTO_set_id_callback

I hope that this is new information, and not something you already knew.

Cheers,

  Sam

On Tue, Aug 24, 2010 at 6:37 AM, Sayan Chaliha wrote:

> Hey all,
>
> Under stressed conditions (multi-threaded apps with several threads using
> OpenSSL at the same time) the function RAND_bytes crashes consistently.
> Anybody have any idea why this is caused and if there's any solution for it?
>
> Attached:
> GDB `disassemble $rip` ourput from core dump.
>
> Stack trace:
> #0  sha1_block_data_order (c=0x2aab118ab4c0, p=,
> num=288230376151706362) at sha_locl.h:256
> #1  0x2b302f4a1e13 in SHA1_Update (c=0x2aab118ab4c0, data_= optimized out>, len=18446744073709551592) at ../md32_common.h:325
> #2  0x2b302f5034ed in ssleay_rand_bytes (buf=0x46d25860 "", num=0) at
> md_rand.c:489
> #3  0x2b302f502df6 in ssleay_rand_pseudo_bytes (buf=0x2022a54d0
> , num=1933866968) at md_rand.c:533
>
> OpenSSL version: 1.0.0a
>
> OS: CentOS 5.4 x86_64
>
> --
> Regards,
> Sayan Chaliha
> Webyog Softworks Private Limited
> 2nd Floor, Novel Team Building
> #10, 100 Feet Ring Road
> BTM Layout 1st Stage
> Bangalore - 560068
>
> +91-9743357501
>



-- 
Sam Jantz
Software Engineer