最新进展:这个库已经重命名为tiny-AES-c,并增加了192和256加密,看andreas-wehrmann和作者进行的对话,应该是修复了这个bug,我没有进行测试。
在对AES加密解密功能进行压力测试时, 单片机进入硬件错误, 怀疑使用的库tinyAES128有内存溢出, 经过Google, 发现已经有人遇到同样的问题。暂时放弃tinyAES128,改用mbedTLS,没有发现问题。
The library tiny-AES128-C contains a buffer overflow in its AES128_CBC_encrypt_buffer() function, where 15 bytes beyond the end of the input buffer can be overwritten.
The library tiny-AES128-C, available from https://github.com/kokke/tiny-AES128-C , contains a buffer overflow in its AES128_CBC_encrypt_buffer() function, where 15 bytes beyond the end of the input buffer can be overwritten. For instance, if the function is invoked with an input buffer of length 33, the bytes at offsets 33…47 with respect to the beginning of the input buffer will be overwritten. An attacker controlling either the key or the plaintext has some latitude to choose the values of some of the bytes thus overwritten.
A fix for the buffer overflow was first proposed by GitHub user andreas-wehrmann in the form of a pull request: https://github.com/kokke/tiny-AES128-C/pull/18
Vincent Benayoun and I fixed a residual issue (a longish writeup can be found at http://trust-in-soft.com/the-sociology-of-open-source-security-fixes-continued/ )
The principal author for the library, who appeared to have abandoned it at the time, has since fixed compiler warnings in tiny-AES128-C, but has not at the time of this writing integrated any fix for the buffer overflow: https://github.com/kokke/tiny-AES128-C/commit/7c959460a188611c26aa45c54c6e8b96b7ac163a