On Wed, Jun 02, 2004, Thomas Schuerger wrote:

> > > Hi,
> > > 
> > > I have problems using the RSA_private_decrypt() function of the crypto
> > > library in parallel with *the same* (RSA *) structure. When using a
> > > single thread, decryption works flawlessly, when using two or more
> > > threads in parallel, decryption mostly fails with PKCS errors.
> > > 
> > > I thought the RSA structure would be accessed read-only so that this
> > > should be thread-safe.
> > > 
> > 
> > There are some montgomery parameters that are cached in the RSA structure when
> > it is first used. You need to set the appropriate locking callbacks to avoid a
> > race condition in a multithreaded environment.
> 
> Can I force this precalculation (caching) to take place after creating
> an RSA structure and before multiple threads use it (without doing an
> actual dummy-decryption)? If yes, would this suffice to avoid the race
> condition so that no locking is required?
> 
> 

The only real way is a dummy enccrypt and decrypt, I'm also not sure the
blinding code will work properly in a multithreaded environment without locking.

Additionally other aspects of the library (such as the error code) require the
use of locks in a multithreaded environment.

Steve.
--
Dr Stephen N. Henson. Email, S/MIME and PGP keys: see homepage
OpenSSL project core developer and freelance consultant.
Funding needed! Details on homepage.
Homepage: http://www.drh-consultancy.demon.co.uk
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    [EMAIL PROTECTED]
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to