e_tls.c
Go to the documentation of this file.
1 /* Copyright (c) 2014, Google Inc.
2  *
3  * Permission to use, copy, modify, and/or distribute this software for any
4  * purpose with or without fee is hereby granted, provided that the above
5  * copyright notice and this permission notice appear in all copies.
6  *
7  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
8  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
9  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
10  * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
11  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
12  * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
13  * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */
14 
15 #include <assert.h>
16 #include <limits.h>
17 #include <string.h>
18 
19 #include <openssl/aead.h>
20 #include <openssl/cipher.h>
21 #include <openssl/err.h>
22 #include <openssl/hmac.h>
23 #include <openssl/md5.h>
24 #include <openssl/mem.h>
25 #include <openssl/sha.h>
26 #include <openssl/type_check.h>
27 
28 #include "../fipsmodule/cipher/internal.h"
29 #include "../internal.h"
30 #include "internal.h"
31 
32 
33 typedef struct {
36  // mac_key is the portion of the key used for the MAC. It is retained
37  // separately for the constant-time CBC code.
40  // implicit_iv is one iff this is a pre-TLS-1.1 CBC cipher without an explicit
41  // IV.
43 } AEAD_TLS_CTX;
44 
46  "mac_key_len does not fit in uint8_t");
47 
48 OPENSSL_STATIC_ASSERT(sizeof(((EVP_AEAD_CTX *)NULL)->state) >=
49  sizeof(AEAD_TLS_CTX),
50  "AEAD state is too small");
51 #if defined(__GNUC__) || defined(__clang__)
53  alignof(AEAD_TLS_CTX),
54  "AEAD state has insufficient alignment");
55 #endif
56 
58  AEAD_TLS_CTX *tls_ctx = (AEAD_TLS_CTX *)&ctx->state;
60  HMAC_CTX_cleanup(&tls_ctx->hmac_ctx);
61 }
62 
63 static int aead_tls_init(EVP_AEAD_CTX *ctx, const uint8_t *key, size_t key_len,
64  size_t tag_len, enum evp_aead_direction_t dir,
65  const EVP_CIPHER *cipher, const EVP_MD *md,
66  char implicit_iv) {
67  if (tag_len != EVP_AEAD_DEFAULT_TAG_LENGTH &&
68  tag_len != EVP_MD_size(md)) {
70  return 0;
71  }
72 
73  if (key_len != EVP_AEAD_key_length(ctx->aead)) {
75  return 0;
76  }
77 
78  size_t mac_key_len = EVP_MD_size(md);
79  size_t enc_key_len = EVP_CIPHER_key_length(cipher);
80  assert(mac_key_len + enc_key_len +
81  (implicit_iv ? EVP_CIPHER_iv_length(cipher) : 0) == key_len);
82 
83  AEAD_TLS_CTX *tls_ctx = (AEAD_TLS_CTX *)&ctx->state;
85  HMAC_CTX_init(&tls_ctx->hmac_ctx);
86  assert(mac_key_len <= EVP_MAX_MD_SIZE);
87  OPENSSL_memcpy(tls_ctx->mac_key, key, mac_key_len);
88  tls_ctx->mac_key_len = (uint8_t)mac_key_len;
89  tls_ctx->implicit_iv = implicit_iv;
90 
91  if (!EVP_CipherInit_ex(&tls_ctx->cipher_ctx, cipher, NULL, &key[mac_key_len],
92  implicit_iv ? &key[mac_key_len + enc_key_len] : NULL,
93  dir == evp_aead_seal) ||
94  !HMAC_Init_ex(&tls_ctx->hmac_ctx, key, mac_key_len, md, NULL)) {
96  return 0;
97  }
99 
100  return 1;
101 }
102 
103 static size_t aead_tls_tag_len(const EVP_AEAD_CTX *ctx, const size_t in_len,
104  const size_t extra_in_len) {
105  assert(extra_in_len == 0);
106  const AEAD_TLS_CTX *tls_ctx = (AEAD_TLS_CTX *)&ctx->state;
107 
108  const size_t hmac_len = HMAC_size(&tls_ctx->hmac_ctx);
110  // The NULL cipher.
111  return hmac_len;
112  }
113 
114  const size_t block_size = EVP_CIPHER_CTX_block_size(&tls_ctx->cipher_ctx);
115  // An overflow of |in_len + hmac_len| doesn't affect the result mod
116  // |block_size|, provided that |block_size| is a smaller power of two.
117  assert(block_size != 0 && (block_size & (block_size - 1)) == 0);
118  const size_t pad_len = block_size - (in_len + hmac_len) % block_size;
119  return hmac_len + pad_len;
120 }
121 
123  uint8_t *out_tag, size_t *out_tag_len,
124  const size_t max_out_tag_len,
125  const uint8_t *nonce, const size_t nonce_len,
126  const uint8_t *in, const size_t in_len,
127  const uint8_t *extra_in,
128  const size_t extra_in_len, const uint8_t *ad,
129  const size_t ad_len) {
130  AEAD_TLS_CTX *tls_ctx = (AEAD_TLS_CTX *)&ctx->state;
131 
132  if (!tls_ctx->cipher_ctx.encrypt) {
133  // Unlike a normal AEAD, a TLS AEAD may only be used in one direction.
135  return 0;
136  }
137 
138  if (in_len > INT_MAX) {
139  // EVP_CIPHER takes int as input.
141  return 0;
142  }
143 
144  if (max_out_tag_len < aead_tls_tag_len(ctx, in_len, extra_in_len)) {
146  return 0;
147  }
148 
149  if (nonce_len != EVP_AEAD_nonce_length(ctx->aead)) {
151  return 0;
152  }
153 
154  if (ad_len != 13 - 2 /* length bytes */) {
156  return 0;
157  }
158 
159  // To allow for CBC mode which changes cipher length, |ad| doesn't include the
160  // length for legacy ciphers.
161  uint8_t ad_extra[2];
162  ad_extra[0] = (uint8_t)(in_len >> 8);
163  ad_extra[1] = (uint8_t)(in_len & 0xff);
164 
165  // Compute the MAC. This must be first in case the operation is being done
166  // in-place.
168  unsigned mac_len;
169  if (!HMAC_Init_ex(&tls_ctx->hmac_ctx, NULL, 0, NULL, NULL) ||
170  !HMAC_Update(&tls_ctx->hmac_ctx, ad, ad_len) ||
171  !HMAC_Update(&tls_ctx->hmac_ctx, ad_extra, sizeof(ad_extra)) ||
172  !HMAC_Update(&tls_ctx->hmac_ctx, in, in_len) ||
173  !HMAC_Final(&tls_ctx->hmac_ctx, mac, &mac_len)) {
174  return 0;
175  }
176 
177  // Configure the explicit IV.
179  !tls_ctx->implicit_iv &&
180  !EVP_EncryptInit_ex(&tls_ctx->cipher_ctx, NULL, NULL, NULL, nonce)) {
181  return 0;
182  }
183 
184  // Encrypt the input.
185  int len;
186  if (!EVP_EncryptUpdate(&tls_ctx->cipher_ctx, out, &len, in, (int)in_len)) {
187  return 0;
188  }
189 
190  unsigned block_size = EVP_CIPHER_CTX_block_size(&tls_ctx->cipher_ctx);
191 
192  // Feed the MAC into the cipher in two steps. First complete the final partial
193  // block from encrypting the input and split the result between |out| and
194  // |out_tag|. Then feed the rest.
195 
196  const size_t early_mac_len = (block_size - (in_len % block_size)) % block_size;
197  if (early_mac_len != 0) {
198  assert(len + block_size - early_mac_len == in_len);
200  int buf_len;
201  if (!EVP_EncryptUpdate(&tls_ctx->cipher_ctx, buf, &buf_len, mac,
202  (int)early_mac_len)) {
203  return 0;
204  }
205  assert(buf_len == (int)block_size);
206  OPENSSL_memcpy(out + len, buf, block_size - early_mac_len);
207  OPENSSL_memcpy(out_tag, buf + block_size - early_mac_len, early_mac_len);
208  }
209  size_t tag_len = early_mac_len;
210 
211  if (!EVP_EncryptUpdate(&tls_ctx->cipher_ctx, out_tag + tag_len, &len,
212  mac + tag_len, mac_len - tag_len)) {
213  return 0;
214  }
215  tag_len += len;
216 
217  if (block_size > 1) {
218  assert(block_size <= 256);
219  assert(EVP_CIPHER_CTX_mode(&tls_ctx->cipher_ctx) == EVP_CIPH_CBC_MODE);
220 
221  // Compute padding and feed that into the cipher.
222  uint8_t padding[256];
223  unsigned padding_len = block_size - ((in_len + mac_len) % block_size);
224  OPENSSL_memset(padding, padding_len - 1, padding_len);
225  if (!EVP_EncryptUpdate(&tls_ctx->cipher_ctx, out_tag + tag_len, &len,
226  padding, (int)padding_len)) {
227  return 0;
228  }
229  tag_len += len;
230  }
231 
232  if (!EVP_EncryptFinal_ex(&tls_ctx->cipher_ctx, out_tag + tag_len, &len)) {
233  return 0;
234  }
235  assert(len == 0); // Padding is explicit.
236  assert(tag_len == aead_tls_tag_len(ctx, in_len, extra_in_len));
237 
238  *out_tag_len = tag_len;
239  return 1;
240 }
241 
242 static int aead_tls_open(const EVP_AEAD_CTX *ctx, uint8_t *out, size_t *out_len,
243  size_t max_out_len, const uint8_t *nonce,
244  size_t nonce_len, const uint8_t *in, size_t in_len,
245  const uint8_t *ad, size_t ad_len) {
246  AEAD_TLS_CTX *tls_ctx = (AEAD_TLS_CTX *)&ctx->state;
247 
248  if (tls_ctx->cipher_ctx.encrypt) {
249  // Unlike a normal AEAD, a TLS AEAD may only be used in one direction.
251  return 0;
252  }
253 
254  if (in_len < HMAC_size(&tls_ctx->hmac_ctx)) {
256  return 0;
257  }
258 
259  if (max_out_len < in_len) {
260  // This requires that the caller provide space for the MAC, even though it
261  // will always be removed on return.
263  return 0;
264  }
265 
266  if (nonce_len != EVP_AEAD_nonce_length(ctx->aead)) {
268  return 0;
269  }
270 
271  if (ad_len != 13 - 2 /* length bytes */) {
273  return 0;
274  }
275 
276  if (in_len > INT_MAX) {
277  // EVP_CIPHER takes int as input.
279  return 0;
280  }
281 
282  // Configure the explicit IV.
284  !tls_ctx->implicit_iv &&
285  !EVP_DecryptInit_ex(&tls_ctx->cipher_ctx, NULL, NULL, NULL, nonce)) {
286  return 0;
287  }
288 
289  // Decrypt to get the plaintext + MAC + padding.
290  size_t total = 0;
291  int len;
292  if (!EVP_DecryptUpdate(&tls_ctx->cipher_ctx, out, &len, in, (int)in_len)) {
293  return 0;
294  }
295  total += len;
296  if (!EVP_DecryptFinal_ex(&tls_ctx->cipher_ctx, out + total, &len)) {
297  return 0;
298  }
299  total += len;
300  assert(total == in_len);
301 
303 
304  // Remove CBC padding. Code from here on is timing-sensitive with respect to
305  // |padding_ok| and |data_plus_mac_len| for CBC ciphers.
306  size_t data_plus_mac_len;
307  crypto_word_t padding_ok;
310  &padding_ok, &data_plus_mac_len, out, total,
312  HMAC_size(&tls_ctx->hmac_ctx))) {
313  // Publicly invalid. This can be rejected in non-constant time.
315  return 0;
316  }
317  } else {
318  padding_ok = CONSTTIME_TRUE_W;
319  data_plus_mac_len = total;
320  // |data_plus_mac_len| = |total| = |in_len| at this point. |in_len| has
321  // already been checked against the MAC size at the top of the function.
322  assert(data_plus_mac_len >= HMAC_size(&tls_ctx->hmac_ctx));
323  }
324  size_t data_len = data_plus_mac_len - HMAC_size(&tls_ctx->hmac_ctx);
325 
326  // At this point, if the padding is valid, the first |data_plus_mac_len| bytes
327  // after |out| are the plaintext and MAC. Otherwise, |data_plus_mac_len| is
328  // still large enough to extract a MAC, but it will be irrelevant.
329 
330  // To allow for CBC mode which changes cipher length, |ad| doesn't include the
331  // length for legacy ciphers.
332  uint8_t ad_fixed[13];
333  OPENSSL_memcpy(ad_fixed, ad, 11);
334  ad_fixed[11] = (uint8_t)(data_len >> 8);
335  ad_fixed[12] = (uint8_t)(data_len & 0xff);
336  ad_len += 2;
337 
338  // Compute the MAC and extract the one in the record.
340  size_t mac_len;
341  uint8_t record_mac_tmp[EVP_MAX_MD_SIZE];
342  uint8_t *record_mac;
345  if (!EVP_tls_cbc_digest_record(tls_ctx->hmac_ctx.md, mac, &mac_len,
346  ad_fixed, out, data_len, total,
347  tls_ctx->mac_key, tls_ctx->mac_key_len)) {
349  return 0;
350  }
351  assert(mac_len == HMAC_size(&tls_ctx->hmac_ctx));
352 
353  record_mac = record_mac_tmp;
354  EVP_tls_cbc_copy_mac(record_mac, mac_len, out, data_plus_mac_len, total);
355  } else {
356  // We should support the constant-time path for all CBC-mode ciphers
357  // implemented.
358  assert(EVP_CIPHER_CTX_mode(&tls_ctx->cipher_ctx) != EVP_CIPH_CBC_MODE);
359 
360  unsigned mac_len_u;
361  if (!HMAC_Init_ex(&tls_ctx->hmac_ctx, NULL, 0, NULL, NULL) ||
362  !HMAC_Update(&tls_ctx->hmac_ctx, ad_fixed, ad_len) ||
363  !HMAC_Update(&tls_ctx->hmac_ctx, out, data_len) ||
364  !HMAC_Final(&tls_ctx->hmac_ctx, mac, &mac_len_u)) {
365  return 0;
366  }
367  mac_len = mac_len_u;
368 
369  assert(mac_len == HMAC_size(&tls_ctx->hmac_ctx));
370  record_mac = &out[data_len];
371  }
372 
373  // Perform the MAC check and the padding check in constant-time. It should be
374  // safe to simply perform the padding check first, but it would not be under a
375  // different choice of MAC location on padding failure. See
376  // EVP_tls_cbc_remove_padding.
377  crypto_word_t good =
378  constant_time_eq_int(CRYPTO_memcmp(record_mac, mac, mac_len), 0);
379  good &= padding_ok;
380  CONSTTIME_DECLASSIFY(&good, sizeof(good));
381  if (!good) {
383  return 0;
384  }
385 
386  CONSTTIME_DECLASSIFY(&data_len, sizeof(data_len));
387  CONSTTIME_DECLASSIFY(out, data_len);
388 
389  // End of timing-sensitive code.
390 
391  *out_len = data_len;
392  return 1;
393 }
394 
396  size_t key_len, size_t tag_len,
397  enum evp_aead_direction_t dir) {
398  return aead_tls_init(ctx, key, key_len, tag_len, dir, EVP_aes_128_cbc(),
399  EVP_sha1(), 0);
400 }
401 
403  EVP_AEAD_CTX *ctx, const uint8_t *key, size_t key_len, size_t tag_len,
404  enum evp_aead_direction_t dir) {
405  return aead_tls_init(ctx, key, key_len, tag_len, dir, EVP_aes_128_cbc(),
406  EVP_sha1(), 1);
407 }
408 
410  size_t key_len, size_t tag_len,
411  enum evp_aead_direction_t dir) {
412  return aead_tls_init(ctx, key, key_len, tag_len, dir, EVP_aes_256_cbc(),
413  EVP_sha1(), 0);
414 }
415 
417  EVP_AEAD_CTX *ctx, const uint8_t *key, size_t key_len, size_t tag_len,
418  enum evp_aead_direction_t dir) {
419  return aead_tls_init(ctx, key, key_len, tag_len, dir, EVP_aes_256_cbc(),
420  EVP_sha1(), 1);
421 }
422 
424  const uint8_t *key, size_t key_len,
425  size_t tag_len,
426  enum evp_aead_direction_t dir) {
427  return aead_tls_init(ctx, key, key_len, tag_len, dir, EVP_des_ede3_cbc(),
428  EVP_sha1(), 0);
429 }
430 
432  EVP_AEAD_CTX *ctx, const uint8_t *key, size_t key_len, size_t tag_len,
433  enum evp_aead_direction_t dir) {
434  return aead_tls_init(ctx, key, key_len, tag_len, dir, EVP_des_ede3_cbc(),
435  EVP_sha1(), 1);
436 }
437 
438 static int aead_tls_get_iv(const EVP_AEAD_CTX *ctx, const uint8_t **out_iv,
439  size_t *out_iv_len) {
440  const AEAD_TLS_CTX *tls_ctx = (AEAD_TLS_CTX *)&ctx->state;
441  const size_t iv_len = EVP_CIPHER_CTX_iv_length(&tls_ctx->cipher_ctx);
442  if (iv_len <= 1) {
443  return 0;
444  }
445 
446  *out_iv = tls_ctx->cipher_ctx.iv;
447  *out_iv_len = iv_len;
448  return 1;
449 }
450 
452  size_t key_len, size_t tag_len,
453  enum evp_aead_direction_t dir) {
454  return aead_tls_init(ctx, key, key_len, tag_len, dir, EVP_enc_null(),
455  EVP_sha1(), 1 /* implicit iv */);
456 }
457 
459  SHA_DIGEST_LENGTH + 16, // key len (SHA1 + AES128)
460  16, // nonce len (IV)
461  16 + SHA_DIGEST_LENGTH, // overhead (padding + SHA1)
462  SHA_DIGEST_LENGTH, // max tag length
463  0, // seal_scatter_supports_extra_in
464 
465  NULL, // init
470  NULL, // open_gather
471  NULL, // get_iv
473 };
474 
476  SHA_DIGEST_LENGTH + 16 + 16, // key len (SHA1 + AES128 + IV)
477  0, // nonce len
478  16 + SHA_DIGEST_LENGTH, // overhead (padding + SHA1)
479  SHA_DIGEST_LENGTH, // max tag length
480  0, // seal_scatter_supports_extra_in
481 
482  NULL, // init
487  NULL, // open_gather
488  aead_tls_get_iv, // get_iv
490 };
491 
493  SHA_DIGEST_LENGTH + 32, // key len (SHA1 + AES256)
494  16, // nonce len (IV)
495  16 + SHA_DIGEST_LENGTH, // overhead (padding + SHA1)
496  SHA_DIGEST_LENGTH, // max tag length
497  0, // seal_scatter_supports_extra_in
498 
499  NULL, // init
504  NULL, // open_gather
505  NULL, // get_iv
507 };
508 
510  SHA_DIGEST_LENGTH + 32 + 16, // key len (SHA1 + AES256 + IV)
511  0, // nonce len
512  16 + SHA_DIGEST_LENGTH, // overhead (padding + SHA1)
513  SHA_DIGEST_LENGTH, // max tag length
514  0, // seal_scatter_supports_extra_in
515 
516  NULL, // init
521  NULL, // open_gather
522  aead_tls_get_iv, // get_iv
524 };
525 
527  SHA_DIGEST_LENGTH + 24, // key len (SHA1 + 3DES)
528  8, // nonce len (IV)
529  8 + SHA_DIGEST_LENGTH, // overhead (padding + SHA1)
530  SHA_DIGEST_LENGTH, // max tag length
531  0, // seal_scatter_supports_extra_in
532 
533  NULL, // init
538  NULL, // open_gather
539  NULL, // get_iv
541 };
542 
544  SHA_DIGEST_LENGTH + 24 + 8, // key len (SHA1 + 3DES + IV)
545  0, // nonce len
546  8 + SHA_DIGEST_LENGTH, // overhead (padding + SHA1)
547  SHA_DIGEST_LENGTH, // max tag length
548  0, // seal_scatter_supports_extra_in
549 
550  NULL, // init
555  NULL, // open_gather
556  aead_tls_get_iv, // get_iv
558 };
559 
560 static const EVP_AEAD aead_null_sha1_tls = {
561  SHA_DIGEST_LENGTH, // key len
562  0, // nonce len
563  SHA_DIGEST_LENGTH, // overhead (SHA1)
564  SHA_DIGEST_LENGTH, // max tag length
565  0, // seal_scatter_supports_extra_in
566 
567  NULL, // init
572  NULL, // open_gather
573  NULL, // get_iv
575 };
576 
579 }
580 
583 }
584 
587 }
588 
591 }
592 
595 }
596 
599 }
600 
EVP_CIPHER_CTX_mode
#define EVP_CIPHER_CTX_mode
Definition: boringssl_prefix_symbols.h:1475
HMAC_size
#define HMAC_size
Definition: boringssl_prefix_symbols.h:1795
gen_build_yaml.out
dictionary out
Definition: src/benchmark/gen_build_yaml.py:24
EVP_enc_null
#define EVP_enc_null
Definition: boringssl_prefix_symbols.h:1723
EVP_CIPHER_CTX_init
#define EVP_CIPHER_CTX_init
Definition: boringssl_prefix_symbols.h:1472
ctx
Definition: benchmark-async.c:30
env_md_st
Definition: third_party/boringssl-with-bazel/src/crypto/fipsmodule/digest/internal.h:67
aead_aes_256_cbc_sha1_tls
static const EVP_AEAD aead_aes_256_cbc_sha1_tls
Definition: e_tls.c:492
CIPHER_R_INVALID_OPERATION
#define CIPHER_R_INVALID_OPERATION
Definition: cipher.h:658
evp_aead_direction_t
evp_aead_direction_t
Definition: aead.h:429
aead_aes_128_cbc_sha1_tls_implicit_iv
static const EVP_AEAD aead_aes_128_cbc_sha1_tls_implicit_iv
Definition: e_tls.c:475
CONSTTIME_TRUE_W
#define CONSTTIME_TRUE_W
Definition: third_party/boringssl-with-bazel/src/crypto/internal.h:276
total
size_t total
Definition: cord_analysis.cc:59
OPENSSL_PUT_ERROR
#define OPENSSL_PUT_ERROR(library, reason)
Definition: err.h:423
EVP_aes_256_cbc
const OPENSSL_EXPORT EVP_CIPHER * EVP_aes_256_cbc(void)
string.h
buf
voidpf void * buf
Definition: bloaty/third_party/zlib/contrib/minizip/ioapi.h:136
CIPHER_R_INVALID_NONCE_SIZE
#define CIPHER_R_INVALID_NONCE_SIZE
Definition: cipher.h:657
aead_des_ede3_cbc_sha1_tls_implicit_iv_init
static int aead_des_ede3_cbc_sha1_tls_implicit_iv_init(EVP_AEAD_CTX *ctx, const uint8_t *key, size_t key_len, size_t tag_len, enum evp_aead_direction_t dir)
Definition: e_tls.c:431
AEAD_TLS_CTX::mac_key_len
uint8_t mac_key_len
Definition: e_tls.c:39
aead_tls_open
static int aead_tls_open(const EVP_AEAD_CTX *ctx, uint8_t *out, size_t *out_len, size_t max_out_len, const uint8_t *nonce, size_t nonce_len, const uint8_t *in, size_t in_len, const uint8_t *ad, size_t ad_len)
Definition: e_tls.c:242
EVP_CIPHER_iv_length
#define EVP_CIPHER_iv_length
Definition: boringssl_prefix_symbols.h:1485
EVP_EncryptUpdate
#define EVP_EncryptUpdate
Definition: boringssl_prefix_symbols.h:1532
AEAD_TLS_CTX
Definition: e_tls.c:33
CONSTTIME_DECLASSIFY
#define CONSTTIME_DECLASSIFY(x, y)
Definition: third_party/boringssl-with-bazel/src/crypto/internal.h:462
aead_aes_128_cbc_sha1_tls
static const EVP_AEAD aead_aes_128_cbc_sha1_tls
Definition: e_tls.c:458
CIPHER_R_BAD_KEY_LENGTH
#define CIPHER_R_BAD_KEY_LENGTH
Definition: cipher.h:648
uint8_t
unsigned char uint8_t
Definition: stdint-msvc2008.h:78
evp_cipher_ctx_st
Definition: cipher.h:536
EVP_CIPHER_CTX_iv_length
#define EVP_CIPHER_CTX_iv_length
Definition: boringssl_prefix_symbols.h:1473
OPENSSL_memset
static void * OPENSSL_memset(void *dst, int c, size_t n)
Definition: third_party/boringssl-with-bazel/src/crypto/internal.h:835
EVP_tls_cbc_remove_padding
#define EVP_tls_cbc_remove_padding
Definition: boringssl_prefix_symbols.h:1757
aead_aes_128_cbc_sha1_tls_init
static int aead_aes_128_cbc_sha1_tls_init(EVP_AEAD_CTX *ctx, const uint8_t *key, size_t key_len, size_t tag_len, enum evp_aead_direction_t dir)
Definition: e_tls.c:395
EVP_DecryptInit_ex
#define EVP_DecryptInit_ex
Definition: boringssl_prefix_symbols.h:1504
EVP_AEAD_nonce_length
#define EVP_AEAD_nonce_length
Definition: boringssl_prefix_symbols.h:1461
EVP_AEAD_DEFAULT_TAG_LENGTH
#define EVP_AEAD_DEFAULT_TAG_LENGTH
Definition: aead.h:240
evp_cipher_ctx_st::iv
uint8_t iv[EVP_MAX_IV_LENGTH]
Definition: cipher.h:560
CIPHER_R_INVALID_AD_SIZE
#define CIPHER_R_INVALID_AD_SIZE
Definition: cipher.h:655
in
const char * in
Definition: third_party/abseil-cpp/absl/strings/internal/str_format/parser_test.cc:391
evp_cipher_st
Definition: cipher.h:585
aead_tls_seal_scatter
static int aead_tls_seal_scatter(const EVP_AEAD_CTX *ctx, uint8_t *out, uint8_t *out_tag, size_t *out_tag_len, const size_t max_out_tag_len, const uint8_t *nonce, const size_t nonce_len, const uint8_t *in, const size_t in_len, const uint8_t *extra_in, const size_t extra_in_len, const uint8_t *ad, const size_t ad_len)
Definition: e_tls.c:122
aead_aes_256_cbc_sha1_tls_init
static int aead_aes_256_cbc_sha1_tls_init(EVP_AEAD_CTX *ctx, const uint8_t *key, size_t key_len, size_t tag_len, enum evp_aead_direction_t dir)
Definition: e_tls.c:409
HMAC_CTX_init
#define HMAC_CTX_init
Definition: boringssl_prefix_symbols.h:1788
EVP_aead_aes_256_cbc_sha1_tls
const EVP_AEAD * EVP_aead_aes_256_cbc_sha1_tls(void)
Definition: e_tls.c:585
aead_tls_tag_len
static size_t aead_tls_tag_len(const EVP_AEAD_CTX *ctx, const size_t in_len, const size_t extra_in_len)
Definition: e_tls.c:103
evp_aead_ctx_st_state
Definition: aead.h:210
EVP_CIPHER_CTX_set_padding
#define EVP_CIPHER_CTX_set_padding
Definition: boringssl_prefix_symbols.h:1482
aead_aes_256_cbc_sha1_tls_implicit_iv
static const EVP_AEAD aead_aes_256_cbc_sha1_tls_implicit_iv
Definition: e_tls.c:509
EVP_CIPHER_CTX_block_size
#define EVP_CIPHER_CTX_block_size
Definition: boringssl_prefix_symbols.h:1463
EVP_MD_size
#define EVP_MD_size
Definition: boringssl_prefix_symbols.h:1579
aead_des_ede3_cbc_sha1_tls
static const EVP_AEAD aead_des_ede3_cbc_sha1_tls
Definition: e_tls.c:526
EVP_aead_des_ede3_cbc_sha1_tls
const EVP_AEAD * EVP_aead_des_ede3_cbc_sha1_tls(void)
Definition: e_tls.c:593
sha.h
evp_aead_ctx_st
Definition: aead.h:217
CIPHER_R_UNSUPPORTED_TAG_SIZE
#define CIPHER_R_UNSUPPORTED_TAG_SIZE
Definition: cipher.h:668
OPENSSL_memcpy
static void * OPENSSL_memcpy(void *dst, const void *src, size_t n)
Definition: third_party/boringssl-with-bazel/src/crypto/internal.h:819
EVP_tls_cbc_copy_mac
#define EVP_tls_cbc_copy_mac
Definition: boringssl_prefix_symbols.h:1754
err.h
aead_null_sha1_tls
static const EVP_AEAD aead_null_sha1_tls
Definition: e_tls.c:560
cipher.h
HMAC_Init_ex
#define HMAC_Init_ex
Definition: boringssl_prefix_symbols.h:1793
evp_aead_seal
@ evp_aead_seal
Definition: aead.h:431
AEAD_TLS_CTX::hmac_ctx
HMAC_CTX hmac_ctx
Definition: e_tls.c:35
aead_des_ede3_cbc_sha1_tls_init
static int aead_des_ede3_cbc_sha1_tls_init(EVP_AEAD_CTX *ctx, const uint8_t *key, size_t key_len, size_t tag_len, enum evp_aead_direction_t dir)
Definition: e_tls.c:423
aead.h
EVP_des_ede3_cbc
const OPENSSL_EXPORT EVP_CIPHER * EVP_des_ede3_cbc(void)
EVP_aead_aes_128_cbc_sha1_tls
const EVP_AEAD * EVP_aead_aes_128_cbc_sha1_tls(void)
Definition: e_tls.c:577
EVP_EncryptInit_ex
#define EVP_EncryptInit_ex
Definition: boringssl_prefix_symbols.h:1531
CIPHER_R_BUFFER_TOO_SMALL
#define CIPHER_R_BUFFER_TOO_SMALL
Definition: cipher.h:649
hmac_ctx_st::md
const EVP_MD * md
Definition: hmac.h:159
EVP_CIPH_CBC_MODE
#define EVP_CIPH_CBC_MODE
Definition: cipher.h:345
aead_tls_init
static int aead_tls_init(EVP_AEAD_CTX *ctx, const uint8_t *key, size_t key_len, size_t tag_len, enum evp_aead_direction_t dir, const EVP_CIPHER *cipher, const EVP_MD *md, char implicit_iv)
Definition: e_tls.c:63
evp_aead_st
Definition: third_party/boringssl-with-bazel/src/crypto/fipsmodule/cipher/internal.h:77
EVP_aead_aes_128_cbc_sha1_tls_implicit_iv
const EVP_AEAD * EVP_aead_aes_128_cbc_sha1_tls_implicit_iv(void)
Definition: e_tls.c:581
aead_aes_256_cbc_sha1_tls_implicit_iv_init
static int aead_aes_256_cbc_sha1_tls_implicit_iv_init(EVP_AEAD_CTX *ctx, const uint8_t *key, size_t key_len, size_t tag_len, enum evp_aead_direction_t dir)
Definition: e_tls.c:416
EVP_CipherInit_ex
#define EVP_CipherInit_ex
Definition: boringssl_prefix_symbols.h:1493
AEAD_TLS_CTX::mac_key
uint8_t mac_key[EVP_MAX_MD_SIZE]
Definition: e_tls.c:38
benchmark.md
md
Definition: benchmark.py:86
key
const char * key
Definition: hpack_parser_table.cc:164
EVP_EncryptFinal_ex
#define EVP_EncryptFinal_ex
Definition: boringssl_prefix_symbols.h:1529
EVP_DecryptUpdate
#define EVP_DecryptUpdate
Definition: boringssl_prefix_symbols.h:1505
HMAC_Final
#define HMAC_Final
Definition: boringssl_prefix_symbols.h:1791
md5.h
aead_des_ede3_cbc_sha1_tls_implicit_iv
static const EVP_AEAD aead_des_ede3_cbc_sha1_tls_implicit_iv
Definition: e_tls.c:543
aead_tls_get_iv
static int aead_tls_get_iv(const EVP_AEAD_CTX *ctx, const uint8_t **out_iv, size_t *out_iv_len)
Definition: e_tls.c:438
EVP_aead_null_sha1_tls
const EVP_AEAD * EVP_aead_null_sha1_tls(void)
Definition: e_tls.c:601
hmac_ctx_st
Definition: hmac.h:158
EVP_CIPHER_CTX_cleanup
#define EVP_CIPHER_CTX_cleanup
Definition: boringssl_prefix_symbols.h:1465
EVP_tls_cbc_digest_record
#define EVP_tls_cbc_digest_record
Definition: boringssl_prefix_symbols.h:1755
EVP_aead_des_ede3_cbc_sha1_tls_implicit_iv
const EVP_AEAD * EVP_aead_des_ede3_cbc_sha1_tls_implicit_iv(void)
Definition: e_tls.c:597
EVP_MAX_MD_SIZE
#define EVP_MAX_MD_SIZE
Definition: digest.h:156
OPENSSL_STATIC_ASSERT
OPENSSL_STATIC_ASSERT(EVP_MAX_MD_SIZE< 256, "mac_key_len does not fit in uint8_t")
aead_tls_cleanup
static void aead_tls_cleanup(EVP_AEAD_CTX *ctx)
Definition: e_tls.c:57
EVP_CIPHER_key_length
#define EVP_CIPHER_key_length
Definition: boringssl_prefix_symbols.h:1486
state
Definition: bloaty/third_party/zlib/contrib/blast/blast.c:41
EVP_DecryptFinal_ex
#define EVP_DecryptFinal_ex
Definition: boringssl_prefix_symbols.h:1502
EVP_sha1
const OPENSSL_EXPORT EVP_MD * EVP_sha1(void)
constant_time_eq_int
static crypto_word_t constant_time_eq_int(int a, int b)
Definition: third_party/boringssl-with-bazel/src/crypto/internal.h:407
SHA_DIGEST_LENGTH
#define SHA_DIGEST_LENGTH
Definition: sha.h:74
CIPHER_R_TOO_LARGE
#define CIPHER_R_TOO_LARGE
Definition: cipher.h:663
EVP_tls_cbc_record_digest_supported
#define EVP_tls_cbc_record_digest_supported
Definition: boringssl_prefix_symbols.h:1756
HMAC_CTX_cleanup
#define HMAC_CTX_cleanup
Definition: boringssl_prefix_symbols.h:1784
aead_aes_128_cbc_sha1_tls_implicit_iv_init
static int aead_aes_128_cbc_sha1_tls_implicit_iv_init(EVP_AEAD_CTX *ctx, const uint8_t *key, size_t key_len, size_t tag_len, enum evp_aead_direction_t dir)
Definition: e_tls.c:402
aead_null_sha1_tls_init
static int aead_null_sha1_tls_init(EVP_AEAD_CTX *ctx, const uint8_t *key, size_t key_len, size_t tag_len, enum evp_aead_direction_t dir)
Definition: e_tls.c:451
mem.h
type_check.h
CONSTTIME_SECRET
#define CONSTTIME_SECRET(x, y)
Definition: third_party/boringssl-with-bazel/src/crypto/internal.h:461
len
int len
Definition: abseil-cpp/absl/base/internal/low_level_alloc_test.cc:46
EVP_MAX_BLOCK_LENGTH
#define EVP_MAX_BLOCK_LENGTH
Definition: cipher.h:534
internal.h
EVP_AEAD_key_length
#define EVP_AEAD_key_length
Definition: boringssl_prefix_symbols.h:1458
EVP_aes_128_cbc
const OPENSSL_EXPORT EVP_CIPHER * EVP_aes_128_cbc(void)
EVP_aead_aes_256_cbc_sha1_tls_implicit_iv
const EVP_AEAD * EVP_aead_aes_256_cbc_sha1_tls_implicit_iv(void)
Definition: e_tls.c:589
HMAC_Update
#define HMAC_Update
Definition: boringssl_prefix_symbols.h:1794
evp_cipher_ctx_st::encrypt
int encrypt
Definition: cipher.h:551
if
if(p->owned &&p->wrapped !=NULL)
Definition: call.c:42
CRYPTO_memcmp
#define CRYPTO_memcmp
Definition: boringssl_prefix_symbols.h:1178
hmac.h
AEAD_TLS_CTX::cipher_ctx
EVP_CIPHER_CTX cipher_ctx
Definition: e_tls.c:34
AEAD_TLS_CTX::implicit_iv
char implicit_iv
Definition: e_tls.c:42
CIPHER_R_BAD_DECRYPT
#define CIPHER_R_BAD_DECRYPT
Definition: cipher.h:647


grpc
Author(s):
autogenerated on Fri May 16 2025 02:58:18