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

Redundant BlockCopy() call at start of AES128_CBC_encrypt_buffer() #45

Closed
camieac opened this issue Jan 3, 2017 · 2 comments
Closed

Comments

@camieac
Copy link

camieac commented Jan 3, 2017

Summary

At the beginning of the CBC encrypt/decrypt functions the contents of the input buffer is copied to the output buffer, this is also done for ECB mode. The initial copy in ECB mode is necessary, but seems to be redundant in the CBC functions. The exact same copy is later made in the for loop iterating through the AES blocks.

A visual inspection of AES128_CBC_encrypt_buffer() and AES128_CBC_decrypt_buffer() should confirm the issue.

Testing

The tests pass with the redundant copy removed.

Fix

Remove redundant call to BlockCopy() in AES128_CBC_encrypt_buffer() and AES128_CBC_decrypt_buffer().

Existing Fixes

I had a hunt through the pull requests and found the following un-merged requests that address this issue:

Conclusion

This is a simple fix that can shave off a few redundant CPU cycles, unless the compiler is already optimising it out for you 😄

I am happy to prepare a pull request addressing this issue only, if there's interest.

@kokke
Copy link
Owner

kokke commented Jul 10, 2017

Bump. What's the status on this one now? I think some redundancy and other idiocy on my part was removed, thanks to PR #58

@kokke
Copy link
Owner

kokke commented Nov 10, 2017

As far as I can tell, this issue was fixed with PR #58

@kokke kokke closed this as completed Nov 10, 2017
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