stcarrez / ada-util

Ada Utility Library - Composing streams, processes, logs, serialization, encoders and more
Apache License 2.0
69 stars 14 forks source link

Fix OFB and CTR modes of AES encoding #51

Closed adezxc closed 6 months ago

adezxc commented 6 months ago

Fixes #50.

This PR implements a simple fix to CTR and OFB mode encryption so that there is no exception when trying to encrypt files bigger than the encoder's buffer size. Tested only locally, would be happy to implement tests if given any guidelines.

stcarrez commented 6 months ago

Thanks for the fix. Indeed, it was correct for CBC that I'm using in Ada Keystore but not for CFB, OFB and CTR. The decoder does not have the issue which occurs only when the size is not a multiple of 16.