* EVP_EncryptUpdate can be called multiple times if necessary
*/
-
+/*
static double time=0;
double t=0;
t=TimeStart();
-
-// for(int i=0;i<nb_test;i++)
+*/
+ for(int i=0;i<nb_test;i++)
{
-
+ ciphertext_len = 0;
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);
+/* time+=TimeStop(t);
+ // if(index==nb_test-1)
+ printf("Time encrypt %f\n",time);
-
+*/
/* Finalise the encryption. Further ciphertext bytes may be written at
* EVP_DecryptUpdate can be called multiple times if necessary
*/
- static double time=0;
+/* static double time=0;
double t=0;
t=TimeStart();
-
-// for(int i=0;i<nb_test;i++)
+*/
+ for(int i=0;i<nb_test;i++)
{
+ plaintext_len = 0;
if(1 != EVP_DecryptUpdate(ctx, plaintext, &len, ciphertext, ciphertext_len))
handleErrors();
plaintext_len = len;
}
-
- time+=TimeStop(t);
- if(index==nb_test-1)
+/* time+=TimeStop(t);
+// if(index==nb_test-1)
printf("Time decrypt %f\n",time);
+*/
+
/* Finalise the decryption. Further plaintext bytes may be written at
* this stage.
if(1 != EVP_DecryptFinal_ex(ctx, plaintext + len, &len)) handleErrors();
plaintext_len += len;
+
+
/* Clean up */
EVP_CIPHER_CTX_free(ctx);
int i;
- for(i=0;i<nb_test;i++)
+// for(i=0;i<nb_test;i++)
{
ciphertext_len = encrypt (plaintext, imsize, key, iv,
ciphertext, ctr, i );
t=0;
t=TimeStart();
- for(int i=0;i<nb_test;i++)
+ //for(int i=0;i<nb_test;i++)
{
/* Decrypt the ciphertext */
decryptedtext_len = decrypt(ciphertext, ciphertext_len, key, iv,
equal=0;
}
}
- printf("RESULT CORRECT: %d\n",equal);
+// printf("RESULT CORRECT: %d\n",equal);
}