Merge BoringSSL d4f877e: Reference the newer ChaCha20-Poly1305 RFC.
This commit is contained in:
commit
1ab2d161fc
@ -19,11 +19,11 @@ use super::{
|
|||||||
use crate::{aead, cpu, endian::*, error, polyfill};
|
use crate::{aead, cpu, endian::*, error, polyfill};
|
||||||
use core::{convert::TryInto, ops::RangeFrom};
|
use core::{convert::TryInto, ops::RangeFrom};
|
||||||
|
|
||||||
/// ChaCha20-Poly1305 as described in [RFC 7539].
|
/// ChaCha20-Poly1305 as described in [RFC 8439].
|
||||||
///
|
///
|
||||||
/// The keys are 256 bits long and the nonces are 96 bits long.
|
/// The keys are 256 bits long and the nonces are 96 bits long.
|
||||||
///
|
///
|
||||||
/// [RFC 7539]: https://tools.ietf.org/html/rfc7539
|
/// [RFC 8439]: https://tools.ietf.org/html/rfc8439
|
||||||
pub static CHACHA20_POLY1305: aead::Algorithm = aead::Algorithm {
|
pub static CHACHA20_POLY1305: aead::Algorithm = aead::Algorithm {
|
||||||
key_len: chacha::KEY_LEN,
|
key_len: chacha::KEY_LEN,
|
||||||
init: chacha20_poly1305_init,
|
init: chacha20_poly1305_init,
|
||||||
@ -261,7 +261,7 @@ pub(super) fn derive_poly1305_key(chacha_key: &chacha::Key, iv: Iv) -> poly1305:
|
|||||||
mod tests {
|
mod tests {
|
||||||
#[test]
|
#[test]
|
||||||
fn max_input_len_test() {
|
fn max_input_len_test() {
|
||||||
// Errata 4858 at https://www.rfc-editor.org/errata_search.php?rfc=7539.
|
// https://tools.ietf.org/html/rfc8439#section-2.8
|
||||||
assert_eq!(super::CHACHA20_POLY1305.max_input_len, 274_877_906_880u64);
|
assert_eq!(super::CHACHA20_POLY1305.max_input_len, 274_877_906_880u64);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,14 +9,14 @@ Input = 000000000000000b170303020000000006db1f1f368d696a810a349c0c714c9a5e7850c2
|
|||||||
MAC = 2637408fe13086ea73f971e3425e2820
|
MAC = 2637408fe13086ea73f971e3425e2820
|
||||||
|
|
||||||
|
|
||||||
# RFC 7539, section 2.5.2.
|
# RFC 8439, section 2.5.2.
|
||||||
|
|
||||||
Key = 85d6be7857556d337f4452fe42d506a80103808afb0db2fd4abff6af4149f51b
|
Key = 85d6be7857556d337f4452fe42d506a80103808afb0db2fd4abff6af4149f51b
|
||||||
Input = "Cryptographic Forum Research Group"
|
Input = "Cryptographic Forum Research Group"
|
||||||
MAC = a8061dc1305136c6c22b8baf0c0127a9
|
MAC = a8061dc1305136c6c22b8baf0c0127a9
|
||||||
|
|
||||||
|
|
||||||
# RFC 7539, section A.3.
|
# RFC 8439, section A.3.
|
||||||
|
|
||||||
Key = 0000000000000000000000000000000000000000000000000000000000000000
|
Key = 0000000000000000000000000000000000000000000000000000000000000000
|
||||||
Input = 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
Input = 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
# Test vector from RFC 7539 Section 2.8.1.
|
# Test vector from RFC 8439 Section 2.8.1.
|
||||||
|
|
||||||
KEY = 808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9f
|
KEY = 808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9f
|
||||||
NONCE = 070000004041424344454647
|
NONCE = 070000004041424344454647
|
||||||
@ -58,7 +58,7 @@ TAG = 2a63876a887f4f080c9df418813fc1fd
|
|||||||
FAILS = WRONG_NONCE_LENGTH
|
FAILS = WRONG_NONCE_LENGTH
|
||||||
|
|
||||||
# Test vectors from chacha20_poly1305_deprecated_tests.txt, modified for the
|
# Test vectors from chacha20_poly1305_deprecated_tests.txt, modified for the
|
||||||
# RFC 7539 AEAD construction.
|
# RFC 8439 AEAD construction.
|
||||||
|
|
||||||
KEY = 9a97f65b9b4c721b960a672145fca8d4e32e67f9111ea979ce9c4826806aeee6
|
KEY = 9a97f65b9b4c721b960a672145fca8d4e32e67f9111ea979ce9c4826806aeee6
|
||||||
NONCE = 000000003de9c0da2bd7f91e
|
NONCE = 000000003de9c0da2bd7f91e
|
||||||
|
Loading…
x
Reference in New Issue
Block a user