Coverage Report

Created: 2026-02-14 06:14

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/rust/registry/src/index.crates.io-1949cf8c6b5b557f/aws-lc-rs-1.15.4/src/aead/chacha.rs
Line
Count
Source
1
// Copyright 2016 Brian Smith.
2
// Portions Copyright (c) 2016, Google Inc.
3
// SPDX-License-Identifier: ISC
4
// Modifications copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
// SPDX-License-Identifier: Apache-2.0 OR ISC
6
7
use crate::aead::aead_ctx::AeadCtx;
8
use crate::aead::{Algorithm, AlgorithmID};
9
use crate::cipher::chacha::KEY_LEN;
10
use crate::error;
11
12
/// ChaCha20-Poly1305 as described in [RFC 7539].
13
///
14
/// The keys are 256 bits long and the nonces are 96 bits long.
15
///
16
/// [RFC 7539]: https://tools.ietf.org/html/rfc7539
17
pub const CHACHA20_POLY1305: Algorithm = Algorithm {
18
    init: init_chacha_aead,
19
    key_len: KEY_LEN,
20
    id: AlgorithmID::CHACHA20_POLY1305,
21
    max_input_len: u64::MAX,
22
};
23
24
#[inline]
25
0
fn init_chacha_aead(key: &[u8], tag_len: usize) -> Result<AeadCtx, error::Unspecified> {
26
0
    AeadCtx::chacha20(key, tag_len)
27
0
}