mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-11-22 22:35:43 +01:00
84867cffdd
In the generic message digest abstraction, instead of storing method pointers in the per-algorithm data structure and using wrapper functions as those methods, call the per-algorithm function directly. This saves some code size (2336B -> 2043B for md with all algorithms enabled on M0+ with gcc -Os). This should also make it easier to optimize the case when a single algorithm is supported. In addition, this is a very slight security improvement since it removes one opportunity for a buffer overflow to directly turn into letting the attacker overwrite a pointer to a function pointer. This commit does not modify the documented API. However, it removes the possibility for users to define their own hash implementations and use them by building their own md_info. Changing mbedtls_md_context to contain a md type identifier rather than a pointer to an info structure would save a few more bytes and a few more runtime memory accesses, but would be a major API break since a lot of code uses `const mbedtls_md_info *` to keep track of which hash is in use. |
||
---|---|---|
.. | ||
VS2010 |