├── .clang-tidy
├── .gitignore
├── .gitmodules
├── CMakeLists.txt
├── COPYING
├── COPYING.APACHE
├── CTestConfig.cmake
├── README.md
├── bin
├── iris.data
├── iris_data.ini
└── ypcd.conf
├── build.sh
├── cmake
├── ClangTidy.cmake
├── Config.cmake.in
├── Coverage.cmake
├── Doxygen.cmake
├── FindSGX.cmake
├── GTest.cmake
├── HunterGate.cmake
├── SGXHelper.cmake
├── Util.cmake.in
├── Version.cmake
├── project_path.h.in
├── vendor.cmake
└── version.h.in
├── doc
├── .gitkeep
├── Compile-ZH.md
├── Debug_EN.md
├── Debug_ZH.md
├── Developer_EN.md
├── Developer_ZH.md
├── Fidelius-Infr.png
├── README_ZH.md
├── Release_EN.md
├── Release_ZH.md
├── pdf
│ ├── delegation.pdf
│ ├── hpda.pdf
│ ├── multi_stream.pdf
│ ├── offchain.pdf
│ ├── programming.pdf
│ ├── shukey.pdf
│ └── task_graph.pdf
└── wechat_image.JPG
├── example
├── CMakeLists.txt
├── iris
│ ├── CMakeLists.txt
│ ├── analyzer
│ │ ├── enclave
│ │ │ ├── CMakeLists.txt
│ │ │ ├── enclave.config.debug.xml
│ │ │ ├── enclave.config.xml
│ │ │ ├── enclave.lds
│ │ │ ├── enclave_debug.lds
│ │ │ ├── enclave_iris_parser.h
│ │ │ ├── enclave_private.pem
│ │ │ ├── eparser.cpp
│ │ │ └── user_type.h
│ │ └── enclave_for_offchain
│ │ │ ├── CMakeLists.txt
│ │ │ ├── enclave.config.xml
│ │ │ ├── enclave_debug.lds
│ │ │ ├── enclave_private.pem
│ │ │ └── eparser.cpp
│ ├── classifier
│ │ ├── CMakeLists.txt
│ │ ├── enclave
│ │ │ ├── CMakeLists.txt
│ │ │ ├── enclave.config.debug.xml
│ │ │ ├── enclave.config.xml
│ │ │ ├── enclave.lds
│ │ │ ├── enclave_debug.lds
│ │ │ ├── enclave_iris_classifier.h
│ │ │ ├── enclave_private.pem
│ │ │ └── eparser.cpp
│ │ ├── input.cpp
│ │ ├── main.cpp
│ │ ├── model.h
│ │ └── user_type.h
│ ├── iris
│ │ ├── CMakeLists.txt
│ │ ├── output
│ │ │ └── user_type.h
│ │ └── reader
│ │ │ ├── CMakeLists.txt
│ │ │ └── reader.cpp
│ └── plugin
│ │ ├── CMakeLists.txt
│ │ ├── iris_reader.cpp
│ │ └── iris_reader.h
├── multi_personlist
│ ├── CMakeLists.txt
│ ├── common.h
│ ├── common_t.h
│ ├── first_match
│ │ ├── enclave
│ │ │ ├── CMakeLists.txt
│ │ │ ├── enclave.config.debug.xml
│ │ │ ├── enclave.config.xml
│ │ │ ├── enclave.lds
│ │ │ ├── enclave_debug.lds
│ │ │ ├── enclave_private.pem
│ │ │ ├── eparser.cpp
│ │ │ ├── first_match_parser.h
│ │ │ └── user_type.h
│ │ ├── enclave_for_offchain
│ │ │ ├── CMakeLists.txt
│ │ │ ├── enclave.config.debug.xml
│ │ │ ├── enclave.config.xml
│ │ │ ├── enclave.lds
│ │ │ ├── enclave_debug.lds
│ │ │ ├── enclave_private.pem
│ │ │ └── eparser.cpp
│ │ └── normal
│ │ │ ├── CMakeLists.txt
│ │ │ └── main.cpp
│ └── generator
│ │ ├── CMakeLists.txt
│ │ └── main.cpp
└── personlist
│ ├── CMakeLists.txt
│ ├── common.h
│ ├── common_t.h
│ ├── first_match
│ ├── enclave
│ │ ├── CMakeLists.txt
│ │ ├── enclave.config.debug.xml
│ │ ├── enclave.config.xml
│ │ ├── enclave.lds
│ │ ├── enclave_debug.lds
│ │ ├── enclave_private.pem
│ │ ├── eparser.cpp
│ │ ├── first_match_parser.h
│ │ └── user_type.h
│ └── normal
│ │ ├── CMakeLists.txt
│ │ └── main.cpp
│ ├── generator
│ ├── CMakeLists.txt
│ └── main.cpp
│ └── plugin
│ ├── CMakeLists.txt
│ ├── person_reader.cpp
│ └── person_reader.h
├── hpda
├── CMakeLists.txt
├── src
│ ├── engine
│ │ ├── engine.cpp
│ │ └── functor.cpp
│ ├── extractor
│ │ ├── internal
│ │ │ └── https_request.cpp
│ │ └── paged_https_extractor.cpp
│ └── util
│ │ └── ntobject_helper.cpp
└── test
│ ├── CMakeLists.txt
│ ├── extractor
│ ├── test_https_extractor.cpp
│ └── test_paged_https_extractor.cpp
│ ├── gtest_main.cpp
│ ├── kmeans
│ ├── test_kmeans_iris.cpp
│ ├── test_kmeans_tuple.cpp
│ ├── test_loyd_tuple.cpp
│ ├── test_loyd_vector.cpp
│ ├── tuple_point.cpp
│ └── tuple_point.h
│ ├── processor
│ ├── test_all.cpp
│ ├── test_concat.cpp
│ ├── test_filter.cpp
│ ├── test_groupby.cpp
│ ├── test_json_to_data_batch.cpp
│ ├── test_set.cpp
│ ├── test_split.cpp
│ └── test_trim.cpp
│ └── test_basic.cpp
├── include
├── hpda
│ ├── algorithm
│ │ ├── algorithm.h
│ │ ├── internal
│ │ │ └── kmeans_loyd.h
│ │ └── kmeans.h
│ ├── common
│ │ ├── common.h
│ │ ├── processor_with_input.h
│ │ ├── processor_with_output.h
│ │ └── stream_policy.h
│ ├── engine
│ │ ├── engine.h
│ │ └── functor.h
│ ├── extractor
│ │ ├── extractor.h
│ │ ├── extractor_base.h
│ │ ├── internal
│ │ │ └── https_request.h
│ │ ├── paged_https_extractor.h
│ │ └── raw_data.h
│ ├── hpda.h
│ ├── output
│ │ ├── memory_output.h
│ │ ├── output.h
│ │ └── output_base.h
│ ├── processor
│ │ ├── processor.h
│ │ ├── processor_base.h
│ │ ├── query
│ │ │ └── filter.h
│ │ ├── set
│ │ │ ├── difference.h
│ │ │ ├── helper
│ │ │ │ ├── copy_helper.h
│ │ │ │ └── upper_stream_helper.h
│ │ │ ├── intersection.h
│ │ │ └── union.h
│ │ └── transform
│ │ │ ├── all.h
│ │ │ ├── concat.h
│ │ │ ├── group.h
│ │ │ ├── json_to_data_batch.h
│ │ │ ├── split.h
│ │ │ └── trim.h
│ └── util
│ │ └── ntobject_helper.h
├── toolkit
│ └── plugins
│ │ ├── csv
│ │ ├── csv.h
│ │ ├── csv_read_assign_helper.h
│ │ └── csv_reader.h
│ │ └── mysql
│ │ └── mysql_reader.h
├── xgboost
│ ├── .gitignore
│ ├── LICENSE
│ ├── Makefile
│ ├── README.md
│ ├── booster
│ │ ├── linear
│ │ │ └── xgboost_linear.hpp
│ │ ├── tree
│ │ │ ├── xgboost_base_treemaker.hpp
│ │ │ ├── xgboost_col_treemaker.hpp
│ │ │ ├── xgboost_row_treemaker.hpp
│ │ │ ├── xgboost_svdf_tree.hpp
│ │ │ ├── xgboost_tree.hpp
│ │ │ └── xgboost_tree_model.h
│ │ ├── xgboost-inl.hpp
│ │ ├── xgboost.h
│ │ ├── xgboost_data.h
│ │ └── xgboost_gbmbase.h
│ ├── regression
│ │ ├── xgboost_reg.h
│ │ ├── xgboost_reg_data.h
│ │ ├── xgboost_reg_eval.h
│ │ ├── xgboost_reg_main.cpp
│ │ └── xgboost_reg_task.h
│ └── utils
│ │ ├── xgboost_config.h
│ │ ├── xgboost_fmap.h
│ │ ├── xgboost_matrix_csr.h
│ │ ├── xgboost_omp.h
│ │ ├── xgboost_random.h
│ │ ├── xgboost_stream.h
│ │ └── xgboost_utils.h
└── ypc
│ ├── common
│ ├── access_policy.h
│ ├── byte.h
│ ├── byte
│ │ ├── base58.h
│ │ ├── base64.h
│ │ ├── bytes.h
│ │ ├── bytes_common.h
│ │ ├── bytes_util.h
│ │ └── fix_bytes.h
│ ├── crypto_prefix.h
│ ├── endian.h
│ ├── ignore.h
│ ├── limits.h
│ ├── parser_type.h
│ └── version.h
│ ├── core
│ ├── block_data_source.h
│ ├── blockfile.h
│ ├── byte.h
│ ├── command_executor.h
│ ├── configuration.h
│ ├── db.h
│ ├── filesystem.h
│ ├── memref.h
│ ├── ntjson.h
│ ├── ntobject_file.h
│ ├── poption_require.h
│ ├── privacy_data_reader.h
│ ├── ref.h
│ ├── sealed_file.h
│ ├── sgx
│ │ ├── parser_sgx_module.h
│ │ └── util
│ │ │ ├── cxxfile_bridge.h
│ │ │ ├── kv_bridge.h
│ │ │ └── util.h
│ ├── singleton.h
│ ├── status.def
│ ├── status.h
│ └── version.h
│ ├── core_t
│ ├── analyzer
│ │ ├── algo_wrapper.h
│ │ ├── analyzer_context.h
│ │ ├── data_source.h
│ │ ├── eparser_t_interface.h
│ │ ├── helper
│ │ │ ├── ecall_impl_helper.h
│ │ │ └── parser_type_traits.h
│ │ ├── interface
│ │ │ ├── algo_interface.h
│ │ │ ├── allowance_interface.h
│ │ │ ├── data_hash_interface.h
│ │ │ ├── data_interface.h
│ │ │ ├── do_parse_interface.h
│ │ │ ├── forward_interface.h
│ │ │ ├── keymgr_interface.h
│ │ │ ├── model_interface.h
│ │ │ └── parser_interface.h
│ │ ├── internal
│ │ │ ├── data_streams
│ │ │ │ ├── multi_data_stream.h
│ │ │ │ ├── noinput_data_stream.h
│ │ │ │ ├── raw_data_stream.h
│ │ │ │ └── sealed_data_stream.h
│ │ │ ├── is_multi_datasource.h
│ │ │ ├── is_param_encrypted.h
│ │ │ ├── keymgr_session.h
│ │ │ └── results
│ │ │ │ ├── forward_result.h
│ │ │ │ ├── local_result.h
│ │ │ │ ├── offchain_file_result.h
│ │ │ │ ├── offchain_result.h
│ │ │ │ └── onchain_result.h
│ │ ├── macro.h
│ │ ├── ntpackage_item_parser.h
│ │ ├── raw_data_provider.h
│ │ ├── sealed_data_provider.h
│ │ ├── to_type.h
│ │ ├── var
│ │ │ ├── data_hash_var.h
│ │ │ ├── data_source_var.h
│ │ │ ├── enclave_hash_var.h
│ │ │ ├── encrypted_param_var.h
│ │ │ ├── internal_key_var.h
│ │ │ ├── keymgr_var.h
│ │ │ ├── model_var.h
│ │ │ ├── parser_var.h
│ │ │ ├── request_key_var.h
│ │ │ └── result_var.h
│ │ └── yaenclave_t_interface.h
│ ├── ecommon
│ │ ├── package.h
│ │ └── signer_verify.h
│ ├── file
│ │ └── blockfile.h
│ └── util
│ │ ├── cxxfile.h
│ │ ├── file_openmode.h
│ │ ├── fpos.h
│ │ └── kv.h
│ ├── corecommon
│ ├── allowance.h
│ ├── blockfile
│ │ ├── blockfile_base.h
│ │ ├── blockfile_base_r.h
│ │ ├── blockfile_interface.h
│ │ ├── blockfile_v1.h
│ │ ├── blockfile_v2.h
│ │ └── traits.h
│ ├── crypto
│ │ ├── aes_gcm_traits.h
│ │ ├── crypto_pack.h
│ │ ├── example
│ │ │ ├── README.md
│ │ │ ├── aes_gcm.h
│ │ │ ├── ecc.h
│ │ │ ├── ecdh.h
│ │ │ └── eth_hash.h
│ │ ├── gmssl.h
│ │ ├── gmssl
│ │ │ ├── sm2_ecc.h
│ │ │ ├── sm3_hash.h
│ │ │ └── sm4_aes.h
│ │ ├── interface
│ │ │ ├── aes_impl.h
│ │ │ ├── ecc_impl.h
│ │ │ ├── ecdh_impl.h
│ │ │ ├── hash_impl.h
│ │ │ └── sign_impl.h
│ │ ├── stdeth.h
│ │ └── stdeth
│ │ │ ├── eth_hash.h
│ │ │ ├── rijndael128GCM.h
│ │ │ ├── secp256k1.h
│ │ │ ├── secp256k1.ipp
│ │ │ └── secp256k1_ecdh_sgx128.h
│ ├── data_source.h
│ ├── exceptions.h
│ ├── nt_cols.h
│ ├── package.h
│ └── to_type.h
│ ├── edl
│ ├── ecc.edl
│ ├── eparser.edl
│ ├── util
│ │ ├── file.edl
│ │ └── kv.edl
│ └── yaenclave.edl
│ ├── keymgr
│ ├── common
│ │ └── util.h
│ └── default
│ │ ├── ekeymgr.ipp
│ │ ├── enclave
│ │ ├── common.h
│ │ └── ekeymgr.edl
│ │ └── keymgr_sgx_module.h
│ ├── stbox
│ ├── ebyte.h
│ ├── exception.h
│ ├── gmssl
│ │ ├── aes.h
│ │ ├── asn1.h
│ │ ├── block_cipher.h
│ │ ├── endian.h
│ │ ├── gcm.h
│ │ ├── gf128.h
│ │ ├── hex.h
│ │ ├── mem.h
│ │ ├── oid.h
│ │ ├── sha2.h
│ │ ├── sm2.h
│ │ ├── sm3.h
│ │ └── sm4.h
│ ├── keccak
│ │ └── keccak.h
│ ├── scope_guard.h
│ ├── sgx_status.def
│ ├── stbox.edl
│ ├── stx_common.h
│ ├── stx_status.def
│ ├── stx_status.h
│ ├── tsgx
│ │ ├── channel
│ │ │ ├── dh_cdef.h
│ │ │ ├── dh_session.h
│ │ │ ├── dh_session_initiator.h
│ │ │ └── dh_session_responder.h
│ │ ├── crypto
│ │ │ ├── seal.h
│ │ │ └── seal_sgx.h
│ │ ├── log.h
│ │ ├── memory
│ │ │ ├── allocator.h
│ │ │ ├── memory_pool.h
│ │ │ └── pool_allocator.h
│ │ ├── ocall.h
│ │ ├── secp256k1
│ │ │ ├── secp256k1.h
│ │ │ ├── secp256k1_ecdh.h
│ │ │ ├── secp256k1_preallocated.h
│ │ │ └── secp256k1_recovery.h
│ │ └── util.h
│ └── usgx
│ │ ├── error_message.h
│ │ ├── sgx_module.h
│ │ └── sgx_module_function_object.ipp
│ ├── terminus
│ ├── crypto_pack.h
│ ├── enclave_interaction.h
│ ├── interaction.h
│ └── single_data_onchain_result.h
│ └── version.h
├── test
├── CMakeLists.txt
├── core
│ ├── CMakeLists.txt
│ ├── enclave
│ │ ├── CMakeLists.txt
│ │ ├── enclave.config.xml
│ │ ├── enclave.cpp
│ │ ├── enclave.edl
│ │ ├── enclave.lds
│ │ ├── enclave_debug.lds
│ │ └── enclave_private.pem
│ ├── file_enclave
│ │ ├── CMakeLists.txt
│ │ ├── enclave.config.xml
│ │ ├── enclave.lds
│ │ ├── enclave_basic.cpp
│ │ ├── enclave_debug.lds
│ │ ├── enclave_private.pem
│ │ ├── enclave_read.cpp
│ │ └── enclave_write.cpp
│ ├── gen_input_param.cpp
│ ├── gen_sign_for_ypc.cpp
│ ├── gtest_base58.cpp
│ ├── gtest_base64.cpp
│ ├── gtest_blockfile.cpp
│ ├── gtest_byte.cpp
│ ├── gtest_command_executor.cpp
│ ├── gtest_common.cpp
│ ├── gtest_common.h
│ ├── gtest_configuration.cpp
│ ├── gtest_core.cpp
│ ├── gtest_db.cpp
│ ├── gtest_filesystem.cpp
│ ├── gtest_ntjson.cpp
│ ├── gtest_ntobject_file.cpp
│ ├── gtest_sealed_file.cpp
│ ├── gtest_sgx_blockfile.cpp
│ ├── main.cpp
│ ├── test_ypc_module.cpp
│ └── test_ypc_module.h
├── crypto
│ ├── CMakeLists.txt
│ ├── enclave
│ │ ├── CMakeLists.txt
│ │ ├── enclave.config.xml
│ │ ├── enclave.cpp
│ │ ├── enclave.edl
│ │ ├── enclave.lds
│ │ ├── enclave_debug.lds
│ │ └── enclave_private.pem
│ ├── gtest_crypto.cpp
│ ├── gtest_gmssl.cpp
│ ├── main.cpp
│ ├── test_crypto_module.cpp
│ └── test_crypto_module.h
├── integrate
│ ├── CMakeLists.txt
│ ├── classic_job.py
│ ├── classify_job.py
│ ├── common.py
│ ├── commonjs.py
│ ├── data_host.py
│ ├── job_step.py
│ ├── js
│ │ ├── blockfile.js
│ │ ├── dataprovider.js
│ │ ├── package.json
│ │ ├── simdataprovider.js
│ │ ├── simjs.js
│ │ ├── ypccrypto.js
│ │ └── ypcntobject.js
│ ├── multistream_job.py
│ ├── multistream_job_offchain.py
│ ├── prepare.py
│ ├── project.py.in
│ ├── test_findperson.py
│ ├── test_findperson_multi.py
│ ├── test_findperson_multi_offchain.py
│ ├── test_iris.py
│ └── test_iris_classifier.py
├── keymgr
│ ├── CMakeLists.txt
│ ├── gtest_enclave.cpp
│ └── main.cpp
└── toolkit
│ ├── CMakeLists.txt
│ └── plugins
│ ├── CMakeLists.txt
│ ├── csv
│ ├── CMakeLists.txt
│ ├── main.cpp
│ └── test1.csv
│ └── mysql
│ ├── CMakeLists.txt
│ └── main.cpp
├── toolkit
├── CMakeLists.txt
├── analyzer
│ ├── CMakeLists.txt
│ ├── db
│ │ ├── db.cpp
│ │ └── db.h
│ ├── iodef.h
│ ├── main.cpp
│ ├── parsers
│ │ ├── parser.cpp
│ │ └── parser.h
│ ├── sgx_bridge.cpp
│ └── sgx_bridge.h
├── datahub
│ ├── CMakeLists.txt
│ ├── main.cpp
│ └── unseal.cpp
├── plugins
│ └── plugen.py
├── terminus
│ ├── CMakeLists.txt
│ ├── cmd
│ │ ├── CMakeLists.txt
│ │ └── cterminus
│ │ │ ├── CMakeLists.txt
│ │ │ ├── allowance.cpp
│ │ │ ├── cmd_line.cpp
│ │ │ ├── cmd_line.h
│ │ │ ├── crypto.cpp
│ │ │ ├── forward.cpp
│ │ │ ├── gen_key.cpp
│ │ │ ├── helper.cpp
│ │ │ ├── main.cpp
│ │ │ ├── relay.cpp
│ │ │ ├── request.cpp
│ │ │ └── sign.cpp
│ ├── lib
│ │ ├── CMakeLists.txt
│ │ ├── src
│ │ │ ├── CMakeLists.txt
│ │ │ ├── crypto_pack.cpp
│ │ │ ├── enclave_interaction.cpp
│ │ │ └── single_data_onchain_result.cpp
│ │ └── test
│ │ │ ├── CMakeLists.txt
│ │ │ ├── gtest_intel_sgx.cpp
│ │ │ └── main.cpp
│ └── python
│ │ ├── CMakeLists.txt
│ │ └── module.cpp
├── verifier
│ ├── CMakeLists.txt
│ └── dian_pubkey_verifier
└── ydump
│ ├── CMakeLists.txt
│ ├── main.cpp
│ └── nouse_bridge.cpp
├── vendor
└── keccak
│ ├── keccak.c
│ └── keccak.h
└── ypc
├── CMakeLists.txt
├── common
├── CMakeLists.txt
├── README.md
├── byte
│ ├── base58.cpp
│ └── base64.cpp
└── version.cpp
├── core
├── CMakeLists.txt
└── src
│ ├── CMakeLists.txt
│ ├── core
│ ├── CMakeLists.txt
│ ├── command_executor.cpp
│ ├── configuration.cpp
│ ├── crypto
│ │ ├── CMakeLists.txt
│ │ ├── gmssl
│ │ │ ├── CMakeLists.txt
│ │ │ ├── sm2_ecc.cpp
│ │ │ └── sm4_aes.cpp
│ │ └── stdeth
│ │ │ ├── CMakeLists.txt
│ │ │ ├── openssl.cpp
│ │ │ ├── openssl.h
│ │ │ ├── rijndael128GCM.cpp
│ │ │ ├── secp256k1.cpp
│ │ │ ├── secp256k1_ecdh_sgx128.cpp
│ │ │ └── zallocator.h
│ ├── db.cpp
│ ├── filesystem.cpp
│ ├── poption_require.cpp
│ ├── privacy_data_reader.cpp
│ ├── sealed_file.cpp
│ ├── sgx
│ │ ├── CMakeLists.txt
│ │ ├── parser_sgx_module.cpp
│ │ └── util
│ │ │ ├── cxxfile_bridge.cpp
│ │ │ ├── kv_bridge.cpp
│ │ │ └── util.cpp
│ ├── status.cpp
│ └── version.cpp
│ ├── core_t
│ ├── CMakeLists.txt
│ ├── analyzer
│ │ ├── CMakeLists.txt
│ │ ├── analyzer_version.cpp
│ │ ├── internal
│ │ │ └── keymgr_session.cpp
│ │ └── var
│ │ │ └── enclave_hash_var.cpp
│ ├── crypto
│ │ ├── CMakeLists.txt
│ │ ├── gmssl
│ │ │ ├── CMakeLists.txt
│ │ │ ├── sm2_ecc.cpp
│ │ │ └── sm4_aes.cpp
│ │ └── stdeth
│ │ │ ├── CMakeLists.txt
│ │ │ ├── rijndael128GCM.cpp
│ │ │ ├── secp256k1.cpp
│ │ │ └── secp256k1_ecdh_sgx128.cpp
│ ├── ecommon
│ │ ├── package.cpp
│ │ └── signer_verify.cpp
│ ├── sgx_ecc
│ │ ├── CMakeLists.txt
│ │ ├── ecc_impl.ipp
│ │ ├── gmssl_ecc_impl.cpp
│ │ └── stdeth_ecc_impl.cpp
│ └── util
│ │ ├── CMakeLists.txt
│ │ ├── cxxfile.cpp
│ │ └── kv.cpp
│ └── corecommon
│ └── crypto
│ ├── eth_hash.cpp
│ └── sm3_hash.cpp
├── keymgr
├── CMakeLists.txt
├── common
│ ├── CMakeLists.txt
│ └── util.cpp
└── default
│ ├── CMakeLists.txt
│ ├── enclave
│ ├── CMakeLists.txt
│ ├── ekeymgr.config.debug.xml
│ ├── ekeymgr.config.xml
│ ├── ekeymgr.cpp
│ ├── ekeymgr.lds
│ ├── ekeymgr_debug.lds
│ └── ekeymgr_private.pem
│ ├── gmssl
│ ├── CMakeLists.txt
│ └── ekeymgr.cpp
│ ├── keymgr_sgx_module.cpp
│ ├── main.cpp
│ └── no_use_extra_data_bridge.cpp
└── stbox
├── CMakeLists.txt
└── src
├── CMakeLists.txt
├── exception.cpp
├── gmssl
├── CMakeLists.txt
├── aes.c
├── aes_modes.c
├── asn1.c
├── block_cipher.c
├── gcm.c
├── gf128.c
├── hex.c
├── sha256.c
├── sm2_alg.c
├── sm2_key.c
├── sm2_lib.c
├── sm3.c
├── sm4_common.c
├── sm4_enc.c
├── sm4_lcl.h
├── sm4_modes.c
└── sm4_setkey.c
├── keccak
├── CMakeLists.txt
└── keccak.c
├── stx_common.cpp
├── stx_status.cpp
├── tsgx
├── CMakeLists.txt
├── channel
│ ├── CMakeLists.txt
│ ├── dh_session.cpp
│ ├── dh_session_initiator.cpp
│ └── dh_session_responder.cpp
├── crypto
│ ├── CMakeLists.txt
│ └── seal_sgx.cpp
├── log.cpp
├── secp256k1
│ ├── CMakeLists.txt
│ ├── asm
│ │ └── field_10x26_arm.s
│ ├── basic-config.h
│ ├── ecdsa.h
│ ├── ecdsa_impl.h
│ ├── eckey.h
│ ├── eckey_impl.h
│ ├── ecmult.h
│ ├── ecmult_const.h
│ ├── ecmult_const_impl.h
│ ├── ecmult_gen.h
│ ├── ecmult_gen_impl.h
│ ├── ecmult_impl.h
│ ├── ecmult_static_context.h
│ ├── field.h
│ ├── field_10x26.h
│ ├── field_10x26_impl.h
│ ├── field_5x52.h
│ ├── field_5x52_asm_impl.h
│ ├── field_5x52_impl.h
│ ├── field_5x52_int128_impl.h
│ ├── field_impl.h
│ ├── gen_context.c
│ ├── group.h
│ ├── group_impl.h
│ ├── hash.h
│ ├── hash_impl.h
│ ├── java
│ │ ├── .deps
│ │ │ ├── libsecp256k1_jni_la-org_bitcoin_NativeSecp256k1.Plo
│ │ │ └── libsecp256k1_jni_la-org_bitcoin_Secp256k1Context.Plo
│ │ ├── org
│ │ │ └── bitcoin
│ │ │ │ ├── NativeSecp256k1.java
│ │ │ │ ├── NativeSecp256k1Test.java
│ │ │ │ ├── NativeSecp256k1Util.java
│ │ │ │ └── Secp256k1Context.java
│ │ ├── org_bitcoin_NativeSecp256k1.c
│ │ ├── org_bitcoin_NativeSecp256k1.h
│ │ ├── org_bitcoin_Secp256k1Context.c
│ │ └── org_bitcoin_Secp256k1Context.h
│ ├── libsecp256k1-config.h
│ ├── libsecp256k1-config.h.in
│ ├── modules
│ │ ├── ecdh
│ │ │ ├── Makefile.am.include
│ │ │ ├── main_impl.h
│ │ │ └── tests_impl.h
│ │ └── recovery
│ │ │ ├── Makefile.am.include
│ │ │ ├── main_impl.h
│ │ │ └── tests_impl.h
│ ├── num.h
│ ├── num_gmp.h
│ ├── num_gmp_impl.h
│ ├── num_impl.h
│ ├── scalar.h
│ ├── scalar_4x64.h
│ ├── scalar_4x64_impl.h
│ ├── scalar_8x32.h
│ ├── scalar_8x32_impl.h
│ ├── scalar_impl.h
│ ├── scalar_low.h
│ ├── scalar_low_impl.h
│ ├── scratch.h
│ ├── scratch_impl.h
│ ├── secp256k1.c
│ ├── stamp-h1
│ └── util.h
├── stx_common_trusted.cpp
└── util.cpp
└── usgx
├── error_message.cpp
├── sgx_module.cpp
└── stx_common_untrusted.cpp
/.clang-tidy:
--------------------------------------------------------------------------------
1 | ---
2 | WarningsAsErrors: '*'
3 | HeaderFilterRegex: 'include/ypc/.*(?
2 | 0
3 | 0
4 | 0x40000
5 | 0x400000
6 | 10
7 | 1
8 |
9 | 0
10 | 0
11 | 0xFFFFFFFF
12 |
13 |
--------------------------------------------------------------------------------
/example/iris/analyzer/enclave/enclave.config.xml:
--------------------------------------------------------------------------------
1 |
2 | 0
3 | 0
4 | 0x40000
5 | 0x400000
6 | 10
7 | 1
8 |
9 | 1
10 | 0
11 | 0xFFFFFFFF
12 |
13 |
--------------------------------------------------------------------------------
/example/iris/analyzer/enclave/enclave.lds:
--------------------------------------------------------------------------------
1 | enclave.so
2 | {
3 | global:
4 | g_global_data_sim;
5 | g_global_data;
6 | enclave_entry;
7 | g_peak_heap_used;
8 | g_peak_rsrv_mem_committed;
9 | local:
10 | *;
11 | };
12 |
--------------------------------------------------------------------------------
/example/iris/analyzer/enclave/enclave_debug.lds:
--------------------------------------------------------------------------------
1 | enclave.so
2 | {
3 | global:
4 | g_global_data_sim;
5 | g_global_data;
6 | enclave_entry;
7 | g_peak_heap_used;
8 | g_peak_rsrv_mem_committed;
9 | local:
10 | *;
11 | };
12 |
--------------------------------------------------------------------------------
/example/iris/analyzer/enclave/eparser.cpp:
--------------------------------------------------------------------------------
1 | #include "enclave_iris_parser.h"
2 | #include "ypc/core_t/analyzer/algo_wrapper.h"
3 | #include "ypc/core_t/analyzer/macro.h"
4 | #include "ypc/corecommon/crypto/gmssl.h"
5 | #include "ypc/corecommon/crypto/stdeth.h"
6 | #include "ypc/core_t/analyzer/interface/allowance_interface.h"
7 |
8 | using Crypto = ypc::crypto::eth_sgx_crypto;
9 | // using Crypto = ypc::crypto::gmssl_sgx_crypto;
10 |
11 | ypc::algo_wrapper, void, ypc::check_data_allowance>
13 | pw;
14 |
15 | YPC_PARSER_IMPL(pw);
16 |
--------------------------------------------------------------------------------
/example/iris/analyzer/enclave/user_type.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 | #include
3 | #include
4 | #include
5 |
6 | define_nt(sepal_len, double);
7 | define_nt(sepal_wid, double);
8 | define_nt(petal_len, double);
9 | define_nt(petal_wid, double);
10 | define_nt(species, std::string);
11 |
12 | typedef ff::net::ntpackage<0, sepal_len, sepal_wid, petal_len, petal_wid>
13 | iris_data_t;
14 | define_nt(iris_data, iris_data_t);
15 |
16 | typedef ff::util::ntobject iris_item_t;
17 | typedef iris_item_t user_item_t;
18 |
19 |
--------------------------------------------------------------------------------
/example/iris/analyzer/enclave_for_offchain/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | set(T_SRCS eparser.cpp )
2 |
3 | add_ypc_applet(iris_parser_for_offchain
4 | CRYPTO stdeth
5 | SRCS ${T_SRCS}
6 | )
7 |
8 | enclave_sign(iris_parser_for_offchain KEY enclave_private.pem
9 | CONFIG enclave.config.xml)
10 |
--------------------------------------------------------------------------------
/example/iris/analyzer/enclave_for_offchain/enclave.config.xml:
--------------------------------------------------------------------------------
1 |
2 | 0
3 | 0
4 | 0x40000
5 | 0x400000
6 | 10
7 | 1
8 |
9 | 1
10 | 0
11 | 0xFFFFFFFF
12 |
13 |
--------------------------------------------------------------------------------
/example/iris/analyzer/enclave_for_offchain/enclave_debug.lds:
--------------------------------------------------------------------------------
1 | enclave.so
2 | {
3 | global:
4 | g_global_data_sim;
5 | g_global_data;
6 | enclave_entry;
7 | g_peak_heap_used;
8 | g_peak_rsrv_mem_committed;
9 | local:
10 | *;
11 | };
12 |
--------------------------------------------------------------------------------
/example/iris/analyzer/enclave_for_offchain/eparser.cpp:
--------------------------------------------------------------------------------
1 | #include "../enclave/enclave_iris_parser.h"
2 | #include "ypc/core_t/analyzer/algo_wrapper.h"
3 | #include "ypc/core_t/analyzer/macro.h"
4 | #include "ypc/corecommon/crypto/stdeth.h"
5 | #include "ypc/core_t/analyzer/interface/allowance_interface.h"
6 |
7 | ypc::algo_wrapper, void, ypc::check_data_allowance>
10 | pw;
11 |
12 | YPC_PARSER_IMPL(pw);
13 |
14 |
--------------------------------------------------------------------------------
/example/iris/classifier/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | add_subdirectory(enclave)
2 | add_executable(iris_gen_model main.cpp)
3 | target_link_libraries(iris_gen_model core)
4 |
5 | add_executable(iris_gen_classify_input input.cpp)
6 | target_link_libraries(iris_gen_classify_input core boost_program_options)
7 | target_include_directories(iris_gen_classify_input PUBLIC
8 | "$"
9 | "$"
10 | "$"
11 | )
12 |
--------------------------------------------------------------------------------
/example/iris/classifier/enclave/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | set(T_SRCS eparser.cpp )
2 |
3 | add_ypc_applet(iris_classifier
4 | CRYPTO stdeth
5 | SRCS ${T_SRCS})
6 |
7 | if(SGX_MODE STREQUAL "Debug")
8 | enclave_sign(iris_classifier KEY enclave_private.pem
9 | CONFIG enclave.config.debug.xml)
10 | else()
11 | enclave_sign(iris_classifier KEY enclave_private.pem
12 | CONFIG enclave.config.xml)
13 | endif()
14 |
15 |
--------------------------------------------------------------------------------
/example/iris/classifier/enclave/enclave.config.debug.xml:
--------------------------------------------------------------------------------
1 |
2 | 0
3 | 0
4 | 0x40000
5 | 0x400000
6 | 10
7 | 1
8 |
9 | 0
10 | 0
11 | 0xFFFFFFFF
12 |
13 |
--------------------------------------------------------------------------------
/example/iris/classifier/enclave/enclave.config.xml:
--------------------------------------------------------------------------------
1 |
2 | 0
3 | 0
4 | 0x40000
5 | 0x400000
6 | 10
7 | 1
8 |
9 | 1
10 | 0
11 | 0xFFFFFFFF
12 |
13 |
--------------------------------------------------------------------------------
/example/iris/classifier/enclave/enclave.lds:
--------------------------------------------------------------------------------
1 | enclave.so
2 | {
3 | global:
4 | g_global_data_sim;
5 | g_global_data;
6 | enclave_entry;
7 | g_peak_heap_used;
8 | g_peak_rsrv_mem_committed;
9 | local:
10 | *;
11 | };
12 |
--------------------------------------------------------------------------------
/example/iris/classifier/enclave/enclave_debug.lds:
--------------------------------------------------------------------------------
1 | enclave.so
2 | {
3 | global:
4 | g_global_data_sim;
5 | g_global_data;
6 | enclave_entry;
7 | g_peak_heap_used;
8 | g_peak_rsrv_mem_committed;
9 | local:
10 | *;
11 | };
12 |
--------------------------------------------------------------------------------
/example/iris/classifier/enclave/eparser.cpp:
--------------------------------------------------------------------------------
1 | #include "enclave_iris_classifier.h"
2 | #include "ypc/core_t/analyzer/algo_wrapper.h"
3 | #include "ypc/core_t/analyzer/macro.h"
4 | #include "ypc/corecommon/crypto/stdeth.h"
5 |
6 | // ypc::algo_wrapper
8 | // pw;
9 |
10 | ypc::algo_wrapper
13 | pw;
14 |
15 | YPC_PARSER_IMPL(pw);
16 |
--------------------------------------------------------------------------------
/example/iris/classifier/main.cpp:
--------------------------------------------------------------------------------
1 | #include "model.h"
2 | #include "ypc/core/byte.h"
3 | #include "ypc/corecommon/package.h"
4 | #include
5 |
6 | int main(int argc, char *argv[]) {
7 |
8 | means_t model;
9 | std::vector means;
10 |
11 | mean_t m1;
12 | iris_data_t md1;
13 | md1.set(5.004082, 3.416327,
14 | 1.465306, 0.244898);
15 |
16 | m1.set("setosa", md1, 0);
17 | means.push_back(m1.make_copy());
18 |
19 | md1.set(5.883607, 2.740984,
20 | 4.388525, 1.434426);
21 | m1.set("versicolor", md1.make_copy(), 0);
22 | means.push_back(m1.make_copy());
23 |
24 | md1.set(6.864864, 3.067567,
25 | 5.735135, 2.059460);
26 | m1.set("virginica", md1.make_copy(), 0);
27 | means.push_back(m1.make_copy());
28 |
29 | model.set(means);
30 | typename ypc::cast_obj_to_package::type pkg = model;
31 | auto ret = ypc::make_bytes::for_package(pkg);
32 | std::cout << ret;
33 |
34 | return 0;
35 | }
36 |
--------------------------------------------------------------------------------
/example/iris/classifier/user_type.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 | #include
3 | #include
4 | #include
5 |
6 | define_nt(sepal_len, double);
7 | define_nt(sepal_wid, double);
8 | define_nt(petal_len, double);
9 | define_nt(petal_wid, double);
10 | define_nt(species, std::string);
11 |
12 | typedef ff::net::ntpackage<0, sepal_len, sepal_wid, petal_len, petal_wid>
13 | iris_data_t;
14 | define_nt(iris_data, iris_data_t);
15 |
16 | typedef ff::util::ntobject iris_item_t;
17 | typedef iris_item_t user_item_t;
18 |
19 |
--------------------------------------------------------------------------------
/example/iris/iris/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | #project(iris)
2 | #cmake_minimum_required(VERSION 3.9.3)
3 | add_definitions(-std=c++11)
4 | #include_directories(${PROJECT_SOURCE_DIR})
5 | add_subdirectory(reader)
6 |
--------------------------------------------------------------------------------
/example/iris/iris/output/user_type.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 | #include
3 | #include
4 | define_nt(sepal_len, double);
5 | define_nt(sepal_wid, double);
6 | define_nt(petal_len, double);
7 | define_nt(petal_wid, double);
8 | define_nt(species, std::string);
9 | typedef ff::util::ntobject iris_item_t;
10 |
--------------------------------------------------------------------------------
/example/iris/iris/reader/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | add_library(iris_reader SHARED reader.cpp)
2 | target_link_libraries(iris_reader pthread ff_net)
3 | target_include_directories(iris_reader PUBLIC
4 | "$"
5 | "$"
6 | "$"
7 | )
8 | target_link_directories(iris_reader PUBLIC ${FF_LIB_DIR})
9 |
--------------------------------------------------------------------------------
/example/iris/iris/reader/reader.cpp:
--------------------------------------------------------------------------------
1 | #include "../output/user_type.h"
2 | #include "toolkit/plugins/csv/csv_reader.h"
3 | typedef ypc::plugins::typed_csv_reader iris_reader_t;
4 | impl_csv_reader(iris_reader_t)
5 |
--------------------------------------------------------------------------------
/example/iris/plugin/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | add_library(iris_reader
2 | SHARED
3 | iris_reader.cpp)
4 |
--------------------------------------------------------------------------------
/example/iris/plugin/iris_reader.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 | #include
3 | #ifdef __cplusplus
4 | extern "C" {
5 | #endif
6 |
7 | void *create_item_reader(const char *file_path, int len);
8 |
9 | int reset_for_read(void *handle);
10 | int read_item_data(void *handle, char *buf, int *len);
11 | int close_item_reader(void *handle);
12 | uint64_t get_item_number(void *handle);
13 |
14 | #ifdef __cplusplus
15 | }
16 | #endif
17 |
--------------------------------------------------------------------------------
/example/multi_personlist/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | add_subdirectory(generator)
2 | add_subdirectory(first_match/enclave)
3 | add_subdirectory(first_match/enclave_for_offchain)
4 | add_subdirectory(first_match/normal)
5 |
--------------------------------------------------------------------------------
/example/multi_personlist/common.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 | #include "common_t.h"
3 | #include "ypc/core/blockfile.h"
4 | typedef ypc::blockfile<0x82, 2, 1024 * 1024, 256 * 64 * 1024> file_t;
5 |
--------------------------------------------------------------------------------
/example/multi_personlist/first_match/enclave/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | set(T_SRCS eparser.cpp)
2 |
3 | add_ypc_applet(person_first_match_multi
4 | CRYPTO stdeth
5 | SRCS ${T_SRCS})
6 |
7 | if(SGX_MODE STREQUAL "Debug")
8 | enclave_sign(person_first_match_multi KEY enclave_private.pem
9 | CONFIG enclave.config.debug.xml)
10 | else()
11 | enclave_sign(person_first_match_multi KEY enclave_private.pem
12 | CONFIG enclave.config.xml)
13 | endif()
14 |
--------------------------------------------------------------------------------
/example/multi_personlist/first_match/enclave/enclave.config.debug.xml:
--------------------------------------------------------------------------------
1 |
2 | 0
3 | 0
4 | 0x50000
5 | 0x5000000
6 | 10
7 | 1
8 |
9 | 0
10 | 0
11 | 0xFFFFFFFF
12 |
13 |
--------------------------------------------------------------------------------
/example/multi_personlist/first_match/enclave/enclave.config.xml:
--------------------------------------------------------------------------------
1 |
2 | 0
3 | 0
4 | 0x50000
5 | 0x5000000
6 | 10
7 | 1
8 |
9 | 1
10 | 0
11 | 0xFFFFFFFF
12 |
13 |
--------------------------------------------------------------------------------
/example/multi_personlist/first_match/enclave/enclave.lds:
--------------------------------------------------------------------------------
1 | enclave.so
2 | {
3 | global:
4 | g_global_data_sim;
5 | g_global_data;
6 | enclave_entry;
7 | g_peak_heap_used;
8 | g_peak_rsrv_mem_committed;
9 | local:
10 | *;
11 | };
12 |
--------------------------------------------------------------------------------
/example/multi_personlist/first_match/enclave/enclave_debug.lds:
--------------------------------------------------------------------------------
1 | enclave.so
2 | {
3 | global:
4 | g_global_data_sim;
5 | g_global_data;
6 | enclave_entry;
7 | g_peak_heap_used;
8 | g_peak_rsrv_mem_committed;
9 | local:
10 | *;
11 | };
12 |
--------------------------------------------------------------------------------
/example/multi_personlist/first_match/enclave/eparser.cpp:
--------------------------------------------------------------------------------
1 | #include "first_match_parser.h"
2 | #include "ypc/core_t/analyzer/algo_wrapper.h"
3 | #include "ypc/core_t/analyzer/macro.h"
4 | #include "ypc/corecommon/crypto/stdeth.h"
5 |
6 | ypc::algo_wrapper, void,
9 | ypc::check_data_allowance>
10 | pw;
11 |
12 | YPC_PARSER_IMPL(pw);
13 |
--------------------------------------------------------------------------------
/example/multi_personlist/first_match/enclave/user_type.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 | #include "../../common_t.h"
3 | #include
4 | #include
5 | #include
6 |
7 | typedef row_t user_item_t;
8 |
--------------------------------------------------------------------------------
/example/multi_personlist/first_match/enclave_for_offchain/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | set(T_SRCS eparser.cpp)
2 |
3 | add_ypc_applet(person_first_match_multi_offchain
4 | CRYPTO stdeth
5 | SRCS ${T_SRCS})
6 |
7 | if(SGX_MODE STREQUAL "Debug")
8 | enclave_sign(person_first_match_multi_offchain KEY enclave_private.pem
9 | CONFIG enclave.config.debug.xml)
10 | else()
11 | enclave_sign(person_first_match_multi_offchain KEY enclave_private.pem
12 | CONFIG enclave.config.xml)
13 | endif()
14 |
--------------------------------------------------------------------------------
/example/multi_personlist/first_match/enclave_for_offchain/enclave.config.debug.xml:
--------------------------------------------------------------------------------
1 |
2 | 0
3 | 0
4 | 0x50000
5 | 0x5000000
6 | 10
7 | 1
8 |
9 | 0
10 | 0
11 | 0xFFFFFFFF
12 |
13 |
--------------------------------------------------------------------------------
/example/multi_personlist/first_match/enclave_for_offchain/enclave.config.xml:
--------------------------------------------------------------------------------
1 |
2 | 0
3 | 0
4 | 0x50000
5 | 0x5000000
6 | 10
7 | 1
8 |
9 | 1
10 | 0
11 | 0xFFFFFFFF
12 |
13 |
--------------------------------------------------------------------------------
/example/multi_personlist/first_match/enclave_for_offchain/enclave.lds:
--------------------------------------------------------------------------------
1 | enclave.so
2 | {
3 | global:
4 | g_global_data_sim;
5 | g_global_data;
6 | enclave_entry;
7 | g_peak_heap_used;
8 | g_peak_rsrv_mem_committed;
9 | local:
10 | *;
11 | };
12 |
--------------------------------------------------------------------------------
/example/multi_personlist/first_match/enclave_for_offchain/enclave_debug.lds:
--------------------------------------------------------------------------------
1 | enclave.so
2 | {
3 | global:
4 | g_global_data_sim;
5 | g_global_data;
6 | enclave_entry;
7 | g_peak_heap_used;
8 | g_peak_rsrv_mem_committed;
9 | local:
10 | *;
11 | };
12 |
--------------------------------------------------------------------------------
/example/multi_personlist/first_match/enclave_for_offchain/eparser.cpp:
--------------------------------------------------------------------------------
1 | #include "../enclave/first_match_parser.h"
2 | #include "ypc/core_t/analyzer/algo_wrapper.h"
3 | #include "ypc/core_t/analyzer/macro.h"
4 | #include "ypc/corecommon/crypto/stdeth.h"
5 |
6 | ypc::algo_wrapper, void,
9 | ypc::check_data_allowance>
10 | pw;
11 |
12 | YPC_PARSER_IMPL(pw);
13 |
--------------------------------------------------------------------------------
/example/multi_personlist/first_match/normal/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | #add_executable(find_person_multi main.cpp)
2 | #target_link_libraries(find_person_multi ypc_core stbox_common_u ff_net hpda pthread)
3 |
--------------------------------------------------------------------------------
/example/multi_personlist/first_match/normal/main.cpp:
--------------------------------------------------------------------------------
1 | #include "../../common.h"
2 | #include "ypc/common/ignore.h"
3 | #include "ypc/core/block_data_source.h"
4 | #include "ypc/stbox/ebyte.h"
5 | #define EXAMPLE_FM_NORMAL
6 | #include "../enclave/first_match_parser.h"
7 | #undef EXAMPLE_FM_NORMAL
8 |
9 | int main(int argc, char *argv[]) {
10 | std::string fp = "person_list";
11 | ypc::bytes param("421003198607263380");
12 | file_t ssf;
13 | ssf.open_for_read(fp.c_str());
14 | ypc::block_data_source sds(&ssf);
15 | first_match_parser fmp(&sds);
16 | fmp.do_parse(param);
17 | return 0;
18 | }
19 |
--------------------------------------------------------------------------------
/example/multi_personlist/generator/CMakeLists.txt:
--------------------------------------------------------------------------------
1 |
2 |
3 | add_executable(personlist_gen_multi main.cpp)
4 |
5 | target_link_libraries(personlist_gen_multi ff_net core)
6 | target_link_directories(personlist_gen_multi PUBLIC ${FF_LIB_DIR})
7 |
--------------------------------------------------------------------------------
/example/personlist/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | add_subdirectory(generator)
2 | add_subdirectory(plugin)
3 | add_subdirectory(first_match/enclave)
4 | add_subdirectory(first_match/normal)
5 |
--------------------------------------------------------------------------------
/example/personlist/common.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 | #include "common_t.h"
3 | #include "ypc/core/blockfile.h"
4 | typedef ypc::blockfile<0x82, 2, 1024 * 1024, 256 * 64 * 1024> file_t;
5 |
--------------------------------------------------------------------------------
/example/personlist/first_match/enclave/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | set(T_SRCS eparser.cpp)
2 |
3 | add_ypc_applet(person_first_match
4 | CRYPTO stdeth
5 | SRCS ${T_SRCS})
6 |
7 | if(SGX_MODE STREQUAL "Debug")
8 | enclave_sign(person_first_match KEY enclave_private.pem
9 | CONFIG enclave.config.debug.xml)
10 | else()
11 | enclave_sign(person_first_match KEY enclave_private.pem
12 | CONFIG enclave.config.xml)
13 | endif()
14 |
--------------------------------------------------------------------------------
/example/personlist/first_match/enclave/enclave.config.debug.xml:
--------------------------------------------------------------------------------
1 |
2 | 0
3 | 0
4 | 0x50000
5 | 0x5000000
6 | 10
7 | 1
8 |
9 | 0
10 | 0
11 | 0xFFFFFFFF
12 |
13 |
--------------------------------------------------------------------------------
/example/personlist/first_match/enclave/enclave.config.xml:
--------------------------------------------------------------------------------
1 |
2 | 0
3 | 0
4 | 0x50000
5 | 0x5000000
6 | 10
7 | 1
8 |
9 | 1
10 | 0
11 | 0xFFFFFFFF
12 |
13 |
--------------------------------------------------------------------------------
/example/personlist/first_match/enclave/enclave.lds:
--------------------------------------------------------------------------------
1 | enclave.so
2 | {
3 | global:
4 | g_global_data_sim;
5 | g_global_data;
6 | enclave_entry;
7 | g_peak_heap_used;
8 | g_peak_rsrv_mem_committed;
9 | local:
10 | *;
11 | };
12 |
--------------------------------------------------------------------------------
/example/personlist/first_match/enclave/enclave_debug.lds:
--------------------------------------------------------------------------------
1 | enclave.so
2 | {
3 | global:
4 | g_global_data_sim;
5 | g_global_data;
6 | enclave_entry;
7 | g_peak_heap_used;
8 | g_peak_rsrv_mem_committed;
9 | local:
10 | *;
11 | };
12 |
--------------------------------------------------------------------------------
/example/personlist/first_match/enclave/eparser.cpp:
--------------------------------------------------------------------------------
1 | #include "first_match_parser.h"
2 | #include "ypc/core_t/analyzer/algo_wrapper.h"
3 | #include "ypc/core_t/analyzer/macro.h"
4 | #include "ypc/corecommon/crypto/stdeth.h"
5 |
6 | ypc::algo_wrapper>
9 | pw;
10 |
11 | YPC_PARSER_IMPL(pw);
12 |
--------------------------------------------------------------------------------
/example/personlist/first_match/enclave/user_type.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 | #include "../../common_t.h"
3 | #include
4 | #include
5 | #include
6 |
7 | typedef row_t user_item_t;
8 |
--------------------------------------------------------------------------------
/example/personlist/first_match/normal/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | add_executable(find_person main.cpp)
2 | target_link_libraries(find_person core stbox_common ff_net hpda)
3 | target_link_directories(find_person PUBLIC ${FF_LIB_DIR})
4 |
--------------------------------------------------------------------------------
/example/personlist/first_match/normal/main.cpp:
--------------------------------------------------------------------------------
1 | #include "../../common.h"
2 | #include "ypc/common/ignore.h"
3 | #include "ypc/core/block_data_source.h"
4 | #include "ypc/stbox/ebyte.h"
5 | #define EXAMPLE_FM_NORMAL
6 | #include "../enclave/first_match_parser.h"
7 | #undef EXAMPLE_FM_NORMAL
8 |
9 | int main(int argc, char *argv[]) {
10 | std::string fp = "person_list";
11 | ypc::bytes param("421003198607263380");
12 | file_t ssf;
13 | ssf.open_for_read(fp.c_str());
14 | ypc::block_data_source sds(&ssf);
15 | first_match_parser fmp(&sds);
16 | fmp.do_parse(param);
17 | return 0;
18 | }
19 |
--------------------------------------------------------------------------------
/example/personlist/generator/CMakeLists.txt:
--------------------------------------------------------------------------------
1 |
2 |
3 | add_executable(personlist_gen main.cpp)
4 |
5 | target_link_libraries(personlist_gen ff_net core)
6 | target_link_directories(personlist_gen PUBLIC ${FF_LIB_DIR})
7 |
--------------------------------------------------------------------------------
/example/personlist/plugin/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | add_library(person_reader
2 | SHARED
3 | person_reader.cpp)
4 |
5 | target_link_libraries(person_reader core)
6 |
--------------------------------------------------------------------------------
/example/personlist/plugin/person_reader.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 | #include
3 | #ifdef __cplusplus
4 | extern "C" {
5 | #endif
6 |
7 | void *create_item_reader(const char *file_path, int len);
8 |
9 | int reset_for_read(void *handle);
10 | int read_item_data(void *handle, char *buf, int *len);
11 | int close_item_reader(void *handle);
12 | uint64_t get_item_number(void *handle);
13 |
14 | #ifdef __cplusplus
15 | }
16 | #endif
17 |
--------------------------------------------------------------------------------
/hpda/CMakeLists.txt:
--------------------------------------------------------------------------------
1 |
2 | find_package (Threads REQUIRED)
3 |
4 | add_library(hpda SHARED src/extractor/internal/https_request.cpp
5 | src/extractor/paged_https_extractor.cpp
6 | src/engine/engine.cpp
7 | src/engine/functor.cpp)
8 | target_link_libraries(hpda ssl crypto boost_system curl
9 | ${CMAKE_THREAD_LIBS_INIT}
10 | )
11 | target_compile_options(hpda PUBLIC $<$:-DHPDA_DEBUG>)
12 |
13 | target_include_directories(hpda PUBLIC
14 | "$"
15 | "$"
16 | "$"
17 | )
18 | install(TARGETS hpda EXPORT mod_hpda
19 | DESTINATION "${lib_install_dir}")
20 | install(EXPORT mod_hpda
21 | DESTINATION "${config_install_dir}/hpda"
22 | NAMESPACE "${namespace}")
23 |
24 | add_version(hpda)
25 |
26 | if(SGX_MODE STREQUAL "Debug")
27 | add_subdirectory(test)
28 | #add_subdirectory(example)
29 | endif()
30 |
--------------------------------------------------------------------------------
/hpda/src/engine/functor.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 |
4 | namespace hpda {
5 | functor::functor() : m_engine(), m_status(), m_has_value(false) {}
6 |
7 | functor::~functor() {
8 | if (m_engine != nullptr) {
9 | m_engine->remove_functor(this);
10 | }
11 | }
12 |
13 | void functor::set_engine(engine *e) {
14 | m_engine = e;
15 | m_engine->add_functor(this);
16 | }
17 | void functor::done_value() { m_has_value = true; }
18 | } // namespace hpda
19 |
--------------------------------------------------------------------------------
/hpda/src/util/ntobject_helper.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 |
4 | namespace hpda {
5 | namespace util {
6 | std::string convert_data_format_to_ntobject_type_file(
7 | const boost::property_tree::ptree &tree) {
8 | std::stringstream ss;
9 | return tree.get("start");
10 | }
11 | } // namespace util
12 | } // namespace hpda
13 |
--------------------------------------------------------------------------------
/hpda/test/CMakeLists.txt:
--------------------------------------------------------------------------------
1 |
2 | find_package(OpenSSL REQUIRED)
3 | add_executable(hpda_gtest gtest_main.cpp
4 | test_basic.cpp
5 | extractor/test_https_extractor.cpp
6 | extractor/test_paged_https_extractor.cpp
7 | processor/test_filter.cpp
8 | processor/test_groupby.cpp
9 | processor/test_json_to_data_batch.cpp
10 | processor/test_concat.cpp
11 | processor/test_split.cpp
12 | processor/test_set.cpp
13 | processor/test_trim.cpp
14 | processor/test_all.cpp
15 | kmeans/test_loyd_vector.cpp
16 | kmeans/test_loyd_tuple.cpp
17 | kmeans/test_kmeans_tuple.cpp
18 | kmeans/tuple_point.cpp
19 | kmeans/test_kmeans_iris.cpp
20 | )
21 | target_link_libraries(hpda_gtest PRIVATE gtest_main glog hpda OpenSSL::SSL OpenSSL::Crypto)
22 |
--------------------------------------------------------------------------------
/hpda/test/extractor/test_https_extractor.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include
4 |
5 | TEST(https_request, basic) {
6 | #if 0
7 | hpda::extractor::internal::https_request req("asresearch.io",
8 | "/iris-data?index=1&limit=3");
9 | //"/iris-data?index=0&limit=10");
10 | EXPECT_TRUE(req.result().size() != 0);
11 | #endif
12 | }
13 |
--------------------------------------------------------------------------------
/hpda/test/extractor/test_paged_https_extractor.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include
4 |
5 | TEST(paged_https_extractor, basic) {
6 | hpda::extractor::paged_https_extractor phe(
7 | "https://asresearch.io", "/iris-data?", 3,
8 | [](const std::string &prefix, int next_index, int page_limit) {
9 | std::stringstream ss;
10 | ss << prefix << "index=" << next_index << "&limit=" << page_limit;
11 | return ss.str();
12 | },
13 | [](const boost::property_tree::ptree &tree) {
14 | return tree.get("start");
15 | },
16 | [](const boost::property_tree::ptree &tree) {
17 | return tree.get("end");
18 | });
19 |
20 | std::cout << "start data" << std::endl;
21 | while (phe.process()) {
22 | std::cout << phe.output_value() << std::endl;
23 | }
24 | std::cout << "end data" << std::endl;
25 | }
26 |
--------------------------------------------------------------------------------
/hpda/test/gtest_main.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | int main(int argc, char *argv[]) {
3 | ::testing::InitGoogleTest(&argc, argv);
4 | return RUN_ALL_TESTS();
5 | }
6 |
--------------------------------------------------------------------------------
/hpda/test/kmeans/tuple_point.cpp:
--------------------------------------------------------------------------------
1 | #include "tuple_point.h"
2 | #include
3 |
4 | Point operator+(const Point &p1, const Point &p2) {
5 | Point s(p1);
6 |
7 | std::get<0>(s) += std::get<0>(p2);
8 | std::get<1>(s) += std::get<1>(p2);
9 | std::get<2>(s) += std::get<2>(p2);
10 | return s;
11 | }
12 |
13 | Point operator/(const Point &p1, size_t v) {
14 | Point s(p1);
15 |
16 | std::get<0>(s) /= v;
17 | std::get<1>(s) /= v;
18 | std::get<2>(s) /= v;
19 | return s;
20 | }
21 |
22 | std::ostream &operator<<(std::ostream &os, const Point &obj) {
23 | os << "(";
24 | os << std::get<0>(obj) << ", ";
25 | os << std::get<1>(obj) << ", ";
26 | os << std::get<2>(obj);
27 | os << ")";
28 | return os;
29 | }
30 |
--------------------------------------------------------------------------------
/hpda/test/kmeans/tuple_point.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 | #include
3 | //#include
4 |
5 | typedef std::tuple Point;
6 |
7 | namespace hpda {
8 | template struct euclidean;
9 |
10 | template <> struct euclidean {
11 | static double distance_square(const Point &p1, const Point &p2) {
12 | double ret = 0;
13 |
14 | auto v1 = std::get<0>(p1) - std::get<0>(p2);
15 | auto v2 = std::get<1>(p1) - std::get<1>(p2);
16 | auto v3 = std::get<2>(p1) - std::get<2>(p2);
17 |
18 | ret += v1 * v1;
19 | ret += v2 * v2;
20 | ret += v3 * v3;
21 | return ret;
22 | }
23 | };
24 | } // namespace hpda
25 |
26 | Point operator+(const Point &p1, const Point &p2);
27 |
28 | Point operator/(const Point &p1, size_t v);
29 |
30 | std::ostream &operator<<(std::ostream &os, const Point &obj);
31 |
32 | define_nt(iid, int);
33 |
--------------------------------------------------------------------------------
/hpda/test/processor/test_all.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 |
4 | define_nt(hash, std::string);
5 | define_nt(value, uint64_t);
6 | typedef hpda::ntobject data_item_t;
7 |
8 | TEST(all, basic) {
9 | hpda::extractor::raw_data rd;
10 |
11 | hpda::engine engine;
12 | rd.set_engine(&engine);
13 |
14 | for (int i = 0; i < 1000; i++) {
15 | data_item_t d;
16 | d.set(std::to_string(i), i);
17 | rd.add_data(d);
18 | }
19 |
20 | hpda::processor::all_t f(&rd);
21 | hpda::output::memory_output mo(&f);
22 |
23 | engine.run();
24 | auto &s = f.values();
25 | EXPECT_EQ(s.size(), 1000);
26 |
27 | for (int i = 0; i < 1000; i++) {
28 | EXPECT_EQ(s[i].get<::value>(), i);
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/hpda/test/processor/test_concat.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 |
4 | define_nt(hash, std::string);
5 | define_nt(value, uint64_t);
6 | typedef hpda::ntobject data_item_t;
7 |
8 | TEST(concat, basic) {
9 | hpda::extractor::raw_data rd1;
10 | hpda::extractor::raw_data rd2;
11 |
12 | hpda::engine engine;
13 | rd1.set_engine(&engine);
14 | rd2.set_engine(&engine);
15 |
16 | for (int i = 0; i < 1000; i++) {
17 | data_item_t d;
18 | d.set(std::to_string(i), i);
19 | rd1.add_data(d);
20 | rd2.add_data(d);
21 | }
22 | hpda::processor::concat con(&rd1);
23 | con.add_upper_stream(&rd2);
24 |
25 | hpda::processor::filter f(
26 | &con, [](const data_item_t &d) { return d.get() >= 500; });
27 |
28 | hpda::output::memory_output mo(&f);
29 |
30 | engine.run();
31 |
32 | auto s = mo.values().size();
33 | EXPECT_EQ(s, 1000);
34 | }
35 |
--------------------------------------------------------------------------------
/hpda/test/processor/test_filter.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 |
4 | define_nt(hash, std::string);
5 | define_nt(value, uint64_t);
6 | typedef hpda::ntobject data_item_t;
7 |
8 | TEST(filter, basic) {
9 | hpda::extractor::raw_data rd;
10 |
11 | hpda::engine engine;
12 | rd.set_engine(&engine);
13 |
14 | for (int i = 0; i < 1000; i++) {
15 | data_item_t d;
16 | d.set(std::to_string(i), i);
17 | rd.add_data(d);
18 | }
19 |
20 | hpda::processor::filter f(&rd, [](const data_item_t &d) {
21 | return d.get() >= 500;
22 | });
23 |
24 | hpda::output::memory_output mo(&f);
25 |
26 | engine.run();
27 | auto s = mo.values().size();
28 | EXPECT_EQ(s, 500);
29 | }
30 |
--------------------------------------------------------------------------------
/hpda/test/processor/test_split.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 |
4 | define_nt(hash, std::string);
5 | define_nt(value, uint64_t);
6 | typedef hpda::ntobject data_item_t;
7 |
8 | TEST(split, basic) {
9 | hpda::extractor::raw_data rd;
10 |
11 | hpda::engine engine;
12 | rd.set_engine(&engine);
13 |
14 | for (int i = 0; i < 10; i++) {
15 | data_item_t d;
16 | d.set(std::to_string(i), i);
17 | rd.add_data(d);
18 | }
19 |
20 | hpda::processor::split split(&rd);
21 |
22 | hpda::output::memory_output mo1(split.new_split_stream());
23 | hpda::output::memory_output mo2(split.new_split_stream());
24 |
25 | engine.run();
26 | auto s = mo1.values().size();
27 | EXPECT_EQ(s, 10);
28 | EXPECT_EQ(s, mo2.values().size());
29 | }
30 |
--------------------------------------------------------------------------------
/hpda/test/processor/test_trim.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 |
4 | define_nt(hash, std::string);
5 | define_nt(value, uint64_t);
6 | typedef hpda::ntobject data_item_t;
7 | typedef hpda::ntobject value_item_t;
8 |
9 | TEST(trim, basic) {
10 | hpda::extractor::raw_data rd;
11 |
12 | hpda::engine engine;
13 | rd.set_engine(&engine);
14 |
15 | for (int i = 0; i < 1000; i++) {
16 | data_item_t d;
17 | d.set(std::to_string(i), i);
18 | rd.add_data(d);
19 | }
20 |
21 | hpda::processor::trim_t f(&rd);
22 | hpda::output::memory_output mo(&f);
23 |
24 | engine.run();
25 | auto &s = mo.values();
26 | EXPECT_EQ(s.size(), 1000);
27 |
28 | for (int i = 0; i < 1000; i++) {
29 | EXPECT_EQ(s[i].get<::value>(), i);
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/include/hpda/algorithm/algorithm.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 | #include
3 |
--------------------------------------------------------------------------------
/include/hpda/common/common.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 | #include
5 | #include
6 | #include
7 | #include
8 | #include
9 | #include
10 |
11 | #ifdef HPDA_DEBUG
12 | #include
13 | #endif
14 |
15 | #ifdef YPC_SGX
16 | #include "ypc/stbox/tsgx/log.h"
17 | #endif
18 |
19 | namespace hpda {
20 | template using ntobject = ::ff::util::ntobject;
21 |
22 | }
23 |
--------------------------------------------------------------------------------
/include/hpda/common/processor_with_output.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 | #include
3 | #include
4 |
5 | namespace hpda {
6 | namespace internal {
7 |
8 | template
9 | class processor_with_output : virtual public functor {
10 | public:
11 | typedef OutputObjType output_type;
12 | virtual ~processor_with_output() {}
13 | virtual OutputObjType output_value() = 0;
14 | };
15 |
16 | } // namespace internal
17 | template
18 | using processor_with_output =
19 | internal::processor_with_output>;
20 | template
21 | using processor_with_output_t = internal::processor_with_output;
22 | } // namespace hpda
23 |
--------------------------------------------------------------------------------
/include/hpda/common/stream_policy.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 | #include
3 |
4 | namespace hpda {
5 | struct lazy_eval_stream_policy {};
6 | struct prefetch_stream_policy {};
7 | struct fetch_all_stream_policy {};
8 |
9 | using default_stream_policy = lazy_eval_stream_policy;
10 | } // namespace hpda
11 |
12 |
--------------------------------------------------------------------------------
/include/hpda/engine/engine.h:
--------------------------------------------------------------------------------
1 | /**@file engine.h
2 | * @brief A class to represent the computing task
3 | * @details Developers can modify algorithms using templates to satisfy certain
4 | * business scenarios
5 | * @author YeeZTech
6 | * @date 2022-10-19
7 | * @version 2.0
8 | */
9 | #pragma once
10 | #include
11 | #include
12 | #include
13 | #include
14 |
15 | namespace hpda {
16 | class engine {
17 | public:
18 | //! Notice that one functor may add to engine multiple times, and it won't
19 | //! affect.
20 | void add_functor(functor *f);
21 |
22 | void remove_functor(functor * f);
23 |
24 | void run();
25 |
26 | protected:
27 |
28 | void build_graph();
29 |
30 | std::vector find_outputs() const;
31 |
32 | bool contain_same_successor(functor *f1, functor *f2, functor *succ) const;
33 |
34 | bool functor_has_input(functor *f) const;
35 |
36 | bool is_output(functor *f) const;
37 |
38 | protected:
39 | std::vector m_functors;
40 |
41 | std::unordered_map> m_successors;
42 | std::unordered_map> m_predecessors;
43 | std::unordered_set m_reach_ends;
44 | };
45 | } // namespace ypc
46 |
--------------------------------------------------------------------------------
/include/hpda/engine/functor.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 | #include
3 | #include
4 |
5 | namespace hpda {
6 | class engine;
7 | class functor {
8 | public:
9 | functor();
10 | virtual ~functor();
11 | virtual bool process() = 0;
12 | inline void reset_done_value() { m_has_value = false; }
13 | virtual void done_value();
14 | inline bool has_value() const { return m_has_value; }
15 | inline engine *get_engine() const { return m_engine; }
16 |
17 | void set_engine(engine *e);
18 |
19 | inline void add_predecessor(functor *pred) { m_predecessors.push_back(pred); }
20 |
21 | inline const std::vector predecessors() const {
22 | return m_predecessors;
23 | }
24 |
25 | protected:
26 | bool m_has_value;
27 | std::vector m_predecessors;
28 | engine *m_engine;
29 |
30 | friend class engine;
31 | uint32_t m_status;
32 | };
33 | } // namespace ypc
34 |
--------------------------------------------------------------------------------
/include/hpda/extractor/extractor.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 | #include
3 | #include
4 |
--------------------------------------------------------------------------------
/include/hpda/extractor/extractor_base.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 | #include
3 | #include
4 |
5 | namespace hpda {
6 | namespace extractor {
7 | namespace internal {
8 | template
9 | class extractor_base
10 | : public ::hpda::internal::processor_with_output {
11 | public:
12 | virtual ~extractor_base() {}
13 | };
14 | } // namespace internal
15 |
16 | } // namespace extractor
17 | } // namespace hpda
18 |
--------------------------------------------------------------------------------
/include/hpda/extractor/internal/https_request.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 | #include
3 | #include
4 | #include
5 | #include
6 |
7 | namespace hpda {
8 | namespace extractor {
9 | namespace internal {
10 |
11 | class https_request {
12 | public:
13 | https_request(const std::string &domain, const std::string &path);
14 |
15 | const std::string &result() const;
16 |
17 | protected:
18 | mutable boost::asio::ssl::context m_ctx;
19 | mutable boost::asio::io_service m_io_service;
20 | std::string m_domain;
21 | std::string m_path;
22 | mutable std::string m_result;
23 | };
24 | } // namespace internal
25 | } // namespace extractor
26 | } // namespace hpda
27 |
--------------------------------------------------------------------------------
/include/hpda/hpda.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 | #include
5 | #include
6 | #include
7 |
--------------------------------------------------------------------------------
/include/hpda/output/memory_output.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 | #include
3 | #include
4 |
5 | namespace hpda {
6 | namespace output {
7 | namespace internal {
8 | template
9 | class memory_output_impl : public output_base {
10 | public:
11 | memory_output_impl(
12 | ::hpda::internal::processor_with_output *upper_stream)
13 | : output_base(upper_stream) {}
14 |
15 | virtual ~memory_output_impl() {}
16 |
17 | typedef output_base base;
18 |
19 | virtual bool process() {
20 | if (!base::has_input_value()) {
21 | return false;
22 | }
23 | m_data.push_back(output_base::input_value().make_copy());
24 | base::consume_input_value();
25 | return true;
26 | }
27 |
28 | std::vector &values() { return m_data; }
29 | const std::vector &values() const { return m_data; }
30 |
31 | protected:
32 | std::vector m_data;
33 | };
34 | } // namespace internal
35 |
36 | template
37 | using memory_output = internal::memory_output_impl>;
38 | template using memory_output_t = internal::memory_output_impl;
39 | } // namespace output
40 | } // namespace hpda
41 |
--------------------------------------------------------------------------------
/include/hpda/output/output.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 | #include
3 |
--------------------------------------------------------------------------------
/include/hpda/output/output_base.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 | #include
3 | #include
4 |
5 | namespace hpda {
6 | namespace output {
7 | namespace internal {
8 |
9 | template
10 | class output_base
11 | : public ::hpda::internal::processor_with_input {
12 | public:
13 | output_base(
14 | ::hpda::internal::processor_with_output *upper_stream)
15 | : ::hpda::internal::processor_with_input(upper_stream) {}
16 |
17 | virtual ~output_base() {}
18 |
19 | typedef ::hpda::internal::processor_with_input base;
20 |
21 | // inline bool next_input() { return base::next_input(); }
22 |
23 | InputObjType input_value() const { return base::input_value(); }
24 |
25 | virtual void done_value() { functor::m_has_value = false; };
26 | };
27 | } // namespace internal
28 | } // namespace output
29 | } // namespace hpda
30 |
--------------------------------------------------------------------------------
/include/hpda/processor/processor.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 | #include
5 | #include
6 | #include
7 | #include
8 | #include
9 | #include
10 | #include
11 | #include
12 | #include
13 |
--------------------------------------------------------------------------------
/include/hpda/processor/processor_base.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 | #include
3 | #include
4 |
5 | namespace hpda {
6 | namespace processor {
7 | namespace internal {
8 | template
9 | class processor_base
10 | : public ::hpda::internal::processor_with_output,
11 | public ::hpda::internal::processor_with_input {
12 | public:
13 | processor_base(
14 | ::hpda::internal::processor_with_output *upper_stream)
15 | : ::hpda::internal::processor_with_input(upper_stream) {}
16 |
17 | virtual ~processor_base() {}
18 |
19 | typedef ::hpda::internal::processor_with_input base;
20 |
21 | // inline bool next_input() { return base::next_input(); }
22 |
23 | inline InputObjType input_value() const { return base::input_value(); }
24 | };
25 | } // namespace internal
26 | template
27 | using processor_base_t = internal::processor_base;
28 | } // namespace processor
29 | } // namespace hpda
30 |
--------------------------------------------------------------------------------
/include/hpda/processor/set/helper/copy_helper.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 | #include
3 |
4 | namespace hpda {
5 | namespace processor {
6 | namespace internal {
7 |
8 | template struct copy_helper {
9 | // TODO optimize for rvalue(&&)
10 | template
11 | static auto copy(T1 &target, T2 &&source) -> typename std::enable_if<
12 | (std::remove_reference::type::type_list::len > Index), void>::type {
13 | typedef typename ::ff::util::get_type_at_index_in_typelist<
14 | typename std::remove_reference::type::type_list, Index>::type
15 | c_type;
16 | target.template set(source.template get());
17 | copy_helper::copy(target, std::forward(source));
18 | }
19 |
20 | template
21 | static auto copy(T1 &target, const T2 &source) -> typename std::enable_if<
22 | (std::remove_reference::type::type_list::len <= Index), void>::type {}
23 | };
24 |
25 | } // namespace internal
26 | } // namespace processor
27 | } // namespace hpda
28 |
--------------------------------------------------------------------------------
/include/hpda/processor/transform/all.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 | #include
3 |
4 | namespace hpda {
5 | namespace processor {
6 | namespace internal {
7 |
8 | template
9 | class all_impl : public processor_base {
10 | public:
11 | all_impl(::hpda::internal::processor_with_output *upper_stream)
12 | : processor_base(upper_stream) {}
13 |
14 | virtual ~all_impl() {}
15 |
16 | typedef processor_base base;
17 |
18 | virtual bool process() {
19 | if (!base::has_input_value()) {
20 | return false;
21 | }
22 | m_data.push_back(base::input_value().make_copy());
23 | base::consume_input_value();
24 | return true;
25 | }
26 |
27 | virtual InputObjType output_value() { return m_data.back(); }
28 |
29 | std::vector &values() { return m_data; }
30 | const std::vector &values() const { return m_data; }
31 |
32 | protected:
33 | std::vector m_data;
34 | };
35 | } // namespace internal
36 | template using all_t = internal::all_impl;
37 | } // namespace processor
38 | } // namespace hpda
39 |
--------------------------------------------------------------------------------
/include/hpda/processor/transform/trim.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 | #include
3 |
4 | namespace hpda {
5 | namespace processor {
6 | namespace internal {
7 |
8 | template
9 | class trim_impl : public processor_base {
10 | public:
11 | trim_impl(::hpda::internal::processor_with_output *upper_stream)
12 | : processor_base(upper_stream) {}
13 |
14 | virtual ~trim_impl() {}
15 |
16 | typedef processor_base base;
17 |
18 | virtual bool process() {
19 | if (!base::has_input_value()) {
20 | return false;
21 | }
22 | m_data = base::input_value().make_copy();
23 | base::consume_input_value();
24 | return true;
25 | }
26 |
27 | virtual OutputObjType output_value() { return m_data; }
28 |
29 | protected:
30 | OutputObjType m_data;
31 | };
32 | } // namespace internal
33 | template using trim_t = internal::trim_impl;
34 | } // namespace processor
35 | } // namespace hpda
36 |
--------------------------------------------------------------------------------
/include/hpda/util/ntobject_helper.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 | #include
3 | #include
4 |
5 | namespace hpda {
6 | namespace util {
7 | std::string convert_data_format_to_ntobject_type_file(
8 | const boost::property_tree::ptree &tree);
9 | }
10 | } // namespace hpda
11 |
--------------------------------------------------------------------------------
/include/xgboost/.gitignore:
--------------------------------------------------------------------------------
1 | # Compiled Object files
2 | *.slo
3 | *.lo
4 | *.o
5 |
6 | # Compiled Dynamic libraries
7 | *.so
8 | *.dylib
9 |
10 | # Compiled Static libraries
11 | *.lai
12 | *.la
13 | *.a
14 | *~
15 | *txt*
16 | *conf
17 | *buffer
18 | *model
19 | xgboost
--------------------------------------------------------------------------------
/include/xgboost/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (c) 2014 Tianqi Chen
2 |
3 | Licensed under the Apache License, Version 2.0 (the "License");
4 | you may not use this file except in compliance with the License.
5 | You may obtain a copy of the License at
6 |
7 | http://www.apache.org/licenses/LICENSE-2.0
8 |
9 | Unless required by applicable law or agreed to in writing, software
10 | distributed under the License is distributed on an "AS IS" BASIS,
11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | See the License for the specific language governing permissions and
13 | limitations under the License.
14 |
--------------------------------------------------------------------------------
/include/xgboost/Makefile:
--------------------------------------------------------------------------------
1 | export CC = gcc
2 | export CXX = g++
3 | export CFLAGS = -Wall -O3 -msse2 -Wno-unknown-pragmas -fopenmp
4 |
5 | # specify tensor path
6 | BIN = xgboost
7 | OBJ =
8 | .PHONY: clean all
9 |
10 | all: $(BIN) $(OBJ)
11 | export LDFLAGS= -pthread -lm
12 |
13 | xgboost: regression/xgboost_reg_main.cpp regression/*.h booster/*.h booster/*/*.hpp booster/*.hpp
14 |
15 | $(BIN) :
16 | $(CXX) $(CFLAGS) $(LDFLAGS) -o $@ $(filter %.cpp %.o %.c, $^)
17 |
18 | $(OBJ) :
19 | $(CXX) -c $(CFLAGS) -o $@ $(firstword $(filter %.cpp %.c, $^) )
20 |
21 | install:
22 | cp -f -r $(BIN) $(INSTALL_PATH)
23 |
24 | clean:
25 | $(RM) $(OBJ) $(BIN) *~
26 |
--------------------------------------------------------------------------------
/include/xgboost/utils/xgboost_omp.h:
--------------------------------------------------------------------------------
1 | #ifndef XGBOOST_OMP_H
2 | #define XGBOOST_OMP_H
3 | /*!
4 | * \file xgboost_omp.h
5 | * \brief header to handle OpenMP compatibility issues
6 | *
7 | * \author Tianqi Chen: tianqi.tchen@gmail.com
8 | */
9 |
10 | #if defined(_OPENMP)
11 | #include
12 | #else
13 | #warning "OpenMP is not available, compile to single thread code"
14 | inline int omp_get_thread_num() { return 0; }
15 | inline int omp_get_num_threads() { return 1; }
16 | inline void omp_set_num_threads( int nthread ) {}
17 | #endif
18 | #endif
19 |
--------------------------------------------------------------------------------
/include/ypc/common/access_policy.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 | #include
3 |
4 | namespace ypc {
5 | namespace utc {
6 | constexpr static uint8_t access_policy_whitelist = 1;
7 | constexpr static uint8_t access_policy_blacklist = 2;
8 | constexpr static uint8_t access_policy_signer = 3;
9 | constexpr static uint8_t access_policy_enclave = 4;
10 |
11 | } // namespace utc
12 | } // namespace ypc
13 |
--------------------------------------------------------------------------------
/include/ypc/common/byte.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 | #include "ypc/common/byte/bytes.h"
3 | #include "ypc/common/byte/bytes_util.h"
4 |
--------------------------------------------------------------------------------
/include/ypc/common/byte/base64.h:
--------------------------------------------------------------------------------
1 | //
2 | // base64 encoding and decoding with C++.
3 | // Version: 2.rc.08 (release candidate)
4 | //
5 |
6 | #ifndef BASE64_H_C0CE2A47_D10E_42C9_A27C_C883944E704A
7 | #define BASE64_H_C0CE2A47_D10E_42C9_A27C_C883944E704A
8 |
9 | #include
10 |
11 | #if __cplusplus >= 201703L
12 | #include
13 | #endif // __cplusplus >= 201703L
14 |
15 | std::string base64_encode(std::string const &s, bool url = false);
16 | std::string base64_encode_pem(std::string const &s);
17 | std::string base64_encode_mime(std::string const &s);
18 |
19 | std::string base64_decode(std::string const &s, bool remove_linebreaks = false);
20 | std::string base64_encode(unsigned char const *, size_t len, bool url = false);
21 |
22 | #if __cplusplus >= 201703L
23 | //
24 | // Interface with std::string_view rather than const std::string&
25 | // Requires C++17
26 | // Provided by Yannic Bonenberger (https://github.com/Yannic)
27 | //
28 | std::string base64_encode(std::string_view s, bool url = false);
29 | std::string base64_encode_pem(std::string_view s);
30 | std::string base64_encode_mime(std::string_view s);
31 |
32 | std::string base64_decode(std::string_view s, bool remove_linebreaks = false);
33 | #endif // __cplusplus >= 201703L
34 |
35 | #endif /* BASE64_H_C0CE2A47_D10E_42C9_A27C_C883944E704A */
36 |
--------------------------------------------------------------------------------
/include/ypc/common/crypto_prefix.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 | #include
3 |
4 | namespace ypc {
5 | namespace utc {
6 | typedef uint32_t crypto_prefix_t;
7 |
8 | constexpr static uint32_t crypto_prefix_length = sizeof(uint32_t);
9 |
10 | constexpr static crypto_prefix_t crypto_prefix_forward = 0x1;
11 | constexpr static crypto_prefix_t crypto_prefix_arbitrary = 0x2;
12 | constexpr static crypto_prefix_t crypto_prefix_backup = 0x4;
13 | constexpr static crypto_prefix_t crypto_prefix_host_data = 0x6;
14 | constexpr static crypto_prefix_t crypto_prefix_host_data_private_key = 0x8;
15 |
16 | } // namespace utc
17 | } // namespace ypc
18 |
--------------------------------------------------------------------------------
/include/ypc/common/ignore.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | namespace ypc {
4 | struct ignore_type {};
5 |
6 | constexpr static ignore_type ignore;
7 | } // namespace ypc
8 |
--------------------------------------------------------------------------------
/include/ypc/common/limits.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 | #include
3 |
4 | namespace ypc {
5 | namespace utc {
6 | constexpr static uint32_t max_item_size = 64 * 1024;
7 | constexpr static uint32_t max_sample_size = 4 * 1024 * 1024;
8 | constexpr static uint32_t max_data_format_size = 1 * 1024 * 1024;
9 | constexpr static uint32_t max_keymgr_response_buf_size = 1024 * 1024;
10 |
11 | } // namespace utc
12 | } // namespace ypc
13 |
--------------------------------------------------------------------------------
/include/ypc/common/parser_type.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 | #include
3 |
4 | namespace ypc {
5 | namespace utc {
6 |
7 | constexpr static uint32_t parser_type_length = sizeof(uint32_t);
8 |
9 | constexpr static uint32_t unknown_result_parser = 0;
10 | constexpr static uint32_t onchain_result_parser = 1;
11 | constexpr static uint32_t offchain_result_parser = 2;
12 | constexpr static uint32_t local_result_parser = 0x3;
13 | constexpr static uint32_t forward_result_parser = 0x4;
14 |
15 | constexpr static uint32_t unknown_datasource_parser = 0;
16 | constexpr static uint32_t single_sealed_datasource_parser = 1;
17 | constexpr static uint32_t multi_sealed_datasource_parser = 2;
18 | constexpr static uint32_t noinput_datasource_parser = 3;
19 | constexpr static uint32_t raw_datasource_parser = 4;
20 |
21 | constexpr static uint32_t no_model_parser = 0;
22 | constexpr static uint32_t has_model_parser = 1;
23 |
24 | union parser_type_t {
25 | uint32_t value;
26 | struct _data {
27 | uint32_t result_type : 4;
28 | uint32_t data_source_type : 4;
29 | uint32_t has_model : 1;
30 | } d;
31 | };
32 | } // namespace utc
33 | } // namespace ypc
34 |
--------------------------------------------------------------------------------
/include/ypc/core/blockfile.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 | #include
3 | #include
4 | #include
5 | #include
6 | #include
7 | #ifdef HPDA_DEBUG
8 | #include
9 | #endif
10 | #include "ypc/corecommon/blockfile/blockfile_v1.h"
11 | #include "ypc/corecommon/blockfile/blockfile_v2.h"
12 | #include "ypc/corecommon/blockfile/traits.h"
13 |
14 | namespace ypc {
15 |
16 | template <> struct file_traits {
17 | constexpr static auto in = std::ios::in;
18 | constexpr static auto binary = std::ios::binary;
19 | constexpr static auto out = std::ios::out;
20 | constexpr static auto trunc = std::ios::trunc;
21 | constexpr static auto ate = std::ios::ate;
22 | constexpr static auto app = std::ios::app;
23 | constexpr static auto cur = std::ios::cur;
24 | constexpr static auto beg = std::ios::beg;
25 | constexpr static auto end = std::ios::end;
26 | };
27 |
28 | template
30 | using blockfile = blockfile_v2_r;
32 |
33 | } // namespace ypc
34 |
--------------------------------------------------------------------------------
/include/ypc/core/command_executor.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 | #include
3 |
4 | namespace ypc {
5 |
6 | namespace internal {
7 | class command_executor_helper {
8 | public:
9 | static int execute_command(const std::string &cmd, std::string &output);
10 | };
11 | } // namespace internal
12 |
13 | class command_executor {
14 | public:
15 | static int execute_command(const std::string &cmd);
16 | static int execute_command(const std::string &cmd, std::string &output);
17 | };
18 |
19 | } // namespace ypc
20 |
--------------------------------------------------------------------------------
/include/ypc/core/configuration.h:
--------------------------------------------------------------------------------
1 |
2 | #pragma once
3 | #include "ypc/core/singleton.h"
4 | #include
5 | #include
6 |
7 | define_nt(db_url, std::string);
8 | define_nt(db_usr, std::string);
9 | define_nt(db_pass, std::string);
10 | define_nt(db_dbname, std::string);
11 | define_nt(ctrl_net_port, uint16_t);
12 |
13 | namespace ypc {
14 |
15 | using db_info_t = ::ff::util::ntobject;
16 | using net_info_t = ::ff::util::ntobject;
17 |
18 | class configuration : public singleton {
19 | public:
20 | configuration() = default;
21 | configuration(const configuration &cf) = delete;
22 | configuration &operator=(const configuration &cf) = delete;
23 | configuration &operator=(configuration &&cf) = delete;
24 | configuration(configuration &&cf) = delete;
25 | ~configuration() = default;
26 |
27 | public:
28 | static std::string create_logdir_if_not_exist();
29 | static std::string find_db_config_file(const std::string &filename);
30 |
31 | static db_info_t read_db_config_file(const std::string &filename);
32 | static net_info_t read_net_info_from_file(const std::string &conf_file);
33 | };
34 |
35 | } // namespace ypc
36 |
--------------------------------------------------------------------------------
/include/ypc/core/db.h:
--------------------------------------------------------------------------------
1 |
2 | #pragma once
3 | #include "ypc/core/configuration.h"
4 | #include