I attempt to estimate the coding requirements and memory size required for an embedded development of AES 256. It seems to be well below 25K lines of code and well below 4MB requirement for memory. I will appreciate if any of you has a better estimate, particularly if based on experience. Thanks!
3 Answers
Do you know how to prevent cache-based timing attacks? How to manage your keys? How to build a cipher from AES-256? Why do you want AES-256 instead of AES-128 when they offer the same security (they both use blocks of 128 bits)? How will you implement the authentication? Why do you want a block cipher instead of a stream cipher?
If you cannot answer those questions strait away, do not try to implement your cipher: you are bound to make mistakes. Just use a trusted implementation. It will have fewer bugs and not having to reinvent the wheel will save you time and money.
- 10,046
- 3
- 28
- 42
https://github.com/kokke/tiny-AES128-C suggests it uses 200 bytes memory and 2.5K bytes code.
- 1,939
- 14
- 9
As A. Hersean said, you shouldn't.
In general, you should not try to implement your own version of cryptography, there is too much things to think that could break the chain of security (one link breaks and your complete chain is out).
Anyway, if you want to implement it FOR EDUCATIONAL PURPOSE only, then you don't have to worry about memory optimisation :)
Always use proven algorithms and implementations when it's about cryptography ;)
Have a look at Why shouldn't we roll our own? for a good explanation about this
- 79
- 3