From c19871af6d6ae7faef0d4052b3a27e59814abcf1 Mon Sep 17 00:00:00 2001 From: Fabio Alessandrelli Date: Thu, 11 Jul 2019 15:21:47 +0200 Subject: [PATCH] Move CryptoCore to it's own folder. Crypto classes will be placed in core/crypto. --- core/SCsub | 1 + core/bind/core_bind.cpp | 2 +- core/{math => crypto}/crypto_core.cpp | 0 core/{math => crypto}/crypto_core.h | 0 core/io/file_access_encrypted.cpp | 2 +- core/math/SCsub | 33 +------------------- core/os/file_access.cpp | 2 +- core/ustring.cpp | 2 +- core/variant_call.cpp | 2 +- editor/editor_export.cpp | 2 +- editor/import/editor_scene_importer_gltf.cpp | 2 +- modules/websocket/wsl_peer.cpp | 2 +- platform/uwp/export/export.cpp | 2 +- 13 files changed, 11 insertions(+), 41 deletions(-) rename core/{math => crypto}/crypto_core.cpp (100%) rename core/{math => crypto}/crypto_core.h (100%) diff --git a/core/SCsub b/core/SCsub index 85e5f1b089f..ed9a0a231db 100644 --- a/core/SCsub +++ b/core/SCsub @@ -159,6 +159,7 @@ env.CommandNoCache('#core/license.gen.h', ["../COPYRIGHT.txt", "../LICENSE.txt"] # Chain load SCsubs SConscript('os/SCsub') SConscript('math/SCsub') +SConscript('crypto/SCsub') SConscript('io/SCsub') SConscript('bind/SCsub') diff --git a/core/bind/core_bind.cpp b/core/bind/core_bind.cpp index 56369a3cc62..8e0d1564381 100644 --- a/core/bind/core_bind.cpp +++ b/core/bind/core_bind.cpp @@ -30,11 +30,11 @@ #include "core_bind.h" +#include "core/crypto/crypto_core.h" #include "core/io/file_access_compressed.h" #include "core/io/file_access_encrypted.h" #include "core/io/json.h" #include "core/io/marshalls.h" -#include "core/math/crypto_core.h" #include "core/math/geometry.h" #include "core/os/keyboard.h" #include "core/os/os.h" diff --git a/core/math/crypto_core.cpp b/core/crypto/crypto_core.cpp similarity index 100% rename from core/math/crypto_core.cpp rename to core/crypto/crypto_core.cpp diff --git a/core/math/crypto_core.h b/core/crypto/crypto_core.h similarity index 100% rename from core/math/crypto_core.h rename to core/crypto/crypto_core.h diff --git a/core/io/file_access_encrypted.cpp b/core/io/file_access_encrypted.cpp index 1452c61d1ad..77decc107de 100644 --- a/core/io/file_access_encrypted.cpp +++ b/core/io/file_access_encrypted.cpp @@ -30,7 +30,7 @@ #include "file_access_encrypted.h" -#include "core/math/crypto_core.h" +#include "core/crypto/crypto_core.h" #include "core/os/copymem.h" #include "core/print_string.h" #include "core/variant.h" diff --git a/core/math/SCsub b/core/math/SCsub index 0995298a4b1..be438fcfbea 100644 --- a/core/math/SCsub +++ b/core/math/SCsub @@ -2,37 +2,6 @@ Import('env') -env_math = env.Clone() # Maybe make one specific for crypto? - -is_builtin = env["builtin_mbedtls"] -has_module = env["module_mbedtls_enabled"] - -if is_builtin or not has_module: - # Use our headers for builtin or if the module is not going to be compiled. - # We decided not to depend on system mbedtls just for these few files that can - # be easily extracted. - env_math.Prepend(CPPPATH=["#thirdparty/mbedtls/include"]) - -# MbedTLS core functions (for CryptoCore). -# If the mbedtls module is compiled we don't need to add the .c files with our -# custom config since they will be built by the module itself. -# Only if the module is not enabled, we must compile here the required sources -# to make a "light" build with only the necessary mbedtls files. -if not has_module: - env_thirdparty = env_math.Clone() - env_thirdparty.disable_warnings() - # Custom config file - env_thirdparty.Append(CPPDEFINES=[('MBEDTLS_CONFIG_FILE', '\\"thirdparty/mbedtls/include/godot_core_mbedtls_config.h\\"')]) - thirdparty_mbedtls_dir = "#thirdparty/mbedtls/library/" - thirdparty_mbedtls_sources = [ - "aes.c", - "base64.c", - "md5.c", - "sha1.c", - "sha256.c", - "godot_core_mbedtls_platform.c" - ] - thirdparty_mbedtls_sources = [thirdparty_mbedtls_dir + file for file in thirdparty_mbedtls_sources] - env_thirdparty.add_source_files(env.core_sources, thirdparty_mbedtls_sources) +env_math = env.Clone() env_math.add_source_files(env.core_sources, "*.cpp") diff --git a/core/os/file_access.cpp b/core/os/file_access.cpp index ba94e87da66..9a8315a3bb5 100644 --- a/core/os/file_access.cpp +++ b/core/os/file_access.cpp @@ -30,9 +30,9 @@ #include "file_access.h" +#include "core/crypto/crypto_core.h" #include "core/io/file_access_pack.h" #include "core/io/marshalls.h" -#include "core/math/crypto_core.h" #include "core/os/os.h" #include "core/project_settings.h" diff --git a/core/ustring.cpp b/core/ustring.cpp index ed401c37633..4e9ab7be6b9 100644 --- a/core/ustring.cpp +++ b/core/ustring.cpp @@ -31,7 +31,7 @@ #include "ustring.h" #include "core/color.h" -#include "core/math/crypto_core.h" +#include "core/crypto/crypto_core.h" #include "core/math/math_funcs.h" #include "core/os/memory.h" #include "core/print_string.h" diff --git a/core/variant_call.cpp b/core/variant_call.cpp index 9ea2fed5ae5..a3803d8701c 100644 --- a/core/variant_call.cpp +++ b/core/variant_call.cpp @@ -32,8 +32,8 @@ #include "core/color_names.inc" #include "core/core_string_names.h" +#include "core/crypto/crypto_core.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" diff --git a/editor/editor_export.cpp b/editor/editor_export.cpp index cb1754bb107..e2a750cf087 100644 --- a/editor/editor_export.cpp +++ b/editor/editor_export.cpp @@ -30,11 +30,11 @@ #include "editor_export.h" +#include "core/crypto/crypto_core.h" #include "core/io/config_file.h" #include "core/io/resource_loader.h" #include "core/io/resource_saver.h" #include "core/io/zip_io.h" -#include "core/math/crypto_core.h" #include "core/os/dir_access.h" #include "core/os/file_access.h" #include "core/project_settings.h" diff --git a/editor/import/editor_scene_importer_gltf.cpp b/editor/import/editor_scene_importer_gltf.cpp index 84dd1aa8667..9ea7c86e0c8 100644 --- a/editor/import/editor_scene_importer_gltf.cpp +++ b/editor/import/editor_scene_importer_gltf.cpp @@ -29,8 +29,8 @@ /*************************************************************************/ #include "editor_scene_importer_gltf.h" +#include "core/crypto/crypto_core.h" #include "core/io/json.h" -#include "core/math/crypto_core.h" #include "core/math/math_defs.h" #include "core/os/file_access.h" #include "core/os/os.h" diff --git a/modules/websocket/wsl_peer.cpp b/modules/websocket/wsl_peer.cpp index b11bd2b70fa..f94f3dfff7d 100644 --- a/modules/websocket/wsl_peer.cpp +++ b/modules/websocket/wsl_peer.cpp @@ -35,7 +35,7 @@ #include "wsl_client.h" #include "wsl_server.h" -#include "core/math/crypto_core.h" +#include "core/crypto/crypto_core.h" #include "core/math/random_number_generator.h" #include "core/os/os.h" diff --git a/platform/uwp/export/export.cpp b/platform/uwp/export/export.cpp index 662ee49935d..ea110b11ca5 100644 --- a/platform/uwp/export/export.cpp +++ b/platform/uwp/export/export.cpp @@ -30,9 +30,9 @@ #include "export.h" #include "core/bind/core_bind.h" +#include "core/crypto/crypto_core.h" #include "core/io/marshalls.h" #include "core/io/zip_io.h" -#include "core/math/crypto_core.h" #include "core/object.h" #include "core/os/dir_access.h" #include "core/os/file_access.h"