Mukesh Yadav
2014-09-18 08:40:01 UTC
Hi,
I have written application code for encryption and decryption using OpenSSL
library.
I am testing on machine where AES-NI support is present. I am not sure how
can I confirm
whether execution is using AES-NI instruction set.
When run command line openssl speed -evp aes128, I was seeing
aesni_cbc_cipher() getting hit.
But with my sample code, I am not seeing aesni_cbc_cipher() getting
executed..
Openssl ver: OpenSSL-1.0.1h
Sample high level code is like
OpenSSL_add_all_algorithms();
ERR_load_crypto_strings();
OPENSSL_config(NULL);
EVP_CIPHER_CTX_init(&ctx);
if(1 != EVP_DecryptInit_ex(&ctx, EVP_aes_128_cbc(), NULL, key, iv))
handleErrors();
EVP_CIPHER_CTX_set_padding(&ctx, 0);
if(1 != EVP_DecryptUpdate(&ctx, plaintext, &len, ciphertext,
ciphertext_len))
handleErrors();
plaintext_len = len;
if(1 != EVP_DecryptFinal_ex(&ctx, plaintext + len, &len)) handleErrors();
plaintext_len += len;
EVP_CIPHER_CTX_cleanup(&ctx);
Any pointers will be appreciated..
Thanks
Mukesh
I have written application code for encryption and decryption using OpenSSL
library.
I am testing on machine where AES-NI support is present. I am not sure how
can I confirm
whether execution is using AES-NI instruction set.
When run command line openssl speed -evp aes128, I was seeing
aesni_cbc_cipher() getting hit.
But with my sample code, I am not seeing aesni_cbc_cipher() getting
executed..
Openssl ver: OpenSSL-1.0.1h
Sample high level code is like
OpenSSL_add_all_algorithms();
ERR_load_crypto_strings();
OPENSSL_config(NULL);
EVP_CIPHER_CTX_init(&ctx);
if(1 != EVP_DecryptInit_ex(&ctx, EVP_aes_128_cbc(), NULL, key, iv))
handleErrors();
EVP_CIPHER_CTX_set_padding(&ctx, 0);
if(1 != EVP_DecryptUpdate(&ctx, plaintext, &len, ciphertext,
ciphertext_len))
handleErrors();
plaintext_len = len;
if(1 != EVP_DecryptFinal_ex(&ctx, plaintext + len, &len)) handleErrors();
plaintext_len += len;
EVP_CIPHER_CTX_cleanup(&ctx);
Any pointers will be appreciated..
Thanks
Mukesh