diff options
author | paulavidas <paulavidas@google.com> | 2019-07-29 01:24:21 -0700 |
---|---|---|
committer | Copybara-Service <copybara-worker@google.com> | 2019-07-29 01:24:53 -0700 |
commit | 3160005944221da55d287a9a0bb92bc545e9604f (patch) | |
tree | 92dc4d607aad1a73f8e5e7c70b1398763cd2a60b /cc/mac/mac_config.cc | |
parent | f2fc21fec80edc774f91ee2aebbb9c33e12a9fde (diff) | |
download | tink-3160005944221da55d287a9a0bb92bc545e9604f.tar.gz |
Remove the MAC catalogue.
We decided to not support the catalogues in the future. Instead, we will simply register the key managers directly in the config.
PiperOrigin-RevId: 260450792
Diffstat (limited to 'cc/mac/mac_config.cc')
-rw-r--r-- | cc/mac/mac_config.cc | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/cc/mac/mac_config.cc b/cc/mac/mac_config.cc index 1845b7cf3..be39102b7 100644 --- a/cc/mac/mac_config.cc +++ b/cc/mac/mac_config.cc @@ -17,9 +17,13 @@ #include "tink/mac/mac_config.h" #include "absl/memory/memory.h" -#include "tink/config.h" -#include "tink/mac/mac_catalogue.h" +#include "tink/config/config_util.h" +#include "tink/mac/aes_cmac_key_manager.h" +#include "tink/mac/hmac_key_manager.h" +#include "tink/mac/mac_wrapper.h" +#include "tink/registry.h" #include "tink/util/status.h" +#include "proto/config.pb.h" namespace crypto { namespace tink { @@ -29,10 +33,10 @@ namespace { google::crypto::tink::RegistryConfig* GenerateRegistryConfig() { google::crypto::tink::RegistryConfig* config = new google::crypto::tink::RegistryConfig(); - config->add_entry()->MergeFrom(*Config::GetTinkKeyTypeEntry( + config->add_entry()->MergeFrom(CreateTinkKeyTypeEntry( MacConfig::kCatalogueName, MacConfig::kPrimitiveName, "HmacKey", 0, true)); - config->add_entry()->MergeFrom(*Config::GetTinkKeyTypeEntry( + config->add_entry()->MergeFrom(CreateTinkKeyTypeEntry( MacConfig::kCatalogueName, MacConfig::kPrimitiveName, "AesCmacKey", 0, true)); config->set_config_name("TINK_MAC"); @@ -52,10 +56,13 @@ const google::crypto::tink::RegistryConfig& MacConfig::Latest() { // static util::Status MacConfig::Register() { - auto status = - Registry::AddCatalogue(kCatalogueName, absl::make_unique<MacCatalogue>()); + auto status = Registry::RegisterKeyManager( + absl::make_unique<HmacKeyManager>(), true); if (!status.ok()) return status; - return Config::Register(Latest()); + status = Registry::RegisterKeyManager( + absl::make_unique<AesCmacKeyManager>(), true); + if (!status.ok()) return status; + return Registry::RegisterPrimitiveWrapper(absl::make_unique<MacWrapper>()); } } // namespace tink |