1 // Copyright 2021 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 #ifndef TINK_AEAD_INTERNAL_AEAD_UTIL_H_ 17 #define TINK_AEAD_INTERNAL_AEAD_UTIL_H_ 18 19 #include <string> 20 21 #include "absl/container/flat_hash_set.h" 22 #include "openssl/evp.h" 23 #include "tink/util/statusor.h" 24 25 namespace crypto { 26 namespace tink { 27 namespace internal { 28 29 bool IsSupportedKmsEnvelopeAeadDekKeyType(absl::string_view key_type); 30 31 // Returns a pointer to an AES-GCM EVP_CIPHER for the given key size. 32 util::StatusOr<const EVP_CIPHER *> GetAesGcmCipherForKeySize( 33 uint32_t key_size_in_bytes); 34 35 #ifdef OPENSSL_IS_BORINGSSL 36 // Returns a pointer to an AES-GCM EVP_AEAD for the given key size. 37 util::StatusOr<const EVP_AEAD *> GetAesGcmAeadForKeySize( 38 uint32_t key_size_in_bytes); 39 40 // Returns a pointer to an AES-GCM-SIV EVP_AEAD for `key_size_in_bytes` or an 41 // error if `key_size_in_bytes` is invalid. 42 util::StatusOr<const EVP_AEAD *> GetAesGcmSivAeadCipherForKeySize( 43 int key_size_in_bytes); 44 #endif 45 46 } // namespace internal 47 } // namespace tink 48 } // namespace crypto 49 50 #endif // TINK_AEAD_INTERNAL_AEAD_UTIL_H_ 51