Commit 07c05770 authored by Leonid Baraz's avatar Leonid Baraz Committed by Commit Bot

Add Chacha20Poly1305 to AEAD Algorithms

Bug: b:153649905
Change-Id: I3eaca93d0ae7b0d0cd5c502e8536977fb66ca979
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2363351Reviewed-by: default avatarAdam Langley <agl@chromium.org>
Commit-Queue: Leonid Baraz <lbaraz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#799275}
parent d9aff4f4
...@@ -27,6 +27,9 @@ Aead::Aead(AeadAlgorithm algorithm) { ...@@ -27,6 +27,9 @@ Aead::Aead(AeadAlgorithm algorithm) {
case AES_256_GCM_SIV: case AES_256_GCM_SIV:
aead_ = EVP_aead_aes_256_gcm_siv(); aead_ = EVP_aead_aes_256_gcm_siv();
break; break;
case CHACHA20_POLY1305:
aead_ = EVP_aead_chacha20_poly1305();
break;
} }
} }
......
...@@ -26,7 +26,12 @@ namespace crypto { ...@@ -26,7 +26,12 @@ namespace crypto {
// Prefer the latter in new code. // Prefer the latter in new code.
class CRYPTO_EXPORT Aead { class CRYPTO_EXPORT Aead {
public: 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); explicit Aead(AeadAlgorithm algorithm);
Aead(const Aead&) = delete; Aead(const Aead&) = delete;
......
...@@ -11,8 +11,10 @@ ...@@ -11,8 +11,10 @@
namespace { namespace {
const crypto::Aead::AeadAlgorithm kAllAlgorithms[]{ 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::AES_256_GCM_SIV,
crypto::Aead::CHACHA20_POLY1305,
}; };
class AeadTest : public testing::TestWithParam<crypto::Aead::AeadAlgorithm> {}; class AeadTest : public testing::TestWithParam<crypto::Aead::AeadAlgorithm> {};
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment