aboutsummaryrefslogtreecommitdiff
path: root/cc/registry.h
diff options
context:
space:
mode:
authortholenst <tholenst@google.com>2019-08-08 00:23:51 -0700
committerCopybara-Service <copybara-worker@google.com>2019-08-08 00:24:18 -0700
commitc101e3797059f9f8093014526e0fea0ffa74df28 (patch)
tree2028cd02cd86b6a525e15e8aed849a61bcd08ee9 /cc/registry.h
parent662b835b395eb5e2e6ee7109dee70bb93e133449 (diff)
downloadtink-c101e3797059f9f8093014526e0fea0ffa74df28.tar.gz
Add using declarations for the type parameters in KeyTypeManagers and use them.
We previously used passed an owned raw pointer from registry.h to registry_impl.h, because this makes it possible to infer template parameters (which doesn't work with unique pointers). However, it is better to instead specify the parameters explicitly, which is easiest if we add typedefs to the KeyTypeManager class. This will also be useful elsewhere (to create [1] automatically). PiperOrigin-RevId: 262295924
Diffstat (limited to 'cc/registry.h')
-rw-r--r--cc/registry.h11
1 files changed, 7 insertions, 4 deletions
diff --git a/cc/registry.h b/cc/registry.h
index 01c40a0fa..ba32c03dd 100644
--- a/cc/registry.h
+++ b/cc/registry.h
@@ -114,11 +114,14 @@ class Registry {
return RegisterKeyManager(absl::WrapUnique(manager), new_key_allowed);
}
- template <class KeyTypeManager>
+ template <class KTManager>
static crypto::tink::util::Status RegisterKeyTypeManager(
- std::unique_ptr<KeyTypeManager> manager, bool new_key_allowed) {
- return RegistryImpl::GlobalInstance().RegisterKeyTypeManager(
- manager.release(), new_key_allowed);
+ std::unique_ptr<KTManager> manager, bool new_key_allowed) {
+ return RegistryImpl::GlobalInstance()
+ .RegisterKeyTypeManager<typename KTManager::KeyProto,
+ typename KTManager::KeyFormatProto,
+ typename KTManager::PrimitiveList>(
+ std::move(manager), new_key_allowed);
}
template <class PrivateKeyTypeManager, class KeyTypeManager>