mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-12-25 02:25:40 +00:00
1292c35c03
This commit introduces the configuration option MBEDTLS_MD_SINGLE_HASH which can be used to hardcode support for a single digest algorithm at compile-time, at the benefit of reduced code-size. To use, it needs to be defined to evaluate to a macro of the form MBEDTLS_MD_INFO_{DIGEST}, and macros MBEDTLS_MD_INFO_{DIGEST}_FIELD must be defined, giving rise to the various aspects (name, type, size, ...) of the chosen digest algorithm. MBEDTLS_MD_INFO_SHA256 provides an example, but other algorithms can be added if needed. At the moment, the effect of using MBEDTLS_MD_SINGLE_HASH is that the implementation of the MD API (e.g. mbedtls_md_update()) need no longer to through the abstraction of the mbedtls_md_info structures by calling their corresponding function pointers fields (akin to virtual functions in C++), but the directly call the corresponding core digest function (such as mbedtls_sha256_update()). Therefore, MBEDTLS_MD_SINGLE_HASH so far removes the second layer of indirection in the chain User calls MD API -> MD API calls underlying digest impl'n -> Core digest impl'n does the actual work, but the first indirection remains, as the MD API remains untouched and cannot yet be inlined. Studying to what extend inlining the shortened MD API implementations would lead to further code-savings is left for a later commit. |
||
---|---|---|
.. | ||
CMakeLists.txt | ||
dtls_client.c | ||
dtls_server.c | ||
mini_client.c | ||
query_config.c | ||
ssl_client1.c | ||
ssl_client2.c | ||
ssl_fork_server.c | ||
ssl_mail_client.c | ||
ssl_pthread_server.c | ||
ssl_server.c | ||
ssl_server2.c |