diff --git a/CMakeLists.txt b/CMakeLists.txt index 1dd586b5fc6a4ab301e4f0344028baad1fcaee60..127df949dd7bf2457170b8cdd9bc8e7e449273d2 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -88,6 +88,7 @@ option(WITH_DGC "Use DGC(Deep Gradient Compression) or not" ${WITH_DISTRIBUTE} option(SANITIZER_TYPE "Choose the type of sanitizer, options are: Address, Leak, Memory, Thread, Undefined" OFF) option(WITH_LITE "Compile Paddle Fluid with Lite Engine" OFF) option(WITH_NCCL "Compile PaddlePaddle with NCCL support" ON) +option(WITH_CRYPTO "Compile PaddlePaddle with paddle_crypto lib" ON) # PY_VERSION if(NOT PY_VERSION) diff --git a/cmake/third_party.cmake b/cmake/third_party.cmake index 55737265d0596f8933923037097dd11d335ac5b6..8a4f54300e9c2e57550b73e85ec6dc381ec54758 100644 --- a/cmake/third_party.cmake +++ b/cmake/third_party.cmake @@ -205,10 +205,9 @@ include(external/threadpool)# download threadpool include(external/dlpack) # download dlpack include(external/xxhash) # download, build, install xxhash include(external/warpctc) # download, build, install warpctc -include(external/cryptopp) # download, build, install cryptopp list(APPEND third_party_deps extern_eigen3 extern_gflags extern_glog extern_boost extern_xxhash) -list(APPEND third_party_deps extern_zlib extern_dlpack extern_warpctc extern_threadpool extern_cryptopp) +list(APPEND third_party_deps extern_zlib extern_dlpack extern_warpctc extern_threadpool) # download file set(CUDAERROR_URL "http://paddlepaddledeps.bj.bcebos.com/cudaErrorMessage.tar.gz" CACHE STRING "" FORCE) @@ -306,4 +305,8 @@ if (WITH_LITE) include(external/lite) endif (WITH_LITE) +if (WITH_CRYPTO) + include(external/cryptopp) # download, build, install cryptopp +endif (WITH_CRYPTO) + add_custom_target(third_party ALL DEPENDS ${third_party_deps}) diff --git a/paddle/fluid/framework/io/CMakeLists.txt b/paddle/fluid/framework/io/CMakeLists.txt index 2c62489dadfee96a8945b8c6632389c2d986cf3c..30c66cee5be9a41d80f0154bad762c6a662cd84a 100644 --- a/paddle/fluid/framework/io/CMakeLists.txt +++ b/paddle/fluid/framework/io/CMakeLists.txt @@ -2,4 +2,6 @@ cc_library(fs SRCS fs.cc DEPS string_helper glog boost) cc_library(shell SRCS shell.cc DEPS string_helper glog timer enforce) cc_test(test_fs SRCS test_fs.cc DEPS fs shell) -add_subdirectory(crypto) +if (WITH_CRYPTO) + add_subdirectory(crypto) +endif (WITH_CRYPTO) diff --git a/paddle/fluid/framework/io/crypto/CMakeLists.txt b/paddle/fluid/framework/io/crypto/CMakeLists.txt index ab4efe83aa576202eca0ffdaeb09fbed438f1390..ae16353ec92ef05fe50acabbfb49cc59900ac36b 100644 --- a/paddle/fluid/framework/io/crypto/CMakeLists.txt +++ b/paddle/fluid/framework/io/crypto/CMakeLists.txt @@ -1,3 +1,3 @@ -cc_library(paddle_ciphers SRCS cipher_utils.cc cipher.cc aes_cipher.cc DEPS cryptopp enforce) -cc_test(aes_cipher_test SRCS aes_cipher_test.cc DEPS paddle_ciphers) -cc_test(cipher_utils_test SRCS cipher_utils_test.cc DEPS paddle_ciphers) +cc_library(paddle_crypto SRCS cipher_utils.cc cipher.cc aes_cipher.cc DEPS cryptopp enforce) +cc_test(aes_cipher_test SRCS aes_cipher_test.cc DEPS paddle_crypto) +cc_test(cipher_utils_test SRCS cipher_utils_test.cc DEPS paddle_crypto) diff --git a/paddle/fluid/framework/io/crypto/aes_cipher.cc b/paddle/fluid/framework/io/crypto/aes_cipher.cc index dce71692b6b07674fde15b29ac36ff7fe35aef1f..c5b1f1d74a5cece1674972f6c1b111dd3faed2fe 100644 --- a/paddle/fluid/framework/io/crypto/aes_cipher.cc +++ b/paddle/fluid/framework/io/crypto/aes_cipher.cc @@ -29,8 +29,11 @@ #include #include +#include +#include #include #include +#include #include #include diff --git a/paddle/fluid/framework/io/crypto/aes_cipher.h b/paddle/fluid/framework/io/crypto/aes_cipher.h index 0c1f1fd243cf8f46094e54303db97fc8d7457801..840e778b09f95b6b77eca208fef137d444af7bb9 100644 --- a/paddle/fluid/framework/io/crypto/aes_cipher.h +++ b/paddle/fluid/framework/io/crypto/aes_cipher.h @@ -27,14 +27,21 @@ #pragma once -#include -#include -#include - #include #include "paddle/fluid/framework/io/crypto/cipher.h" +namespace CryptoPP { + +class StreamTransformationFilter; +class SymmetricCipher; +class AuthenticatedSymmetricCipher; +class AuthenticatedDecryptionFilter; +class AuthenticatedEncryptionFilter; +template +class member_ptr; + +} // namespace CryptoPP namespace paddle { namespace framework { diff --git a/paddle/fluid/framework/io/crypto/aes_cipher_test.cc b/paddle/fluid/framework/io/crypto/aes_cipher_test.cc index 0702e4ab78364cc01d7d5a7d4bee6daf1ae67735..3ba55f4f45561a80d712ae064f976c270be340dd 100644 --- a/paddle/fluid/framework/io/crypto/aes_cipher_test.cc +++ b/paddle/fluid/framework/io/crypto/aes_cipher_test.cc @@ -14,6 +14,7 @@ limitations under the License. */ #include "paddle/fluid/framework/io/crypto/aes_cipher.h" +#include #include #include