Skip to content

Commit

Permalink
partically revert last change
Browse files Browse the repository at this point in the history
  • Loading branch information
HarukaMa committed Jul 16, 2019
1 parent 7636225 commit 5cc304a
Showing 1 changed file with 1 addition and 14 deletions.
15 changes: 1 addition & 14 deletions encrypt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -326,11 +326,6 @@ int cipher_aes128cfb_encrypt(const char *data,char *output,int &len,char * key)
if(first_time==0) key=0;
else first_time=0;
}

if(len>=16)
{
AES_ECB_encrypt_buffer(data,key,buf); //tmp solution, to fix a problem
}

AES_CFB_encrypt_buffer((unsigned char *)output,(unsigned char *)buf,len,(unsigned char *)key,(unsigned char *)zero_iv);
return 0;
Expand Down Expand Up @@ -379,15 +374,7 @@ int cipher_aes128cfb_decrypt(const char *data,char *output,int &len,char * key)
if(first_time==0) key=0;
else first_time=0;
}
char buf[buf_len];
memcpy(buf,data,len);//TODO inefficient code

if(len>=16)
{
AES_ECB_decrypt_buffer(data,key,buf);//tmp solution to fix a problem
}

AES_CFB_decrypt_buffer((unsigned char *)output,(unsigned char *)buf,len,(unsigned char *)key,(unsigned char *)zero_iv);
AES_CFB_decrypt_buffer((unsigned char *)output,(unsigned char *)data,len,(unsigned char *)key,(unsigned char *)zero_iv);
//if(de_padding(output,len,16)<0) return -1;
return 0;
}
Expand Down

0 comments on commit 5cc304a

Please sign in to comment.