-16 24853009.422268 12073029.699382 24312060.119877 22712164.686998
-64 29239597.581647 21770893.460994 28834420.467964 27452341.069102
-256 28640940.011478 24345378.101055 29777684.534513 28019041.037202
-1024 28372088.498681 26600138.538540 30514757.151944 30254598.193300
-4096 27672973.807444 26390460.160040 30854932.730167 29810211.761870
-16384 27188968.272242 26364380.906928 29872238.408986 29781664.429377
-65536 26784903.402114 25893041.626707 29480177.539200 29574716.040163
-262144 26575001.832701 24080881.729320 28423938.509768 27758084.837318
+16 4266494.418846 3081416.483593 5602293.240846 5453685.258750
+64 10797497.763435 8711324.600519 13063803.677160 12830336.315220
+256 18197558.778266 15645778.566316 19590792.689739 19743147.990634
+1024 22145668.759662 20683142.757309 24273342.272811 24364963.773051
+4096 23391254.474360 22771376.612303 25764950.303487 25868119.833668
+16384 23568308.010499 23088957.270996 26007722.617563 26242546.688995
+65536 23535344.288671 22558828.551031 26023002.713085 26156724.424639
+262144 23360671.888226 21859806.457488 24964575.772754 25029872.028797
-16 18108628.460942 7968801.288301 16880245.846543 15685451.701793
-64 21730879.436960 15744707.504760 21190747.888969 20964161.415561
-256 22942914.090862 19033481.473887 23130254.948512 23008809.907361
-1024 23447171.003305 21871361.530630 25182896.331411 25200482.341492
-4096 23530217.444970 22562944.638518 25651938.888494 25768193.779253
-16384 23515431.878772 22762755.837213 25758988.446117 25852516.057349
-65536 23516062.688510 22773816.544906 25778722.005436 25906567.785661
-262144 23352506.138671 22090784.060962 25643566.009893 25506546.662715
+16 3719175.371431 2666876.597505 4870392.460705 4705481.975792
+64 10011656.706117 8077062.133933 11838592.654523 11467872.840959
+256 17520838.436308 14297688.707592 19002369.744068 18828829.372910
+1024 21589008.873980 19894166.563513 23685133.884672 23666778.609453
+4096 23025294.475722 22155053.962862 25105363.224472 25130141.530436
+16384 23353759.159228 22672846.895401 25502056.915384 25578054.469604
+65536 23146658.501951 22451743.041700 25733501.605702 25864593.713096
+262144 23290039.900553 22401472.059140 25495580.916500 25474529.696408
int nb_test=1;
int ctr=0;
+double time_encrypt=0;
+double time_decrypt=0;
+
double TimeStart()
{
struct timeval tstart;
int ciphertext_len;
+
+
+
/* Create and initialise the context */
if(!(ctx = EVP_CIPHER_CTX_new())) handleErrors();
* 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 */
- //static double time=0;
- //double t=0;
- //t=TimeStart();
+
+ double t=TimeStart();
+
//256
//avant ecb
- for(int i=0;i<nb_test;i++)
+ for(int i=0;i<nb_test;i++)
{
-
- if(ctr) {
- if(1 != EVP_EncryptInit_ex(ctx, EVP_aes_128_ctr(), NULL, key, iv))
- handleErrors();
- }
- else
+
+ if(ctr) {
+ if(1 != EVP_EncryptInit_ex(ctx, EVP_aes_128_ctr(), NULL, key, iv))
+ handleErrors();
+ }
+ else
if(1 != EVP_EncryptInit_ex(ctx, EVP_aes_128_cbc(), NULL, key, iv))
handleErrors();
-
- //time+=TimeStop(t);
- //printf("Time init %f\n",time);
-
-
+
+ //time+=TimeStop(t);
+ //printf("Time init %f\n",time);
+
+
// int cipherBlockSize = EVP_CIPHER_CTX_block_size(ctx);
// printf("INFO(evp_encrypt): block size: %d\n", cipherBlockSize);
-
-
- /* Provide the message to be encrypted, and obtain the encrypted output.
- * EVP_EncryptUpdate can be called multiple times if necessary
- */
-
-/*
- static double time=0;
- double t=0;
- t=TimeStart();
-*/
-
- if(1 != EVP_EncryptUpdate(ctx, ciphertext, &len, plaintext, plaintext_len))
+
+
+ /* Provide the message to be encrypted, and obtain the encrypted output.
+ * EVP_EncryptUpdate can be called multiple times if necessary
+ */
+
+ if(1 != EVP_EncryptUpdate(ctx, ciphertext, &len, plaintext, plaintext_len))
handleErrors();
ciphertext_len = len;
-
-/* time+=TimeStop(t);
- // if(index==nb_test-1)
- printf("Time encrypt %f\n",time);
-
-*/
-
-
- /* Finalise the encryption. Further ciphertext bytes may be written at
- * this stage.
- */
- if(1 != EVP_EncryptFinal_ex(ctx, ciphertext + len, &len)) handleErrors();
- ciphertext_len += len;
+ /* Finalise the encryption. Further ciphertext bytes may be written at
+ * this stage.
+ */
+ if(1 != EVP_EncryptFinal_ex(ctx, ciphertext + len, &len)) handleErrors();
+ ciphertext_len += len;
}
+
+ time_encrypt+=TimeStop(t);
+
/* Clean up */
EVP_CIPHER_CTX_free(ctx);
//256
+ double t=TimeStart();
+
for(int i=0;i<nb_test;i++)
{
if(1 != EVP_DecryptFinal_ex(ctx, plaintext + len, &len)) handleErrors();
plaintext_len += len;
}
-
+
+
+ time_decrypt+=TimeStop(t);
/* Clean up */
EVP_CIPHER_CTX_free(ctx);
*/
- double time_encrypt=0;
- double time_decrypt=0;
- double t=TimeStart();
+
+
/* Encrypt the plaintext */
ciphertext, ctr, i );
}
- time_encrypt+=TimeStop(t);
+
// printf("Time encrypt %f\n",time);
printf("%f\t",(double)imsize*nb_test/time_encrypt);
}
- t=0;
- t=TimeStart();
-
//for(int i=0;i<nb_test;i++)
{
/* Decrypt the ciphertext */
decryptedtext,ctr, i);
}
- time_decrypt+=TimeStop(t);
-
//printf("Time decrypt %f\n",time);
printf("%f\t",(double)imsize*nb_test/time_decrypt);