1 // Copyright 2023 Google LLC 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 // 15 //////////////////////////////////////////////////////////////////////////////// 16 17 #include "tink/config/global_registry.h" 18 19 #include "absl/log/check.h" 20 #include "tink/configuration.h" 21 #include "tink/internal/configuration_impl.h" 22 #include "tink/internal/key_gen_configuration_impl.h" 23 #include "tink/key_gen_configuration.h" 24 25 namespace crypto { 26 namespace tink { 27 ConfigGlobalRegistry()28const Configuration& ConfigGlobalRegistry() { 29 static const Configuration* instance = [] { 30 static Configuration* config = new Configuration(); 31 CHECK_OK(internal::ConfigurationImpl::SetGlobalRegistryMode(*config)); 32 return config; 33 }(); 34 return *instance; 35 } 36 KeyGenConfigGlobalRegistry()37const KeyGenConfiguration& KeyGenConfigGlobalRegistry() { 38 static const KeyGenConfiguration* instance = [] { 39 static KeyGenConfiguration* config = new KeyGenConfiguration(); 40 CHECK_OK(internal::KeyGenConfigurationImpl::SetGlobalRegistryMode(*config)); 41 return config; 42 }(); 43 return *instance; 44 } 45 46 } // namespace tink 47 } // namespace crypto 48