Are   CRYPTO_set_locking_callback()   and   CRYPTO_set_id_callback()  
required  in a multi-threaded application that only encrypts and
decrypts with symmetric ciphers...
...and performs no other SSL functions...???

I am using openssl 0.9.7g.
The platform is AIX  (IBM's UNIX).

Here are the specifics:

A given thread, based upon info passed to it, "may" need to encrypt a
file.
Here's what it is doing (with error checking and other processing
removed for clarity):

    EVP_CIPHER_CTX_init(&ctx);

    rc = EVP_EncryptInit_ex(&ctx,
                                EVP_aes_128_cbc(),
                                NULL,
                                (const unsigned char *)key,
                                (const unsigned char *)iov);

    rc = EVP_EncryptUpdate(&ctx, encryptd_buf, &chars_in_enc_buf,
curr_object_ptr, max_bytes);

    rc = EVP_EncryptUpdate(&ctx, encryptd_buf, &chars_in_enc_buf,
curr_object_ptr, max_bytes);

    EVP_CIPHER_CTX_cleanup(&ctx);

Another thread, based upon info passed to it, "may" need to decrypt a
file.
Here's what it is doing (with error checking and other processing
removed for clarity):

    EVP_CIPHER_CTX_init(&ctx);
    rc = EVP_DecryptInit_ex(&ctx,
                                EVP_aes_128_cbc(),
                                NULL,
                                (const unsigned char*)key,
                                (const unsigned char *)iov);

   rc = EVP_DecryptUpdate(&ctx, decrypted_buf, &chars_in_decr_buf,
curr_object_ptr, max_bytes);

   rc = EVP_DecryptFinal_ex(&ctx, decrypted_buf, &chars_in_decr_buf);

   EVP_CIPHER_CTX_cleanup(&ctx);


Thanks,
-tony

Reply via email to