* In this example we are using 256 bit AES (i.e. a 256 bit key). The
* IV size for *most* modes is the same as the block size. For AES this
* is 128 bits */
* In this example we are using 256 bit AES (i.e. a 256 bit key). The
* IV size for *most* modes is the same as the block size. For AES this
* is 128 bits */
if(ctr) {
if(1 != EVP_EncryptInit_ex(ctx, EVP_aes_128_ctr(), NULL, key, iv))
handleErrors();
if(ctr) {
if(1 != EVP_EncryptInit_ex(ctx, EVP_aes_128_ctr(), NULL, key, iv))
handleErrors();
if(1 != EVP_EncryptInit_ex(ctx, EVP_aes_128_cbc(), NULL, key, iv))
handleErrors();
if(1 != EVP_EncryptInit_ex(ctx, EVP_aes_128_cbc(), NULL, key, iv))
handleErrors();
// int cipherBlockSize = EVP_CIPHER_CTX_block_size(ctx);
// printf("INFO(evp_encrypt): block size: %d\n", cipherBlockSize);
// int cipherBlockSize = EVP_CIPHER_CTX_block_size(ctx);
// printf("INFO(evp_encrypt): block size: %d\n", cipherBlockSize);
-
- if(1 != EVP_EncryptUpdate(ctx, ciphertext, &len, plaintext, plaintext_len))
+ if(1 != EVP_EncryptUpdate(ctx, ciphertext, &len, plaintext, plaintext_len))
if(1 != EVP_DecryptUpdate(ctx, plaintext, &len, ciphertext, ciphertext_len))
handleErrors();
plaintext_len = len;
}
if(1 != EVP_DecryptUpdate(ctx, plaintext, &len, ciphertext, ciphertext_len))
handleErrors();
plaintext_len = len;
}
// load_RGB_pixmap("No_ecb_mode_picture.ppm", &width, &height, &data_R, &data_G, &data_B);
}
else {
// load_RGB_pixmap("No_ecb_mode_picture.ppm", &width, &height, &data_R, &data_G, &data_B);
}
else {
{
ciphertext_len = encrypt (plaintext, imsize, key, iv,
ciphertext, ctr, i );
}
{
ciphertext_len = encrypt (plaintext, imsize, key, iv,
ciphertext, ctr, i );
}
- printf("Time encrypt %f\n",time);
+// printf("Time encrypt %f\n",time);
+ printf("%f\t",(double)imsize*nb_test/time_encrypt);
{
/* Decrypt the ciphertext */
decryptedtext_len = decrypt(ciphertext, ciphertext_len, key, iv,
decryptedtext,ctr, i);
}
{
/* Decrypt the ciphertext */
decryptedtext_len = decrypt(ciphertext, ciphertext_len, key, iv,
decryptedtext,ctr, i);
}
- printf("Time decrypt %f\n",time);
+ //printf("Time decrypt %f\n",time);
+ printf("%f\t",(double)imsize*nb_test/time_decrypt);