}
+void printBytes(unsigned char *buf, size_t len) {
+ for(int i=0; i<len; i++) {
+ printf("%02x ", buf[i]);
+ }
+ printf("\n");
+}
+
+
void handleErrors(void)
{
ERR_print_errors_fp(stderr);
if(1 != CMAC_Final(ctx, mact, &mactlen)) handleErrors();
ciphertext_len += len;
+ printBytes(mact, mactlen);
+
/* Clean up */
CMAC_CTX_free(ctx);
int size_buf=1;
int lena=0;
-
+ int change=0;
for(int i=1; i<argc; i++){
if(strncmp(argv[i],"nb",2)==0) nb_test = atoi(&(argv[i][2])); //nb of test
if(strncmp(argv[i],"ctr",3)==0) ctr = atoi(&(argv[i][3])); //CTR ? 1 otherwise CBC like
if(strncmp(argv[i],"sizebuf",7)==0) size_buf = atoi(&(argv[i][7])); //SIZE of the buffer
if(strncmp(argv[i],"lena",4)==0) lena = atoi(&(argv[i][4])); //Use Lena or buffer
+ if(strncmp(argv[i],"c",1)==0) change = atoi(&(argv[i][1])); //Use Lena or buffer
}
/* printf("nb times %d\n",nb_test);
}
}
-
+ if(change==1) {
+
+ plaintext[4]++;
+ }
+ if(change==2) {
+
+ plaintext[9]++;
+ }
+
uchar *ciphertext = malloc(imsize+1000); //add that for cbc
time_encrypt+=TimeStop(t);
// printf("Time encrypt %f\n",time);
- printf("%f\t",(double)imsize*nb_test/time_encrypt);
+ printf("%e\t",(double)imsize*nb_test/time_encrypt);
+ /*
if(lena) {
for(int i=0;i<oneD;i++) {
data_R[i]=ciphertext[i];
}
store_RGB_pixmap("lena2.ppm", data_R, data_G, data_B, width, height);
}
-
+ */
/*
t=0;
t=TimeStart();