proxygen
ChaCha20Poly1305.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2018-present, Facebook, Inc.
3  * All rights reserved.
4  *
5  * This source code is licensed under the BSD-style license found in the
6  * LICENSE file in the root directory of this source tree.
7  */
8 
9 #pragma once
10 
12 #include <openssl/evp.h>
13 
14 namespace fizz {
15 
17  static const EVP_CIPHER* Cipher() {
18 #if FOLLY_OPENSSL_IS_110
19  return EVP_chacha20_poly1305();
20 #else
21  throw std::runtime_error(
22  "chacha20-poly1305 support requires OpenSSL 1.1.0");
23 #endif // FOLLY_OPENSSL_IS_110
24  }
25 
26  static const size_t kKeyLength{32};
27  static const size_t kIVLength{12};
28  static const size_t kTagLength{16};
29  static const bool kOperatesInBlocks{false};
30  static const bool kRequiresPresetTagLen{false};
31 };
32 
33 } // namespace fizz
static const size_t kTagLength
static const bool kRequiresPresetTagLen
static const size_t kIVLength
static const EVP_CIPHER * Cipher()
Definition: Actions.h:16
static const bool kOperatesInBlocks
static const size_t kKeyLength