Go to the documentation of this file.
24 if (
name ==
"des-cbc") {
26 }
else if (
name ==
"des-ecb") {
28 }
else if (
name ==
"des-ede") {
30 }
else if (
name ==
"des-ede3") {
32 }
else if (
name ==
"des-ede-cbc") {
34 }
else if (
name ==
"des-ede3-cbc") {
36 }
else if (
name ==
"rc4") {
38 }
else if (
name ==
"aes-128-ecb") {
40 }
else if (
name ==
"aes-256-ecb") {
42 }
else if (
name ==
"aes-128-cbc") {
44 }
else if (
name ==
"aes-128-gcm") {
46 }
else if (
name ==
"aes-128-ofb") {
48 }
else if (
name ==
"aes-192-cbc") {
50 }
else if (
name ==
"aes-192-ctr") {
52 }
else if (
name ==
"aes-192-ecb") {
54 }
else if (
name ==
"aes-256-cbc") {
56 }
else if (
name ==
"aes-128-ctr") {
58 }
else if (
name ==
"aes-256-ctr") {
60 }
else if (
name ==
"aes-256-gcm") {
62 }
else if (
name ==
"aes-256-ofb") {
69 bool encrypt,
const std::vector<uint8_t> &
key,
70 const std::vector<uint8_t> &iv,
71 const std::vector<uint8_t> &
in) {
72 bssl::ScopedEVP_CIPHER_CTX
ctx;
81 int result_len1 = 0, result_len2;
82 *
out = std::vector<uint8_t>(
in.size());
92 out->resize(result_len1 + result_len2);
98 std::vector<uint8_t> *
tag,
size_t tag_len,
99 const std::vector<uint8_t> &
key,
100 const std::vector<uint8_t> &pt,
101 const std::vector<uint8_t> &aad,
102 const std::vector<uint8_t> &iv) {
103 bssl::ScopedEVP_AEAD_CTX
ctx;
109 std::vector<uint8_t>
out;
113 iv.size(), pt.data(), pt.size(), aad.data(),
119 ct->assign(
out.begin(),
out.end() - tag_len);
120 tag->assign(
out.end() - tag_len,
out.end());
126 const std::vector<uint8_t> &
key,
127 const std::vector<uint8_t> &aad,
128 const std::vector<uint8_t> &ct,
129 const std::vector<uint8_t> &
tag,
130 const std::vector<uint8_t> &iv) {
131 bssl::ScopedEVP_AEAD_CTX
ctx;
136 std::vector<uint8_t>
in = ct;
137 in.reserve(ct.size() +
tag.size());
143 iv.data(), iv.size(),
in.data(),
in.size(), aad.data(),
145 out_pt_len != pt_len) {
160 if (!t->GetAttribute(&hex, attribute)) {
164 bssl::UniquePtr<BIGNUM>
ret;
165 if (
HexToBIGNUM(&
ret, hex.c_str()) !=
static_cast<int>(hex.size())) {
166 t->PrintLine(
"Could not decode '%s'.", hex.c_str());
174 if (out_str ==
nullptr) {
178 if (t->HasInstruction(
"P-224")) {
182 if (t->HasInstruction(
"P-256")) {
186 if (t->HasInstruction(
"P-384")) {
190 if (t->HasInstruction(
"P-521")) {
194 t->PrintLine(
"No supported group specified.");
199 if (t->HasInstruction(
"SHA-1")) {
202 if (t->HasInstruction(
"SHA-224")) {
205 if (t->HasInstruction(
"SHA-256")) {
208 if (t->HasInstruction(
"SHA-384")) {
211 if (t->HasInstruction(
"SHA-512")) {
214 t->PrintLine(
"No supported digest function specified.");
219 fwrite(comment.c_str(), comment.size(), 1,
stdout);
const OPENSSL_EXPORT EVP_MD * EVP_sha512(void)
const EVP_MD * GetDigestFromInstruction(FileTest *t)
const OPENSSL_EXPORT EVP_CIPHER * EVP_aes_192_ecb(void)
#define NID_X9_62_prime256v1
const OPENSSL_EXPORT EVP_CIPHER * EVP_aes_256_ecb(void)
const OPENSSL_EXPORT EVP_MD * EVP_sha384(void)
const OPENSSL_EXPORT EVP_CIPHER * EVP_des_cbc(void)
const OPENSSL_EXPORT EVP_CIPHER * EVP_des_ede3(void)
const OPENSSL_EXPORT EVP_CIPHER * EVP_aes_256_cbc(void)
const OPENSSL_EXPORT EVP_CIPHER * EVP_aes_192_cbc(void)
const OPENSSL_EXPORT EVP_CIPHER * EVP_aes_128_ctr(void)
const OPENSSL_EXPORT EVP_CIPHER * EVP_aes_128_gcm(void)
static struct test_ctx ctx
const OPENSSL_EXPORT EVP_MD * EVP_sha256(void)
#define EVP_CIPHER_CTX_iv_length
const OPENSSL_EXPORT EVP_CIPHER * EVP_des_ecb(void)
const OPENSSL_EXPORT EVP_CIPHER * EVP_aes_192_ctr(void)
const OPENSSL_EXPORT EVP_CIPHER * EVP_aes_256_ctr(void)
#define EVP_AEAD_CTX_init_with_direction
static int HexToBIGNUM(bssl::UniquePtr< BIGNUM > *out, const char *in)
static void * tag(intptr_t t)
#define EVP_CIPHER_CTX_set_padding
const OPENSSL_EXPORT EVP_CIPHER * EVP_aes_128_ecb(void)
int GetECGroupNIDFromInstruction(FileTest *t, const char **out_str)
#define EVP_AEAD_CTX_seal
const EVP_CIPHER * GetCipher(const std::string &name)
#define EVP_CIPHER_CTX_set_key_length
#define EVP_AEAD_CTX_init
const OPENSSL_EXPORT EVP_CIPHER * EVP_des_ede_cbc(void)
void EchoComment(const std::string &comment)
const OPENSSL_EXPORT EVP_CIPHER * EVP_des_ede3_cbc(void)
bool AEADDecrypt(const EVP_AEAD *aead, std::vector< uint8_t > *pt, size_t pt_len, const std::vector< uint8_t > &key, const std::vector< uint8_t > &aad, const std::vector< uint8_t > &ct, const std::vector< uint8_t > &tag, const std::vector< uint8_t > &iv)
bool CipherOperation(const EVP_CIPHER *cipher, std::vector< uint8_t > *out, bool encrypt, const std::vector< uint8_t > &key, const std::vector< uint8_t > &iv, const std::vector< uint8_t > &in)
const OPENSSL_EXPORT EVP_CIPHER * EVP_des_ede(void)
#define EVP_CipherFinal_ex
#define EVP_AEAD_CTX_open
#define EVP_CipherInit_ex
bool AEADEncrypt(const EVP_AEAD *aead, std::vector< uint8_t > *ct, std::vector< uint8_t > *tag, size_t tag_len, const std::vector< uint8_t > &key, const std::vector< uint8_t > &pt, const std::vector< uint8_t > &aad, const std::vector< uint8_t > &iv)
UniquePtr< SSL_SESSION > ret
const OPENSSL_EXPORT EVP_MD * EVP_sha1(void)
const OPENSSL_EXPORT EVP_CIPHER * EVP_aes_256_gcm(void)
bssl::UniquePtr< BIGNUM > GetBIGNUM(FileTest *t, const char *attribute)
const OPENSSL_EXPORT EVP_CIPHER * EVP_aes_128_ofb(void)
const OPENSSL_EXPORT EVP_CIPHER * EVP_aes_256_ofb(void)
const OPENSSL_EXPORT EVP_CIPHER * EVP_aes_128_cbc(void)
const OPENSSL_EXPORT EVP_MD * EVP_sha224(void)
#define EVP_AEAD_max_overhead
grpc
Author(s):
autogenerated on Fri May 16 2025 02:57:52