tink_daead/
lib.rs

1// Copyright 2020 The Tink-Rust Authors
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//! This crate provides implementations of the [`tink_core::DeterministicAead`] primitive.
18//!
19//! Unlike AEAD, implementations of this interface are not semantically secure, because
20//! encrypting the same plaintex always yields the same ciphertext.
21
22#![deny(broken_intra_doc_links)]
23
24use std::sync::Once;
25
26mod aes_siv_key_manager;
27pub use aes_siv_key_manager::*;
28mod factory;
29pub use factory::*;
30mod key_templates;
31pub use key_templates::*;
32
33pub mod subtle;
34
35/// The [upstream Tink](https://github.com/google/tink) version that this Rust
36/// port is based on.
37pub const UPSTREAM_VERSION: &str = "1.6.0";
38
39static INIT: Once = Once::new();
40
41/// Initialize the `tink-daead` crate, registering its primitives so they are available via
42/// tink-core.
43pub fn init() {
44    INIT.call_once(|| {
45        tink_core::registry::register_key_manager(std::sync::Arc::new(AesSivKeyManager))
46            .expect("tink_daead::init() failed"); // safe: init
47
48        tink_core::registry::register_template_generator("AES256_SIV", aes_siv_key_template);
49    });
50}