0

Add Chacha20Poly1305 to AEAD Algorithms

Bug: b:153649905
Change-Id: I3eaca93d0ae7b0d0cd5c502e8536977fb66ca979
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2363351
Reviewed-by: Adam Langley <agl@chromium.org>
Commit-Queue: Leonid Baraz <lbaraz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#799275}
This commit is contained in:
Leonid Baraz
2020-08-18 19:55:09 +00:00
committed by Commit Bot
parent d9aff4f43c
commit 07c057709a
3 changed files with 12 additions and 2 deletions

@ -27,6 +27,9 @@ Aead::Aead(AeadAlgorithm algorithm) {
case AES_256_GCM_SIV:
aead_ = EVP_aead_aes_256_gcm_siv();
break;
case CHACHA20_POLY1305:
aead_ = EVP_aead_chacha20_poly1305();
break;
}
}

@ -26,7 +26,12 @@ namespace crypto {
// Prefer the latter in new code.
class CRYPTO_EXPORT Aead {
public:
enum AeadAlgorithm { AES_128_CTR_HMAC_SHA256, AES_256_GCM, AES_256_GCM_SIV };
enum AeadAlgorithm {
AES_128_CTR_HMAC_SHA256,
AES_256_GCM,
AES_256_GCM_SIV,
CHACHA20_POLY1305
};
explicit Aead(AeadAlgorithm algorithm);
Aead(const Aead&) = delete;

@ -11,8 +11,10 @@
namespace {
const crypto::Aead::AeadAlgorithm kAllAlgorithms[]{
crypto::Aead::AES_128_CTR_HMAC_SHA256, crypto::Aead::AES_256_GCM,
crypto::Aead::AES_128_CTR_HMAC_SHA256,
crypto::Aead::AES_256_GCM,
crypto::Aead::AES_256_GCM_SIV,
crypto::Aead::CHACHA20_POLY1305,
};
class AeadTest : public testing::TestWithParam<crypto::Aead::AeadAlgorithm> {};