You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@apr.apache.org by Ben Laurie <be...@algroup.co.uk> on 2005/05/03 13:51:30 UTC

Re: Using OpenSSL's des_fcrypt for thread safe crypt()

Joe Orton wrote:
> On Mon, Apr 25, 2005 at 10:06:59PM +1000, Brian Havard wrote:
> 
>>I'd like to add to apr-util the ability to use des_fcrypt from the OpenSSL 
>>library as a possible thread-safe implementation of crypt() for systems that 
>>have no crypt_r().
>>
>>Does anyone have a problem with either the concept or implementation of this?
> 
> 
> With the implementation, at least, yes:
> - only pick up the dependency on -lcrypto on platforms which need this
> - keep the flag private to apr-util (i.e. use AC_CHECK_HEADERS and
> AC_DEFINE), it doesn't need to be exported via apu.h
> 
> Is this function really thread-safe in OpenSSL even without the locking
> callbacks registered?

Probably not.

-- 
http://www.apache-ssl.org/ben.html       http://www.thebunker.net/

"There is no limit to what a man can do or how far he can go if he
doesn't mind who gets the credit." - Robert Woodruff

Re: Using OpenSSL's des_fcrypt for thread safe crypt()

Posted by Ben Laurie <be...@algroup.co.uk>.
Brian Havard wrote:
>>>Is this function really thread-safe in OpenSSL even without the locking
>>>callbacks registered?
>>
>>Probably not.
> 
> Really? I can't see any use of locks in the fcrypt code or anything that
> looks thread-unsafe. The docs also state specifically that it IS thread
> safe.
> "DES_fcrypt() ... This function is thread safe, unlike the normal crypt".
> (from http://www.openssl.org/docs/crypto/des.html)

Ah. I was, I admit, thinking generally, i.e. that most things are not 
thread-safe without the locking call-backs. I don't disbelieve that this 
code is an exception. Apologies for confusion.

-- 
http://www.apache-ssl.org/ben.html       http://www.thebunker.net/

"There is no limit to what a man can do or how far he can go if he
doesn't mind who gets the credit." - Robert Woodruff

Re: Using OpenSSL's des_fcrypt for thread safe crypt()

Posted by Brian Havard <br...@kheldar.apana.org.au>.
On Tue, 03 May 2005 12:51:30 +0100, Ben Laurie wrote:

>Joe Orton wrote:
>> On Mon, Apr 25, 2005 at 10:06:59PM +1000, Brian Havard wrote:
>> 
>>>I'd like to add to apr-util the ability to use des_fcrypt from the OpenSSL 
>>>library as a possible thread-safe implementation of crypt() for systems that 
>>>have no crypt_r().
>>>
>>>Does anyone have a problem with either the concept or implementation of this?
>> 
>> 
>> With the implementation, at least, yes:
>> - only pick up the dependency on -lcrypto on platforms which need this

Ok, fair enough. I'll just have to figure out how to do that.



>> - keep the flag private to apr-util (i.e. use AC_CHECK_HEADERS and
>> AC_DEFINE), it doesn't need to be exported via apu.h

I think I can handle that.



>> Is this function really thread-safe in OpenSSL even without the locking
>> callbacks registered?
>
>Probably not.

Really? I can't see any use of locks in the fcrypt code or anything that
looks thread-unsafe. The docs also state specifically that it IS thread
safe.
"DES_fcrypt() ... This function is thread safe, unlike the normal crypt".
(from http://www.openssl.org/docs/crypto/des.html)

-- 
 ______________________________________________________________________________
 |  Brian Havard                 |  "He is not the messiah!                   |
 |  brianh@kheldar.apana.org.au  |  He's a very naughty boy!" - Life of Brian |
 ------------------------------------------------------------------------------