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

Method register_decryption_and_key

lite/src/global.cpp:58–74  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

56}
57
58bool lite::register_decryption_and_key(
59 std::string decrypt_name, const DecryptionFunc& func,
60 const std::vector<uint8_t>& key) {
61 LITE_LOCK_GUARD(decryption_static_data().map_mutex);
62 auto& global_map = decryption_static_data().decryption_methods;
63 if (global_map.find(decrypt_name) != global_map.end()) {
64 LITE_THROW(ssprintf(
65 "The decryption method %s is already registered.",
66 decrypt_name.c_str()));
67 return false;
68 } else {
69 auto key_pointer = std::make_shared<std::vector<uint8_t>>(key);
70 global_map[decrypt_name] = {func, key_pointer};
71 LITE_LOG("Registered ecryption method %s.", decrypt_name.c_str());
72 return true;
73 }
74}
75
76bool lite::update_decryption_or_key(
77 std::string decrypt_name, const DecryptionFunc& func,

Callers

nothing calls this directly

Calls 2

findMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected