/* Message to be encrypted */
-
+ int nb_test=1;
+ if(argc==2)
+ nb_test=atoi(argv[1]);
+ if(nb_test<=0 || nb_test>10000) {
+ printf("nb tests is not correct\n");
+ exit(0);
+ }
+ else
+ printf("nb tests = %d\n\n",nb_test);
int width;
int height;
uchar *data_R, *data_G, *data_B;
-// load_RGB_pixmap("lena.ppm", &width, &height, &data_R, &data_G, &data_B);
+ load_RGB_pixmap("lena.ppm", &width, &height, &data_R, &data_G, &data_B);
// load_RGB_pixmap("No_ecb_mode_picture.ppm", &width, &height, &data_R, &data_G, &data_B);
- load_RGB_pixmap("4096.ppm", &width, &height, &data_R, &data_G, &data_B);
+// load_RGB_pixmap("4096.ppm", &width, &height, &data_R, &data_G, &data_B);
int size=width*height*3;
int oneD=width*height;
int decryptedtext_len, ciphertext_len;
- /* Initialise the library */
- ERR_load_crypto_strings();
- OpenSSL_add_all_algorithms();
- OPENSSL_config(NULL);
-
+
int ss=0;
double time=0;
double t=TimeStart();
int i;
- for(i=0;i<100;i++)
+ for(i=0;i<nb_test;i++)
{
ciphertext_len = encrypt (plaintext, size, key, iv,
ciphertext);
- ss+=ciphertext[100];
}
-
+
time+=TimeStop(t);
- printf("Time encrypt %f ss %d\n",time,ss);
+ printf("Time encrypt %f \n",time);
for(int i=0;i<oneD;i++) {
t=0;
t=TimeStart();
- for(int i=0;i<100;i++)
+ for(int i=0;i<nb_test;i++)
{
/* Decrypt the ciphertext */
decryptedtext_len = decrypt(ciphertext, ciphertext_len, key, iv,