grpc 1.41.0 → 1.41.1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of grpc might be problematic. Click here for more details.

Files changed (119) hide show
  1. checksums.yaml +4 -4
  2. data/Makefile +4 -3
  3. data/etc/roots.pem +335 -326
  4. data/src/ruby/ext/grpc/extconf.rb +1 -1
  5. data/src/ruby/lib/grpc/version.rb +1 -1
  6. data/third_party/boringssl-with-bazel/err_data.c +278 -272
  7. data/third_party/boringssl-with-bazel/src/crypto/asn1/a_bool.c +1 -1
  8. data/third_party/boringssl-with-bazel/src/crypto/asn1/a_d2i_fp.c +0 -2
  9. data/third_party/boringssl-with-bazel/src/crypto/asn1/a_gentm.c +5 -0
  10. data/third_party/boringssl-with-bazel/src/crypto/asn1/a_mbstr.c +15 -22
  11. data/third_party/boringssl-with-bazel/src/crypto/asn1/a_object.c +13 -7
  12. data/third_party/boringssl-with-bazel/src/crypto/asn1/a_print.c +19 -29
  13. data/third_party/boringssl-with-bazel/src/crypto/{x509 → asn1}/a_strex.c +268 -271
  14. data/third_party/boringssl-with-bazel/src/crypto/asn1/a_strnid.c +6 -43
  15. data/third_party/boringssl-with-bazel/src/crypto/asn1/a_time.c +2 -2
  16. data/third_party/boringssl-with-bazel/src/crypto/asn1/a_utctm.c +0 -39
  17. data/third_party/boringssl-with-bazel/src/crypto/asn1/asn1_par.c +1 -1
  18. data/third_party/boringssl-with-bazel/src/crypto/{x509 → asn1}/charmap.h +0 -0
  19. data/third_party/boringssl-with-bazel/src/crypto/asn1/internal.h +25 -0
  20. data/third_party/boringssl-with-bazel/src/crypto/asn1/tasn_dec.c +8 -8
  21. data/third_party/boringssl-with-bazel/src/crypto/asn1/tasn_enc.c +289 -198
  22. data/third_party/boringssl-with-bazel/src/crypto/asn1/tasn_fre.c +8 -8
  23. data/third_party/boringssl-with-bazel/src/crypto/asn1/tasn_new.c +9 -13
  24. data/third_party/boringssl-with-bazel/src/crypto/asn1/tasn_utl.c +1 -0
  25. data/third_party/boringssl-with-bazel/src/crypto/base64/base64.c +11 -8
  26. data/third_party/boringssl-with-bazel/src/crypto/bio/bio_mem.c +1 -7
  27. data/third_party/boringssl-with-bazel/src/crypto/bio/connect.c +1 -5
  28. data/third_party/boringssl-with-bazel/src/crypto/bio/fd.c +0 -4
  29. data/third_party/boringssl-with-bazel/src/crypto/bio/file.c +1 -7
  30. data/third_party/boringssl-with-bazel/src/crypto/bio/pair.c +1 -6
  31. data/third_party/boringssl-with-bazel/src/crypto/bio/socket.c +3 -17
  32. data/third_party/boringssl-with-bazel/src/crypto/bytestring/cbb.c +9 -0
  33. data/third_party/boringssl-with-bazel/src/crypto/bytestring/cbs.c +8 -0
  34. data/third_party/boringssl-with-bazel/src/crypto/cipher_extra/cipher_extra.c +45 -65
  35. data/third_party/boringssl-with-bazel/src/crypto/digest_extra/digest_extra.c +1 -0
  36. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/div.c +21 -3
  37. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/gcd_extra.c +3 -2
  38. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/internal.h +5 -2
  39. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/cipher/e_aes.c +10 -0
  40. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/md4/md4.c +1 -1
  41. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/modes/gcm_nohw.c +1 -1
  42. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rand/rand.c +1 -1
  43. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rsa/rsa.c +24 -9
  44. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rsa/rsa_impl.c +4 -2
  45. data/third_party/boringssl-with-bazel/src/crypto/mem.c +12 -9
  46. data/third_party/boringssl-with-bazel/src/crypto/pem/pem_all.c +0 -9
  47. data/third_party/boringssl-with-bazel/src/crypto/pem/pem_info.c +0 -2
  48. data/third_party/boringssl-with-bazel/src/crypto/pem/pem_lib.c +0 -8
  49. data/third_party/boringssl-with-bazel/src/crypto/pem/pem_pk8.c +0 -2
  50. data/third_party/boringssl-with-bazel/src/crypto/pem/pem_pkey.c +0 -4
  51. data/third_party/boringssl-with-bazel/src/crypto/pkcs7/internal.h +16 -7
  52. data/third_party/boringssl-with-bazel/src/crypto/pkcs7/pkcs7.c +9 -4
  53. data/third_party/boringssl-with-bazel/src/crypto/pkcs7/pkcs7_x509.c +151 -12
  54. data/third_party/boringssl-with-bazel/src/crypto/pkcs8/pkcs8_x509.c +1 -1
  55. data/third_party/boringssl-with-bazel/src/crypto/x509/by_file.c +2 -0
  56. data/third_party/boringssl-with-bazel/src/crypto/x509/internal.h +181 -1
  57. data/third_party/boringssl-with-bazel/src/crypto/x509/name_print.c +246 -0
  58. data/third_party/boringssl-with-bazel/src/crypto/x509/rsa_pss.c +11 -2
  59. data/third_party/boringssl-with-bazel/src/crypto/x509/t_crl.c +0 -2
  60. data/third_party/boringssl-with-bazel/src/crypto/x509/t_x509.c +0 -179
  61. data/third_party/boringssl-with-bazel/src/crypto/x509/t_x509a.c +4 -2
  62. data/third_party/boringssl-with-bazel/src/crypto/x509/x509_lu.c +0 -5
  63. data/third_party/boringssl-with-bazel/src/crypto/x509/x509_obj.c +1 -0
  64. data/third_party/boringssl-with-bazel/src/crypto/x509/x509_vfy.c +11 -50
  65. data/third_party/boringssl-with-bazel/src/crypto/x509/x509_vpm.c +1 -1
  66. data/third_party/boringssl-with-bazel/src/crypto/x509/x509name.c +2 -4
  67. data/third_party/boringssl-with-bazel/src/crypto/x509/x_all.c +0 -16
  68. data/third_party/boringssl-with-bazel/src/crypto/x509/x_name.c +22 -18
  69. data/third_party/boringssl-with-bazel/src/crypto/x509/x_x509.c +11 -8
  70. data/third_party/boringssl-with-bazel/src/crypto/x509v3/internal.h +16 -0
  71. data/third_party/boringssl-with-bazel/src/crypto/x509v3/pcy_cache.c +1 -0
  72. data/third_party/boringssl-with-bazel/src/crypto/x509v3/pcy_data.c +1 -1
  73. data/third_party/boringssl-with-bazel/src/crypto/x509v3/pcy_int.h +1 -1
  74. data/third_party/boringssl-with-bazel/src/crypto/x509v3/pcy_map.c +1 -0
  75. data/third_party/boringssl-with-bazel/src/crypto/x509v3/pcy_tree.c +4 -3
  76. data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_akey.c +24 -5
  77. data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_alt.c +17 -8
  78. data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_bitst.c +3 -0
  79. data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_cpols.c +6 -6
  80. data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_crld.c +4 -0
  81. data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_enum.c +5 -0
  82. data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_ncons.c +112 -55
  83. data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_pci.c +2 -1
  84. data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_prn.c +0 -2
  85. data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_purp.c +1 -0
  86. data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_utl.c +71 -26
  87. data/third_party/boringssl-with-bazel/src/include/openssl/asn1.h +304 -192
  88. data/third_party/boringssl-with-bazel/src/include/openssl/asn1t.h +2 -9
  89. data/third_party/boringssl-with-bazel/src/include/openssl/base.h +5 -3
  90. data/third_party/boringssl-with-bazel/src/include/openssl/bio.h +3 -1
  91. data/third_party/boringssl-with-bazel/src/include/openssl/bn.h +3 -3
  92. data/third_party/boringssl-with-bazel/src/include/openssl/bytestring.h +9 -0
  93. data/third_party/boringssl-with-bazel/src/include/openssl/cipher.h +8 -2
  94. data/third_party/boringssl-with-bazel/src/include/openssl/hkdf.h +4 -0
  95. data/third_party/boringssl-with-bazel/src/include/openssl/mem.h +9 -3
  96. data/third_party/boringssl-with-bazel/src/include/openssl/pem.h +0 -20
  97. data/third_party/boringssl-with-bazel/src/include/openssl/pkcs7.h +12 -5
  98. data/third_party/boringssl-with-bazel/src/include/openssl/rsa.h +5 -0
  99. data/third_party/boringssl-with-bazel/src/include/openssl/span.h +37 -15
  100. data/third_party/boringssl-with-bazel/src/include/openssl/ssl.h +26 -12
  101. data/third_party/boringssl-with-bazel/src/include/openssl/tls1.h +31 -32
  102. data/third_party/boringssl-with-bazel/src/include/openssl/x509.h +50 -76
  103. data/third_party/boringssl-with-bazel/src/include/openssl/x509_vfy.h +0 -131
  104. data/third_party/boringssl-with-bazel/src/include/openssl/x509v3.h +48 -8
  105. data/third_party/boringssl-with-bazel/src/ssl/encrypted_client_hello.cc +266 -357
  106. data/third_party/boringssl-with-bazel/src/ssl/extensions.cc +90 -152
  107. data/third_party/boringssl-with-bazel/src/ssl/handshake.cc +15 -13
  108. data/third_party/boringssl-with-bazel/src/ssl/handshake_client.cc +75 -79
  109. data/third_party/boringssl-with-bazel/src/ssl/handshake_server.cc +96 -97
  110. data/third_party/boringssl-with-bazel/src/ssl/internal.h +63 -43
  111. data/third_party/boringssl-with-bazel/src/ssl/ssl_cipher.cc +2 -2
  112. data/third_party/boringssl-with-bazel/src/ssl/ssl_lib.cc +2 -2
  113. data/third_party/boringssl-with-bazel/src/ssl/ssl_transcript.cc +6 -12
  114. data/third_party/boringssl-with-bazel/src/ssl/ssl_x509.cc +14 -16
  115. data/third_party/boringssl-with-bazel/src/ssl/tls13_both.cc +14 -27
  116. data/third_party/boringssl-with-bazel/src/ssl/tls13_client.cc +203 -203
  117. data/third_party/boringssl-with-bazel/src/ssl/tls13_enc.cc +30 -41
  118. data/third_party/boringssl-with-bazel/src/ssl/tls13_server.cc +47 -33
  119. metadata +39 -38
