cipher.c
Go to the documentation of this file.
1 /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
2  * All rights reserved.
3  *
4  * This package is an SSL implementation written
5  * by Eric Young (eay@cryptsoft.com).
6  * The implementation was written so as to conform with Netscapes SSL.
7  *
8  * This library is free for commercial and non-commercial use as long as
9  * the following conditions are aheared to. The following conditions
10  * apply to all code found in this distribution, be it the RC4, RSA,
11  * lhash, DES, etc., code; not just the SSL code. The SSL documentation
12  * included with this distribution is covered by the same copyright terms
13  * except that the holder is Tim Hudson (tjh@cryptsoft.com).
14  *
15  * Copyright remains Eric Young's, and as such any Copyright notices in
16  * the code are not to be removed.
17  * If this package is used in a product, Eric Young should be given attribution
18  * as the author of the parts of the library used.
19  * This can be in the form of a textual message at program startup or
20  * in documentation (online or textual) provided with the package.
21  *
22  * Redistribution and use in source and binary forms, with or without
23  * modification, are permitted provided that the following conditions
24  * are met:
25  * 1. Redistributions of source code must retain the copyright
26  * notice, this list of conditions and the following disclaimer.
27  * 2. Redistributions in binary form must reproduce the above copyright
28  * notice, this list of conditions and the following disclaimer in the
29  * documentation and/or other materials provided with the distribution.
30  * 3. All advertising materials mentioning features or use of this software
31  * must display the following acknowledgement:
32  * "This product includes cryptographic software written by
33  * Eric Young (eay@cryptsoft.com)"
34  * The word 'cryptographic' can be left out if the rouines from the library
35  * being used are not cryptographic related :-).
36  * 4. If you include any Windows specific code (or a derivative thereof) from
37  * the apps directory (application code) you must include an acknowledgement:
38  * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
39  *
40  * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
41  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
42  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
43  * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
44  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
45  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
46  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
47  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
48  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
49  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
50  * SUCH DAMAGE.
51  *
52  * The licence and distribution terms for any publically available version or
53  * derivative of this code cannot be changed. i.e. this code cannot simply be
54  * copied and put under another distribution licence
55  * [including the GNU Public Licence.] */
56 
57 #include <openssl/cipher.h>
58 
59 #include <assert.h>
60 #include <limits.h>
61 #include <string.h>
62 
63 #include <openssl/err.h>
64 #include <openssl/mem.h>
65 #include <openssl/nid.h>
66 
67 #include "internal.h"
68 #include "../../internal.h"
69 
70 
72  OPENSSL_memset(ctx, 0, sizeof(EVP_CIPHER_CTX));
73 }
74 
77  if (ctx) {
79  }
80  return ctx;
81 }
82 
84  if (c->cipher != NULL && c->cipher->cleanup) {
85  c->cipher->cleanup(c);
86  }
87  OPENSSL_free(c->cipher_data);
88 
89  OPENSSL_memset(c, 0, sizeof(EVP_CIPHER_CTX));
90  return 1;
91 }
92 
94  if (ctx) {
97  }
98 }
99 
101  if (in == NULL || in->cipher == NULL) {
103  return 0;
104  }
105 
107  OPENSSL_memcpy(out, in, sizeof(EVP_CIPHER_CTX));
108 
109  if (in->cipher_data && in->cipher->ctx_size) {
110  out->cipher_data = OPENSSL_malloc(in->cipher->ctx_size);
111  if (!out->cipher_data) {
112  out->cipher = NULL;
114  return 0;
115  }
116  OPENSSL_memcpy(out->cipher_data, in->cipher_data, in->cipher->ctx_size);
117  }
118 
119  if (in->cipher->flags & EVP_CIPH_CUSTOM_COPY) {
120  if (!in->cipher->ctrl((EVP_CIPHER_CTX *)in, EVP_CTRL_COPY, 0, out)) {
121  out->cipher = NULL;
122  return 0;
123  }
124  }
125 
126  return 1;
127 }
128 
132  return 1;
133 }
134 
136  ENGINE *engine, const uint8_t *key, const uint8_t *iv,
137  int enc) {
138  if (enc == -1) {
139  enc = ctx->encrypt;
140  } else {
141  if (enc) {
142  enc = 1;
143  }
144  ctx->encrypt = enc;
145  }
146 
147  if (cipher) {
148  // Ensure a context left from last time is cleared (the previous check
149  // attempted to avoid this if the same ENGINE and EVP_CIPHER could be
150  // used).
151  if (ctx->cipher) {
153  // Restore encrypt and flags
154  ctx->encrypt = enc;
155  }
156 
157  ctx->cipher = cipher;
158  if (ctx->cipher->ctx_size) {
159  ctx->cipher_data = OPENSSL_malloc(ctx->cipher->ctx_size);
160  if (!ctx->cipher_data) {
161  ctx->cipher = NULL;
163  return 0;
164  }
165  } else {
166  ctx->cipher_data = NULL;
167  }
168 
169  ctx->key_len = cipher->key_len;
170  ctx->flags = 0;
171 
172  if (ctx->cipher->flags & EVP_CIPH_CTRL_INIT) {
173  if (!EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_INIT, 0, NULL)) {
174  ctx->cipher = NULL;
176  return 0;
177  }
178  }
179  } else if (!ctx->cipher) {
181  return 0;
182  }
183 
184  // we assume block size is a power of 2 in *cryptUpdate
185  assert(ctx->cipher->block_size == 1 || ctx->cipher->block_size == 8 ||
186  ctx->cipher->block_size == 16);
187 
189  switch (EVP_CIPHER_CTX_mode(ctx)) {
191  case EVP_CIPH_ECB_MODE:
192  break;
193 
194  case EVP_CIPH_CFB_MODE:
195  ctx->num = 0;
197 
198  case EVP_CIPH_CBC_MODE:
199  assert(EVP_CIPHER_CTX_iv_length(ctx) <= sizeof(ctx->iv));
200  if (iv) {
202  }
204  break;
205 
206  case EVP_CIPH_CTR_MODE:
207  case EVP_CIPH_OFB_MODE:
208  ctx->num = 0;
209  // Don't reuse IV for CTR mode
210  if (iv) {
212  }
213  break;
214 
215  default:
216  return 0;
217  }
218  }
219 
220  if (key || (ctx->cipher->flags & EVP_CIPH_ALWAYS_CALL_INIT)) {
221  if (!ctx->cipher->init(ctx, key, iv, enc)) {
222  return 0;
223  }
224  }
225 
226  ctx->buf_len = 0;
227  ctx->final_used = 0;
228  return 1;
229 }
230 
232  ENGINE *impl, const uint8_t *key, const uint8_t *iv) {
233  return EVP_CipherInit_ex(ctx, cipher, impl, key, iv, 1);
234 }
235 
237  ENGINE *impl, const uint8_t *key, const uint8_t *iv) {
238  return EVP_CipherInit_ex(ctx, cipher, impl, key, iv, 0);
239 }
240 
241 // block_remainder returns the number of bytes to remove from |len| to get a
242 // multiple of |ctx|'s block size.
243 static int block_remainder(const EVP_CIPHER_CTX *ctx, int len) {
244  // |block_size| must be a power of two.
245  assert(ctx->cipher->block_size != 0);
246  assert((ctx->cipher->block_size & (ctx->cipher->block_size - 1)) == 0);
247  return len & (ctx->cipher->block_size - 1);
248 }
249 
251  const uint8_t *in, int in_len) {
252  // Ciphers that use blocks may write up to |bl| extra bytes. Ensure the output
253  // does not overflow |*out_len|.
254  int bl = ctx->cipher->block_size;
255  if (bl > 1 && in_len > INT_MAX - bl) {
257  return 0;
258  }
259 
260  if (ctx->cipher->flags & EVP_CIPH_FLAG_CUSTOM_CIPHER) {
261  int ret = ctx->cipher->cipher(ctx, out, in, in_len);
262  if (ret < 0) {
263  return 0;
264  } else {
265  *out_len = ret;
266  }
267  return 1;
268  }
269 
270  if (in_len <= 0) {
271  *out_len = 0;
272  return in_len == 0;
273  }
274 
275  if (ctx->buf_len == 0 && block_remainder(ctx, in_len) == 0) {
276  if (ctx->cipher->cipher(ctx, out, in, in_len)) {
277  *out_len = in_len;
278  return 1;
279  } else {
280  *out_len = 0;
281  return 0;
282  }
283  }
284 
285  int i = ctx->buf_len;
286  assert(bl <= (int)sizeof(ctx->buf));
287  if (i != 0) {
288  if (bl - i > in_len) {
289  OPENSSL_memcpy(&ctx->buf[i], in, in_len);
290  ctx->buf_len += in_len;
291  *out_len = 0;
292  return 1;
293  } else {
294  int j = bl - i;
295  OPENSSL_memcpy(&ctx->buf[i], in, j);
296  if (!ctx->cipher->cipher(ctx, out, ctx->buf, bl)) {
297  return 0;
298  }
299  in_len -= j;
300  in += j;
301  out += bl;
302  *out_len = bl;
303  }
304  } else {
305  *out_len = 0;
306  }
307 
308  i = block_remainder(ctx, in_len);
309  in_len -= i;
310  if (in_len > 0) {
311  if (!ctx->cipher->cipher(ctx, out, in, in_len)) {
312  return 0;
313  }
314  *out_len += in_len;
315  }
316 
317  if (i != 0) {
318  OPENSSL_memcpy(ctx->buf, &in[in_len], i);
319  }
320  ctx->buf_len = i;
321  return 1;
322 }
323 
325  int n, ret;
326  unsigned int i, b, bl;
327 
328  if (ctx->cipher->flags & EVP_CIPH_FLAG_CUSTOM_CIPHER) {
329  ret = ctx->cipher->cipher(ctx, out, NULL, 0);
330  if (ret < 0) {
331  return 0;
332  } else {
333  *out_len = ret;
334  }
335  return 1;
336  }
337 
338  b = ctx->cipher->block_size;
339  assert(b <= sizeof(ctx->buf));
340  if (b == 1) {
341  *out_len = 0;
342  return 1;
343  }
344 
345  bl = ctx->buf_len;
346  if (ctx->flags & EVP_CIPH_NO_PADDING) {
347  if (bl) {
349  return 0;
350  }
351  *out_len = 0;
352  return 1;
353  }
354 
355  n = b - bl;
356  for (i = bl; i < b; i++) {
357  ctx->buf[i] = n;
358  }
359  ret = ctx->cipher->cipher(ctx, out, ctx->buf, b);
360 
361  if (ret) {
362  *out_len = b;
363  }
364 
365  return ret;
366 }
367 
369  const uint8_t *in, int in_len) {
370  // Ciphers that use blocks may write up to |bl| extra bytes. Ensure the output
371  // does not overflow |*out_len|.
372  unsigned int b = ctx->cipher->block_size;
373  if (b > 1 && in_len > INT_MAX - (int)b) {
375  return 0;
376  }
377 
378  if (ctx->cipher->flags & EVP_CIPH_FLAG_CUSTOM_CIPHER) {
379  int r = ctx->cipher->cipher(ctx, out, in, in_len);
380  if (r < 0) {
381  *out_len = 0;
382  return 0;
383  } else {
384  *out_len = r;
385  }
386  return 1;
387  }
388 
389  if (in_len <= 0) {
390  *out_len = 0;
391  return in_len == 0;
392  }
393 
394  if (ctx->flags & EVP_CIPH_NO_PADDING) {
395  return EVP_EncryptUpdate(ctx, out, out_len, in, in_len);
396  }
397 
398  assert(b <= sizeof(ctx->final));
399  int fix_len = 0;
400  if (ctx->final_used) {
401  OPENSSL_memcpy(out, ctx->final, b);
402  out += b;
403  fix_len = 1;
404  }
405 
406  if (!EVP_EncryptUpdate(ctx, out, out_len, in, in_len)) {
407  return 0;
408  }
409 
410  // if we have 'decrypted' a multiple of block size, make sure
411  // we have a copy of this last block
412  if (b > 1 && !ctx->buf_len) {
413  *out_len -= b;
414  ctx->final_used = 1;
415  OPENSSL_memcpy(ctx->final, &out[*out_len], b);
416  } else {
417  ctx->final_used = 0;
418  }
419 
420  if (fix_len) {
421  *out_len += b;
422  }
423 
424  return 1;
425 }
426 
427 int EVP_DecryptFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *out, int *out_len) {
428  int i, n;
429  unsigned int b;
430  *out_len = 0;
431 
432  if (ctx->cipher->flags & EVP_CIPH_FLAG_CUSTOM_CIPHER) {
433  i = ctx->cipher->cipher(ctx, out, NULL, 0);
434  if (i < 0) {
435  return 0;
436  } else {
437  *out_len = i;
438  }
439  return 1;
440  }
441 
442  b = ctx->cipher->block_size;
443  if (ctx->flags & EVP_CIPH_NO_PADDING) {
444  if (ctx->buf_len) {
446  return 0;
447  }
448  *out_len = 0;
449  return 1;
450  }
451 
452  if (b > 1) {
453  if (ctx->buf_len || !ctx->final_used) {
455  return 0;
456  }
457  assert(b <= sizeof(ctx->final));
458 
459  // The following assumes that the ciphertext has been authenticated.
460  // Otherwise it provides a padding oracle.
461  n = ctx->final[b - 1];
462  if (n == 0 || n > (int)b) {
464  return 0;
465  }
466 
467  for (i = 0; i < n; i++) {
468  if (ctx->final[--b] != n) {
470  return 0;
471  }
472  }
473 
474  n = ctx->cipher->block_size - n;
475  for (i = 0; i < n; i++) {
476  out[i] = ctx->final[i];
477  }
478  *out_len = n;
479  } else {
480  *out_len = 0;
481  }
482 
483  return 1;
484 }
485 
487  size_t in_len) {
488  return ctx->cipher->cipher(ctx, out, in, in_len);
489 }
490 
492  const uint8_t *in, int in_len) {
493  if (ctx->encrypt) {
494  return EVP_EncryptUpdate(ctx, out, out_len, in, in_len);
495  } else {
496  return EVP_DecryptUpdate(ctx, out, out_len, in, in_len);
497  }
498 }
499 
501  if (ctx->encrypt) {
502  return EVP_EncryptFinal_ex(ctx, out, out_len);
503  } else {
504  return EVP_DecryptFinal_ex(ctx, out, out_len);
505  }
506 }
507 
509  return ctx->cipher;
510 }
511 
513  return ctx->cipher->nid;
514 }
515 
517  return ctx->encrypt;
518 }
519 
521  return ctx->cipher->block_size;
522 }
523 
525  return ctx->key_len;
526 }
527 
529  return ctx->cipher->iv_len;
530 }
531 
533  return ctx->app_data;
534 }
535 
537  ctx->app_data = data;
538 }
539 
541  return ctx->cipher->flags & ~EVP_CIPH_MODE_MASK;
542 }
543 
545  return ctx->cipher->flags & EVP_CIPH_MODE_MASK;
546 }
547 
549  int ret;
550  if (!ctx->cipher) {
552  return 0;
553  }
554 
555  if (!ctx->cipher->ctrl) {
557  return 0;
558  }
559 
560  ret = ctx->cipher->ctrl(ctx, command, arg, ptr);
561  if (ret == -1) {
563  return 0;
564  }
565 
566  return ret;
567 }
568 
570  if (pad) {
571  ctx->flags &= ~EVP_CIPH_NO_PADDING;
572  } else {
573  ctx->flags |= EVP_CIPH_NO_PADDING;
574  }
575  return 1;
576 }
577 
579  if (c->key_len == key_len) {
580  return 1;
581  }
582 
583  if (key_len == 0 || !(c->cipher->flags & EVP_CIPH_VARIABLE_LENGTH)) {
585  return 0;
586  }
587 
588  c->key_len = key_len;
589  return 1;
590 }
591 
592 int EVP_CIPHER_nid(const EVP_CIPHER *cipher) { return cipher->nid; }
593 
594 unsigned EVP_CIPHER_block_size(const EVP_CIPHER *cipher) {
595  return cipher->block_size;
596 }
597 
598 unsigned EVP_CIPHER_key_length(const EVP_CIPHER *cipher) {
599  return cipher->key_len;
600 }
601 
602 unsigned EVP_CIPHER_iv_length(const EVP_CIPHER *cipher) {
603  return cipher->iv_len;
604 }
605 
607  return cipher->flags & ~EVP_CIPH_MODE_MASK;
608 }
609 
611  return cipher->flags & EVP_CIPH_MODE_MASK;
612 }
613 
615  const uint8_t *key, const uint8_t *iv, int enc) {
616  if (cipher) {
618  }
619  return EVP_CipherInit_ex(ctx, cipher, NULL, key, iv, enc);
620 }
621 
623  const uint8_t *key, const uint8_t *iv) {
624  return EVP_CipherInit(ctx, cipher, key, iv, 1);
625 }
626 
628  const uint8_t *key, const uint8_t *iv) {
629  return EVP_CipherInit(ctx, cipher, key, iv, 0);
630 }
631 
633  return EVP_CipherFinal_ex(ctx, out, out_len);
634 }
635 
637  return EVP_EncryptFinal_ex(ctx, out, out_len);
638 }
639 
641  return EVP_DecryptFinal_ex(ctx, out, out_len);
642 }
643 
644 int EVP_add_cipher_alias(const char *a, const char *b) {
645  return 1;
646 }
647 
EVP_CIPHER_CTX_block_size
unsigned EVP_CIPHER_CTX_block_size(const EVP_CIPHER_CTX *ctx)
Definition: cipher.c:520
ptr
char * ptr
Definition: abseil-cpp/absl/base/internal/low_level_alloc_test.cc:45
EVP_CIPHER_CTX_copy
int EVP_CIPHER_CTX_copy(EVP_CIPHER_CTX *out, const EVP_CIPHER_CTX *in)
Definition: cipher.c:100
EVP_CIPHER_iv_length
unsigned EVP_CIPHER_iv_length(const EVP_CIPHER *cipher)
Definition: cipher.c:602
EVP_CIPH_VARIABLE_LENGTH
#define EVP_CIPH_VARIABLE_LENGTH
Definition: cipher.h:357
gen_build_yaml.out
dictionary out
Definition: src/benchmark/gen_build_yaml.py:24
EVP_CTRL_COPY
#define EVP_CTRL_COPY
Definition: cipher.h:511
EVP_DecryptInit_ex
int EVP_DecryptInit_ex(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher, ENGINE *impl, const uint8_t *key, const uint8_t *iv)
Definition: cipher.c:236
EVP_EncryptInit
int EVP_EncryptInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher, const uint8_t *key, const uint8_t *iv)
Definition: cipher.c:622
EVP_CIPHER_CTX_nid
int EVP_CIPHER_CTX_nid(const EVP_CIPHER_CTX *ctx)
Definition: cipher.c:512
ctx
Definition: benchmark-async.c:30
EVP_EncryptUpdate
int EVP_EncryptUpdate(EVP_CIPHER_CTX *ctx, uint8_t *out, int *out_len, const uint8_t *in, int in_len)
Definition: cipher.c:250
EVP_CIPHER_CTX_new
EVP_CIPHER_CTX * EVP_CIPHER_CTX_new(void)
Definition: cipher.c:75
EVP_CIPHER_CTX_free
void EVP_CIPHER_CTX_free(EVP_CIPHER_CTX *ctx)
Definition: cipher.c:93
OPENSSL_PUT_ERROR
#define OPENSSL_PUT_ERROR(library, reason)
Definition: err.h:423
string.h
EVP_CipherFinal_ex
int EVP_CipherFinal_ex(EVP_CIPHER_CTX *ctx, uint8_t *out, int *out_len)
Definition: cipher.c:500
EVP_CipherInit_ex
int EVP_CipherInit_ex(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher, ENGINE *engine, const uint8_t *key, const uint8_t *iv, int enc)
Definition: cipher.c:135
EVP_CIPHER_CTX_ctrl
int EVP_CIPHER_CTX_ctrl(EVP_CIPHER_CTX *ctx, int command, int arg, void *ptr)
Definition: cipher.c:548
CIPHER_R_DATA_NOT_MULTIPLE_OF_BLOCK_LENGTH
#define CIPHER_R_DATA_NOT_MULTIPLE_OF_BLOCK_LENGTH
Definition: cipher.h:652
EVP_CIPHER_nid
int EVP_CIPHER_nid(const EVP_CIPHER *cipher)
Definition: cipher.c:592
CIPHER_R_CTRL_NOT_IMPLEMENTED
#define CIPHER_R_CTRL_NOT_IMPLEMENTED
Definition: cipher.h:650
ctx
static struct test_ctx ctx
Definition: test-ipc-send-recv.c:65
a
int a
Definition: abseil-cpp/absl/container/internal/hash_policy_traits_test.cc:88
EVP_CIPHER_CTX_mode
uint32_t EVP_CIPHER_CTX_mode(const EVP_CIPHER_CTX *ctx)
Definition: cipher.c:544
block_remainder
static int block_remainder(const EVP_CIPHER_CTX *ctx, int len)
Definition: cipher.c:243
EVP_CIPHER_CTX_encrypting
int EVP_CIPHER_CTX_encrypting(const EVP_CIPHER_CTX *ctx)
Definition: cipher.c:516
uint8_t
unsigned char uint8_t
Definition: stdint-msvc2008.h:78
evp_cipher_ctx_st
Definition: cipher.h:536
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_CIPHER_CTX_cipher
const EVP_CIPHER * EVP_CIPHER_CTX_cipher(const EVP_CIPHER_CTX *ctx)
Definition: cipher.c:508
EVP_CIPHER_CTX_get_app_data
void * EVP_CIPHER_CTX_get_app_data(const EVP_CIPHER_CTX *ctx)
Definition: cipher.c:532
EVP_CTRL_INIT
#define EVP_CTRL_INIT
Definition: cipher.h:503
EVP_CIPHER_CTX_flags
uint32_t EVP_CIPHER_CTX_flags(const EVP_CIPHER_CTX *ctx)
Definition: cipher.c:540
uint32_t
unsigned int uint32_t
Definition: stdint-msvc2008.h:80
OPENSSL_malloc
#define OPENSSL_malloc
Definition: boringssl_prefix_symbols.h:1885
EVP_CIPH_CTRL_INIT
#define EVP_CIPH_CTRL_INIT
Definition: cipher.h:370
internal.h
in
const char * in
Definition: third_party/abseil-cpp/absl/strings/internal/str_format/parser_test.cc:391
c
void c(T a)
Definition: miscompile_with_no_unique_address_test.cc:40
evp_cipher_st
Definition: cipher.h:585
EVP_CIPHER_CTX_key_length
unsigned EVP_CIPHER_CTX_key_length(const EVP_CIPHER_CTX *ctx)
Definition: cipher.c:524
CIPHER_R_INPUT_NOT_INITIALIZED
#define CIPHER_R_INPUT_NOT_INITIALIZED
Definition: cipher.h:654
evp_cipher_st::iv_len
unsigned iv_len
Definition: cipher.h:598
EVP_CIPHER_CTX_reset
int EVP_CIPHER_CTX_reset(EVP_CIPHER_CTX *ctx)
Definition: cipher.c:129
EVP_CIPH_STREAM_CIPHER
#define EVP_CIPH_STREAM_CIPHER
Definition: cipher.h:343
EVP_EncryptFinal
int EVP_EncryptFinal(EVP_CIPHER_CTX *ctx, uint8_t *out, int *out_len)
Definition: cipher.c:636
EVP_CIPHER_CTX_set_app_data
void EVP_CIPHER_CTX_set_app_data(EVP_CIPHER_CTX *ctx, void *data)
Definition: cipher.c:536
EVP_CIPHER_CTX_set_padding
int EVP_CIPHER_CTX_set_padding(EVP_CIPHER_CTX *ctx, int pad)
Definition: cipher.c:569
pad
int pad
Definition: bloaty/third_party/protobuf/src/google/protobuf/stubs/statusor_test.cc:47
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
err.h
EVP_CIPHER_block_size
unsigned EVP_CIPHER_block_size(const EVP_CIPHER *cipher)
Definition: cipher.c:594
EVP_CIPH_MODE_MASK
#define EVP_CIPH_MODE_MASK
Definition: third_party/boringssl-with-bazel/src/crypto/fipsmodule/cipher/internal.h:74
evp_cipher_st::key_len
unsigned key_len
Definition: cipher.h:595
cipher.h
arg
Definition: cmdline.cc:40
EVP_CIPH_CUSTOM_COPY
#define EVP_CIPH_CUSTOM_COPY
Definition: cipher.h:384
data
char data[kBufferLength]
Definition: abseil-cpp/absl/strings/internal/str_format/float_conversion.cc:1006
evp_cipher_st::flags
uint32_t flags
Definition: cipher.h:605
CIPHER_R_CTRL_OPERATION_NOT_IMPLEMENTED
#define CIPHER_R_CTRL_OPERATION_NOT_IMPLEMENTED
Definition: cipher.h:651
b
uint64_t b
Definition: abseil-cpp/absl/container/internal/layout_test.cc:53
EVP_EncryptInit_ex
int EVP_EncryptInit_ex(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher, ENGINE *impl, const uint8_t *key, const uint8_t *iv)
Definition: cipher.c:231
EVP_CIPHER_mode
uint32_t EVP_CIPHER_mode(const EVP_CIPHER *cipher)
Definition: cipher.c:610
n
int n
Definition: abseil-cpp/absl/container/btree_test.cc:1080
ERR_R_OVERFLOW
#define ERR_R_OVERFLOW
Definition: err.h:375
EVP_CIPH_CBC_MODE
#define EVP_CIPH_CBC_MODE
Definition: cipher.h:345
evp_cipher_st::block_size
unsigned block_size
Definition: cipher.h:591
EVP_EncryptFinal_ex
int EVP_EncryptFinal_ex(EVP_CIPHER_CTX *ctx, uint8_t *out, int *out_len)
Definition: cipher.c:324
EVP_CIPHER_CTX_set_key_length
int EVP_CIPHER_CTX_set_key_length(EVP_CIPHER_CTX *c, unsigned key_len)
Definition: cipher.c:578
EVP_CIPH_NO_PADDING
#define EVP_CIPH_NO_PADDING
Definition: cipher.h:500
EVP_CIPH_CFB_MODE
#define EVP_CIPH_CFB_MODE
Definition: cipher.h:346
CIPHER_R_INVALID_KEY_LENGTH
#define CIPHER_R_INVALID_KEY_LENGTH
Definition: cipher.h:656
evp_cipher_st::nid
int nid
Definition: cipher.h:587
nid.h
EVP_CIPHER_CTX_set_flags
void EVP_CIPHER_CTX_set_flags(const EVP_CIPHER_CTX *ctx, uint32_t flags)
Definition: cipher.c:648
key
const char * key
Definition: hpack_parser_table.cc:164
CIPHER_R_NO_CIPHER_SET
#define CIPHER_R_NO_CIPHER_SET
Definition: cipher.h:660
EVP_DecryptInit
int EVP_DecryptInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher, const uint8_t *key, const uint8_t *iv)
Definition: cipher.c:627
EVP_CIPH_FLAG_CUSTOM_CIPHER
#define EVP_CIPH_FLAG_CUSTOM_CIPHER
Definition: cipher.h:374
absl::flags_internal
Definition: abseil-cpp/absl/flags/commandlineflag.h:40
EVP_CIPH_CTR_MODE
#define EVP_CIPH_CTR_MODE
Definition: cipher.h:348
ret
UniquePtr< SSL_SESSION > ret
Definition: ssl_x509.cc:1029
fix_build_deps.r
r
Definition: fix_build_deps.py:491
EVP_DecryptFinal_ex
int EVP_DecryptFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *out, int *out_len)
Definition: cipher.c:427
EVP_CIPHER_key_length
unsigned EVP_CIPHER_key_length(const EVP_CIPHER *cipher)
Definition: cipher.c:598
EVP_CIPH_OFB_MODE
#define EVP_CIPH_OFB_MODE
Definition: cipher.h:347
EVP_CIPHER_CTX_init
void EVP_CIPHER_CTX_init(EVP_CIPHER_CTX *ctx)
Definition: cipher.c:71
EVP_Cipher
int EVP_Cipher(EVP_CIPHER_CTX *ctx, uint8_t *out, const uint8_t *in, size_t in_len)
Definition: cipher.c:486
engine_st
Definition: engine.c:29
EVP_CipherInit
int EVP_CipherInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher, const uint8_t *key, const uint8_t *iv, int enc)
Definition: cipher.c:614
mem.h
EVP_CipherUpdate
int EVP_CipherUpdate(EVP_CIPHER_CTX *ctx, uint8_t *out, int *out_len, const uint8_t *in, int in_len)
Definition: cipher.c:491
len
int len
Definition: abseil-cpp/absl/base/internal/low_level_alloc_test.cc:46
EVP_CIPHER_CTX_iv_length
unsigned EVP_CIPHER_CTX_iv_length(const EVP_CIPHER_CTX *ctx)
Definition: cipher.c:528
EVP_CIPH_ALWAYS_CALL_INIT
#define EVP_CIPH_ALWAYS_CALL_INIT
Definition: cipher.h:362
EVP_CIPHER_CTX_cleanup
int EVP_CIPHER_CTX_cleanup(EVP_CIPHER_CTX *c)
Definition: cipher.c:83
OPENSSL_free
#define OPENSSL_free
Definition: boringssl_prefix_symbols.h:1869
CIPHER_R_WRONG_FINAL_BLOCK_LENGTH
#define CIPHER_R_WRONG_FINAL_BLOCK_LENGTH
Definition: cipher.h:669
EVP_CIPHER_flags
uint32_t EVP_CIPHER_flags(const EVP_CIPHER *cipher)
Definition: cipher.c:606
OPENSSL_FALLTHROUGH
#define OPENSSL_FALLTHROUGH
Definition: third_party/boringssl-with-bazel/src/crypto/internal.h:201
EVP_DecryptUpdate
int EVP_DecryptUpdate(EVP_CIPHER_CTX *ctx, uint8_t *out, int *out_len, const uint8_t *in, int in_len)
Definition: cipher.c:368
command
const char * command
Definition: grpc_tool.cc:247
EVP_add_cipher_alias
int EVP_add_cipher_alias(const char *a, const char *b)
Definition: cipher.c:644
i
uint64_t i
Definition: abseil-cpp/absl/container/btree_benchmark.cc:230
ERR_R_MALLOC_FAILURE
#define ERR_R_MALLOC_FAILURE
Definition: err.h:371
EVP_CIPH_CUSTOM_IV
#define EVP_CIPH_CUSTOM_IV
Definition: cipher.h:366
EVP_CipherFinal
int EVP_CipherFinal(EVP_CIPHER_CTX *ctx, uint8_t *out, int *out_len)
Definition: cipher.c:632
CIPHER_R_BAD_DECRYPT
#define CIPHER_R_BAD_DECRYPT
Definition: cipher.h:647
EVP_DecryptFinal
int EVP_DecryptFinal(EVP_CIPHER_CTX *ctx, uint8_t *out, int *out_len)
Definition: cipher.c:640
CIPHER_R_INITIALIZATION_ERROR
#define CIPHER_R_INITIALIZATION_ERROR
Definition: cipher.h:653
EVP_CIPH_ECB_MODE
#define EVP_CIPH_ECB_MODE
Definition: cipher.h:344


grpc
Author(s):
autogenerated on Thu Mar 13 2025 02:58:45