Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AES Encryption/Decryption Swapped #5

Open
onizenso opened this issue Jul 25, 2015 · 2 comments
Open

AES Encryption/Decryption Swapped #5

onizenso opened this issue Jul 25, 2015 · 2 comments

Comments

@onizenso
Copy link

I was reading source in for the AES encryption and decryption function, and it looks like you have gotten the purpose of the functions mixed up (unless I am misunderstanding something).

In the chb_aes_encryption function, you have plaintext as write data and ciphertext as read data. That's just semantically incorrect. Encryption functions read plaintext and write ciphertext. The reverse is also true in your chb_aes_decryption function.

With AES in ECB mode, the encryption machine is inversely reversible. But using the ciphertext buffer for writing in an encryption function can't be a good idea. At the very least, its very confusing.

@freaklabs
Copy link
Owner

Thanks for the feedback and nice catch. I don't think it's been a heavily used function so there hasn't been much peer review of it. I'll re-examine the encryption part of the code since I will be using it in a project in the future.

@onizenso
Copy link
Author

Hey no problem, it just hit me weird.

I really enjoy using your library in my current project. Hopefully, when I get more familiar I can add some significant features/fixes/attacks.

This weird 'bug' is the only thing I've wrong with the library. The comments and coding style have really helped simplify the more complex interactions with the Freakduino.

edit: I'm looking forward to what you find in the AES en/decryption functions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants