3 #include "hpda/extractor/extractor_base.h"
4 #include "ypc/common/limits.h"
5 #include "ypc/core_t/analyzer/data_source.h"
6 #include "ypc/core_t/ecommon/package.h"
7 #include "ypc/corecommon/package.h"
8 #include "ypc/stbox/ebyte.h"
9 #include "ypc/stbox/stx_common.h"
10 #include "ypc/stbox/tsgx/channel/dh_session_initiator.h"
11 #include "ypc/stbox/tsgx/log.h"
12 #include <ff/util/ntobject.h>
14 #include "ypc/corecommon/crypto/stdeth.h"
19 typedef ::ypc::crypto::eth_sgx_crypto
crypto;
23 crypto::hash_256(stbox::bytes(
"Fidelius"), m_actual_data_hash);
24 m_data_reach_end =
false;
30 if (m_data_reach_end) {
33 if (m_item_index + 1 < m_items.size()) {
37 uint8_t *t_sealed_data;
38 uint32_t t_sealed_data_len;
39 stbox::stx_status ret =
static_cast<stbox::stx_status
>(
40 stbox::ocall_cast<uint32_t>(next_data_batch)(
41 m_expect_data_hash.data(), m_expect_data_hash.size(),
42 &t_sealed_data, &t_sealed_data_len));
44 if (ret != stbox::stx_status::success) {
45 m_data_reach_end =
true;
49 stbox::bytes sealed_data(t_sealed_data_len);
50 memcpy(sealed_data.data(), t_sealed_data, t_sealed_data_len);
53 stbox::ocall_cast<void>(free_data_batch)(t_sealed_data);
59 m_items = pkg.get<ntt::batch_data>();
60 if (m_items.size() == 0) {
61 m_data_reach_end =
true;
65 for (
auto b : m_items) {
66 stbox::bytes k = m_actual_data_hash + b;
67 crypto::hash_256(k, m_actual_data_hash);
72 }
catch (
const std::exception &e) {
73 LOG(ERROR) <<
"make_package got: " << e.what();
74 m_data_reach_end =
true;
81 virtual data_source_output_t output_value() {
82 data_source_output_t ret;
87 virtual const bytes &data_hash()
const {
return m_actual_data_hash; }
90 bytes m_actual_data_hash;
91 std::vector<stbox::bytes> m_items;