1 // Copyright 2018 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/daead/deterministic_aead_config.h" 18 19 #include "absl/memory/memory.h" 20 #include "tink/config/tink_fips.h" 21 #include "tink/daead/aes_siv_key_manager.h" 22 #include "tink/daead/aes_siv_proto_serialization.h" 23 #include "tink/daead/deterministic_aead_wrapper.h" 24 #include "tink/registry.h" 25 #include "tink/util/status.h" 26 27 namespace crypto { 28 namespace tink { 29 30 // static Register()31util::Status DeterministicAeadConfig::Register() { 32 // Currently there are no FIPS-validated deterministic AEAD key managers 33 // available, therefore none will be registered in FIPS only mode. 34 if (IsFipsModeEnabled()) { 35 return util::OkStatus(); 36 } 37 38 // Register non-FIPS key managers. 39 auto status = Registry::RegisterKeyTypeManager( 40 absl::make_unique<AesSivKeyManager>(), true); 41 if (!status.ok()) return status; 42 43 status = RegisterAesSivProtoSerialization(); 44 if (!status.ok()) return status; 45 46 // Register primitive wrapper. 47 return Registry::RegisterPrimitiveWrapper( 48 absl::make_unique<DeterministicAeadWrapper>()); 49 } 50 51 } // namespace tink 52 } // namespace crypto 53