Is openssl's BF_cfb64_encrypt() thread safe?
A sample code to use it to encrypt / decrypt a blob of data would be much appreciated.
Is openssl's BF_cfb64_encrypt() thread safe?
A sample code to use it to encrypt / decrypt a blob of data would be much appreciated.
According to the FAQ, the OpenSSL routines are thread safe. I looked at the source of that function, and it does indeed appear to be thread safe. Of course, that assumes you are not passing the same input/output buffers to the function on different threads.
For an example of a call to it, you should be able to look in the OpenSSL source. There is a file named bftest.c located in openssl/crypto/bf/ that has test calls to the function.
Edit After thinking about this a bit more, it is probably still wise to use the CRYPTO_set_locking_callback functionality for multi-threaded locking. The Blowfish algorithm asked about in the original question does not currently (in the version of OpenSSL I am using) use those locks, but that does not guarantee it will not in the future for some reason. Plus it saves future pain if you end up using functionality (such as RAND_bytes) that does need those locks.