MCPcopy Create free account
hub / github.com/MegEngine/MegEngine / LITE_register_decryption_and_key

Function LITE_register_decryption_and_key

lite/lite-c/src/global.cpp:72–90  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

70}
71
72int LITE_register_decryption_and_key(
73 const char* decrypt_name, const LiteDecryptionFunc func,
74 const uint8_t* key_data, size_t key_size) {
75 LITE_CAPI_BEGIN();
76 LITE_ASSERT(decrypt_name && key_data && func, "The ptr pass to LITE api is null");
77 std::vector<uint8_t> key;
78 for (size_t i = 0; i < key_size; i++) {
79 key.push_back(key_data[i]);
80 }
81 auto decrypt_func = [func](const void* input_data, size_t input_size,
82 const std::vector<uint8_t>& key) {
83 auto size = func(input_data, input_size, key.data(), key.size(), nullptr);
84 std::vector<uint8_t> output(size, 0);
85 func(input_data, input_size, key.data(), key.size(), output.data());
86 return output;
87 };
88 lite::register_decryption_and_key(decrypt_name, decrypt_func, key);
89 LITE_CAPI_END();
90}
91
92int LITE_update_decryption_or_key(
93 const char* decrypt_name, const LiteDecryptionFunc func,

Callers

nothing calls this directly

Calls 4

funcFunction · 0.50
push_backMethod · 0.45
dataMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected