summaryrefslogtreecommitdiffstats
path: root/core/variant_call.cpp
diff options
context:
space:
mode:
authorFabio Alessandrelli <fabio.alessandrelli@gmail.com>2019-07-02 03:06:52 +0200
committerFabio Alessandrelli <fabio.alessandrelli@gmail.com>2019-07-02 12:36:27 +0200
commit564d93ff10b19dd15df6ea049bd7c9a9c99680c6 (patch)
treeee6523844280ff5874e8d7aff7c95f498ae769e0 /core/variant_call.cpp
parent0268a4869ded42079d3f4c255406711c726e3df4 (diff)
downloadredot-engine-564d93ff10b19dd15df6ea049bd7c9a9c99680c6.tar.gz
CryptoCore class to access to base crypto utils.
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.
Diffstat (limited to 'core/variant_call.cpp')
-rw-r--r--core/variant_call.cpp7
1 files changed, 2 insertions, 5 deletions
diff --git a/core/variant_call.cpp b/core/variant_call.cpp
index dc28f1ca02..811008e7c8 100644
--- a/core/variant_call.cpp
+++ b/core/variant_call.cpp
@@ -33,10 +33,10 @@
#include "core/color_names.inc"
#include "core/core_string_names.h"
#include "core/io/compression.h"
+#include "core/math/crypto_core.h"
#include "core/object.h"
#include "core/os/os.h"
#include "core/script_language.h"
-#include "thirdparty/misc/sha256.h"
typedef void (*VariantFunc)(Variant &r_ret, Variant &p_self, const Variant **p_args);
typedef void (*VariantConstructFunc)(Variant &r_ret, const Variant **p_args);
@@ -598,10 +598,7 @@ struct _VariantCall {
PoolByteArray::Read r = ba->read();
String s;
unsigned char hash[32];
- sha256_context sha256;
- sha256_init(&sha256);
- sha256_hash(&sha256, (unsigned char *)r.ptr(), ba->size());
- sha256_done(&sha256, hash);
+ CryptoCore::sha256((unsigned char *)r.ptr(), ba->size(), hash);
s = String::hex_encode_buffer(hash, 32);
r_ret = s;
}