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
@@ -110,28 +110,19 @@ extern "C" {
110
110
  #define X509v3_KU_DECIPHER_ONLY 0x8000
111
111
  #define X509v3_KU_UNDEF 0xffff
112
112
 
113
+ struct X509_algor_st {
114
+ ASN1_OBJECT *algorithm;
115
+ ASN1_TYPE *parameter;
116
+ } /* X509_ALGOR */;
117
+
118
+ DECLARE_ASN1_FUNCTIONS(X509_ALGOR)
119
+
113
120
  DEFINE_STACK_OF(X509_ALGOR)
114
121
 
115
122
  typedef STACK_OF(X509_ALGOR) X509_ALGORS;
116
123
 
117
- struct X509_name_entry_st {
118
- ASN1_OBJECT *object;
119
- ASN1_STRING *value;
120
- int set;
121
- } /* X509_NAME_ENTRY */;
122
-
123
124
  DEFINE_STACK_OF(X509_NAME_ENTRY)
124
125
 
125
- // we always keep X509_NAMEs in 2 forms.
126
- struct X509_name_st {
127
- STACK_OF(X509_NAME_ENTRY) *entries;
128
- int modified; // true if 'bytes' needs to be built
129
- BUF_MEM *bytes;
130
- // unsigned long hash; Keep the hash around for lookups
131
- unsigned char *canon_enc;
132
- int canon_enclen;
133
- } /* X509_NAME */;
134
-
135
126
  DEFINE_STACK_OF(X509_NAME)
136
127
 
137
128
  typedef STACK_OF(X509_EXTENSION) X509_EXTENSIONS;
@@ -140,20 +131,6 @@ DEFINE_STACK_OF(X509_EXTENSION)
140
131
 
141
132
  DEFINE_STACK_OF(X509_ATTRIBUTE)
142
133
 
143
- struct x509_cinf_st {
144
- ASN1_INTEGER *version; // [ 0 ] default of v1
145
- ASN1_INTEGER *serialNumber;
146
- X509_ALGOR *signature;
147
- X509_NAME *issuer;
148
- X509_VAL *validity;
149
- X509_NAME *subject;
150
- X509_PUBKEY *key;
151
- ASN1_BIT_STRING *issuerUID; // [ 1 ] optional in v2
152
- ASN1_BIT_STRING *subjectUID; // [ 2 ] optional in v2
153
- STACK_OF(X509_EXTENSION) *extensions; // [ 3 ] optional in v3
154
- ASN1_ENCODING enc;
155
- } /* X509_CINF */;
156
-
157
134
  // This stuff is certificate "auxiliary info"
158
135
  // it contains details which are useful in certificate
159
136
  // stores and databases. When used this is tagged onto
@@ -162,31 +139,6 @@ struct x509_cinf_st {
162
139
  DECLARE_STACK_OF(DIST_POINT)
163
140
  DECLARE_STACK_OF(GENERAL_NAME)
164
141
 
165
- struct x509_st {
166
- X509_CINF *cert_info;
167
- X509_ALGOR *sig_alg;
168
- ASN1_BIT_STRING *signature;
169
- CRYPTO_refcount_t references;
170
- CRYPTO_EX_DATA ex_data;
171
- // These contain copies of various extension values
172
- long ex_pathlen;
173
- long ex_pcpathlen;
174
- unsigned long ex_flags;
175
- unsigned long ex_kusage;
176
- unsigned long ex_xkusage;
177
- unsigned long ex_nscert;
178
- ASN1_OCTET_STRING *skid;
179
- AUTHORITY_KEYID *akid;
180
- X509_POLICY_CACHE *policy_cache;
181
- STACK_OF(DIST_POINT) *crldp;
182
- STACK_OF(GENERAL_NAME) *altname;
183
- NAME_CONSTRAINTS *nc;
184
- unsigned char sha1_hash[SHA_DIGEST_LENGTH];
185
- X509_CERT_AUX *aux;
186
- CRYPTO_BUFFER *buf;
187
- CRYPTO_MUTEX lock;
188
- } /* X509 */;
189
-
190
142
  DEFINE_STACK_OF(X509)
191
143
 
192
144
  // This is used for a table of trust checking functions
@@ -254,7 +206,7 @@ DEFINE_STACK_OF(X509_TRUST)
254
206
  #define XN_FLAG_SEP_MASK (0xf << 16)
255
207
 
256
208
  #define XN_FLAG_COMPAT 0 // Traditional SSLeay: use old X509_NAME_print
257
- #define XN_FLAG_SEP_COMMA_PLUS (1 << 16) // RFC2253 ,+
209
+ #define XN_FLAG_SEP_COMMA_PLUS (1 << 16) // RFC 2253 ,+
258
210
  #define XN_FLAG_SEP_CPLUS_SPC (2 << 16) // ,+ spaced: more readable
259
211
  #define XN_FLAG_SEP_SPLUS_SPC (3 << 16) // ;+ spaced
260
212
  #define XN_FLAG_SEP_MULTILINE (4 << 16) // One line per field
@@ -273,13 +225,13 @@ DEFINE_STACK_OF(X509_TRUST)
273
225
  #define XN_FLAG_SPC_EQ (1 << 23) // Put spaces round '='
274
226
 
275
227
  // This determines if we dump fields we don't recognise:
276
- // RFC2253 requires this.
228
+ // RFC 2253 requires this.
277
229
 
278
230
  #define XN_FLAG_DUMP_UNKNOWN_FIELDS (1 << 24)
279
231
 
280
232
  #define XN_FLAG_FN_ALIGN (1 << 25) // Align field names to 20 characters
281
233
 
282
- // Complete set of RFC2253 flags
234
+ // Complete set of RFC 2253 flags
283
235
 
284
236
  #define XN_FLAG_RFC2253 \
285
237
  (ASN1_STRFLGS_RFC2253 | XN_FLAG_SEP_COMMA_PLUS | XN_FLAG_DN_REV | \
@@ -456,7 +408,7 @@ OPENSSL_EXPORT void X509_get0_uids(const X509 *x509,
456
408
  #define X509_extract_key(x) X509_get_pubkey(x)
457
409
 
458
410
  // X509_get_pathlen returns path length constraint from the basic constraints
459
- // extension in |x509|. (See RFC5280, section 4.2.1.9.) It returns -1 if the
411
+ // extension in |x509|. (See RFC 5280, section 4.2.1.9.) It returns -1 if the
460
412
  // constraint is not present, or if some extension in |x509| was invalid.
461
413
  //
462
414
  // Note that decoding an |X509| object will not check for invalid extensions. To
@@ -724,7 +676,6 @@ OPENSSL_EXPORT int X509_NAME_digest(const X509_NAME *name, const EVP_MD *md,
724
676
  // copying parts of it as a normal |d2i_X509| call would do.
725
677
  OPENSSL_EXPORT X509 *X509_parse_from_buffer(CRYPTO_BUFFER *buf);
726
678
 
727
- #ifndef OPENSSL_NO_FP_API
728
679
  OPENSSL_EXPORT X509 *d2i_X509_fp(FILE *fp, X509 **x509);
729
680
  OPENSSL_EXPORT int i2d_X509_fp(FILE *fp, X509 *x509);
730
681
  OPENSSL_EXPORT X509_CRL *d2i_X509_CRL_fp(FILE *fp, X509_CRL **crl);
@@ -758,7 +709,6 @@ OPENSSL_EXPORT int i2d_PrivateKey_fp(FILE *fp, EVP_PKEY *pkey);
758
709
  OPENSSL_EXPORT EVP_PKEY *d2i_PrivateKey_fp(FILE *fp, EVP_PKEY **a);
759
710
  OPENSSL_EXPORT int i2d_PUBKEY_fp(FILE *fp, EVP_PKEY *pkey);
760
711
  OPENSSL_EXPORT EVP_PKEY *d2i_PUBKEY_fp(FILE *fp, EVP_PKEY **a);
761
- #endif
762
712
 
763
713
  OPENSSL_EXPORT X509 *d2i_X509_bio(BIO *bp, X509 **x509);
764
714
  OPENSSL_EXPORT int i2d_X509_bio(BIO *bp, X509 *x509);
@@ -860,12 +810,30 @@ OPENSSL_EXPORT int X509_NAME_ENTRY_set(const X509_NAME_ENTRY *ne);
860
810
  OPENSSL_EXPORT int X509_NAME_get0_der(X509_NAME *nm, const unsigned char **pder,
861
811
  size_t *pderlen);
862
812
 
813
+ // X509_cmp_time compares |s| against |*t|. On success, it returns a negative
814
+ // number if |s| <= |*t| and a positive number if |s| > |*t|. On error, it
815
+ // returns zero. If |t| is NULL, it uses the current time instead of |*t|.
816
+ //
817
+ // WARNING: Unlike most comparison functions, this function returns zero on
818
+ // error, not equality.
863
819
  OPENSSL_EXPORT int X509_cmp_time(const ASN1_TIME *s, time_t *t);
820
+
821
+ // X509_cmp_current_time behaves like |X509_cmp_time| but compares |s| against
822
+ // the current time.
864
823
  OPENSSL_EXPORT int X509_cmp_current_time(const ASN1_TIME *s);
865
- OPENSSL_EXPORT ASN1_TIME *X509_time_adj(ASN1_TIME *s, long adj, time_t *t);
824
+
825
+ // X509_time_adj calls |X509_time_adj_ex| with |offset_day| equal to zero.
826
+ OPENSSL_EXPORT ASN1_TIME *X509_time_adj(ASN1_TIME *s, long offset_sec,
827
+ time_t *t);
828
+
829
+ // X509_time_adj_ex behaves like |ASN1_TIME_adj|, but adds an offset to |*t|. If
830
+ // |t| is NULL, it uses the current time instead of |*t|.
866
831
  OPENSSL_EXPORT ASN1_TIME *X509_time_adj_ex(ASN1_TIME *s, int offset_day,
867
832
  long offset_sec, time_t *t);
868
- OPENSSL_EXPORT ASN1_TIME *X509_gmtime_adj(ASN1_TIME *s, long adj);
833
+
834
+ // X509_gmtime_adj behaves like |X509_time_adj_ex| but adds |offset_sec| to the
835
+ // current time.
836
+ OPENSSL_EXPORT ASN1_TIME *X509_gmtime_adj(ASN1_TIME *s, long offset_sec);
869
837
 
870
838
  OPENSSL_EXPORT const char *X509_get_default_cert_area(void);
871
839
  OPENSSL_EXPORT const char *X509_get_default_cert_dir(void);
@@ -882,7 +850,15 @@ DECLARE_ASN1_FUNCTIONS(X509_VAL)
882
850
 
883
851
  DECLARE_ASN1_FUNCTIONS(X509_PUBKEY)
884
852
 
853
+ // X509_PUBKEY_set serializes |pkey| into a newly-allocated |X509_PUBKEY|
854
+ // structure. On success, it frees |*x|, sets |*x| to the new object, and
855
+ // returns one. Otherwise, it returns zero.
885
856
  OPENSSL_EXPORT int X509_PUBKEY_set(X509_PUBKEY **x, EVP_PKEY *pkey);
857
+
858
+ // X509_PUBKEY_get decodes the public key in |key| and returns an |EVP_PKEY| on
859
+ // success, or NULL on error. The caller must release the result with
860
+ // |EVP_PKEY_free| when done. The |EVP_PKEY| is cached in |key|, so callers must
861
+ // not mutate the result.
886
862
  OPENSSL_EXPORT EVP_PKEY *X509_PUBKEY_get(X509_PUBKEY *key);
887
863
 
888
864
  DECLARE_ASN1_FUNCTIONS(X509_SIG)
@@ -904,10 +880,10 @@ DECLARE_ASN1_FUNCTIONS(X509_NAME_ENTRY)
904
880
 
905
881
  DECLARE_ASN1_FUNCTIONS(X509_NAME)
906
882
 
883
+ // X509_NAME_set makes a copy of |name|. On success, it frees |*xn|, sets |*xn|
884
+ // to the copy, and returns one. Otherwise, it returns zero.
907
885
  OPENSSL_EXPORT int X509_NAME_set(X509_NAME **xn, X509_NAME *name);
908
886
 
909
- DECLARE_ASN1_FUNCTIONS(X509_CINF)
910
-
911
887
  DECLARE_ASN1_FUNCTIONS(X509)
912
888
  DECLARE_ASN1_FUNCTIONS(X509_CERT_AUX)
913
889
 
@@ -1111,7 +1087,7 @@ OPENSSL_EXPORT void X509_REQ_get0_signature(const X509_REQ *req,
1111
1087
  // a known NID.
1112
1088
  OPENSSL_EXPORT int X509_REQ_get_signature_nid(const X509_REQ *req);
1113
1089
 
1114
- // i2d_re_X509_REQ_tbs serializes the CertificationRequestInfo (see RFC2986)
1090
+ // i2d_re_X509_REQ_tbs serializes the CertificationRequestInfo (see RFC 2986)
1115
1091
  // portion of |req|. If |outp| is NULL, nothing is written. Otherwise, if
1116
1092
  // |*outp| is not NULL, the result is written to |*outp|, which must have enough
1117
1093
  // space available, and |*outp| is advanced just past the output. If |outp| is
@@ -1138,7 +1114,7 @@ OPENSSL_EXPORT EVP_PKEY *X509_REQ_get_pubkey(X509_REQ *req);
1138
1114
 
1139
1115
  // X509_REQ_extension_nid returns one if |nid| is a supported CSR attribute type
1140
1116
  // for carrying extensions and zero otherwise. The supported types are
1141
- // |NID_ext_req| (pkcs-9-at-extensionRequest from RFC2985) and |NID_ms_ext_req|
1117
+ // |NID_ext_req| (pkcs-9-at-extensionRequest from RFC 2985) and |NID_ms_ext_req|
1142
1118
  // (a Microsoft szOID_CERT_EXTENSIONS variant).
1143
1119
  OPENSSL_EXPORT int X509_REQ_extension_nid(int nid);
1144
1120
 
@@ -1146,7 +1122,7 @@ OPENSSL_EXPORT int X509_REQ_extension_nid(int nid);
1146
1122
  // returns a newly-allocated |STACK_OF(X509_EXTENSION)| containing the result.
1147
1123
  // It returns NULL on error, or if |req| did not request extensions.
1148
1124
  //
1149
- // This function supports both pkcs-9-at-extensionRequest from RFC2985 and the
1125
+ // This function supports both pkcs-9-at-extensionRequest from RFC 2985 and the
1150
1126
  // Microsoft szOID_CERT_EXTENSIONS variant.
1151
1127
  OPENSSL_EXPORT STACK_OF(X509_EXTENSION) *X509_REQ_get_extensions(X509_REQ *req);
1152
1128
 
@@ -1366,7 +1342,6 @@ OPENSSL_EXPORT unsigned long X509_NAME_hash_old(X509_NAME *x);
1366
1342
 
1367
1343
  OPENSSL_EXPORT int X509_CRL_cmp(const X509_CRL *a, const X509_CRL *b);
1368
1344
  OPENSSL_EXPORT int X509_CRL_match(const X509_CRL *a, const X509_CRL *b);
1369
- #ifndef OPENSSL_NO_FP_API
1370
1345
  OPENSSL_EXPORT int X509_print_ex_fp(FILE *bp, X509 *x, unsigned long nmflag,
1371
1346
  unsigned long cflag);
1372
1347
  OPENSSL_EXPORT int X509_print_fp(FILE *bp, X509 *x);
@@ -1374,7 +1349,6 @@ OPENSSL_EXPORT int X509_CRL_print_fp(FILE *bp, X509_CRL *x);
1374
1349
  OPENSSL_EXPORT int X509_REQ_print_fp(FILE *bp, X509_REQ *req);
1375
1350
  OPENSSL_EXPORT int X509_NAME_print_ex_fp(FILE *fp, const X509_NAME *nm,
1376
1351
  int indent, unsigned long flags);
1377
- #endif
1378
1352
 
1379
1353
  OPENSSL_EXPORT int X509_NAME_print(BIO *bp, const X509_NAME *name, int obase);
1380
1354
  OPENSSL_EXPORT int X509_NAME_print_ex(BIO *out, const X509_NAME *nm, int indent,
@@ -1913,12 +1887,16 @@ OPENSSL_EXPORT char *X509_TRUST_get0_name(const X509_TRUST *xp);
1913
1887
  OPENSSL_EXPORT int X509_TRUST_get_trust(const X509_TRUST *xp);
1914
1888
 
1915
1889
 
1916
- typedef struct rsa_pss_params_st {
1890
+ struct rsa_pss_params_st {
1917
1891
  X509_ALGOR *hashAlgorithm;
1918
1892
  X509_ALGOR *maskGenAlgorithm;
1919
1893
  ASN1_INTEGER *saltLength;
1920
1894
  ASN1_INTEGER *trailerField;
1921
- } RSA_PSS_PARAMS;
1895
+ // OpenSSL caches the MGF hash on |RSA_PSS_PARAMS| in some cases. None of the
1896
+ // cases apply to BoringSSL, so this is always NULL, but Node expects the
1897
+ // field to be present.
1898
+ X509_ALGOR *maskHash;
1899
+ } /* RSA_PSS_PARAMS */;
1922
1900
 
1923
1901
  DECLARE_ASN1_FUNCTIONS(RSA_PSS_PARAMS)
1924
1902
 
@@ -1958,10 +1936,6 @@ BORINGSSL_MAKE_UP_REF(X509_STORE, X509_STORE_up_ref)
1958
1936
  BORINGSSL_MAKE_DELETER(X509_STORE_CTX, X509_STORE_CTX_free)
1959
1937
  BORINGSSL_MAKE_DELETER(X509_VERIFY_PARAM, X509_VERIFY_PARAM_free)
1960
1938
 
1961
- using ScopedX509_STORE_CTX =
1962
- internal::StackAllocated<X509_STORE_CTX, void, X509_STORE_CTX_zero,
1963
- X509_STORE_CTX_cleanup>;
1964
-
1965
1939
  BSSL_NAMESPACE_END
1966
1940
 
1967
1941
  } // extern C++
@@ -99,39 +99,8 @@ certificate chain.
99
99
  #define X509_LU_CRL 2
100
100
  #define X509_LU_PKEY 3
101
101
 
102
- typedef struct x509_object_st {
103
- // one of the above types
104
- int type;
105
- union {
106
- char *ptr;
107
- X509 *x509;
108
- X509_CRL *crl;
109
- EVP_PKEY *pkey;
110
- } data;
111
- } X509_OBJECT;
112
-
113
102
  DEFINE_STACK_OF(X509_LOOKUP)
114
103
  DEFINE_STACK_OF(X509_OBJECT)
115
-
116
- // This is a static that defines the function interface
117
- typedef struct x509_lookup_method_st {
118
- const char *name;
119
- int (*new_item)(X509_LOOKUP *ctx);
120
- void (*free)(X509_LOOKUP *ctx);
121
- int (*init)(X509_LOOKUP *ctx);
122
- int (*shutdown)(X509_LOOKUP *ctx);
123
- int (*ctrl)(X509_LOOKUP *ctx, int cmd, const char *argc, long argl,
124
- char **ret);
125
- int (*get_by_subject)(X509_LOOKUP *ctx, int type, X509_NAME *name,
126
- X509_OBJECT *ret);
127
- int (*get_by_issuer_serial)(X509_LOOKUP *ctx, int type, X509_NAME *name,
128
- ASN1_INTEGER *serial, X509_OBJECT *ret);
129
- int (*get_by_fingerprint)(X509_LOOKUP *ctx, int type, unsigned char *bytes,
130
- int len, X509_OBJECT *ret);
131
- int (*get_by_alias)(X509_LOOKUP *ctx, int type, char *str, int len,
132
- X509_OBJECT *ret);
133
- } X509_LOOKUP_METHOD;
134
-
135
104
  DEFINE_STACK_OF(X509_VERIFY_PARAM)
136
105
 
137
106
  typedef int (*X509_STORE_CTX_verify_cb)(int, X509_STORE_CTX *);
@@ -153,103 +122,8 @@ typedef STACK_OF(X509_CRL) *(*X509_STORE_CTX_lookup_crls_fn)(
153
122
  X509_STORE_CTX *ctx, X509_NAME *nm);
154
123
  typedef int (*X509_STORE_CTX_cleanup_fn)(X509_STORE_CTX *ctx);
155
124
 
156
- // This is used to hold everything. It is used for all certificate
157
- // validation. Once we have a certificate chain, the 'verify'
158
- // function is then called to actually check the cert chain.
159
- struct x509_store_st {
160
- // The following is a cache of trusted certs
161
- int cache; // if true, stash any hits
162
- STACK_OF(X509_OBJECT) *objs; // Cache of all objects
163
- CRYPTO_MUTEX objs_lock;
164
- STACK_OF(X509) *additional_untrusted;
165
-
166
- // These are external lookup methods
167
- STACK_OF(X509_LOOKUP) *get_cert_methods;
168
-
169
- X509_VERIFY_PARAM *param;
170
-
171
- // Callbacks for various operations
172
- X509_STORE_CTX_verify_fn verify; // called to verify a certificate
173
- X509_STORE_CTX_verify_cb verify_cb; // error callback
174
- X509_STORE_CTX_get_issuer_fn get_issuer; // get issuers cert from ctx
175
- X509_STORE_CTX_check_issued_fn check_issued; // check issued
176
- X509_STORE_CTX_check_revocation_fn
177
- check_revocation; // Check revocation status of chain
178
- X509_STORE_CTX_get_crl_fn get_crl; // retrieve CRL
179
- X509_STORE_CTX_check_crl_fn check_crl; // Check CRL validity
180
- X509_STORE_CTX_cert_crl_fn cert_crl; // Check certificate against CRL
181
- X509_STORE_CTX_lookup_certs_fn lookup_certs;
182
- X509_STORE_CTX_lookup_crls_fn lookup_crls;
183
- X509_STORE_CTX_cleanup_fn cleanup;
184
-
185
- CRYPTO_refcount_t references;
186
- } /* X509_STORE */;
187
-
188
125
  OPENSSL_EXPORT int X509_STORE_set_depth(X509_STORE *store, int depth);
189
126
 
190
- // This is the functions plus an instance of the local variables.
191
- struct x509_lookup_st {
192
- int init; // have we been started
193
- int skip; // don't use us.
194
- X509_LOOKUP_METHOD *method; // the functions
195
- char *method_data; // method data
196
-
197
- X509_STORE *store_ctx; // who owns us
198
- } /* X509_LOOKUP */;
199
-
200
- // This is a used when verifying cert chains. Since the
201
- // gathering of the cert chain can take some time (and have to be
202
- // 'retried', this needs to be kept and passed around.
203
- struct x509_store_ctx_st // X509_STORE_CTX
204
- {
205
- X509_STORE *ctx;
206
-
207
- // The following are set by the caller
208
- X509 *cert; // The cert to check
209
- STACK_OF(X509) *untrusted; // chain of X509s - untrusted - passed in
210
- STACK_OF(X509_CRL) *crls; // set of CRLs passed in
211
-
212
- X509_VERIFY_PARAM *param;
213
- void *other_ctx; // Other info for use with get_issuer()
214
-
215
- // Callbacks for various operations
216
- X509_STORE_CTX_verify_fn verify; // called to verify a certificate
217
- X509_STORE_CTX_verify_cb verify_cb; // error callback
218
- X509_STORE_CTX_get_issuer_fn get_issuer; // get issuers cert from ctx
219
- X509_STORE_CTX_check_issued_fn check_issued; // check issued
220
- X509_STORE_CTX_check_revocation_fn
221
- check_revocation; // Check revocation status of chain
222
- X509_STORE_CTX_get_crl_fn get_crl; // retrieve CRL
223
- X509_STORE_CTX_check_crl_fn check_crl; // Check CRL validity
224
- X509_STORE_CTX_cert_crl_fn cert_crl; // Check certificate against CRL
225
- X509_STORE_CTX_check_policy_fn check_policy;
226
- X509_STORE_CTX_lookup_certs_fn lookup_certs;
227
- X509_STORE_CTX_lookup_crls_fn lookup_crls;
228
- X509_STORE_CTX_cleanup_fn cleanup;
229
-
230
- // The following is built up
231
- int valid; // if 0, rebuild chain
232
- int last_untrusted; // index of last untrusted cert
233
- STACK_OF(X509) *chain; // chain of X509s - built up and trusted
234
- X509_POLICY_TREE *tree; // Valid policy tree
235
-
236
- int explicit_policy; // Require explicit policy value
237
-
238
- // When something goes wrong, this is why
239
- int error_depth;
240
- int error;
241
- X509 *current_cert;
242
- X509 *current_issuer; // cert currently being tested as valid issuer
243
- X509_CRL *current_crl; // current CRL
244
-
245
- int current_crl_score; // score of current CRL
246
- unsigned int current_reasons; // Reason mask
247
-
248
- X509_STORE_CTX *parent; // For CRL path validation: parent context
249
-
250
- CRYPTO_EX_DATA ex_data;
251
- } /* X509_STORE_CTX */;
252
-
253
127
  OPENSSL_EXPORT void X509_STORE_CTX_set_depth(X509_STORE_CTX *ctx, int depth);
254
128
 
255
129
  #define X509_STORE_CTX_set_app_data(ctx, data) \
@@ -432,11 +306,6 @@ OPENSSL_EXPORT int X509_STORE_set_trust(X509_STORE *ctx, int trust);
432
306
  OPENSSL_EXPORT int X509_STORE_set1_param(X509_STORE *ctx,
433
307
  X509_VERIFY_PARAM *pm);
434
308
  OPENSSL_EXPORT X509_VERIFY_PARAM *X509_STORE_get0_param(X509_STORE *ctx);
435
- // X509_STORE_set0_additional_untrusted sets a stack of additional, untrusted
436
- // certificates that are available for chain building. This function does not
437
- // take ownership of the stack.
438
- OPENSSL_EXPORT void X509_STORE_set0_additional_untrusted(
439
- X509_STORE *ctx, STACK_OF(X509) *untrusted);
440
309
 
441
310
  OPENSSL_EXPORT void X509_STORE_set_verify(X509_STORE *ctx,
442
311
  X509_STORE_CTX_verify_fn verify);
@@ -154,8 +154,6 @@ DEFINE_STACK_OF(X509V3_EXT_METHOD)
154
154
  #define X509V3_EXT_CTX_DEP 0x2
155
155
  #define X509V3_EXT_MULTILINE 0x4
156
156
 
157
- typedef BIT_STRING_BITNAME ENUMERATED_NAMES;
158
-
159
157
  struct BASIC_CONSTRAINTS_st {
160
158
  int ca;
161
159
  ASN1_INTEGER *pathlen;
@@ -485,12 +483,30 @@ OPENSSL_EXPORT STACK_OF(CONF_VALUE) *i2v_ASN1_BIT_STRING(
485
483
  X509V3_EXT_METHOD *method, ASN1_BIT_STRING *bits,
486
484
  STACK_OF(CONF_VALUE) *extlist);
487
485
 
486
+ // i2v_GENERAL_NAME serializes |gen| as a |CONF_VALUE|. If |ret| is non-NULL, it
487
+ // appends the value to |ret| and returns |ret| on success or NULL on error. If
488
+ // it returns NULL, the caller is still responsible for freeing |ret|. If |ret|
489
+ // is NULL, it returns a newly-allocated |STACK_OF(CONF_VALUE)| containing the
490
+ // result. |method| is ignored.
491
+ //
492
+ // Do not use this function. This is an internal implementation detail of the
493
+ // human-readable print functions. If extracting a SAN list from a certificate,
494
+ // look at |gen| directly.
488
495
  OPENSSL_EXPORT STACK_OF(CONF_VALUE) *i2v_GENERAL_NAME(
489
496
  X509V3_EXT_METHOD *method, GENERAL_NAME *gen, STACK_OF(CONF_VALUE) *ret);
490
497
  OPENSSL_EXPORT int GENERAL_NAME_print(BIO *out, GENERAL_NAME *gen);
491
498
 
492
499
  DECLARE_ASN1_FUNCTIONS(GENERAL_NAMES)
493
500
 
501
+ // i2v_GENERAL_NAMES serializes |gen| as a list of |CONF_VALUE|s. If |ret| is
502
+ // non-NULL, it appends the values to |ret| and returns |ret| on success or NULL
503
+ // on error. If it returns NULL, the caller is still responsible for freeing
504
+ // |ret|. If |ret| is NULL, it returns a newly-allocated |STACK_OF(CONF_VALUE)|
505
+ // containing the results. |method| is ignored.
506
+ //
507
+ // Do not use this function. This is an internal implementation detail of the
508
+ // human-readable print functions. If extracting a SAN list from a certificate,
509
+ // look at |gen| directly.
494
510
  OPENSSL_EXPORT STACK_OF(CONF_VALUE) *i2v_GENERAL_NAMES(
495
511
  X509V3_EXT_METHOD *method, GENERAL_NAMES *gen,
496
512
  STACK_OF(CONF_VALUE) *extlist);
@@ -604,15 +620,35 @@ OPENSSL_EXPORT void X509V3_section_free(X509V3_CTX *ctx,
604
620
  OPENSSL_EXPORT void X509V3_set_ctx(X509V3_CTX *ctx, X509 *issuer, X509 *subject,
605
621
  X509_REQ *req, X509_CRL *crl, int flags);
606
622
 
623
+ // X509V3_add_value appends a |CONF_VALUE| containing |name| and |value| to
624
+ // |*extlist|. It returns one on success and zero on error. If |*extlist| is
625
+ // NULL, it sets |*extlist| to a newly-allocated |STACK_OF(CONF_VALUE)|
626
+ // containing the result. Either |name| or |value| may be NULL to omit the
627
+ // field.
628
+ //
629
+ // On failure, if |*extlist| was NULL, |*extlist| will remain NULL when the
630
+ // function returns.
607
631
  OPENSSL_EXPORT int X509V3_add_value(const char *name, const char *value,
608
632
  STACK_OF(CONF_VALUE) **extlist);
633
+
634
+ // X509V3_add_value_uchar behaves like |X509V3_add_value| but takes an
635
+ // |unsigned char| pointer.
609
636
  OPENSSL_EXPORT int X509V3_add_value_uchar(const char *name,
610
637
  const unsigned char *value,
611
638
  STACK_OF(CONF_VALUE) **extlist);
639
+
640
+ // X509V3_add_value_bool behaves like |X509V3_add_value| but stores the value
641
+ // "TRUE" if |asn1_bool| is non-zero and "FALSE" otherwise.
612
642
  OPENSSL_EXPORT int X509V3_add_value_bool(const char *name, int asn1_bool,
613
643
  STACK_OF(CONF_VALUE) **extlist);
614
- OPENSSL_EXPORT int X509V3_add_value_int(const char *name, ASN1_INTEGER *aint,
644
+
645
+ // X509V3_add_value_bool behaves like |X509V3_add_value| but stores a string
646
+ // representation of |aint|. Note this string representation may be decimal or
647
+ // hexadecimal, depending on the size of |aint|.
648
+ OPENSSL_EXPORT int X509V3_add_value_int(const char *name,
649
+ const ASN1_INTEGER *aint,
615
650
  STACK_OF(CONF_VALUE) **extlist);
651
+
616
652
  OPENSSL_EXPORT char *i2s_ASN1_INTEGER(X509V3_EXT_METHOD *meth,
617
653
  const ASN1_INTEGER *aint);
618
654
  OPENSSL_EXPORT ASN1_INTEGER *s2i_ASN1_INTEGER(X509V3_EXT_METHOD *meth,
@@ -659,7 +695,7 @@ OPENSSL_EXPORT void *X509V3_EXT_d2i(const X509_EXTENSION *ext);
659
695
  // extension, or -1 if not found. If |out_idx| is non-NULL, duplicate extensions
660
696
  // are not treated as an error. Callers, however, should not rely on this
661
697
  // behavior as it may be removed in the future. Duplicate extensions are
662
- // forbidden in RFC5280.
698
+ // forbidden in RFC 5280.
663
699
  //
664
700
  // WARNING: This function is difficult to use correctly. Callers should pass a
665
701
  // non-NULL |out_critical| and check both the return value and |*out_critical|
@@ -789,7 +825,7 @@ OPENSSL_EXPORT uint32_t X509_get_key_usage(X509 *x);
789
825
  OPENSSL_EXPORT uint32_t X509_get_extended_key_usage(X509 *x);
790
826
 
791
827
  // X509_get0_subject_key_id returns |x509|'s subject key identifier, if present.
792
- // (See RFC5280, section 4.2.1.2.) It returns NULL if the extension is not
828
+ // (See RFC 5280, section 4.2.1.2.) It returns NULL if the extension is not
793
829
  // present or if some extension in |x509| was invalid.
794
830
  //
795
831
  // Note that decoding an |X509| object will not check for invalid extensions. To
@@ -798,7 +834,7 @@ OPENSSL_EXPORT uint32_t X509_get_extended_key_usage(X509 *x);
798
834
  OPENSSL_EXPORT const ASN1_OCTET_STRING *X509_get0_subject_key_id(X509 *x509);
799
835
 
800
836
  // X509_get0_authority_key_id returns keyIdentifier of |x509|'s authority key
801
- // identifier, if the extension and field are present. (See RFC5280,
837
+ // identifier, if the extension and field are present. (See RFC 5280,
802
838
  // section 4.2.1.1.) It returns NULL if the extension is not present, if it is
803
839
  // present but lacks a keyIdentifier field, or if some extension in |x509| was
804
840
  // invalid.
@@ -810,7 +846,7 @@ OPENSSL_EXPORT const ASN1_OCTET_STRING *X509_get0_authority_key_id(X509 *x509);
810
846
 
811
847
  // X509_get0_authority_issuer returns the authorityCertIssuer of |x509|'s
812
848
  // authority key identifier, if the extension and field are present. (See
813
- // RFC5280, section 4.2.1.1.) It returns NULL if the extension is not present,
849
+ // RFC 5280, section 4.2.1.1.) It returns NULL if the extension is not present,
814
850
  // if it is present but lacks a authorityCertIssuer field, or if some extension
815
851
  // in |x509| was invalid.
816
852
  //
@@ -821,7 +857,7 @@ OPENSSL_EXPORT const GENERAL_NAMES *X509_get0_authority_issuer(X509 *x509);
821
857
 
822
858
  // X509_get0_authority_serial returns the authorityCertSerialNumber of |x509|'s
823
859
  // authority key identifier, if the extension and field are present. (See
824
- // RFC5280, section 4.2.1.1.) It returns NULL if the extension is not present,
860
+ // RFC 5280, section 4.2.1.1.) It returns NULL if the extension is not present,
825
861
  // if it is present but lacks a authorityCertSerialNumber field, or if some
826
862
  // extension in |x509| was invalid.
827
863
  //
@@ -902,8 +938,11 @@ BSSL_NAMESPACE_BEGIN
902
938
  BORINGSSL_MAKE_DELETER(ACCESS_DESCRIPTION, ACCESS_DESCRIPTION_free)
903
939
  BORINGSSL_MAKE_DELETER(AUTHORITY_KEYID, AUTHORITY_KEYID_free)
904
940
  BORINGSSL_MAKE_DELETER(BASIC_CONSTRAINTS, BASIC_CONSTRAINTS_free)
941
+ // TODO(davidben): Move this to conf.h and rename to CONF_VALUE_free.
942
+ BORINGSSL_MAKE_DELETER(CONF_VALUE, X509V3_conf_free)
905
943
  BORINGSSL_MAKE_DELETER(DIST_POINT, DIST_POINT_free)
906
944
  BORINGSSL_MAKE_DELETER(GENERAL_NAME, GENERAL_NAME_free)
945
+ BORINGSSL_MAKE_DELETER(GENERAL_SUBTREE, GENERAL_SUBTREE_free)
907
946
  BORINGSSL_MAKE_DELETER(NAME_CONSTRAINTS, NAME_CONSTRAINTS_free)
908
947
  BORINGSSL_MAKE_DELETER(POLICY_MAPPING, POLICY_MAPPING_free)
909
948
  BORINGSSL_MAKE_DELETER(POLICYINFO, POLICYINFO_free)
@@ -976,5 +1015,6 @@ BSSL_NAMESPACE_END
976
1015
  #define X509V3_R_UNSUPPORTED_OPTION 160
977
1016
  #define X509V3_R_UNSUPPORTED_TYPE 161
978
1017
  #define X509V3_R_USER_TOO_LONG 162
1018
+ #define X509V3_R_INVALID_VALUE 163
979
1019
 
980
1020
  #endif