diff --git a/CMakeLists.txt b/CMakeLists.txt index 88aae89760..a7eaec0dd7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -203,6 +203,7 @@ include_directories(src/include) include_directories(third_party/antlr4_cypher/include) include_directories(third_party/antlr4_runtime/src) include_directories(third_party/fast_float/include) +include_directories(third_party/mbedtls/include) include_directories(third_party/miniparquet/src) include_directories(third_party/miniz) include_directories(third_party/nlohmann_json) diff --git a/extension/httpfs/CMakeLists.txt b/extension/httpfs/CMakeLists.txt index 8c6b0f1d4f..4a78e36a62 100644 --- a/extension/httpfs/CMakeLists.txt +++ b/extension/httpfs/CMakeLists.txt @@ -6,13 +6,11 @@ find_package(OpenSSL REQUIRED) include_directories(${OPENSSL_INCLUDE_DIR}) add_compile_definitions(CPPHTTPLIB_OPENSSL_SUPPORT) -add_subdirectory(third_party/mbedtls) - include_directories( ${PROJECT_SOURCE_DIR}/src/include ${PROJECT_SOURCE_DIR}/third_party/httplib - src/include - third_party/mbedtls/include) + ${PROJECT_SOURCE_DIR}/third_party/mbedtls/include + src/include) add_library(httpfs SHARED diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 6859972eb3..8b421ef170 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -21,7 +21,7 @@ add_subdirectory(extension) add_library(kuzu STATIC ${ALL_OBJECT_FILES}) add_library(kuzu_shared SHARED ${ALL_OBJECT_FILES}) -set(KUZU_LIBRARIES antlr4_cypher antlr4_runtime fast_float utf8proc re2 serd Threads::Threads fastpfor miniparquet zstd miniz) +set(KUZU_LIBRARIES antlr4_cypher antlr4_runtime fast_float utf8proc re2 serd Threads::Threads fastpfor miniparquet zstd miniz mbedtls) if(NOT WIN32) set(KUZU_LIBRARIES dl ${KUZU_LIBRARIES}) endif() diff --git a/src/common/CMakeLists.txt b/src/common/CMakeLists.txt index 0ae41a12b1..3a735213ee 100644 --- a/src/common/CMakeLists.txt +++ b/src/common/CMakeLists.txt @@ -22,6 +22,7 @@ add_library(kuzu_common profiler.cpp type_utils.cpp utils.cpp + sha256.cpp string_utils.cpp system_message.cpp random_engine.cpp diff --git a/src/common/sha256.cpp b/src/common/sha256.cpp new file mode 100644 index 0000000000..ba8a1e4f76 --- /dev/null +++ b/src/common/sha256.cpp @@ -0,0 +1,52 @@ +#include "common/sha256.h" + +#include "common/exception/runtime.h" + +namespace kuzu { +namespace common { + +SHA256::SHA256() { + mbedtls_sha256_init(&shaContext); + + // These errors would only occur if there's an issue with shaContext which is wrapped inside + // SHA256, or with the mbedtls library itself + if (mbedtls_sha256_starts(&shaContext, false)) { + throw RuntimeException{"SHA256 Error"}; + } +} + +SHA256::~SHA256() { + mbedtls_sha256_free(&shaContext); +} + +void SHA256::addString(const std::string& str) { + if (mbedtls_sha256_update( + &shaContext, reinterpret_cast(str.data()), str.size())) { + throw RuntimeException{"SHA256 Error"}; + } +} + +void SHA256::finishSHA256(char* out) { + std::string hash; + hash.resize(SHA256_HASH_LENGTH_BYTES); + + if (mbedtls_sha256_finish(&shaContext, reinterpret_cast(hash.data()))) { + throw RuntimeException{"SHA256 Error"}; + } + + toBase16(hash.c_str(), out, SHA256_HASH_LENGTH_BYTES); +} + +void SHA256::toBase16(const char* in, char* out, size_t len) { + static char const HEX_CODES[] = "0123456789abcdef"; + size_t i, j; + + for (j = i = 0; i < len; i++) { + int a = in[i]; + out[j++] = HEX_CODES[(a >> 4) & 0xf]; + out[j++] = HEX_CODES[a & 0xf]; + } +} + +} // namespace common +} // namespace kuzu diff --git a/src/function/function_collection.cpp b/src/function/function_collection.cpp index 60179caded..8f0d55c1d3 100644 --- a/src/function/function_collection.cpp +++ b/src/function/function_collection.cpp @@ -9,6 +9,7 @@ #include "function/cast/vector_cast_functions.h" #include "function/comparison/vector_comparison_functions.h" #include "function/date/vector_date_functions.h" +#include "function/hash/vector_hash_functions.h" #include "function/interval/vector_interval_functions.h" #include "function/list/vector_list_functions.h" #include "function/map/vector_map_functions.h" @@ -178,6 +179,10 @@ FunctionCollection* FunctionCollection::getFunctions() { // Rdf functions SCALAR_FUNCTION(RDFTypeFunction), SCALAR_FUNCTION(ValidatePredicateFunction), + // Hash functions + SCALAR_FUNCTION(MD5Function), SCALAR_FUNCTION(SHA256Function), + SCALAR_FUNCTION(HashFunction), + // Aggregate functions AGGREGATE_FUNCTION(CountStarFunction), AGGREGATE_FUNCTION(CountFunction), AGGREGATE_FUNCTION(AggregateSumFunction), AGGREGATE_FUNCTION(AggregateAvgFunction), diff --git a/src/function/vector_hash_functions.cpp b/src/function/vector_hash_functions.cpp index 6796bd861d..e1ba1b0f04 100644 --- a/src/function/vector_hash_functions.cpp +++ b/src/function/vector_hash_functions.cpp @@ -1,12 +1,64 @@ #include "function/hash/vector_hash_functions.h" #include "function/binary_function_executor.h" +#include "function/hash/functions/md5_function.h" +#include "function/hash/functions/sha256_function.h" +#include "function/hash/hash_functions.h" +#include "function/scalar_function.h" using namespace kuzu::common; namespace kuzu { namespace function { +template +void UnaryHashFunctionExecutor::execute(ValueVector& operand, ValueVector& result) { + auto resultValues = (RESULT_TYPE*)result.getData(); + if (operand.state->isFlat()) { + auto pos = operand.state->selVector->selectedPositions[0]; + if (!operand.isNull(pos)) { + Hash::operation(operand.getValue(pos), resultValues[pos], &operand); + } else { + result.setValue(pos, NULL_HASH); + } + } else { + if (operand.hasNoNullsGuarantee()) { + if (operand.state->selVector->isUnfiltered()) { + for (auto i = 0u; i < operand.state->selVector->selectedSize; i++) { + Hash::operation(operand.getValue(i), resultValues[i], &operand); + } + } else { + for (auto i = 0u; i < operand.state->selVector->selectedSize; i++) { + auto pos = operand.state->selVector->selectedPositions[i]; + Hash::operation( + operand.getValue(pos), resultValues[pos], &operand); + } + } + } else { + if (operand.state->selVector->isUnfiltered()) { + for (auto i = 0u; i < operand.state->selVector->selectedSize; i++) { + if (!operand.isNull(i)) { + Hash::operation( + operand.getValue(i), resultValues[i], &operand); + } else { + result.setValue(i, NULL_HASH); + } + } + } else { + for (auto i = 0u; i < operand.state->selVector->selectedSize; i++) { + auto pos = operand.state->selVector->selectedPositions[i]; + if (!operand.isNull(pos)) { + Hash::operation( + operand.getValue(pos), resultValues[pos], &operand); + } else { + resultValues[pos] = NULL_HASH; + } + } + } + } + } +} + static std::unique_ptr computeDataVecHash(ValueVector* operand) { auto hashVector = std::make_unique(*LogicalType::LIST(LogicalType::HASH())); auto numValuesInDataVec = ListVector::getDataVectorSize(operand); @@ -147,5 +199,37 @@ void VectorHashFunction::combineHash(ValueVector* left, ValueVector* right, Valu BinaryFunctionExecutor::execute(*left, *right, *result); } +function_set MD5Function::getFunctionSet() { + function_set functionSet; + functionSet.push_back(std::make_unique(name, + std::vector{LogicalTypeID::STRING}, LogicalTypeID::STRING, + ScalarFunction::UnaryStringExecFunction, + false /* isVarLength */)); + return functionSet; +} + +function_set SHA256Function::getFunctionSet() { + function_set functionSet; + functionSet.push_back(std::make_unique(name, + std::vector{LogicalTypeID::STRING}, LogicalTypeID::STRING, + ScalarFunction::UnaryStringExecFunction, + false /* isVarLength */)); + return functionSet; +} + +static void HashExecFunc(const std::vector>& params, + common::ValueVector& result, void* /*dataPtr*/ = nullptr) { + KU_ASSERT(params.size() == 1); + VectorHashFunction::computeHash(params[0].get(), &result); +} + +function_set HashFunction::getFunctionSet() { + function_set functionSet; + functionSet.push_back( + std::make_unique(name, std::vector{LogicalTypeID::ANY}, + LogicalTypeID::INT64, HashExecFunc, false /* isVarLength */)); + return functionSet; +} + } // namespace function } // namespace kuzu diff --git a/src/include/common/sha256.h b/src/include/common/sha256.h new file mode 100644 index 0000000000..017e201d17 --- /dev/null +++ b/src/include/common/sha256.h @@ -0,0 +1,29 @@ +#pragma once + +#include + +#include "mbedtls/sha256.h" + +namespace kuzu { +namespace common { + +class SHA256 { +public: + static constexpr size_t SHA256_HASH_LENGTH_BYTES = 32; + static constexpr size_t SHA256_HASH_LENGTH_TEXT = 64; + +public: + SHA256(); + ~SHA256(); + void addString(const std::string& str); + void finishSHA256(char* out); + static void toBase16(const char* in, char* out, size_t len); + +private: + typedef mbedtls_sha256_context SHA256Context; + + SHA256Context shaContext; +}; + +} // namespace common +} // namespace kuzu diff --git a/src/include/function/hash/functions/md5_function.h b/src/include/function/hash/functions/md5_function.h new file mode 100644 index 0000000000..5af6c12bf5 --- /dev/null +++ b/src/include/function/hash/functions/md5_function.h @@ -0,0 +1,20 @@ +#pragma once + +#include "common/md5.h" +#include "common/vector/value_vector.h" + +using namespace kuzu::common; + +namespace kuzu { +namespace function { + +struct MD5Operator { + static void operation(ku_string_t& operand, ku_string_t& result, ValueVector& resultVector) { + MD5 hasher; + hasher.addToMD5(reinterpret_cast(operand.getData())); + StringVector::addString(&resultVector, result, std::string(hasher.finishMD5())); + } +}; + +} // namespace function +} // namespace kuzu diff --git a/src/include/function/hash/functions/sha256_function.h b/src/include/function/hash/functions/sha256_function.h new file mode 100644 index 0000000000..c24dfe1583 --- /dev/null +++ b/src/include/function/hash/functions/sha256_function.h @@ -0,0 +1,21 @@ +#pragma once + +#include "common/sha256.h" +#include "common/vector/value_vector.h" + +using namespace kuzu::common; + +namespace kuzu { +namespace function { + +struct SHA256Operator { + static void operation(ku_string_t& operand, ku_string_t& result, ValueVector& resultVector) { + StringVector::reserveString(&resultVector, result, SHA256::SHA256_HASH_LENGTH_TEXT); + SHA256 hasher; + hasher.addString(operand.getAsString()); + hasher.finishSHA256(reinterpret_cast(result.getDataUnsafe())); + } +}; + +} // namespace function +} // namespace kuzu diff --git a/src/include/function/hash/vector_hash_functions.h b/src/include/function/hash/vector_hash_functions.h index 1a73c939da..27122ac347 100644 --- a/src/include/function/hash/vector_hash_functions.h +++ b/src/include/function/hash/vector_hash_functions.h @@ -1,60 +1,14 @@ #pragma once #include "common/vector/value_vector.h" -#include "hash_functions.h" +#include "function/function.h" namespace kuzu { namespace function { struct UnaryHashFunctionExecutor { template - static void execute(common::ValueVector& operand, common::ValueVector& result) { - auto resultValues = (RESULT_TYPE*)result.getData(); - if (operand.state->isFlat()) { - auto pos = operand.state->selVector->selectedPositions[0]; - if (!operand.isNull(pos)) { - Hash::operation(operand.getValue(pos), resultValues[pos], &operand); - } else { - result.setValue(pos, NULL_HASH); - } - } else { - if (operand.hasNoNullsGuarantee()) { - if (operand.state->selVector->isUnfiltered()) { - for (auto i = 0u; i < operand.state->selVector->selectedSize; i++) { - Hash::operation(operand.getValue(i), resultValues[i], - &operand); - } - } else { - for (auto i = 0u; i < operand.state->selVector->selectedSize; i++) { - auto pos = operand.state->selVector->selectedPositions[i]; - Hash::operation(operand.getValue(pos), resultValues[pos], - &operand); - } - } - } else { - if (operand.state->selVector->isUnfiltered()) { - for (auto i = 0u; i < operand.state->selVector->selectedSize; i++) { - if (!operand.isNull(i)) { - Hash::operation(operand.getValue(i), resultValues[i], - &operand); - } else { - result.setValue(i, NULL_HASH); - } - } - } else { - for (auto i = 0u; i < operand.state->selVector->selectedSize; i++) { - auto pos = operand.state->selVector->selectedPositions[i]; - if (!operand.isNull(pos)) { - Hash::operation(operand.getValue(pos), resultValues[pos], - &operand); - } else { - resultValues[pos] = NULL_HASH; - } - } - } - } - } - } + static void execute(common::ValueVector& operand, common::ValueVector& result); }; struct VectorHashFunction { @@ -64,5 +18,23 @@ struct VectorHashFunction { common::ValueVector* result); }; +struct MD5Function { + static constexpr const char* name = "MD5"; + + static function_set getFunctionSet(); +}; + +struct SHA256Function { + static constexpr const char* name = "SHA256"; + + static function_set getFunctionSet(); +}; + +struct HashFunction { + static constexpr const char* name = "HASH"; + + static function_set getFunctionSet(); +}; + } // namespace function } // namespace kuzu diff --git a/src/processor/result/base_hash_table.cpp b/src/processor/result/base_hash_table.cpp index 33ae95b2ef..1d93d504c0 100644 --- a/src/processor/result/base_hash_table.cpp +++ b/src/processor/result/base_hash_table.cpp @@ -3,6 +3,7 @@ #include "math.h" #include "common/null_buffer.h" +#include "common/type_utils.h" #include "common/utils.h" #include "function/comparison/comparison_functions.h" #include "function/hash/vector_hash_functions.h" diff --git a/test/test_files/function/hash/hash.test b/test/test_files/function/hash/hash.test new file mode 100644 index 0000000000..ff4f5908a7 --- /dev/null +++ b/test/test_files/function/hash/hash.test @@ -0,0 +1,49 @@ +-GROUP HashFunctionTests +-DATASET CSV empty + +-- + +-CASE HashFuncTests + +-LOG HashBool +-STATEMENT RETURN hash(true); +---- 1 +4717996019076358352 + +-STATEMENT RETURN hash(false); +---- 1 +0 + +-LOG HashInteger +-STATEMENT RETURN hash(123213213); +---- 1 +5409473644860454233 + +-STATEMENT RETURN hash(-182812789912); +---- 1 +6017956686658665710 + +-LOG HashDouble +-STATEMENT RETURN hash(3.145454); +---- 1 +7162734438776005526 + +-LOG HashString +-STATEMENT RETURN hash('abc'); +---- 1 +-5315477578366381819 + +-LOG HashInterval +-STATEMENT RETURN hash(interval("1 years 2 months 3 hours")); +---- 1 +-5050076354121952078 + +-LOG HashStruct +-STATEMENT RETURN hash({name: 'Bob', age: 25}); +---- 1 +-8624809801234475505 + +-LOG HashList +-STATEMENT RETURN hash(list_creation(1,2,3,4,5,56,2)); +---- 1 +5340394995802248375 diff --git a/test/test_files/function/hash/md5.test b/test/test_files/function/hash/md5.test new file mode 100644 index 0000000000..f1b68238b5 --- /dev/null +++ b/test/test_files/function/hash/md5.test @@ -0,0 +1,21 @@ +-GROUP HashFunctionTests +-DATASET CSV empty + +-- + +-CASE MD5Tests +-STATEMENT RETURN md5(NULL); +---- 1 + + +-STATEMENT RETURN md5('hello'); +---- 1 +5d41402abc4b2a76b9719d911017c592 + +-STATEMENT RETURN md5(123); +---- 1 +202cb962ac59075b964b07152d234b70 + +-STATEMENT return md5('abc123def456ghi789jkl101112'); +---- 1 +436e6c40874ff499047bc73a53e67897 diff --git a/test/test_files/function/hash/sha256.test b/test/test_files/function/hash/sha256.test new file mode 100644 index 0000000000..de392f6916 --- /dev/null +++ b/test/test_files/function/hash/sha256.test @@ -0,0 +1,26 @@ +-GROUP HashFunctionTests +-DATASET CSV empty + +-- + +-CASE SHA256Tests +-STATEMENT RETURN sha256(NULL); +---- 1 + + +-STATEMENT RETURN sha256('hello'); +---- 1 +2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824 + +-STATEMENT RETURN sha256(''); +---- 1 +e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 + +-STATEMENT RETURN sha256('1'); +---- 1 +6b86b273ff34fce19d6b804eff5a3f5747ada4eaa22f1d49c01e52ddb7875b4b + +-STATEMENT RETURN sha256(); +---- error +Binder exception: Cannot match a built-in function for given function SHA256. Supported inputs are +(STRING) -> STRING diff --git a/third_party/CMakeLists.txt b/third_party/CMakeLists.txt index 4486601d15..2f5b81ebec 100644 --- a/third_party/CMakeLists.txt +++ b/third_party/CMakeLists.txt @@ -7,6 +7,7 @@ add_subdirectory(antlr4_runtime) add_subdirectory(fast_float) add_subdirectory(fastpfor) add_subdirectory(glob) +add_subdirectory(mbedtls) add_subdirectory(miniparquet) add_subdirectory(miniz) if(${BUILD_PYTHON}) diff --git a/extension/httpfs/third_party/mbedtls/CMakeLists.txt b/third_party/mbedtls/CMakeLists.txt similarity index 100% rename from extension/httpfs/third_party/mbedtls/CMakeLists.txt rename to third_party/mbedtls/CMakeLists.txt diff --git a/extension/httpfs/third_party/mbedtls/LICENSE b/third_party/mbedtls/LICENSE similarity index 100% rename from extension/httpfs/third_party/mbedtls/LICENSE rename to third_party/mbedtls/LICENSE diff --git a/extension/httpfs/third_party/mbedtls/include/mbedtls/aes.h b/third_party/mbedtls/include/mbedtls/aes.h similarity index 100% rename from extension/httpfs/third_party/mbedtls/include/mbedtls/aes.h rename to third_party/mbedtls/include/mbedtls/aes.h diff --git a/extension/httpfs/third_party/mbedtls/include/mbedtls/aria.h b/third_party/mbedtls/include/mbedtls/aria.h similarity index 100% rename from extension/httpfs/third_party/mbedtls/include/mbedtls/aria.h rename to third_party/mbedtls/include/mbedtls/aria.h diff --git a/extension/httpfs/third_party/mbedtls/include/mbedtls/asn1.h b/third_party/mbedtls/include/mbedtls/asn1.h similarity index 100% rename from extension/httpfs/third_party/mbedtls/include/mbedtls/asn1.h rename to third_party/mbedtls/include/mbedtls/asn1.h diff --git a/extension/httpfs/third_party/mbedtls/include/mbedtls/base64.h b/third_party/mbedtls/include/mbedtls/base64.h similarity index 100% rename from extension/httpfs/third_party/mbedtls/include/mbedtls/base64.h rename to third_party/mbedtls/include/mbedtls/base64.h diff --git a/extension/httpfs/third_party/mbedtls/include/mbedtls/bignum.h b/third_party/mbedtls/include/mbedtls/bignum.h similarity index 100% rename from extension/httpfs/third_party/mbedtls/include/mbedtls/bignum.h rename to third_party/mbedtls/include/mbedtls/bignum.h diff --git a/extension/httpfs/third_party/mbedtls/include/mbedtls/build_info.h b/third_party/mbedtls/include/mbedtls/build_info.h similarity index 100% rename from extension/httpfs/third_party/mbedtls/include/mbedtls/build_info.h rename to third_party/mbedtls/include/mbedtls/build_info.h diff --git a/extension/httpfs/third_party/mbedtls/include/mbedtls/camellia.h b/third_party/mbedtls/include/mbedtls/camellia.h similarity index 100% rename from extension/httpfs/third_party/mbedtls/include/mbedtls/camellia.h rename to third_party/mbedtls/include/mbedtls/camellia.h diff --git a/extension/httpfs/third_party/mbedtls/include/mbedtls/ccm.h b/third_party/mbedtls/include/mbedtls/ccm.h similarity index 100% rename from extension/httpfs/third_party/mbedtls/include/mbedtls/ccm.h rename to third_party/mbedtls/include/mbedtls/ccm.h diff --git a/extension/httpfs/third_party/mbedtls/include/mbedtls/check_config.h b/third_party/mbedtls/include/mbedtls/check_config.h similarity index 100% rename from extension/httpfs/third_party/mbedtls/include/mbedtls/check_config.h rename to third_party/mbedtls/include/mbedtls/check_config.h diff --git a/extension/httpfs/third_party/mbedtls/include/mbedtls/cipher.h b/third_party/mbedtls/include/mbedtls/cipher.h similarity index 100% rename from extension/httpfs/third_party/mbedtls/include/mbedtls/cipher.h rename to third_party/mbedtls/include/mbedtls/cipher.h diff --git a/extension/httpfs/third_party/mbedtls/include/mbedtls/constant_time.h b/third_party/mbedtls/include/mbedtls/constant_time.h similarity index 100% rename from extension/httpfs/third_party/mbedtls/include/mbedtls/constant_time.h rename to third_party/mbedtls/include/mbedtls/constant_time.h diff --git a/extension/httpfs/third_party/mbedtls/include/mbedtls/des.h b/third_party/mbedtls/include/mbedtls/des.h similarity index 100% rename from extension/httpfs/third_party/mbedtls/include/mbedtls/des.h rename to third_party/mbedtls/include/mbedtls/des.h diff --git a/extension/httpfs/third_party/mbedtls/include/mbedtls/entropy.h b/third_party/mbedtls/include/mbedtls/entropy.h similarity index 100% rename from extension/httpfs/third_party/mbedtls/include/mbedtls/entropy.h rename to third_party/mbedtls/include/mbedtls/entropy.h diff --git a/extension/httpfs/third_party/mbedtls/include/mbedtls/error.h b/third_party/mbedtls/include/mbedtls/error.h similarity index 100% rename from extension/httpfs/third_party/mbedtls/include/mbedtls/error.h rename to third_party/mbedtls/include/mbedtls/error.h diff --git a/extension/httpfs/third_party/mbedtls/include/mbedtls/gcm.h b/third_party/mbedtls/include/mbedtls/gcm.h similarity index 100% rename from extension/httpfs/third_party/mbedtls/include/mbedtls/gcm.h rename to third_party/mbedtls/include/mbedtls/gcm.h diff --git a/extension/httpfs/third_party/mbedtls/include/mbedtls/mbedtls_config.h b/third_party/mbedtls/include/mbedtls/mbedtls_config.h similarity index 100% rename from extension/httpfs/third_party/mbedtls/include/mbedtls/mbedtls_config.h rename to third_party/mbedtls/include/mbedtls/mbedtls_config.h diff --git a/extension/httpfs/third_party/mbedtls/include/mbedtls/md.h b/third_party/mbedtls/include/mbedtls/md.h similarity index 100% rename from extension/httpfs/third_party/mbedtls/include/mbedtls/md.h rename to third_party/mbedtls/include/mbedtls/md.h diff --git a/extension/httpfs/third_party/mbedtls/include/mbedtls/memory_buffer_alloc.h b/third_party/mbedtls/include/mbedtls/memory_buffer_alloc.h similarity index 100% rename from extension/httpfs/third_party/mbedtls/include/mbedtls/memory_buffer_alloc.h rename to third_party/mbedtls/include/mbedtls/memory_buffer_alloc.h diff --git a/extension/httpfs/third_party/mbedtls/include/mbedtls/oid.h b/third_party/mbedtls/include/mbedtls/oid.h similarity index 100% rename from extension/httpfs/third_party/mbedtls/include/mbedtls/oid.h rename to third_party/mbedtls/include/mbedtls/oid.h diff --git a/extension/httpfs/third_party/mbedtls/include/mbedtls/pem.h b/third_party/mbedtls/include/mbedtls/pem.h similarity index 100% rename from extension/httpfs/third_party/mbedtls/include/mbedtls/pem.h rename to third_party/mbedtls/include/mbedtls/pem.h diff --git a/extension/httpfs/third_party/mbedtls/include/mbedtls/pk.h b/third_party/mbedtls/include/mbedtls/pk.h similarity index 100% rename from extension/httpfs/third_party/mbedtls/include/mbedtls/pk.h rename to third_party/mbedtls/include/mbedtls/pk.h diff --git a/extension/httpfs/third_party/mbedtls/include/mbedtls/platform.h b/third_party/mbedtls/include/mbedtls/platform.h similarity index 100% rename from extension/httpfs/third_party/mbedtls/include/mbedtls/platform.h rename to third_party/mbedtls/include/mbedtls/platform.h diff --git a/extension/httpfs/third_party/mbedtls/include/mbedtls/platform_time.h b/third_party/mbedtls/include/mbedtls/platform_time.h similarity index 100% rename from extension/httpfs/third_party/mbedtls/include/mbedtls/platform_time.h rename to third_party/mbedtls/include/mbedtls/platform_time.h diff --git a/extension/httpfs/third_party/mbedtls/include/mbedtls/platform_util.h b/third_party/mbedtls/include/mbedtls/platform_util.h similarity index 100% rename from extension/httpfs/third_party/mbedtls/include/mbedtls/platform_util.h rename to third_party/mbedtls/include/mbedtls/platform_util.h diff --git a/extension/httpfs/third_party/mbedtls/include/mbedtls/private_access.h b/third_party/mbedtls/include/mbedtls/private_access.h similarity index 100% rename from extension/httpfs/third_party/mbedtls/include/mbedtls/private_access.h rename to third_party/mbedtls/include/mbedtls/private_access.h diff --git a/extension/httpfs/third_party/mbedtls/include/mbedtls/rsa.h b/third_party/mbedtls/include/mbedtls/rsa.h similarity index 100% rename from extension/httpfs/third_party/mbedtls/include/mbedtls/rsa.h rename to third_party/mbedtls/include/mbedtls/rsa.h diff --git a/extension/httpfs/third_party/mbedtls/include/mbedtls/sha1.h b/third_party/mbedtls/include/mbedtls/sha1.h similarity index 100% rename from extension/httpfs/third_party/mbedtls/include/mbedtls/sha1.h rename to third_party/mbedtls/include/mbedtls/sha1.h diff --git a/extension/httpfs/third_party/mbedtls/include/mbedtls/sha256.h b/third_party/mbedtls/include/mbedtls/sha256.h similarity index 100% rename from extension/httpfs/third_party/mbedtls/include/mbedtls/sha256.h rename to third_party/mbedtls/include/mbedtls/sha256.h diff --git a/extension/httpfs/third_party/mbedtls/include/mbedtls/sha512.h b/third_party/mbedtls/include/mbedtls/sha512.h similarity index 100% rename from extension/httpfs/third_party/mbedtls/include/mbedtls/sha512.h rename to third_party/mbedtls/include/mbedtls/sha512.h diff --git a/extension/httpfs/third_party/mbedtls/library/aes.cpp b/third_party/mbedtls/library/aes.cpp similarity index 100% rename from extension/httpfs/third_party/mbedtls/library/aes.cpp rename to third_party/mbedtls/library/aes.cpp diff --git a/extension/httpfs/third_party/mbedtls/library/aria.cpp b/third_party/mbedtls/library/aria.cpp similarity index 100% rename from extension/httpfs/third_party/mbedtls/library/aria.cpp rename to third_party/mbedtls/library/aria.cpp diff --git a/extension/httpfs/third_party/mbedtls/library/asn1parse.cpp b/third_party/mbedtls/library/asn1parse.cpp similarity index 100% rename from extension/httpfs/third_party/mbedtls/library/asn1parse.cpp rename to third_party/mbedtls/library/asn1parse.cpp diff --git a/extension/httpfs/third_party/mbedtls/library/base64.cpp b/third_party/mbedtls/library/base64.cpp similarity index 100% rename from extension/httpfs/third_party/mbedtls/library/base64.cpp rename to third_party/mbedtls/library/base64.cpp diff --git a/extension/httpfs/third_party/mbedtls/library/bignum.cpp b/third_party/mbedtls/library/bignum.cpp similarity index 100% rename from extension/httpfs/third_party/mbedtls/library/bignum.cpp rename to third_party/mbedtls/library/bignum.cpp diff --git a/extension/httpfs/third_party/mbedtls/library/bn_mul.h b/third_party/mbedtls/library/bn_mul.h similarity index 100% rename from extension/httpfs/third_party/mbedtls/library/bn_mul.h rename to third_party/mbedtls/library/bn_mul.h diff --git a/extension/httpfs/third_party/mbedtls/library/camellia.cpp b/third_party/mbedtls/library/camellia.cpp similarity index 100% rename from extension/httpfs/third_party/mbedtls/library/camellia.cpp rename to third_party/mbedtls/library/camellia.cpp diff --git a/extension/httpfs/third_party/mbedtls/library/cipher.cpp b/third_party/mbedtls/library/cipher.cpp similarity index 100% rename from extension/httpfs/third_party/mbedtls/library/cipher.cpp rename to third_party/mbedtls/library/cipher.cpp diff --git a/extension/httpfs/third_party/mbedtls/library/cipher_wrap.cpp b/third_party/mbedtls/library/cipher_wrap.cpp similarity index 100% rename from extension/httpfs/third_party/mbedtls/library/cipher_wrap.cpp rename to third_party/mbedtls/library/cipher_wrap.cpp diff --git a/extension/httpfs/third_party/mbedtls/library/cipher_wrap.h b/third_party/mbedtls/library/cipher_wrap.h similarity index 100% rename from extension/httpfs/third_party/mbedtls/library/cipher_wrap.h rename to third_party/mbedtls/library/cipher_wrap.h diff --git a/extension/httpfs/third_party/mbedtls/library/common.h b/third_party/mbedtls/library/common.h similarity index 100% rename from extension/httpfs/third_party/mbedtls/library/common.h rename to third_party/mbedtls/library/common.h diff --git a/extension/httpfs/third_party/mbedtls/library/constant_time.cpp b/third_party/mbedtls/library/constant_time.cpp similarity index 100% rename from extension/httpfs/third_party/mbedtls/library/constant_time.cpp rename to third_party/mbedtls/library/constant_time.cpp diff --git a/extension/httpfs/third_party/mbedtls/library/constant_time_internal.h b/third_party/mbedtls/library/constant_time_internal.h similarity index 100% rename from extension/httpfs/third_party/mbedtls/library/constant_time_internal.h rename to third_party/mbedtls/library/constant_time_internal.h diff --git a/extension/httpfs/third_party/mbedtls/library/constant_time_invasive.h b/third_party/mbedtls/library/constant_time_invasive.h similarity index 100% rename from extension/httpfs/third_party/mbedtls/library/constant_time_invasive.h rename to third_party/mbedtls/library/constant_time_invasive.h diff --git a/extension/httpfs/third_party/mbedtls/library/entropy.cpp b/third_party/mbedtls/library/entropy.cpp similarity index 100% rename from extension/httpfs/third_party/mbedtls/library/entropy.cpp rename to third_party/mbedtls/library/entropy.cpp diff --git a/extension/httpfs/third_party/mbedtls/library/entropy_poll.cpp b/third_party/mbedtls/library/entropy_poll.cpp similarity index 100% rename from extension/httpfs/third_party/mbedtls/library/entropy_poll.cpp rename to third_party/mbedtls/library/entropy_poll.cpp diff --git a/extension/httpfs/third_party/mbedtls/library/entropy_poll.h b/third_party/mbedtls/library/entropy_poll.h similarity index 100% rename from extension/httpfs/third_party/mbedtls/library/entropy_poll.h rename to third_party/mbedtls/library/entropy_poll.h diff --git a/extension/httpfs/third_party/mbedtls/library/gcm.cpp b/third_party/mbedtls/library/gcm.cpp similarity index 100% rename from extension/httpfs/third_party/mbedtls/library/gcm.cpp rename to third_party/mbedtls/library/gcm.cpp diff --git a/extension/httpfs/third_party/mbedtls/library/md.cpp b/third_party/mbedtls/library/md.cpp similarity index 100% rename from extension/httpfs/third_party/mbedtls/library/md.cpp rename to third_party/mbedtls/library/md.cpp diff --git a/extension/httpfs/third_party/mbedtls/library/md_wrap.h b/third_party/mbedtls/library/md_wrap.h similarity index 100% rename from extension/httpfs/third_party/mbedtls/library/md_wrap.h rename to third_party/mbedtls/library/md_wrap.h diff --git a/extension/httpfs/third_party/mbedtls/library/oid.cpp b/third_party/mbedtls/library/oid.cpp similarity index 100% rename from extension/httpfs/third_party/mbedtls/library/oid.cpp rename to third_party/mbedtls/library/oid.cpp diff --git a/extension/httpfs/third_party/mbedtls/library/pem.cpp b/third_party/mbedtls/library/pem.cpp similarity index 100% rename from extension/httpfs/third_party/mbedtls/library/pem.cpp rename to third_party/mbedtls/library/pem.cpp diff --git a/extension/httpfs/third_party/mbedtls/library/pk.cpp b/third_party/mbedtls/library/pk.cpp similarity index 100% rename from extension/httpfs/third_party/mbedtls/library/pk.cpp rename to third_party/mbedtls/library/pk.cpp diff --git a/extension/httpfs/third_party/mbedtls/library/pk_wrap.cpp b/third_party/mbedtls/library/pk_wrap.cpp similarity index 100% rename from extension/httpfs/third_party/mbedtls/library/pk_wrap.cpp rename to third_party/mbedtls/library/pk_wrap.cpp diff --git a/extension/httpfs/third_party/mbedtls/library/pk_wrap.h b/third_party/mbedtls/library/pk_wrap.h similarity index 100% rename from extension/httpfs/third_party/mbedtls/library/pk_wrap.h rename to third_party/mbedtls/library/pk_wrap.h diff --git a/extension/httpfs/third_party/mbedtls/library/pkparse.cpp b/third_party/mbedtls/library/pkparse.cpp similarity index 100% rename from extension/httpfs/third_party/mbedtls/library/pkparse.cpp rename to third_party/mbedtls/library/pkparse.cpp diff --git a/extension/httpfs/third_party/mbedtls/library/platform_util.cpp b/third_party/mbedtls/library/platform_util.cpp similarity index 100% rename from extension/httpfs/third_party/mbedtls/library/platform_util.cpp rename to third_party/mbedtls/library/platform_util.cpp diff --git a/extension/httpfs/third_party/mbedtls/library/rsa.cpp b/third_party/mbedtls/library/rsa.cpp similarity index 100% rename from extension/httpfs/third_party/mbedtls/library/rsa.cpp rename to third_party/mbedtls/library/rsa.cpp diff --git a/extension/httpfs/third_party/mbedtls/library/rsa_alt_helpers.cpp b/third_party/mbedtls/library/rsa_alt_helpers.cpp similarity index 100% rename from extension/httpfs/third_party/mbedtls/library/rsa_alt_helpers.cpp rename to third_party/mbedtls/library/rsa_alt_helpers.cpp diff --git a/extension/httpfs/third_party/mbedtls/library/rsa_alt_helpers.h b/third_party/mbedtls/library/rsa_alt_helpers.h similarity index 100% rename from extension/httpfs/third_party/mbedtls/library/rsa_alt_helpers.h rename to third_party/mbedtls/library/rsa_alt_helpers.h diff --git a/extension/httpfs/third_party/mbedtls/library/sha1.cpp b/third_party/mbedtls/library/sha1.cpp similarity index 100% rename from extension/httpfs/third_party/mbedtls/library/sha1.cpp rename to third_party/mbedtls/library/sha1.cpp diff --git a/extension/httpfs/third_party/mbedtls/library/sha256.cpp b/third_party/mbedtls/library/sha256.cpp similarity index 100% rename from extension/httpfs/third_party/mbedtls/library/sha256.cpp rename to third_party/mbedtls/library/sha256.cpp diff --git a/extension/httpfs/third_party/mbedtls/library/sha512.cpp b/third_party/mbedtls/library/sha512.cpp similarity index 100% rename from extension/httpfs/third_party/mbedtls/library/sha512.cpp rename to third_party/mbedtls/library/sha512.cpp diff --git a/tools/rust_api/build.rs b/tools/rust_api/build.rs index b44edf715b..15ed5bebbf 100644 --- a/tools/rust_api/build.rs +++ b/tools/rust_api/build.rs @@ -43,6 +43,7 @@ fn link_libraries() { println!("cargo:rustc-link-lib=static=miniparquet"); println!("cargo:rustc-link-lib=static=zstd"); println!("cargo:rustc-link-lib=static=miniz"); + println!("cargo:rustc-link-lib=static=mbedtls"); } } @@ -83,6 +84,7 @@ fn build_bundled_cmake() -> Result, Box> { "miniparquet", "zstd", "miniz", + "mbedtls", ] { let lib_path = build_dir .join("build")