xref: /aosp_15_r20/external/tink/cc/config/tink_config.cc (revision e7b1675dde1b92d52ec075b0a92829627f2c52a5)
1 // Copyright 2017 Google Inc.
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/tink_config.h"
18 
19 #include "tink/daead/deterministic_aead_config.h"
20 #include "tink/hybrid/hybrid_config.h"
21 #include "tink/key_manager.h"
22 #include "tink/prf/prf_config.h"
23 #include "tink/registry.h"
24 #include "tink/signature/signature_config.h"
25 #include "tink/streamingaead/streaming_aead_config.h"
26 #include "tink/util/status.h"
27 #include "proto/config.pb.h"
28 
29 using google::crypto::tink::RegistryConfig;
30 
31 namespace crypto {
32 namespace tink {
33 
34 // static
Latest()35 const RegistryConfig& TinkConfig::Latest() {
36   static const RegistryConfig* config = new RegistryConfig();
37   return *config;
38 }
39 
40 // static
Register()41 util::Status TinkConfig::Register() {
42   auto status = HybridConfig::Register();  // includes Mac & Aead
43   if (!status.ok()) return status;
44   status = PrfConfig::Register();
45   if (!status.ok()) return status;
46   status = SignatureConfig::Register();
47   if (!status.ok()) return status;
48   status = DeterministicAeadConfig::Register();
49   if (!status.ok()) return status;
50   return StreamingAeadConfig::Register();
51 }
52 
53 }  // namespace tink
54 }  // namespace crypto
55