Godot core needs MD5/SHA256/AES/Base64 which used to be provided by separate libraries. Since we bundle mbedtls in most cases, and we can easily only include the needed sources if we so desire, let's use it. To simplify library changes in the future, and better isolate header dependencies all functions have been wrapped around inside a class in `core/math/crypto_base.h`. If the mbedtls module is disabled, we only bundle the needed source files independently of the `builtin_mbedtls` option. If the module is enabled, the `builtin_mbedtls` option works as usual. Also remove some unused headers from StreamPeerMbedTLS which were causing build issues.
18 lines
373 B
C
18 lines
373 B
C
#if !defined(MBEDTLS_CONFIG_FILE)
|
|
#include "mbedtls/config.h"
|
|
#else
|
|
#include MBEDTLS_CONFIG_FILE
|
|
#endif
|
|
|
|
#include <stdio.h>
|
|
#include <string.h>
|
|
#include <stddef.h>
|
|
|
|
#ifdef MBEDTLS_PLATFORM_ZEROIZE_ALT
|
|
static void *(*const volatile memset_func)(void *, int, size_t) = memset;
|
|
|
|
void mbedtls_platform_zeroize(void *buf, size_t len) {
|
|
memset_func( buf, 0, len );
|
|
}
|
|
#endif
|
|
|