* 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();
+ //static double time=0;
+ //double t=0;
+ //t=TimeStart();
//256
//avant ecb
+ for(int i=0;i<nb_test;i++)
+ {
+
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();
- 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);
double t=0;
t=TimeStart();
*/
- for(int i=0;i<nb_test;i++)
- {
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);
*/
if(1 != EVP_EncryptFinal_ex(ctx, ciphertext + len, &len)) handleErrors();
ciphertext_len += len;
-
+ }
/* Clean up */
EVP_CIPHER_CTX_free(ctx);
*/
- double time=0;
+ double time_encrypt=0;
+ double time_decrypt=0;
double t=TimeStart();
ciphertext, ctr, i );
}
- time+=TimeStop(t);
+ time_encrypt+=TimeStop(t);
- printf("Time encrypt %f\n",time);
+// printf("Time encrypt %f\n",time);
+ printf("%f\t",(double)imsize*nb_test/time_encrypt);
if(lena) {
for(int i=0;i<oneD;i++) {
}
- time=0;
t=0;
t=TimeStart();
decryptedtext,ctr, i);
}
- time+=TimeStop(t);
+ time_decrypt+=TimeStop(t);
- printf("Time decrypt %f\n",time);
+ //printf("Time decrypt %f\n",time);
+ printf("%f\t",(double)imsize*nb_test/time_decrypt);
if(lena) {
for(int i=0;i<oneD;i++) {