-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move AddStreamingAeadV0() to streamingaead/internal/.
PiperOrigin-RevId: 574997632 Change-Id: Id6d992c85f46732cb8e662425bc18848f74e3c49
- Loading branch information
1 parent
4149827
commit 46aac36
Showing
12 changed files
with
427 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
tink_module(streamingaead) | ||
|
||
add_subdirectory(internal) | ||
|
||
tink_cc_library( | ||
NAME streaming_aead_wrapper | ||
SRCS | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,64 @@ | ||
package(default_visibility = ["//:__subpackages__"]) | ||
|
||
licenses(["notice"]) | ||
|
||
cc_library( | ||
name = "config_v0", | ||
srcs = ["config_v0.cc"], | ||
hdrs = ["config_v0.h"], | ||
include_prefix = "tink/streamingaead/internal", | ||
deps = [ | ||
"//tink:configuration", | ||
"//tink/internal:configuration_impl", | ||
"//tink/streamingaead:aes_ctr_hmac_streaming_key_manager", | ||
"//tink/streamingaead:aes_gcm_hkdf_streaming_key_manager", | ||
"//tink/streamingaead:streaming_aead_wrapper", | ||
"//tink/util:status", | ||
"@com_google_absl//absl/memory", | ||
], | ||
) | ||
|
||
cc_test( | ||
name = "config_v0_test", | ||
srcs = ["config_v0_test.cc"], | ||
deps = [ | ||
":config_v0", | ||
":key_gen_config_v0", | ||
"//tink:configuration", | ||
"//tink:input_stream", | ||
"//tink:key_gen_configuration", | ||
"//tink:keyset_handle", | ||
"//tink:output_stream", | ||
"//tink:streaming_aead", | ||
"//tink/internal:configuration_impl", | ||
"//tink/internal:key_gen_configuration_impl", | ||
"//tink/internal:key_type_info_store", | ||
"//tink/internal:keyset_wrapper_store", | ||
"//proto:tink_cc_proto", | ||
"//tink/streamingaead:aes_ctr_hmac_streaming_key_manager", | ||
"//tink/streamingaead:aes_gcm_hkdf_streaming_key_manager", | ||
"//tink/streamingaead:streaming_aead_key_templates", | ||
"//tink/subtle:test_util", | ||
"//tink/util:istream_input_stream", | ||
"//tink/util:ostream_output_stream", | ||
"//tink/util:statusor", | ||
"//tink/util:test_matchers", | ||
"@com_google_absl//absl/memory", | ||
"@com_google_googletest//:gtest_main", | ||
], | ||
) | ||
|
||
cc_library( | ||
name = "key_gen_config_v0", | ||
srcs = ["key_gen_config_v0.cc"], | ||
hdrs = ["key_gen_config_v0.h"], | ||
include_prefix = "tink/streamingaead/internal", | ||
deps = [ | ||
"//tink:key_gen_configuration", | ||
"//tink/internal:key_gen_configuration_impl", | ||
"//tink/streamingaead:aes_ctr_hmac_streaming_key_manager", | ||
"//tink/streamingaead:aes_gcm_hkdf_streaming_key_manager", | ||
"//tink/util:status", | ||
"@com_google_absl//absl/memory", | ||
], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
tink_module(streamingaead::internal) | ||
|
||
tink_cc_library( | ||
NAME config_v0 | ||
SRCS | ||
config_v0.cc | ||
config_v0.h | ||
DEPS | ||
absl::memory | ||
tink::core::configuration | ||
tink::internal::configuration_impl | ||
tink::streamingaead::aes_ctr_hmac_streaming_key_manager | ||
tink::streamingaead::aes_gcm_hkdf_streaming_key_manager | ||
tink::streamingaead::streaming_aead_wrapper | ||
tink::util::status | ||
) | ||
|
||
tink_cc_test( | ||
NAME config_v0_test | ||
SRCS | ||
config_v0_test.cc | ||
DEPS | ||
tink::streamingaead::internal::config_v0 | ||
tink::streamingaead::internal::key_gen_config_v0 | ||
gmock | ||
absl::memory | ||
tink::core::configuration | ||
tink::core::input_stream | ||
tink::core::key_gen_configuration | ||
tink::core::keyset_handle | ||
tink::core::output_stream | ||
tink::core::streaming_aead | ||
tink::internal::configuration_impl | ||
tink::internal::key_gen_configuration_impl | ||
tink::internal::key_type_info_store | ||
tink::internal::keyset_wrapper_store | ||
tink::streamingaead::aes_ctr_hmac_streaming_key_manager | ||
tink::streamingaead::aes_gcm_hkdf_streaming_key_manager | ||
tink::streamingaead::streaming_aead_key_templates | ||
tink::subtle::test_util | ||
tink::util::istream_input_stream | ||
tink::util::ostream_output_stream | ||
tink::util::statusor | ||
tink::util::test_matchers | ||
tink::proto::tink_cc_proto | ||
) | ||
|
||
tink_cc_library( | ||
NAME key_gen_config_v0 | ||
SRCS | ||
key_gen_config_v0.cc | ||
key_gen_config_v0.h | ||
DEPS | ||
absl::memory | ||
tink::core::key_gen_configuration | ||
tink::internal::key_gen_configuration_impl | ||
tink::streamingaead::aes_ctr_hmac_streaming_key_manager | ||
tink::streamingaead::aes_gcm_hkdf_streaming_key_manager | ||
tink::util::status | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
// Copyright 2023 Google LLC | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
// | ||
//////////////////////////////////////////////////////////////////////////////// | ||
|
||
#include "tink/streamingaead/internal/config_v0.h" | ||
|
||
#include "absl/memory/memory.h" | ||
#include "tink/configuration.h" | ||
#include "tink/internal/configuration_impl.h" | ||
#include "tink/streamingaead/aes_ctr_hmac_streaming_key_manager.h" | ||
#include "tink/streamingaead/aes_gcm_hkdf_streaming_key_manager.h" | ||
#include "tink/streamingaead/streaming_aead_wrapper.h" | ||
#include "tink/util/status.h" | ||
|
||
namespace crypto { | ||
namespace tink { | ||
namespace internal { | ||
|
||
util::Status AddStreamingAeadV0(Configuration& config) { | ||
util::Status status = ConfigurationImpl::AddPrimitiveWrapper( | ||
absl::make_unique<StreamingAeadWrapper>(), config); | ||
if (!status.ok()) { | ||
return status; | ||
} | ||
|
||
status = ConfigurationImpl::AddKeyTypeManager( | ||
absl::make_unique<AesCtrHmacStreamingKeyManager>(), config); | ||
if (!status.ok()) { | ||
return status; | ||
} | ||
return ConfigurationImpl::AddKeyTypeManager( | ||
absl::make_unique<AesGcmHkdfStreamingKeyManager>(), config); | ||
} | ||
|
||
} // namespace internal | ||
} // namespace tink | ||
} // namespace crypto |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// Copyright 2023 Google LLC | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
// | ||
//////////////////////////////////////////////////////////////////////////////// | ||
|
||
#ifndef TINK_STREAMINGAEAD_INTERNAL_CONFIG_V0_H_ | ||
#define TINK_STREAMINGAEAD_INTERNAL_CONFIG_V0_H_ | ||
|
||
#include "tink/configuration.h" | ||
#include "tink/util/status.h" | ||
|
||
namespace crypto { | ||
namespace tink { | ||
namespace internal { | ||
|
||
// Add recommended Streaming AEAD primitive wrappers and key managers to | ||
// `config`, used to generate primitives. | ||
util::Status AddStreamingAeadV0(Configuration& config); | ||
|
||
} // namespace internal | ||
} // namespace tink | ||
} // namespace crypto | ||
|
||
#endif // TINK_STREAMINGAEAD_INTERNAL_CONFIG_V0_H_ |
Oops, something went wrong.