padding.c
Go to the documentation of this file.
1 /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
2  * project 2005.
3  */
4 /* ====================================================================
5  * Copyright (c) 2005 The OpenSSL Project. All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  *
11  * 1. Redistributions of source code must retain the above copyright
12  * notice, this list of conditions and the following disclaimer.
13  *
14  * 2. Redistributions in binary form must reproduce the above copyright
15  * notice, this list of conditions and the following disclaimer in
16  * the documentation and/or other materials provided with the
17  * distribution.
18  *
19  * 3. All advertising materials mentioning features or use of this
20  * software must display the following acknowledgment:
21  * "This product includes software developed by the OpenSSL Project
22  * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
23  *
24  * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
25  * endorse or promote products derived from this software without
26  * prior written permission. For written permission, please contact
27  * licensing@OpenSSL.org.
28  *
29  * 5. Products derived from this software may not be called "OpenSSL"
30  * nor may "OpenSSL" appear in their names without prior written
31  * permission of the OpenSSL Project.
32  *
33  * 6. Redistributions of any form whatsoever must retain the following
34  * acknowledgment:
35  * "This product includes software developed by the OpenSSL Project
36  * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
37  *
38  * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
39  * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
40  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
41  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
42  * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
43  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
44  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
45  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
46  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
47  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
48  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49  * OF THE POSSIBILITY OF SUCH DAMAGE.
50  * ====================================================================
51  *
52  * This product includes cryptographic software written by Eric Young
53  * (eay@cryptsoft.com). This product includes software written by Tim
54  * Hudson (tjh@cryptsoft.com). */
55 
56 #include <openssl/rsa.h>
57 
58 #include <assert.h>
59 #include <limits.h>
60 #include <string.h>
61 
62 #include <openssl/bn.h>
63 #include <openssl/digest.h>
64 #include <openssl/err.h>
65 #include <openssl/mem.h>
66 #include <openssl/rand.h>
67 #include <openssl/sha.h>
68 
69 #include "internal.h"
70 #include "../../internal.h"
71 
72 
73 #define RSA_PKCS1_PADDING_SIZE 11
74 
76  const uint8_t *from, size_t from_len) {
77  // See RFC 8017, section 9.2.
78  if (to_len < RSA_PKCS1_PADDING_SIZE) {
80  return 0;
81  }
82 
83  if (from_len > to_len - RSA_PKCS1_PADDING_SIZE) {
85  return 0;
86  }
87 
88  to[0] = 0;
89  to[1] = 1;
90  OPENSSL_memset(to + 2, 0xff, to_len - 3 - from_len);
91  to[to_len - from_len - 1] = 0;
92  OPENSSL_memcpy(to + to_len - from_len, from, from_len);
93  return 1;
94 }
95 
97  size_t max_out, const uint8_t *from,
98  size_t from_len) {
99  // See RFC 8017, section 9.2. This is part of signature verification and thus
100  // does not need to run in constant-time.
101  if (from_len < 2) {
103  return 0;
104  }
105 
106  // Check the header.
107  if (from[0] != 0 || from[1] != 1) {
109  return 0;
110  }
111 
112  // Scan over padded data, looking for the 00.
113  size_t pad;
114  for (pad = 2 /* header */; pad < from_len; pad++) {
115  if (from[pad] == 0x00) {
116  break;
117  }
118 
119  if (from[pad] != 0xff) {
121  return 0;
122  }
123  }
124 
125  if (pad == from_len) {
127  return 0;
128  }
129 
130  if (pad < 2 /* header */ + 8) {
132  return 0;
133  }
134 
135  // Skip over the 00.
136  pad++;
137 
138  if (from_len - pad > max_out) {
140  return 0;
141  }
142 
143  OPENSSL_memcpy(out, from + pad, from_len - pad);
144  *out_len = from_len - pad;
145  return 1;
146 }
147 
148 static int rand_nonzero(uint8_t *out, size_t len) {
149  if (!RAND_bytes(out, len)) {
150  return 0;
151  }
152 
153  for (size_t i = 0; i < len; i++) {
154  while (out[i] == 0) {
155  if (!RAND_bytes(out + i, 1)) {
156  return 0;
157  }
158  }
159  }
160 
161  return 1;
162 }
163 
165  const uint8_t *from, size_t from_len) {
166  // See RFC 8017, section 7.2.1.
167  if (to_len < RSA_PKCS1_PADDING_SIZE) {
169  return 0;
170  }
171 
172  if (from_len > to_len - RSA_PKCS1_PADDING_SIZE) {
174  return 0;
175  }
176 
177  to[0] = 0;
178  to[1] = 2;
179 
180  size_t padding_len = to_len - 3 - from_len;
181  if (!rand_nonzero(to + 2, padding_len)) {
182  return 0;
183  }
184 
185  to[2 + padding_len] = 0;
186  OPENSSL_memcpy(to + to_len - from_len, from, from_len);
187  return 1;
188 }
189 
191  size_t max_out, const uint8_t *from,
192  size_t from_len) {
193  if (from_len == 0) {
195  return 0;
196  }
197 
198  // PKCS#1 v1.5 decryption. See "PKCS #1 v2.2: RSA Cryptography
199  // Standard", section 7.2.2.
200  if (from_len < RSA_PKCS1_PADDING_SIZE) {
201  // |from| is zero-padded to the size of the RSA modulus, a public value, so
202  // this can be rejected in non-constant time.
204  return 0;
205  }
206 
207  crypto_word_t first_byte_is_zero = constant_time_eq_w(from[0], 0);
208  crypto_word_t second_byte_is_two = constant_time_eq_w(from[1], 2);
209 
210  crypto_word_t zero_index = 0, looking_for_index = CONSTTIME_TRUE_W;
211  for (size_t i = 2; i < from_len; i++) {
212  crypto_word_t equals0 = constant_time_is_zero_w(from[i]);
213  zero_index =
214  constant_time_select_w(looking_for_index & equals0, i, zero_index);
215  looking_for_index = constant_time_select_w(equals0, 0, looking_for_index);
216  }
217 
218  // The input must begin with 00 02.
219  crypto_word_t valid_index = first_byte_is_zero;
220  valid_index &= second_byte_is_two;
221 
222  // We must have found the end of PS.
223  valid_index &= ~looking_for_index;
224 
225  // PS must be at least 8 bytes long, and it starts two bytes into |from|.
226  valid_index &= constant_time_ge_w(zero_index, 2 + 8);
227 
228  // Skip the zero byte.
229  zero_index++;
230 
231  // NOTE: Although this logic attempts to be constant time, the API contracts
232  // of this function and |RSA_decrypt| with |RSA_PKCS1_PADDING| make it
233  // impossible to completely avoid Bleichenbacher's attack. Consumers should
234  // use |RSA_PADDING_NONE| and perform the padding check in constant-time
235  // combined with a swap to a random session key or other mitigation.
236  CONSTTIME_DECLASSIFY(&valid_index, sizeof(valid_index));
237  CONSTTIME_DECLASSIFY(&zero_index, sizeof(zero_index));
238 
239  if (!valid_index) {
241  return 0;
242  }
243 
244  const size_t msg_len = from_len - zero_index;
245  if (msg_len > max_out) {
246  // This shouldn't happen because this function is always called with
247  // |max_out| as the key size and |from_len| is bounded by the key size.
249  return 0;
250  }
251 
252  OPENSSL_memcpy(out, &from[zero_index], msg_len);
253  *out_len = msg_len;
254  return 1;
255 }
256 
257 int RSA_padding_add_none(uint8_t *to, size_t to_len, const uint8_t *from,
258  size_t from_len) {
259  if (from_len > to_len) {
261  return 0;
262  }
263 
264  if (from_len < to_len) {
266  return 0;
267  }
268 
269  OPENSSL_memcpy(to, from, from_len);
270  return 1;
271 }
272 
273 static int PKCS1_MGF1(uint8_t *out, size_t len, const uint8_t *seed,
274  size_t seed_len, const EVP_MD *md) {
275  int ret = 0;
276  EVP_MD_CTX ctx;
278 
279  size_t md_len = EVP_MD_size(md);
280 
281  for (uint32_t i = 0; len > 0; i++) {
282  uint8_t counter[4];
283  counter[0] = (uint8_t)(i >> 24);
284  counter[1] = (uint8_t)(i >> 16);
285  counter[2] = (uint8_t)(i >> 8);
286  counter[3] = (uint8_t)i;
287  if (!EVP_DigestInit_ex(&ctx, md, NULL) ||
288  !EVP_DigestUpdate(&ctx, seed, seed_len) ||
289  !EVP_DigestUpdate(&ctx, counter, sizeof(counter))) {
290  goto err;
291  }
292 
293  if (md_len <= len) {
294  if (!EVP_DigestFinal_ex(&ctx, out, NULL)) {
295  goto err;
296  }
297  out += md_len;
298  len -= md_len;
299  } else {
300  uint8_t digest[EVP_MAX_MD_SIZE];
301  if (!EVP_DigestFinal_ex(&ctx, digest, NULL)) {
302  goto err;
303  }
304  OPENSSL_memcpy(out, digest, len);
305  len = 0;
306  }
307  }
308 
309  ret = 1;
310 
311 err:
313  return ret;
314 }
315 
317  const uint8_t *from, size_t from_len,
318  const uint8_t *param, size_t param_len,
319  const EVP_MD *md, const EVP_MD *mgf1md) {
320  if (md == NULL) {
321  md = EVP_sha1();
322  }
323  if (mgf1md == NULL) {
324  mgf1md = md;
325  }
326 
327  size_t mdlen = EVP_MD_size(md);
328 
329  if (to_len < 2 * mdlen + 2) {
331  return 0;
332  }
333 
334  size_t emlen = to_len - 1;
335  if (from_len > emlen - 2 * mdlen - 1) {
337  return 0;
338  }
339 
340  if (emlen < 2 * mdlen + 1) {
342  return 0;
343  }
344 
345  to[0] = 0;
346  uint8_t *seed = to + 1;
347  uint8_t *db = to + mdlen + 1;
348 
349  if (!EVP_Digest(param, param_len, db, NULL, md, NULL)) {
350  return 0;
351  }
352  OPENSSL_memset(db + mdlen, 0, emlen - from_len - 2 * mdlen - 1);
353  db[emlen - from_len - mdlen - 1] = 0x01;
354  OPENSSL_memcpy(db + emlen - from_len - mdlen, from, from_len);
355  if (!RAND_bytes(seed, mdlen)) {
356  return 0;
357  }
358 
359  uint8_t *dbmask = OPENSSL_malloc(emlen - mdlen);
360  if (dbmask == NULL) {
362  return 0;
363  }
364 
365  int ret = 0;
366  if (!PKCS1_MGF1(dbmask, emlen - mdlen, seed, mdlen, mgf1md)) {
367  goto out;
368  }
369  for (size_t i = 0; i < emlen - mdlen; i++) {
370  db[i] ^= dbmask[i];
371  }
372 
373  uint8_t seedmask[EVP_MAX_MD_SIZE];
374  if (!PKCS1_MGF1(seedmask, mdlen, db, emlen - mdlen, mgf1md)) {
375  goto out;
376  }
377  for (size_t i = 0; i < mdlen; i++) {
378  seed[i] ^= seedmask[i];
379  }
380  ret = 1;
381 
382 out:
383  OPENSSL_free(dbmask);
384  return ret;
385 }
386 
388  size_t max_out, const uint8_t *from,
389  size_t from_len, const uint8_t *param,
390  size_t param_len, const EVP_MD *md,
391  const EVP_MD *mgf1md) {
392  uint8_t *db = NULL;
393 
394  if (md == NULL) {
395  md = EVP_sha1();
396  }
397  if (mgf1md == NULL) {
398  mgf1md = md;
399  }
400 
401  size_t mdlen = EVP_MD_size(md);
402 
403  // The encoded message is one byte smaller than the modulus to ensure that it
404  // doesn't end up greater than the modulus. Thus there's an extra "+1" here
405  // compared to https://tools.ietf.org/html/rfc2437#section-9.1.1.2.
406  if (from_len < 1 + 2*mdlen + 1) {
407  // 'from_len' is the length of the modulus, i.e. does not depend on the
408  // particular ciphertext.
409  goto decoding_err;
410  }
411 
412  size_t dblen = from_len - mdlen - 1;
413  db = OPENSSL_malloc(dblen);
414  if (db == NULL) {
416  goto err;
417  }
418 
419  const uint8_t *maskedseed = from + 1;
420  const uint8_t *maskeddb = from + 1 + mdlen;
421 
423  if (!PKCS1_MGF1(seed, mdlen, maskeddb, dblen, mgf1md)) {
424  goto err;
425  }
426  for (size_t i = 0; i < mdlen; i++) {
427  seed[i] ^= maskedseed[i];
428  }
429 
430  if (!PKCS1_MGF1(db, dblen, seed, mdlen, mgf1md)) {
431  goto err;
432  }
433  for (size_t i = 0; i < dblen; i++) {
434  db[i] ^= maskeddb[i];
435  }
436 
437  uint8_t phash[EVP_MAX_MD_SIZE];
438  if (!EVP_Digest(param, param_len, phash, NULL, md, NULL)) {
439  goto err;
440  }
441 
442  crypto_word_t bad = ~constant_time_is_zero_w(CRYPTO_memcmp(db, phash, mdlen));
444 
445  crypto_word_t looking_for_one_byte = CONSTTIME_TRUE_W;
446  size_t one_index = 0;
447  for (size_t i = mdlen; i < dblen; i++) {
448  crypto_word_t equals1 = constant_time_eq_w(db[i], 1);
449  crypto_word_t equals0 = constant_time_eq_w(db[i], 0);
450  one_index =
451  constant_time_select_w(looking_for_one_byte & equals1, i, one_index);
452  looking_for_one_byte =
453  constant_time_select_w(equals1, 0, looking_for_one_byte);
454  bad |= looking_for_one_byte & ~equals0;
455  }
456 
457  bad |= looking_for_one_byte;
458 
459  if (bad) {
460  goto decoding_err;
461  }
462 
463  one_index++;
464  size_t mlen = dblen - one_index;
465  if (max_out < mlen) {
467  goto err;
468  }
469 
470  OPENSSL_memcpy(out, db + one_index, mlen);
471  *out_len = mlen;
472  OPENSSL_free(db);
473  return 1;
474 
475 decoding_err:
476  // to avoid chosen ciphertext attacks, the error message should not reveal
477  // which kind of decoding error happened
479  err:
480  OPENSSL_free(db);
481  return 0;
482 }
483 
484 static const uint8_t kPSSZeroes[] = {0, 0, 0, 0, 0, 0, 0, 0};
485 
486 int RSA_verify_PKCS1_PSS_mgf1(const RSA *rsa, const uint8_t *mHash,
487  const EVP_MD *Hash, const EVP_MD *mgf1Hash,
488  const uint8_t *EM, int sLen) {
489  int i;
490  int ret = 0;
491  int maskedDBLen, MSBits, emLen;
492  size_t hLen;
493  const uint8_t *H;
494  uint8_t *DB = NULL;
495  EVP_MD_CTX ctx;
498 
499  if (mgf1Hash == NULL) {
500  mgf1Hash = Hash;
501  }
502 
503  hLen = EVP_MD_size(Hash);
504 
505  // Negative sLen has special meanings:
506  // -1 sLen == hLen
507  // -2 salt length is autorecovered from signature
508  // -N reserved
509  if (sLen == -1) {
510  sLen = hLen;
511  } else if (sLen == -2) {
512  sLen = -2;
513  } else if (sLen < -2) {
515  goto err;
516  }
517 
518  MSBits = (BN_num_bits(rsa->n) - 1) & 0x7;
519  emLen = RSA_size(rsa);
520  if (EM[0] & (0xFF << MSBits)) {
522  goto err;
523  }
524  if (MSBits == 0) {
525  EM++;
526  emLen--;
527  }
528  if (emLen < (int)hLen + 2 || emLen < ((int)hLen + sLen + 2)) {
529  // sLen can be small negative
531  goto err;
532  }
533  if (EM[emLen - 1] != 0xbc) {
535  goto err;
536  }
537  maskedDBLen = emLen - hLen - 1;
538  H = EM + maskedDBLen;
539  DB = OPENSSL_malloc(maskedDBLen);
540  if (!DB) {
542  goto err;
543  }
544  if (!PKCS1_MGF1(DB, maskedDBLen, H, hLen, mgf1Hash)) {
545  goto err;
546  }
547  for (i = 0; i < maskedDBLen; i++) {
548  DB[i] ^= EM[i];
549  }
550  if (MSBits) {
551  DB[0] &= 0xFF >> (8 - MSBits);
552  }
553  for (i = 0; DB[i] == 0 && i < (maskedDBLen - 1); i++) {
554  ;
555  }
556  if (DB[i++] != 0x1) {
558  goto err;
559  }
560  if (sLen >= 0 && (maskedDBLen - i) != sLen) {
562  goto err;
563  }
564  if (!EVP_DigestInit_ex(&ctx, Hash, NULL) ||
565  !EVP_DigestUpdate(&ctx, kPSSZeroes, sizeof(kPSSZeroes)) ||
566  !EVP_DigestUpdate(&ctx, mHash, hLen) ||
567  !EVP_DigestUpdate(&ctx, DB + i, maskedDBLen - i) ||
568  !EVP_DigestFinal_ex(&ctx, H_, NULL)) {
569  goto err;
570  }
571  if (OPENSSL_memcmp(H_, H, hLen)) {
573  ret = 0;
574  } else {
575  ret = 1;
576  }
577 
578 err:
579  OPENSSL_free(DB);
581 
582  return ret;
583 }
584 
585 int RSA_padding_add_PKCS1_PSS_mgf1(const RSA *rsa, unsigned char *EM,
586  const unsigned char *mHash,
587  const EVP_MD *Hash, const EVP_MD *mgf1Hash,
588  int sLenRequested) {
589  int ret = 0;
590  size_t maskedDBLen, MSBits, emLen;
591  size_t hLen;
592  unsigned char *H, *salt = NULL, *p;
593 
594  if (mgf1Hash == NULL) {
595  mgf1Hash = Hash;
596  }
597 
598  hLen = EVP_MD_size(Hash);
599 
600  if (BN_is_zero(rsa->n)) {
602  goto err;
603  }
604 
605  MSBits = (BN_num_bits(rsa->n) - 1) & 0x7;
606  emLen = RSA_size(rsa);
607  if (MSBits == 0) {
608  assert(emLen >= 1);
609  *EM++ = 0;
610  emLen--;
611  }
612 
613  if (emLen < hLen + 2) {
615  goto err;
616  }
617 
618  // Negative sLenRequested has special meanings:
619  // -1 sLen == hLen
620  // -2 salt length is maximized
621  // -N reserved
622  size_t sLen;
623  if (sLenRequested == -1) {
624  sLen = hLen;
625  } else if (sLenRequested == -2) {
626  sLen = emLen - hLen - 2;
627  } else if (sLenRequested < 0) {
629  goto err;
630  } else {
631  sLen = (size_t)sLenRequested;
632  }
633 
634  if (emLen - hLen - 2 < sLen) {
636  goto err;
637  }
638 
639  if (sLen > 0) {
640  salt = OPENSSL_malloc(sLen);
641  if (!salt) {
643  goto err;
644  }
645  if (!RAND_bytes(salt, sLen)) {
646  goto err;
647  }
648  }
649  maskedDBLen = emLen - hLen - 1;
650  H = EM + maskedDBLen;
651 
652  EVP_MD_CTX ctx;
654  int digest_ok = EVP_DigestInit_ex(&ctx, Hash, NULL) &&
656  EVP_DigestUpdate(&ctx, mHash, hLen) &&
657  EVP_DigestUpdate(&ctx, salt, sLen) &&
658  EVP_DigestFinal_ex(&ctx, H, NULL);
660  if (!digest_ok) {
661  goto err;
662  }
663 
664  // Generate dbMask in place then perform XOR on it
665  if (!PKCS1_MGF1(EM, maskedDBLen, H, hLen, mgf1Hash)) {
666  goto err;
667  }
668 
669  p = EM;
670 
671  // Initial PS XORs with all zeroes which is a NOP so just update
672  // pointer. Note from a test above this value is guaranteed to
673  // be non-negative.
674  p += emLen - sLen - hLen - 2;
675  *p++ ^= 0x1;
676  if (sLen > 0) {
677  for (size_t i = 0; i < sLen; i++) {
678  *p++ ^= salt[i];
679  }
680  }
681  if (MSBits) {
682  EM[0] &= 0xFF >> (8 - MSBits);
683  }
684 
685  // H is already in place so just set final 0xbc
686 
687  EM[emLen - 1] = 0xbc;
688 
689  ret = 1;
690 
691 err:
692  OPENSSL_free(salt);
693 
694  return ret;
695 }
RSA_R_NULL_BEFORE_BLOCK_MISSING
#define RSA_R_NULL_BEFORE_BLOCK_MISSING
Definition: rsa.h:836
RSA_verify_PKCS1_PSS_mgf1
int RSA_verify_PKCS1_PSS_mgf1(const RSA *rsa, const uint8_t *mHash, const EVP_MD *Hash, const EVP_MD *mgf1Hash, const uint8_t *EM, int sLen)
Definition: padding.c:486
bn.h
check_banned_filenames.bad
bad
Definition: check_banned_filenames.py:26
gen_build_yaml.out
dictionary out
Definition: src/benchmark/gen_build_yaml.py:24
RAND_bytes
#define RAND_bytes
Definition: boringssl_prefix_symbols.h:2060
Hash
Hash
Definition: abseil-cpp/absl/container/internal/hash_function_defaults_test.cc:339
OPENSSL_memcmp
static int OPENSSL_memcmp(const void *s1, const void *s2, size_t n)
Definition: third_party/boringssl-with-bazel/src/crypto/internal.h:811
ctx
Definition: benchmark-async.c:30
env_md_st
Definition: third_party/boringssl-with-bazel/src/crypto/fipsmodule/digest/internal.h:67
RSA_R_OAEP_DECODING_ERROR
#define RSA_R_OAEP_DECODING_ERROR
Definition: rsa.h:838
internal.h
RSA_size
#define RSA_size
Definition: boringssl_prefix_symbols.h:2139
CONSTTIME_TRUE_W
#define CONSTTIME_TRUE_W
Definition: third_party/boringssl-with-bazel/src/crypto/internal.h:276
RSA_R_SLEN_CHECK_FAILED
#define RSA_R_SLEN_CHECK_FAILED
Definition: rsa.h:843
OPENSSL_PUT_ERROR
#define OPENSSL_PUT_ERROR(library, reason)
Definition: err.h:423
string.h
seed
static const uint8_t seed[20]
Definition: dsa_test.cc:79
RSA_R_EMPTY_PUBLIC_KEY
#define RSA_R_EMPTY_PUBLIC_KEY
Definition: rsa.h:825
error_ref_leak.err
err
Definition: error_ref_leak.py:35
PKCS1_MGF1
static int PKCS1_MGF1(uint8_t *out, size_t len, const uint8_t *seed, size_t seed_len, const EVP_MD *md)
Definition: padding.c:273
EVP_DigestUpdate
#define EVP_DigestUpdate
Definition: boringssl_prefix_symbols.h:1516
ctx
static struct test_ctx ctx
Definition: test-ipc-send-recv.c:65
RSA_padding_add_PKCS1_type_2
int RSA_padding_add_PKCS1_type_2(uint8_t *to, size_t to_len, const uint8_t *from, size_t from_len)
Definition: padding.c:164
CONSTTIME_DECLASSIFY
#define CONSTTIME_DECLASSIFY(x, y)
Definition: third_party/boringssl-with-bazel/src/crypto/internal.h:462
to
size_t to
Definition: abseil-cpp/absl/container/internal/layout_test.cc:1385
xds_manager.p
p
Definition: xds_manager.py:60
EVP_DigestInit_ex
#define EVP_DigestInit_ex
Definition: boringssl_prefix_symbols.h:1511
uint8_t
unsigned char uint8_t
Definition: stdint-msvc2008.h:78
OPENSSL_memset
static void * OPENSSL_memset(void *dst, int c, size_t n)
Definition: third_party/boringssl-with-bazel/src/crypto/internal.h:835
constant_time_is_zero_w
static crypto_word_t constant_time_is_zero_w(crypto_word_t a)
Definition: third_party/boringssl-with-bazel/src/crypto/internal.h:372
RSA_R_SLEN_RECOVERY_FAILED
#define RSA_R_SLEN_RECOVERY_FAILED
Definition: rsa.h:844
env_md_ctx_st
Definition: digest.h:306
constant_time_ge_w
static crypto_word_t constant_time_ge_w(crypto_word_t a, crypto_word_t b)
Definition: third_party/boringssl-with-bazel/src/crypto/internal.h:360
RSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE
#define RSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE
Definition: rsa.h:819
uint32_t
unsigned int uint32_t
Definition: stdint-msvc2008.h:80
OPENSSL_malloc
#define OPENSSL_malloc
Definition: boringssl_prefix_symbols.h:1885
from
size_t from
Definition: abseil-cpp/absl/container/internal/layout_test.cc:1384
RSA_R_BAD_FIXED_HEADER_DECRYPT
#define RSA_R_BAD_FIXED_HEADER_DECRYPT
Definition: rsa.h:807
RSA_R_DIGEST_TOO_BIG_FOR_RSA_KEY
#define RSA_R_DIGEST_TOO_BIG_FOR_RSA_KEY
Definition: rsa.h:823
RSA_padding_check_PKCS1_type_1
int RSA_padding_check_PKCS1_type_1(uint8_t *out, size_t *out_len, size_t max_out, const uint8_t *from, size_t from_len)
Definition: padding.c:96
RSA_R_KEY_SIZE_TOO_SMALL
#define RSA_R_KEY_SIZE_TOO_SMALL
Definition: rsa.h:831
EVP_MD_size
#define EVP_MD_size
Definition: boringssl_prefix_symbols.h:1579
sha.h
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
RSA_R_PKCS_DECODING_ERROR
#define RSA_R_PKCS_DECODING_ERROR
Definition: rsa.h:842
err.h
counter
static int counter
Definition: abseil-cpp/absl/flags/reflection_test.cc:131
rsa.h
EVP_MD_CTX_init
#define EVP_MD_CTX_init
Definition: boringssl_prefix_symbols.h:1567
kPSSZeroes
static const uint8_t kPSSZeroes[]
Definition: padding.c:484
BN_is_zero
#define BN_is_zero
Definition: boringssl_prefix_symbols.h:940
RSA_padding_add_none
int RSA_padding_add_none(uint8_t *to, size_t to_len, const uint8_t *from, size_t from_len)
Definition: padding.c:257
H
#define H(b, c, d)
Definition: md4.c:114
RSA_padding_check_PKCS1_type_2
int RSA_padding_check_PKCS1_type_2(uint8_t *out, size_t *out_len, size_t max_out, const uint8_t *from, size_t from_len)
Definition: padding.c:190
RSA_padding_add_PKCS1_type_1
int RSA_padding_add_PKCS1_type_1(uint8_t *to, size_t to_len, const uint8_t *from, size_t from_len)
Definition: padding.c:75
BN_num_bits
#define BN_num_bits
Definition: boringssl_prefix_symbols.h:974
rand_nonzero
static int rand_nonzero(uint8_t *out, size_t len)
Definition: padding.c:148
benchmark.md
md
Definition: benchmark.py:86
rand.h
digest.h
RSA_padding_check_PKCS1_OAEP_mgf1
int RSA_padding_check_PKCS1_OAEP_mgf1(uint8_t *out, size_t *out_len, size_t max_out, const uint8_t *from, size_t from_len, const uint8_t *param, size_t param_len, const EVP_MD *md, const EVP_MD *mgf1md)
Definition: padding.c:387
EVP_Digest
#define EVP_Digest
Definition: boringssl_prefix_symbols.h:1506
EVP_DigestFinal_ex
#define EVP_DigestFinal_ex
Definition: boringssl_prefix_symbols.h:1509
RSA_R_BAD_SIGNATURE
#define RSA_R_BAD_SIGNATURE
Definition: rsa.h:810
RSA_padding_add_PKCS1_OAEP_mgf1
int RSA_padding_add_PKCS1_OAEP_mgf1(uint8_t *to, size_t to_len, const uint8_t *from, size_t from_len, const uint8_t *param, size_t param_len, const EVP_MD *md, const EVP_MD *mgf1md)
Definition: padding.c:316
RSA_R_BAD_PAD_BYTE_COUNT
#define RSA_R_BAD_PAD_BYTE_COUNT
Definition: rsa.h:808
RSA_PKCS1_PADDING_SIZE
#define RSA_PKCS1_PADDING_SIZE
Definition: padding.c:73
RSA_padding_add_PKCS1_PSS_mgf1
int RSA_padding_add_PKCS1_PSS_mgf1(const RSA *rsa, unsigned char *EM, const unsigned char *mHash, const EVP_MD *Hash, const EVP_MD *mgf1Hash, int sLenRequested)
Definition: padding.c:585
ret
UniquePtr< SSL_SESSION > ret
Definition: ssl_x509.cc:1029
EVP_MAX_MD_SIZE
#define EVP_MAX_MD_SIZE
Definition: digest.h:156
RSA_R_FIRST_OCTET_INVALID
#define RSA_R_FIRST_OCTET_INVALID
Definition: rsa.h:827
EVP_sha1
const OPENSSL_EXPORT EVP_MD * EVP_sha1(void)
constant_time_select_w
static crypto_word_t constant_time_select_w(crypto_word_t mask, crypto_word_t a, crypto_word_t b)
Definition: third_party/boringssl-with-bazel/src/crypto/internal.h:420
RSA_R_DATA_TOO_LARGE
#define RSA_R_DATA_TOO_LARGE
Definition: rsa.h:818
RSA_R_BLOCK_TYPE_IS_NOT_01
#define RSA_R_BLOCK_TYPE_IS_NOT_01
Definition: rsa.h:812
mem.h
rsa_st
Definition: rsa.h:732
RSA_R_LAST_OCTET_INVALID
#define RSA_R_LAST_OCTET_INVALID
Definition: rsa.h:832
len
int len
Definition: abseil-cpp/absl/base/internal/low_level_alloc_test.cc:46
constant_time_eq_w
static crypto_word_t constant_time_eq_w(crypto_word_t a, crypto_word_t b)
Definition: third_party/boringssl-with-bazel/src/crypto/internal.h:394
RSA_R_DATA_TOO_SMALL
#define RSA_R_DATA_TOO_SMALL
Definition: rsa.h:821
EVP_MD_CTX_cleanup
#define EVP_MD_CTX_cleanup
Definition: boringssl_prefix_symbols.h:1561
OPENSSL_free
#define OPENSSL_free
Definition: boringssl_prefix_symbols.h:1869
CRYPTO_memcmp
#define CRYPTO_memcmp
Definition: boringssl_prefix_symbols.h:1178
rsa_st::n
BIGNUM * n
Definition: rsa.h:738
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


grpc
Author(s):
autogenerated on Thu Mar 13 2025 03:00:49