turiya / keyczar

Automatically exported from code.google.com/p/keyczar
0 stars 0 forks source link

keyczar-cpp multi-thread safe problem #114

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
CryptoFactory::SHA1 return a static instance to calculate hash. In the 
multi-thread, will get the wrong result.

My modification is attached.

Original issue reported on code.google.com by jatspi...@gmail.com on 14 Jan 2013 at 4:35

Attachments:

GoogleCodeExporter commented 9 years ago

Original comment by jtu...@gmail.com on 2 Mar 2013 at 9:04

GoogleCodeExporter commented 9 years ago
I agree that static is not the way to go for these SHA functions. 

This change may have performance implications as there is now an initialization 
of the hash function in openssl every time it is called. I don't know how long 
EVP_MD_CTX_create() takes to run but that looks like it would be the only 
bottleneck.

There is also a Rand() function that performs similarly to the message digests 
that may need to be changed as well.

Here is a commit on a branch so it is easier for people to comment on. 
https://code.google.com/p/keyczar/source/detail?r=a04c9aeac57b844da2a03ef59809e7
0dba0c377e&name=cpp_thread_safe_md

Original comment by dlundb...@google.com on 20 Aug 2013 at 7:21

GoogleCodeExporter commented 9 years ago

Original comment by dlundb...@google.com on 27 Aug 2013 at 7:23

GoogleCodeExporter commented 9 years ago

Original comment by dlundb...@google.com on 9 Sep 2013 at 5:49