@@ -111,10 +111,6 @@ extern "C" {
111
111
  // V_ASN1_UNDEF is used in some APIs to indicate an ASN.1 element is omitted.
112
112
  #define V_ASN1_UNDEF (-1)
113
113
 
114
- // V_ASN1_APP_CHOOSE is used in some APIs to specify a default ASN.1 type based
115
- // on the context.
116
- #define V_ASN1_APP_CHOOSE (-2)
117
-
118
114
  // V_ASN1_OTHER is used in |ASN1_TYPE| to indicate a non-universal ASN.1 type.
119
115
  #define V_ASN1_OTHER (-3)
120
116
 
@@ -157,6 +153,31 @@ extern "C" {
157
153
  #define V_ASN1_NEG_INTEGER (V_ASN1_INTEGER | V_ASN1_NEG)
158
154
  #define V_ASN1_NEG_ENUMERATED (V_ASN1_ENUMERATED | V_ASN1_NEG)
159
155
 
156
+ // The following constants are bitmask representations of ASN.1 types.
157
+ #define B_ASN1_NUMERICSTRING 0x0001
158
+ #define B_ASN1_PRINTABLESTRING 0x0002
159
+ #define B_ASN1_T61STRING 0x0004
160
+ #define B_ASN1_TELETEXSTRING 0x0004
161
+ #define B_ASN1_VIDEOTEXSTRING 0x0008
162
+ #define B_ASN1_IA5STRING 0x0010
163
+ #define B_ASN1_GRAPHICSTRING 0x0020
164
+ #define B_ASN1_ISO64STRING 0x0040
165
+ #define B_ASN1_VISIBLESTRING 0x0040
166
+ #define B_ASN1_GENERALSTRING 0x0080
167
+ #define B_ASN1_UNIVERSALSTRING 0x0100
168
+ #define B_ASN1_OCTET_STRING 0x0200
169
+ #define B_ASN1_BIT_STRING 0x0400
170
+ #define B_ASN1_BMPSTRING 0x0800
171
+ #define B_ASN1_UNKNOWN 0x1000
172
+ #define B_ASN1_UTF8STRING 0x2000
173
+ #define B_ASN1_UTCTIME 0x4000
174
+ #define B_ASN1_GENERALIZEDTIME 0x8000
175
+ #define B_ASN1_SEQUENCE 0x10000
176
+
177
+ // ASN1_tag2str returns a string representation of |tag|, interpret as a tag
178
+ // number for a universal type, or |V_ASN1_NEG_*|.
179
+ OPENSSL_EXPORT const char *ASN1_tag2str(int tag);
180
+
160
181
 
161
182
  // Strings.
162
183
  //
@@ -232,14 +253,6 @@ struct asn1_string_st {
232
253
  // treated as padding. This behavior is deprecated and should not be used.
233
254
  #define ASN1_STRING_FLAG_BITS_LEFT 0x08
234
255
 
235
- // ASN1_STRING_FLAG_MSTRING indicates that the |ASN1_STRING| is an MSTRING type,
236
- // which is how this library refers to a CHOICE type of several string types.
237
- // For example, DirectoryString as defined in RFC5280.
238
- //
239
- // TODO(davidben): This is only used in one place within the library and is easy
240
- // to accidentally drop. Can it be removed?
241
- #define ASN1_STRING_FLAG_MSTRING 0x040
242
-
243
256
  // ASN1_STRING_type_new returns a newly-allocated empty |ASN1_STRING| object of
244
257
  // type |type|, or NULL on error.
245
258
  OPENSSL_EXPORT ASN1_STRING *ASN1_STRING_type_new(int type);
@@ -311,6 +324,52 @@ OPENSSL_EXPORT void ASN1_STRING_set0(ASN1_STRING *str, void *data, int len);
311
324
  OPENSSL_EXPORT int ASN1_STRING_to_UTF8(unsigned char **out,
312
325
  const ASN1_STRING *in);
313
326
 
327
+ // The following formats define encodings for use with functions like
328
+ // |ASN1_mbstring_copy|.
329
+ #define MBSTRING_FLAG 0x1000
330
+ #define MBSTRING_UTF8 (MBSTRING_FLAG)
331
+ // |MBSTRING_ASC| refers to Latin-1, not ASCII.
332
+ #define MBSTRING_ASC (MBSTRING_FLAG | 1)
333
+ #define MBSTRING_BMP (MBSTRING_FLAG | 2)
334
+ #define MBSTRING_UNIV (MBSTRING_FLAG | 4)
335
+
336
+ // DIRSTRING_TYPE contains the valid string types in an X.509 DirectoryString.
337
+ #define DIRSTRING_TYPE \
338
+ (B_ASN1_PRINTABLESTRING | B_ASN1_T61STRING | B_ASN1_BMPSTRING | \
339
+ B_ASN1_UTF8STRING)
340
+
341
+ // PKCS9STRING_TYPE contains the valid string types in a PKCS9String.
342
+ #define PKCS9STRING_TYPE (DIRSTRING_TYPE | B_ASN1_IA5STRING)
343
+
344
+ // ASN1_mbstring_copy converts |len| bytes from |in| to an ASN.1 string. If
345
+ // |len| is -1, |in| must be NUL-terminated and the length is determined by
346
+ // |strlen|. |in| is decoded according to |inform|, which must be one of
347
+ // |MBSTRING_*|. |mask| determines the set of valid output types and is a
348
+ // bitmask containing a subset of |B_ASN1_PRINTABLESTRING|, |B_ASN1_IA5STRING|,
349
+ // |B_ASN1_T61STRING|, |B_ASN1_BMPSTRING|, |B_ASN1_UNIVERSALSTRING|, and
350
+ // |B_ASN1_UTF8STRING|, in that preference order. This function chooses the
351
+ // first output type in |mask| which can represent |in|. It interprets T61String
352
+ // as Latin-1, rather than T.61.
353
+ //
354
+ // If |mask| is zero, |DIRSTRING_TYPE| is used by default.
355
+ //
356
+ // On success, this function returns the |V_ASN1_*| constant corresponding to
357
+ // the selected output type and, if |out| and |*out| are both non-NULL, updates
358
+ // the object at |*out| with the result. If |out| is non-NULL and |*out| is
359
+ // NULL, it instead sets |*out| to a newly-allocated |ASN1_STRING| containing
360
+ // the result. If |out| is NULL, it returns the selected output type without
361
+ // constructing an |ASN1_STRING|. On error, this function returns -1.
362
+ OPENSSL_EXPORT int ASN1_mbstring_copy(ASN1_STRING **out, const uint8_t *in,
363
+ int len, int inform, unsigned long mask);
364
+
365
+ // ASN1_mbstring_ncopy behaves like |ASN1_mbstring_copy| but returns an error if
366
+ // the input is less than |minsize| or greater than |maxsize| codepoints long. A
367
+ // |maxsize| value of zero is ignored. Note the sizes are measured in
368
+ // codepoints, not output bytes.
369
+ OPENSSL_EXPORT int ASN1_mbstring_ncopy(ASN1_STRING **out, const uint8_t *in,
370
+ int len, int inform, unsigned long mask,
371
+ long minsize, long maxsize);
372
+
314
373
  // TODO(davidben): Expand and document function prototypes generated in macros.
315
374
 
316
375
 
@@ -321,7 +380,7 @@ OPENSSL_EXPORT int ASN1_STRING_to_UTF8(unsigned char **out,
321
380
  // in several forms:
322
381
  //
323
382
  // Some BIT STRINGs represent a bitmask of named bits, such as the X.509 key
324
- // usage extension in RFC5280, section 4.2.1.3. For such bit strings, DER
383
+ // usage extension in RFC 5280, section 4.2.1.3. For such bit strings, DER
325
384
  // imposes an additional restriction that trailing zero bits are removed. Some
326
385
  // functions like |ASN1_BIT_STRING_set_bit| help in maintaining this.
327
386
  //
@@ -452,6 +511,135 @@ OPENSSL_EXPORT BIGNUM *ASN1_ENUMERATED_to_BN(const ASN1_ENUMERATED *ai,
452
511
  // TODO(davidben): Expand and document function prototypes generated in macros.
453
512
 
454
513
 
514
+ // Time.
515
+ //
516
+ // GeneralizedTime and UTCTime values are represented as |ASN1_STRING|s. The
517
+ // type field is |V_ASN1_GENERALIZEDTIME| or |V_ASN1_UTCTIME|, respectively. The
518
+ // data field contains the DER encoding of the value. For example, the UNIX
519
+ // epoch would be "19700101000000Z" for a GeneralizedTime and "700101000000Z"
520
+ // for a UTCTime.
521
+ //
522
+ // ASN.1 does not define how to interpret UTCTime's two-digit year. RFC 5280
523
+ // defines it as a range from 1950 to 2049 for X.509. The library uses the
524
+ // RFC 5280 interpretation. It does not currently enforce the restrictions from
525
+ // BER, and the additional restrictions from RFC 5280, but future versions may.
526
+ // Callers should not rely on fractional seconds and non-UTC time zones.
527
+ //
528
+ // The |ASN1_TIME| typedef represents the X.509 Time type, which is a CHOICE of
529
+ // GeneralizedTime and UTCTime, using UTCTime when the value is in range.
530
+
531
+ // ASN1_UTCTIME_check returns one if |a| is a valid UTCTime and zero otherwise.
532
+ OPENSSL_EXPORT int ASN1_UTCTIME_check(const ASN1_UTCTIME *a);
533
+
534
+ // ASN1_UTCTIME_set represents |t| as a UTCTime and writes the result to |s|. It
535
+ // returns |s| on success and NULL on error. If |s| is NULL, it returns a
536
+ // newly-allocated |ASN1_UTCTIME| instead.
537
+ //
538
+ // Note this function may fail if the time is out of range for UTCTime.
539
+ OPENSSL_EXPORT ASN1_UTCTIME *ASN1_UTCTIME_set(ASN1_UTCTIME *s, time_t t);
540
+
541
+ // ASN1_UTCTIME_adj adds |offset_day| days and |offset_sec| seconds to |t| and
542
+ // writes the result to |s| as a UTCTime. It returns |s| on success and NULL on
543
+ // error. If |s| is NULL, it returns a newly-allocated |ASN1_UTCTIME| instead.
544
+ //
545
+ // Note this function may fail if the time overflows or is out of range for
546
+ // UTCTime.
547
+ OPENSSL_EXPORT ASN1_UTCTIME *ASN1_UTCTIME_adj(ASN1_UTCTIME *s, time_t t,
548
+ int offset_day, long offset_sec);
549
+
550
+ // ASN1_UTCTIME_set_string sets |s| to a UTCTime whose contents are a copy of
551
+ // |str|. It returns one on success and zero on error or if |str| is not a valid
552
+ // UTCTime.
553
+ //
554
+ // If |s| is NULL, this function validates |str| without copying it.
555
+ OPENSSL_EXPORT int ASN1_UTCTIME_set_string(ASN1_UTCTIME *s, const char *str);
556
+
557
+ // ASN1_UTCTIME_cmp_time_t compares |s| to |t|. It returns -1 if |s| < |t|, 0 if
558
+ // they are equal, 1 if |s| > |t|, and -2 on error.
559
+ OPENSSL_EXPORT int ASN1_UTCTIME_cmp_time_t(const ASN1_UTCTIME *s, time_t t);
560
+
561
+ // ASN1_GENERALIZEDTIME_check returns one if |a| is a valid GeneralizedTime and
562
+ // zero otherwise.
563
+ OPENSSL_EXPORT int ASN1_GENERALIZEDTIME_check(const ASN1_GENERALIZEDTIME *a);
564
+
565
+ // ASN1_GENERALIZEDTIME_set represents |t| as a GeneralizedTime and writes the
566
+ // result to |s|. It returns |s| on success and NULL on error. If |s| is NULL,
567
+ // it returns a newly-allocated |ASN1_GENERALIZEDTIME| instead.
568
+ //
569
+ // Note this function may fail if the time is out of range for GeneralizedTime.
570
+ OPENSSL_EXPORT ASN1_GENERALIZEDTIME *ASN1_GENERALIZEDTIME_set(
571
+ ASN1_GENERALIZEDTIME *s, time_t t);
572
+
573
+ // ASN1_GENERALIZEDTIME_adj adds |offset_day| days and |offset_sec| seconds to
574
+ // |t| and writes the result to |s| as a GeneralizedTime. It returns |s| on
575
+ // success and NULL on error. If |s| is NULL, it returns a newly-allocated
576
+ // |ASN1_GENERALIZEDTIME| instead.
577
+ //
578
+ // Note this function may fail if the time overflows or is out of range for
579
+ // GeneralizedTime.
580
+ OPENSSL_EXPORT ASN1_GENERALIZEDTIME *ASN1_GENERALIZEDTIME_adj(
581
+ ASN1_GENERALIZEDTIME *s, time_t t, int offset_day, long offset_sec);
582
+
583
+ // ASN1_GENERALIZEDTIME_set_string sets |s| to a GeneralizedTime whose contents
584
+ // are a copy of |str|. It returns one on success and zero on error or if |str|
585
+ // is not a valid GeneralizedTime.
586
+ //
587
+ // If |s| is NULL, this function validates |str| without copying it.
588
+ OPENSSL_EXPORT int ASN1_GENERALIZEDTIME_set_string(ASN1_GENERALIZEDTIME *s,
589
+ const char *str);
590
+
591
+ // ASN1_TIME_diff computes |to| - |from|. On success, it sets |*out_days| to the
592
+ // difference in days, rounded towards zero, sets |*out_seconds| to the
593
+ // remainder, and returns one. On error, it returns zero.
594
+ //
595
+ // If |from| is before |to|, both outputs will be <= 0, with at least one
596
+ // negative. If |from| is after |to|, both will be >= 0, with at least one
597
+ // positive. If they are equal, ignoring fractional seconds, both will be zero.
598
+ //
599
+ // Note this function may fail on overflow, or if |from| or |to| cannot be
600
+ // decoded.
601
+ OPENSSL_EXPORT int ASN1_TIME_diff(int *out_days, int *out_seconds,
602
+ const ASN1_TIME *from, const ASN1_TIME *to);
603
+
604
+ // ASN1_TIME_set represents |t| as a GeneralizedTime or UTCTime and writes
605
+ // the result to |s|. As in RFC 5280, section 4.1.2.5, it uses UTCTime when the
606
+ // time fits and GeneralizedTime otherwise. It returns |s| on success and NULL
607
+ // on error. If |s| is NULL, it returns a newly-allocated |ASN1_TIME| instead.
608
+ //
609
+ // Note this function may fail if the time is out of range for GeneralizedTime.
610
+ OPENSSL_EXPORT ASN1_TIME *ASN1_TIME_set(ASN1_TIME *s, time_t t);
611
+
612
+ // ASN1_TIME_adj adds |offset_day| days and |offset_sec| seconds to
613
+ // |t| and writes the result to |s|. As in RFC 5280, section 4.1.2.5, it uses
614
+ // UTCTime when the time fits and GeneralizedTime otherwise. It returns |s| on
615
+ // success and NULL on error. If |s| is NULL, it returns a newly-allocated
616
+ // |ASN1_GENERALIZEDTIME| instead.
617
+ //
618
+ // Note this function may fail if the time overflows or is out of range for
619
+ // GeneralizedTime.
620
+ OPENSSL_EXPORT ASN1_TIME *ASN1_TIME_adj(ASN1_TIME *s, time_t t, int offset_day,
621
+ long offset_sec);
622
+
623
+ // ASN1_TIME_check returns one if |t| is a valid UTCTime or GeneralizedTime, and
624
+ // zero otherwise. |t|'s type determines which check is performed. This
625
+ // function does not enforce that UTCTime was used when possible.
626
+ OPENSSL_EXPORT int ASN1_TIME_check(const ASN1_TIME *t);
627
+
628
+ // ASN1_TIME_to_generalizedtime converts |t| to a GeneralizedTime. If |out| is
629
+ // NULL, it returns a newly-allocated |ASN1_GENERALIZEDTIME| on success, or NULL
630
+ // on error. If |out| is non-NULL and |*out| is NULL, it additionally sets
631
+ // |*out| to the result. If |out| and |*out| are non-NULL, it instead updates
632
+ // the object pointed by |*out| and returns |*out| on success or NULL on error.
633
+ OPENSSL_EXPORT ASN1_GENERALIZEDTIME *ASN1_TIME_to_generalizedtime(
634
+ const ASN1_TIME *t, ASN1_GENERALIZEDTIME **out);
635
+
636
+ // ASN1_TIME_set_string behaves like |ASN1_UTCTIME_set_string| if |str| is a
637
+ // valid UTCTime, and |ASN1_GENERALIZEDTIME_set_string| if |str| is a valid
638
+ // GeneralizedTime. If |str| is neither, it returns zero.
639
+ OPENSSL_EXPORT int ASN1_TIME_set_string(ASN1_TIME *s, const char *str);
640
+
641
+ // TODO(davidben): Expand and document function prototypes generated in macros.
642
+
455
643
 
456
644
  // Arbitrary elements.
457
645
 
@@ -558,40 +746,102 @@ OPENSSL_EXPORT int ASN1_TYPE_cmp(const ASN1_TYPE *a, const ASN1_TYPE *b);
558
746
  // the macros, document them, and move them to this section.
559
747
 
560
748
 
561
- // Underdocumented functions.
749
+ // Human-readable output.
562
750
  //
563
- // The following functions are not yet documented and organized.
751
+ // The following functions output types in some human-readable format. These
752
+ // functions may be used for debugging and logging. However, the output should
753
+ // not be consumed programmatically. They may be ambiguous or lose information.
564
754
 
565
- // For use with d2i_ASN1_type_bytes()
566
- #define B_ASN1_NUMERICSTRING 0x0001
567
- #define B_ASN1_PRINTABLESTRING 0x0002
568
- #define B_ASN1_T61STRING 0x0004
569
- #define B_ASN1_TELETEXSTRING 0x0004
570
- #define B_ASN1_VIDEOTEXSTRING 0x0008
571
- #define B_ASN1_IA5STRING 0x0010
572
- #define B_ASN1_GRAPHICSTRING 0x0020
573
- #define B_ASN1_ISO64STRING 0x0040
574
- #define B_ASN1_VISIBLESTRING 0x0040
575
- #define B_ASN1_GENERALSTRING 0x0080
576
- #define B_ASN1_UNIVERSALSTRING 0x0100
577
- #define B_ASN1_OCTET_STRING 0x0200
578
- #define B_ASN1_BIT_STRING 0x0400
579
- #define B_ASN1_BMPSTRING 0x0800
580
- #define B_ASN1_UNKNOWN 0x1000
581
- #define B_ASN1_UTF8STRING 0x2000
582
- #define B_ASN1_UTCTIME 0x4000
583
- #define B_ASN1_GENERALIZEDTIME 0x8000
584
- #define B_ASN1_SEQUENCE 0x10000
755
+ // ASN1_UTCTIME_print writes a human-readable representation of |a| to |out|. It
756
+ // returns one on success and zero on error.
757
+ OPENSSL_EXPORT int ASN1_UTCTIME_print(BIO *out, const ASN1_UTCTIME *a);
585
758
 
586
- // For use with ASN1_mbstring_copy()
587
- #define MBSTRING_FLAG 0x1000
588
- #define MBSTRING_UTF8 (MBSTRING_FLAG)
589
- // |MBSTRING_ASC| refers to Latin-1, not ASCII. It is used with TeletexString
590
- // which, in turn, is treated as Latin-1 rather than T.61 by OpenSSL and most
591
- // other software.
592
- #define MBSTRING_ASC (MBSTRING_FLAG | 1)
593
- #define MBSTRING_BMP (MBSTRING_FLAG | 2)
594
- #define MBSTRING_UNIV (MBSTRING_FLAG | 4)
759
+ // ASN1_GENERALIZEDTIME_print writes a human-readable representation of |a| to
760
+ // |out|. It returns one on success and zero on error.
761
+ OPENSSL_EXPORT int ASN1_GENERALIZEDTIME_print(BIO *out,
762
+ const ASN1_GENERALIZEDTIME *a);
763
+
764
+ // ASN1_TIME_print writes a human-readable representation of |a| to |out|. It
765
+ // returns one on success and zero on error.
766
+ OPENSSL_EXPORT int ASN1_TIME_print(BIO *out, const ASN1_TIME *a);
767
+
768
+ // ASN1_STRING_print writes a human-readable representation of |str| to |out|.
769
+ // It returns one on success and zero on error. Unprintable characters are
770
+ // replaced with '.'.
771
+ OPENSSL_EXPORT int ASN1_STRING_print(BIO *out, const ASN1_STRING *str);
772
+
773
+ // ASN1_STRFLGS_ESC_2253 causes characters to be escaped as in RFC 2253, section
774
+ // 2.4.
775
+ #define ASN1_STRFLGS_ESC_2253 1
776
+
777
+ // ASN1_STRFLGS_ESC_CTRL causes all control characters to be escaped.
778
+ #define ASN1_STRFLGS_ESC_CTRL 2
779
+
780
+ // ASN1_STRFLGS_ESC_MSB causes all characters above 127 to be escaped.
781
+ #define ASN1_STRFLGS_ESC_MSB 4
782
+
783
+ // ASN1_STRFLGS_ESC_QUOTE causes the string to be surrounded by quotes, rather
784
+ // than using backslashes, when characters are escaped. Fewer characters will
785
+ // require escapes in this case.
786
+ #define ASN1_STRFLGS_ESC_QUOTE 8
787
+
788
+ // ASN1_STRFLGS_UTF8_CONVERT causes the string to be encoded as UTF-8, with each
789
+ // byte in the UTF-8 encoding treated as an individual character for purposes of
790
+ // escape sequences. If not set, each Unicode codepoint in the string is treated
791
+ // as a character, with wide characters escaped as "\Uxxxx" or "\Wxxxxxxxx".
792
+ // Note this can be ambiguous if |ASN1_STRFLGS_ESC_*| are all unset. In that
793
+ // case, backslashes are not escaped, but wide characters are.
794
+ #define ASN1_STRFLGS_UTF8_CONVERT 0x10
795
+
796
+ // ASN1_STRFLGS_IGNORE_TYPE causes the string type to be ignored. The
797
+ // |ASN1_STRING| in-memory representation will be printed directly.
798
+ #define ASN1_STRFLGS_IGNORE_TYPE 0x20
799
+
800
+ // ASN1_STRFLGS_SHOW_TYPE causes the string type to be included in the output.
801
+ #define ASN1_STRFLGS_SHOW_TYPE 0x40
802
+
803
+ // ASN1_STRFLGS_DUMP_ALL causes all strings to be printed as a hexdump, using
804
+ // RFC 2253 hexstring notation, such as "#0123456789ABCDEF".
805
+ #define ASN1_STRFLGS_DUMP_ALL 0x80
806
+
807
+ // ASN1_STRFLGS_DUMP_UNKNOWN behaves like |ASN1_STRFLGS_DUMP_ALL| but only
808
+ // applies to values of unknown type. If unset, unknown values will print
809
+ // their contents as single-byte characters with escape sequences.
810
+ #define ASN1_STRFLGS_DUMP_UNKNOWN 0x100
811
+
812
+ // ASN1_STRFLGS_DUMP_DER causes hexdumped strings (as determined by
813
+ // |ASN1_STRFLGS_DUMP_ALL| or |ASN1_STRFLGS_DUMP_UNKNOWN|) to print the entire
814
+ // DER element as in RFC 2253, rather than only the contents of the
815
+ // |ASN1_STRING|.
816
+ #define ASN1_STRFLGS_DUMP_DER 0x200
817
+
818
+ // ASN1_STRFLGS_RFC2253 causes the string to be escaped as in RFC 2253,
819
+ // additionally escaping control characters.
820
+ #define ASN1_STRFLGS_RFC2253 \
821
+ (ASN1_STRFLGS_ESC_2253 | ASN1_STRFLGS_ESC_CTRL | ASN1_STRFLGS_ESC_MSB | \
822
+ ASN1_STRFLGS_UTF8_CONVERT | ASN1_STRFLGS_DUMP_UNKNOWN | \
823
+ ASN1_STRFLGS_DUMP_DER)
824
+
825
+ // ASN1_STRING_print_ex writes a human-readable representation of |str| to
826
+ // |out|. It returns the number of bytes written on success and -1 on error. If
827
+ // |out| is NULL, it returns the number of bytes it would have written, without
828
+ // writing anything.
829
+ //
830
+ // The |flags| should be a combination of combination of |ASN1_STRFLGS_*|
831
+ // constants. See the documentation for each flag for how it controls the
832
+ // output. If unsure, use |ASN1_STRFLGS_RFC2253|.
833
+ OPENSSL_EXPORT int ASN1_STRING_print_ex(BIO *out, const ASN1_STRING *str,
834
+ unsigned long flags);
835
+
836
+ // ASN1_STRING_print_ex_fp behaves like |ASN1_STRING_print_ex| but writes to a
837
+ // |FILE| rather than a |BIO|.
838
+ OPENSSL_EXPORT int ASN1_STRING_print_ex_fp(FILE *fp, const ASN1_STRING *str,
839
+ unsigned long flags);
840
+
841
+
842
+ // Underdocumented functions.
843
+ //
844
+ // The following functions are not yet documented and organized.
595
845
 
596
846
  DEFINE_STACK_OF(ASN1_OBJECT)
597
847
 
@@ -615,10 +865,6 @@ typedef struct ASN1_ENCODING_st {
615
865
 
616
866
  #define STABLE_FLAGS_MALLOC 0x01
617
867
  #define STABLE_NO_MASK 0x02
618
- #define DIRSTRING_TYPE \
619
- (B_ASN1_PRINTABLESTRING | B_ASN1_T61STRING | B_ASN1_BMPSTRING | \
620
- B_ASN1_UTF8STRING)
621
- #define PKCS9STRING_TYPE (DIRSTRING_TYPE | B_ASN1_IA5STRING)
622
868
 
623
869
  typedef struct asn1_string_table_st {
624
870
  int nid;
@@ -628,17 +874,6 @@ typedef struct asn1_string_table_st {
628
874
  unsigned long flags;
629
875
  } ASN1_STRING_TABLE;
630
876
 
631
- // size limits: this stuff is taken straight from RFC2459
632
-
633
- #define ub_name 32768
634
- #define ub_common_name 64
635
- #define ub_locality_name 128
636
- #define ub_state_name 128
637
- #define ub_organization_name 64
638
- #define ub_organization_unit_name 64
639
- #define ub_title 64
640
- #define ub_email_address 128
641
-
642
877
  // Declarations for template structures: for full definitions
643
878
  // see asn1t.h
644
879
  typedef struct ASN1_TEMPLATE_st ASN1_TEMPLATE;
@@ -736,75 +971,6 @@ typedef const ASN1_ITEM ASN1_ITEM_EXP;
736
971
 
737
972
  #define DECLARE_ASN1_ITEM(name) extern OPENSSL_EXPORT const ASN1_ITEM name##_it;
738
973
 
739
- // Parameters used by ASN1_STRING_print_ex()
740
-
741
- // These determine which characters to escape:
742
- // RFC2253 special characters, control characters and
743
- // MSB set characters
744
-
745
- #define ASN1_STRFLGS_ESC_2253 1
746
- #define ASN1_STRFLGS_ESC_CTRL 2
747
- #define ASN1_STRFLGS_ESC_MSB 4
748
-
749
-
750
- // This flag determines how we do escaping: normally
751
- // RC2253 backslash only, set this to use backslash and
752
- // quote.
753
-
754
- #define ASN1_STRFLGS_ESC_QUOTE 8
755
-
756
-
757
- // These three flags are internal use only.
758
-
759
- // Character is a valid PrintableString character
760
- #define CHARTYPE_PRINTABLESTRING 0x10
761
- // Character needs escaping if it is the first character
762
- #define CHARTYPE_FIRST_ESC_2253 0x20
763
- // Character needs escaping if it is the last character
764
- #define CHARTYPE_LAST_ESC_2253 0x40
765
-
766
- // NB the internal flags are safely reused below by flags
767
- // handled at the top level.
768
-
769
- // If this is set we convert all character strings
770
- // to UTF8 first
771
-
772
- #define ASN1_STRFLGS_UTF8_CONVERT 0x10
773
-
774
- // If this is set we don't attempt to interpret content:
775
- // just assume all strings are 1 byte per character. This
776
- // will produce some pretty odd looking output!
777
-
778
- #define ASN1_STRFLGS_IGNORE_TYPE 0x20
779
-
780
- // If this is set we include the string type in the output
781
- #define ASN1_STRFLGS_SHOW_TYPE 0x40
782
-
783
- // This determines which strings to display and which to
784
- // 'dump' (hex dump of content octets or DER encoding). We can
785
- // only dump non character strings or everything. If we
786
- // don't dump 'unknown' they are interpreted as character
787
- // strings with 1 octet per character and are subject to
788
- // the usual escaping options.
789
-
790
- #define ASN1_STRFLGS_DUMP_ALL 0x80
791
- #define ASN1_STRFLGS_DUMP_UNKNOWN 0x100
792
-
793
- // These determine what 'dumping' does, we can dump the
794
- // content octets or the DER encoding: both use the
795
- // RFC2253 #XXXXX notation.
796
-
797
- #define ASN1_STRFLGS_DUMP_DER 0x200
798
-
799
- // All the string flags consistent with RFC2253,
800
- // escaping control characters isn't essential in
801
- // RFC2253 but it is advisable anyway.
802
-
803
- #define ASN1_STRFLGS_RFC2253 \
804
- (ASN1_STRFLGS_ESC_2253 | ASN1_STRFLGS_ESC_CTRL | ASN1_STRFLGS_ESC_MSB | \
805
- ASN1_STRFLGS_UTF8_CONVERT | ASN1_STRFLGS_DUMP_UNKNOWN | \
806
- ASN1_STRFLGS_DUMP_DER)
807
-
808
974
  DEFINE_STACK_OF(ASN1_INTEGER)
809
975
 
810
976
  DEFINE_STACK_OF(ASN1_TYPE)
@@ -814,20 +980,6 @@ typedef STACK_OF(ASN1_TYPE) ASN1_SEQUENCE_ANY;
814
980
  DECLARE_ASN1_ENCODE_FUNCTIONS_const(ASN1_SEQUENCE_ANY, ASN1_SEQUENCE_ANY)
815
981
  DECLARE_ASN1_ENCODE_FUNCTIONS_const(ASN1_SEQUENCE_ANY, ASN1_SET_ANY)
816
982
 
817
- struct X509_algor_st {
818
- ASN1_OBJECT *algorithm;
819
- ASN1_TYPE *parameter;
820
- } /* X509_ALGOR */;
821
-
822
- DECLARE_ASN1_FUNCTIONS(X509_ALGOR)
823
-
824
- // This is used to contain a list of bit names
825
- typedef struct BIT_STRING_BITNAME_st {
826
- int bitnum;
827
- const char *lname;
828
- const char *sname;
829
- } BIT_STRING_BITNAME;
830
-
831
983
  // M_ASN1_* are legacy aliases for various |ASN1_STRING| functions. Use the
832
984
  // functions themselves.
833
985
  #define M_ASN1_STRING_length(x) ASN1_STRING_length(x)
@@ -924,26 +1076,6 @@ OPENSSL_EXPORT ASN1_INTEGER *ASN1_INTEGER_dup(const ASN1_INTEGER *x);
924
1076
 
925
1077
  DECLARE_ASN1_FUNCTIONS(ASN1_ENUMERATED)
926
1078
 
927
- OPENSSL_EXPORT int ASN1_UTCTIME_check(const ASN1_UTCTIME *a);
928
- OPENSSL_EXPORT ASN1_UTCTIME *ASN1_UTCTIME_set(ASN1_UTCTIME *s, time_t t);
929
- OPENSSL_EXPORT ASN1_UTCTIME *ASN1_UTCTIME_adj(ASN1_UTCTIME *s, time_t t,
930
- int offset_day, long offset_sec);
931
- OPENSSL_EXPORT int ASN1_UTCTIME_set_string(ASN1_UTCTIME *s, const char *str);
932
- OPENSSL_EXPORT int ASN1_UTCTIME_cmp_time_t(const ASN1_UTCTIME *s, time_t t);
933
- #if 0
934
- time_t ASN1_UTCTIME_get(const ASN1_UTCTIME *s);
935
- #endif
936
-
937
- OPENSSL_EXPORT int ASN1_GENERALIZEDTIME_check(const ASN1_GENERALIZEDTIME *a);
938
- OPENSSL_EXPORT ASN1_GENERALIZEDTIME *ASN1_GENERALIZEDTIME_set(
939
- ASN1_GENERALIZEDTIME *s, time_t t);
940
- OPENSSL_EXPORT ASN1_GENERALIZEDTIME *ASN1_GENERALIZEDTIME_adj(
941
- ASN1_GENERALIZEDTIME *s, time_t t, int offset_day, long offset_sec);
942
- OPENSSL_EXPORT int ASN1_GENERALIZEDTIME_set_string(ASN1_GENERALIZEDTIME *s,
943
- const char *str);
944
- OPENSSL_EXPORT int ASN1_TIME_diff(int *pday, int *psec, const ASN1_TIME *from,
945
- const ASN1_TIME *to);
946
-
947
1079
  DECLARE_ASN1_FUNCTIONS(ASN1_OCTET_STRING)
948
1080
  OPENSSL_EXPORT ASN1_OCTET_STRING *ASN1_OCTET_STRING_dup(
949
1081
  const ASN1_OCTET_STRING *a);
@@ -970,14 +1102,6 @@ DECLARE_ASN1_FUNCTIONS(ASN1_UTCTIME)
970
1102
  DECLARE_ASN1_FUNCTIONS(ASN1_GENERALIZEDTIME)
971
1103
  DECLARE_ASN1_FUNCTIONS(ASN1_TIME)
972
1104
 
973
- OPENSSL_EXPORT ASN1_TIME *ASN1_TIME_set(ASN1_TIME *s, time_t t);
974
- OPENSSL_EXPORT ASN1_TIME *ASN1_TIME_adj(ASN1_TIME *s, time_t t, int offset_day,
975
- long offset_sec);
976
- OPENSSL_EXPORT int ASN1_TIME_check(const ASN1_TIME *t);
977
- OPENSSL_EXPORT ASN1_GENERALIZEDTIME *ASN1_TIME_to_generalizedtime(
978
- const ASN1_TIME *t, ASN1_GENERALIZEDTIME **out);
979
- OPENSSL_EXPORT int ASN1_TIME_set_string(ASN1_TIME *s, const char *str);
980
-
981
1105
  OPENSSL_EXPORT int i2a_ASN1_INTEGER(BIO *bp, const ASN1_INTEGER *a);
982
1106
  OPENSSL_EXPORT int i2a_ASN1_ENUMERATED(BIO *bp, const ASN1_ENUMERATED *a);
983
1107
  OPENSSL_EXPORT int i2a_ASN1_OBJECT(BIO *bp, const ASN1_OBJECT *a);
@@ -990,9 +1114,11 @@ OPENSSL_EXPORT ASN1_OBJECT *ASN1_OBJECT_create(int nid,
990
1114
  int len, const char *sn,
991
1115
  const char *ln);
992
1116
 
993
- // General
994
- // given a string, return the correct type, max is the maximum length
995
- OPENSSL_EXPORT int ASN1_PRINTABLE_type(const unsigned char *s, int max);
1117
+ // ASN1_PRINTABLE_type interprets |len| bytes from |s| as a Latin-1 string. It
1118
+ // returns the first of |V_ASN1_PRINTABLESTRING|, |V_ASN1_IA5STRING|, or
1119
+ // |V_ASN1_T61STRING| that can represent every character. If |len| is negative,
1120
+ // |strlen(s)| is used instead.
1121
+ OPENSSL_EXPORT int ASN1_PRINTABLE_type(const unsigned char *s, int len);
996
1122
 
997
1123
  OPENSSL_EXPORT unsigned long ASN1_tag2bit(int tag);
998
1124
 
@@ -1006,23 +1132,11 @@ OPENSSL_EXPORT int ASN1_object_size(int constructed, int length, int tag);
1006
1132
 
1007
1133
  OPENSSL_EXPORT void *ASN1_item_dup(const ASN1_ITEM *it, void *x);
1008
1134
 
1009
- #ifndef OPENSSL_NO_FP_API
1010
1135
  OPENSSL_EXPORT void *ASN1_item_d2i_fp(const ASN1_ITEM *it, FILE *in, void *x);
1011
1136
  OPENSSL_EXPORT int ASN1_item_i2d_fp(const ASN1_ITEM *it, FILE *out, void *x);
1012
- OPENSSL_EXPORT int ASN1_STRING_print_ex_fp(FILE *fp, const ASN1_STRING *str,
1013
- unsigned long flags);
1014
- #endif
1015
1137
 
1016
1138
  OPENSSL_EXPORT void *ASN1_item_d2i_bio(const ASN1_ITEM *it, BIO *in, void *x);
1017
1139
  OPENSSL_EXPORT int ASN1_item_i2d_bio(const ASN1_ITEM *it, BIO *out, void *x);
1018
- OPENSSL_EXPORT int ASN1_UTCTIME_print(BIO *fp, const ASN1_UTCTIME *a);
1019
- OPENSSL_EXPORT int ASN1_GENERALIZEDTIME_print(BIO *fp,
1020
- const ASN1_GENERALIZEDTIME *a);
1021
- OPENSSL_EXPORT int ASN1_TIME_print(BIO *fp, const ASN1_TIME *a);
1022
- OPENSSL_EXPORT int ASN1_STRING_print(BIO *bp, const ASN1_STRING *v);
1023
- OPENSSL_EXPORT int ASN1_STRING_print_ex(BIO *out, const ASN1_STRING *str,
1024
- unsigned long flags);
1025
- OPENSSL_EXPORT const char *ASN1_tag2str(int tag);
1026
1140
 
1027
1141
  // Used to load and write netscape format cert
1028
1142
 
@@ -1032,16 +1146,14 @@ OPENSSL_EXPORT void *ASN1_item_unpack(const ASN1_STRING *oct,
1032
1146
  OPENSSL_EXPORT ASN1_STRING *ASN1_item_pack(void *obj, const ASN1_ITEM *it,
1033
1147
  ASN1_OCTET_STRING **oct);
1034
1148
 
1149
+ // ASN1_STRING_set_default_mask does nothing.
1035
1150
  OPENSSL_EXPORT void ASN1_STRING_set_default_mask(unsigned long mask);
1151
+
1152
+ // ASN1_STRING_set_default_mask_asc returns one.
1036
1153
  OPENSSL_EXPORT int ASN1_STRING_set_default_mask_asc(const char *p);
1154
+
1155
+ // ASN1_STRING_get_default_mask returns |B_ASN1_UTF8STRING|.
1037
1156
  OPENSSL_EXPORT unsigned long ASN1_STRING_get_default_mask(void);
1038
- OPENSSL_EXPORT int ASN1_mbstring_copy(ASN1_STRING **out,
1039
- const unsigned char *in, int len,
1040
- int inform, unsigned long mask);
1041
- OPENSSL_EXPORT int ASN1_mbstring_ncopy(ASN1_STRING **out,
1042
- const unsigned char *in, int len,
1043
- int inform, unsigned long mask,
1044
- long minsize, long maxsize);
1045
1157
 
1046
1158
  OPENSSL_EXPORT ASN1_STRING *ASN1_STRING_set_by_NID(ASN1_STRING **out,
1047
1159
  const unsigned char *in,
@@ -389,13 +389,6 @@ struct ASN1_ADB_TABLE_st {
389
389
  /* Field is a SEQUENCE OF */
390
390
  #define ASN1_TFLG_SEQUENCE_OF (0x2 << 1)
391
391
 
392
- /* Special case: this refers to a SET OF that
393
- * will be sorted into DER order when encoded *and*
394
- * the corresponding STACK will be modified to match
395
- * the new order.
396
- */
397
- #define ASN1_TFLG_SET_ORDER (0x3 << 1)
398
-
399
392
  /* Mask for SET OF or SEQUENCE OF */
400
393
  #define ASN1_TFLG_SK_MASK (0x3 << 1)
401
394
 
@@ -602,8 +595,8 @@ typedef struct ASN1_AUX_st {
602
595
  #define ASN1_OP_FREE_POST 3
603
596
  #define ASN1_OP_D2I_PRE 4
604
597
  #define ASN1_OP_D2I_POST 5
605
- #define ASN1_OP_I2D_PRE 6
606
- #define ASN1_OP_I2D_POST 7
598
+ /* ASN1_OP_I2D_PRE and ASN1_OP_I2D_POST are not supported. We leave the
599
+ * constants undefined so code relying on them does not accidentally compile. */
607
600
  #define ASN1_OP_PRINT_PRE 8
608
601
  #define ASN1_OP_PRINT_POST 9
609
602
  #define ASN1_OP_STREAM_PRE 10
@@ -145,7 +145,7 @@ extern "C" {
145
145
  // Trusty isn't Linux but currently defines __linux__. As a workaround, we
146
146
  // exclude it here.
147
147
  // TODO(b/169780122): Remove this workaround once Trusty no longer defines it.
148
- #if defined(__linux__) && !defined(TRUSTY)
148
+ #if defined(__linux__) && !defined(__TRUSTY__)
149
149
  #define OPENSSL_LINUX
150
150
  #endif
151
151
 
@@ -153,7 +153,7 @@ extern "C" {
153
153
  #define OPENSSL_FUCHSIA
154
154
  #endif
155
155
 
156
- #if defined(TRUSTY)
156
+ #if defined(__TRUSTY__)
157
157
  #define OPENSSL_TRUSTY
158
158
  #define OPENSSL_NO_THREADS_CORRUPT_MEMORY_AND_LEAK_SECRETS_IF_THREADED
159
159
  #endif
@@ -422,6 +422,7 @@ typedef struct private_key_st X509_PKEY;
422
422
  typedef struct rand_meth_st RAND_METHOD;
423
423
  typedef struct rc4_key_st RC4_KEY;
424
424
  typedef struct rsa_meth_st RSA_METHOD;
425
+ typedef struct rsa_pss_params_st RSA_PSS_PARAMS;
425
426
  typedef struct rsa_st RSA;
426
427
  typedef struct sha256_state_st SHA256_CTX;
427
428
  typedef struct sha512_state_st SHA512_CTX;
@@ -445,9 +446,10 @@ typedef struct trust_token_method_st TRUST_TOKEN_METHOD;
445
446
  typedef struct v3_ext_ctx X509V3_CTX;
446
447
  typedef struct x509_attributes_st X509_ATTRIBUTE;
447
448
  typedef struct x509_cert_aux_st X509_CERT_AUX;
448
- typedef struct x509_cinf_st X509_CINF;
449
449
  typedef struct x509_crl_method_st X509_CRL_METHOD;
450
450
  typedef struct x509_lookup_st X509_LOOKUP;
451
+ typedef struct x509_lookup_method_st X509_LOOKUP_METHOD;
452
+ typedef struct x509_object_st X509_OBJECT;
451
453
  typedef struct x509_revoked_st X509_REVOKED;
452
454
  typedef struct x509_st X509;
453
455
  typedef struct x509_store_ctx_st X509_STORE_CTX;