for(int i=0;i<nb_test;i++)
{
-
- if(1 != EVP_EncryptUpdate(ctx, ciphertext, &len, plaintext, plaintext_len))
+ if(1 != EVP_EncryptUpdate(ctx, ciphertext, &len, plaintext, plaintext_len))
handleErrors();
ciphertext_len = len;
*/
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;
// load_RGB_pixmap("No_ecb_mode_picture.ppm", &width, &height, &data_R, &data_G, &data_B);
}
else {
- width=height=size_buf;
+ width=size_buf;
+ height=size_buf;
imsize=width*height;
buffer=malloc(imsize*sizeof(uchar));
for(int i=0;i<imsize;i++) {
int oneD=width*height;
- uchar *plaintext = malloc(imsize);
+ uchar *plaintext = malloc(imsize+1000); //add that for cbc
if(lena) {
for(int i=0;i<oneD;i++) {
plaintext[i]=data_R[i];
- uchar *ciphertext = malloc(imsize);
+ uchar *ciphertext = malloc(imsize+1000); //add that for cbc
/* Buffer for the decrypted text */
- uchar *decryptedtext = malloc(imsize);
+ uchar *decryptedtext = malloc(imsize+1000); //add that for cbc
int decryptedtext_len, ciphertext_len;
equal=0;
}
}
- printf("RESULT CORRECT: %d\n",equal);
+// printf("RESULT CORRECT: %d\n",equal);
}