mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-11-22 23:15:43 +01:00
c4e4210aab
Recall that in the default configuration, Mbed TLS provides access digest implementations through two layers of indirection: 1) Call of MD API (e.g. mbedtls_md_update()) 2) Call of function pointer from MD info structure 3) Actual digest implementation (e.g. mbedtls_sha256_update()). Ideally, if only a single digest is enabled - say SHA-256 - then calling mbedtls_md_update() should _directly_ jump to mbedtls_sha256_update(), with both layers of indirection removed. So far, however, setting MBEDTLS_MD_SINGLE_HASH will only remove the second - function pointer - layer of indirection, while keeping the non-inlined stub implementations of e.g. mbedtls_md_update() around. This commit is a step towards allowing to define implementations of the MD API as `static inline` in case we know that they are so small that they should be defined in md.h and not in md.c. In a nutshell, the approach is as follows: For an MD API function mbedtls_md_xxx() that should be inlin-able, introduce its implementation as a `static inline` wrapper `mbedtls_md_xxx_internal()` in md.h, and then define mbedtls_md_xxx() either in md.h or in md.c, by just calling mbedtls_md_xxx_internal(). Moving the implementations of those MD API functions that should be inlinable to md.h requires the presence of both the MD info struct and all specific digest wrapper functions in md.h, and this is what this commit ensures, by moving them from md.c into a new internal header file md_internal.h. Implementing the aforementioned wrappers for those MD API that should be inlinable is left for subsequent commits. |
||
---|---|---|
.. | ||
mbedtls | ||
tinycrypt | ||
.gitignore | ||
CMakeLists.txt |