grpc 1.32.0 → 1.33.0.pre1

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 (214) hide show
  1. checksums.yaml +4 -4
  2. data/Makefile +175 -376
  3. data/include/grpc/grpc.h +0 -5
  4. data/include/grpc/grpc_security.h +16 -0
  5. data/include/grpc/impl/codegen/grpc_types.h +0 -5
  6. data/src/core/ext/filters/client_channel/client_channel.cc +204 -170
  7. data/src/core/ext/filters/client_channel/config_selector.cc +0 -4
  8. data/src/core/ext/filters/client_channel/config_selector.h +34 -5
  9. data/src/core/ext/filters/client_channel/lb_policy.h +1 -1
  10. data/src/core/ext/filters/client_channel/lb_policy/address_filtering.cc +48 -35
  11. data/src/core/ext/filters/client_channel/lb_policy/address_filtering.h +7 -5
  12. data/src/core/ext/filters/client_channel/lb_policy/child_policy_handler.cc +3 -2
  13. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc +106 -106
  14. data/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc +2 -2
  15. data/src/core/ext/filters/client_channel/lb_policy/priority/priority.cc +3 -3
  16. data/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc +3 -3
  17. data/src/core/ext/filters/client_channel/lb_policy/subchannel_list.h +9 -32
  18. data/src/core/ext/filters/client_channel/lb_policy/weighted_target/weighted_target.cc +3 -3
  19. data/src/core/ext/filters/client_channel/lb_policy/xds/cds.cc +198 -126
  20. data/src/core/ext/filters/client_channel/lb_policy/xds/eds.cc +439 -249
  21. data/src/core/ext/filters/client_channel/lb_policy/xds/eds_drop.cc +571 -0
  22. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_manager.cc +727 -0
  23. data/src/core/ext/filters/client_channel/lb_policy_registry.cc +8 -1
  24. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc +1 -1
  25. data/src/core/ext/filters/client_channel/resolver/xds/xds_resolver.cc +553 -358
  26. data/src/core/ext/filters/client_channel/resolver/xds/xds_resolver.h +28 -0
  27. data/src/core/ext/filters/client_channel/resolver_result_parsing.cc +8 -39
  28. data/src/core/ext/filters/client_channel/resolver_result_parsing.h +4 -2
  29. data/src/core/ext/filters/client_channel/resolving_lb_policy.cc +44 -43
  30. data/src/core/ext/filters/client_channel/resolving_lb_policy.h +5 -9
  31. data/src/core/ext/filters/client_channel/server_address.cc +80 -0
  32. data/src/core/ext/filters/client_channel/server_address.h +25 -36
  33. data/src/core/ext/filters/client_channel/service_config.cc +16 -13
  34. data/src/core/ext/filters/client_channel/service_config.h +7 -4
  35. data/src/core/ext/filters/client_channel/service_config_channel_arg_filter.cc +2 -2
  36. data/src/core/ext/filters/client_channel/service_config_parser.cc +8 -6
  37. data/src/core/ext/filters/client_channel/service_config_parser.h +8 -5
  38. data/src/core/ext/filters/client_channel/subchannel_interface.h +44 -0
  39. data/src/core/ext/filters/message_size/message_size_filter.cc +2 -1
  40. data/src/core/ext/filters/message_size/message_size_filter.h +2 -1
  41. data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +17 -10
  42. data/src/core/ext/transport/chttp2/transport/flow_control.cc +10 -2
  43. data/src/core/ext/transport/chttp2/transport/flow_control.h +10 -0
  44. data/src/core/ext/transport/chttp2/transport/internal.h +5 -0
  45. data/src/core/ext/transport/chttp2/transport/parsing.cc +16 -2
  46. data/src/core/ext/upb-generated/envoy/config/accesslog/v3/accesslog.upb.c +29 -9
  47. data/src/core/ext/upb-generated/envoy/config/accesslog/v3/accesslog.upb.h +66 -0
  48. data/src/core/ext/upb-generated/envoy/config/cluster/v3/cluster.upb.c +123 -45
  49. data/src/core/ext/upb-generated/envoy/config/cluster/v3/cluster.upb.h +310 -53
  50. data/src/core/ext/upb-generated/envoy/config/core/v3/address.upb.c +17 -5
  51. data/src/core/ext/upb-generated/envoy/config/core/v3/address.upb.h +45 -0
  52. data/src/core/ext/upb-generated/envoy/config/core/v3/base.upb.c +1 -0
  53. data/src/core/ext/upb-generated/envoy/config/core/v3/config_source.upb.c +16 -9
  54. data/src/core/ext/upb-generated/envoy/config/core/v3/config_source.upb.h +38 -15
  55. data/src/core/ext/upb-generated/envoy/config/core/v3/extension.upb.c +53 -0
  56. data/src/core/ext/upb-generated/envoy/config/core/v3/extension.upb.h +133 -0
  57. data/src/core/ext/upb-generated/envoy/config/core/v3/grpc_service.upb.c +54 -8
  58. data/src/core/ext/upb-generated/envoy/config/core/v3/grpc_service.upb.h +123 -5
  59. data/src/core/ext/upb-generated/envoy/config/core/v3/protocol.upb.c +40 -16
  60. data/src/core/ext/upb-generated/envoy/config/core/v3/protocol.upb.h +114 -5
  61. data/src/core/ext/upb-generated/envoy/config/core/v3/substitution_format_string.upb.c +36 -0
  62. data/src/core/ext/upb-generated/envoy/config/core/v3/substitution_format_string.upb.h +85 -0
  63. data/src/core/ext/upb-generated/envoy/config/listener/v3/listener.upb.c +36 -16
  64. data/src/core/ext/upb-generated/envoy/config/listener/v3/listener.upb.h +86 -20
  65. data/src/core/ext/upb-generated/envoy/config/listener/v3/listener_components.upb.c +23 -6
  66. data/src/core/ext/upb-generated/envoy/config/listener/v3/listener_components.upb.h +54 -5
  67. data/src/core/ext/upb-generated/envoy/config/rbac/v3/rbac.upb.c +10 -6
  68. data/src/core/ext/upb-generated/envoy/config/rbac/v3/rbac.upb.h +28 -11
  69. data/src/core/ext/upb-generated/envoy/config/route/v3/route_components.upb.c +184 -57
  70. data/src/core/ext/upb-generated/envoy/config/route/v3/route_components.upb.h +504 -69
  71. data/src/core/ext/upb-generated/envoy/config/route/v3/scoped_route.upb.c +6 -5
  72. data/src/core/ext/upb-generated/envoy/config/route/v3/scoped_route.upb.h +11 -7
  73. data/src/core/ext/upb-generated/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upb.c +78 -26
  74. data/src/core/ext/upb-generated/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upb.h +236 -25
  75. data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/common.upb.c +8 -9
  76. data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/common.upb.h +19 -33
  77. data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/secret.upb.c +7 -3
  78. data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/secret.upb.h +16 -0
  79. data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/tls.upb.c +65 -23
  80. data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/tls.upb.h +229 -47
  81. data/src/core/ext/upb-generated/envoy/service/discovery/v3/discovery.upb.c +20 -10
  82. data/src/core/ext/upb-generated/envoy/service/discovery/v3/discovery.upb.h +67 -4
  83. data/src/core/ext/upb-generated/envoy/type/matcher/v3/string.upb.c +3 -2
  84. data/src/core/ext/upb-generated/envoy/type/matcher/v3/string.upb.h +6 -0
  85. data/src/core/ext/upb-generated/google/api/expr/v1alpha1/checked.upb.c +242 -0
  86. data/src/core/ext/upb-generated/google/api/expr/v1alpha1/checked.upb.h +753 -0
  87. data/src/core/ext/upb-generated/udpa/annotations/security.upb.c +31 -0
  88. data/src/core/ext/upb-generated/udpa/annotations/security.upb.h +57 -0
  89. data/src/core/ext/upb-generated/udpa/core/v1/authority.upb.c +28 -0
  90. data/src/core/ext/upb-generated/udpa/core/v1/authority.upb.h +53 -0
  91. data/src/core/ext/upb-generated/udpa/core/v1/collection_entry.upb.c +52 -0
  92. data/src/core/ext/upb-generated/udpa/core/v1/collection_entry.upb.h +129 -0
  93. data/src/core/ext/upb-generated/udpa/core/v1/context_params.upb.c +42 -0
  94. data/src/core/ext/upb-generated/udpa/core/v1/context_params.upb.h +77 -0
  95. data/src/core/ext/upb-generated/udpa/core/v1/resource.upb.c +36 -0
  96. data/src/core/ext/upb-generated/udpa/core/v1/resource.upb.h +85 -0
  97. data/src/core/ext/upb-generated/udpa/core/v1/resource_locator.upb.c +54 -0
  98. data/src/core/ext/upb-generated/udpa/core/v1/resource_locator.upb.h +160 -0
  99. data/src/core/ext/upb-generated/udpa/core/v1/resource_name.upb.c +36 -0
  100. data/src/core/ext/upb-generated/udpa/core/v1/resource_name.upb.h +84 -0
  101. data/src/core/ext/xds/certificate_provider_factory.h +59 -0
  102. data/src/core/ext/xds/certificate_provider_registry.cc +103 -0
  103. data/src/core/ext/xds/certificate_provider_registry.h +57 -0
  104. data/src/core/ext/xds/certificate_provider_store.h +50 -0
  105. data/src/core/ext/xds/google_mesh_ca_certificate_provider_factory.cc +377 -0
  106. data/src/core/ext/xds/google_mesh_ca_certificate_provider_factory.h +102 -0
  107. data/src/core/ext/xds/xds_api.cc +301 -93
  108. data/src/core/ext/xds/xds_api.h +129 -92
  109. data/src/core/ext/xds/xds_channel_args.h +6 -3
  110. data/src/core/ext/xds/xds_client.cc +498 -410
  111. data/src/core/ext/xds/xds_client.h +105 -51
  112. data/src/core/ext/xds/xds_client_stats.cc +18 -12
  113. data/src/core/ext/xds/xds_client_stats.h +33 -5
  114. data/src/core/lib/channel/channel_args.h +0 -1
  115. data/src/core/lib/channel/channelz.cc +10 -45
  116. data/src/core/lib/channel/channelz.h +11 -19
  117. data/src/core/lib/channel/channelz_registry.cc +12 -11
  118. data/src/core/lib/channel/channelz_registry.h +3 -0
  119. data/src/core/lib/gpr/time_precise.cc +2 -0
  120. data/src/core/lib/gpr/time_precise.h +6 -2
  121. data/src/core/lib/gprpp/dual_ref_counted.h +336 -0
  122. data/src/core/lib/gprpp/ref_counted.h +51 -22
  123. data/src/core/lib/gprpp/ref_counted_ptr.h +153 -0
  124. data/src/core/lib/iomgr/endpoint_cfstream.cc +9 -5
  125. data/src/core/lib/iomgr/exec_ctx.h +10 -8
  126. data/src/core/lib/json/json_util.cc +58 -0
  127. data/src/core/lib/json/json_util.h +37 -0
  128. data/src/core/lib/security/certificate_provider.h +60 -0
  129. data/src/core/lib/security/credentials/tls/grpc_tls_certificate_distributor.cc +321 -0
  130. data/src/core/lib/security/credentials/tls/grpc_tls_certificate_distributor.h +214 -0
  131. data/src/core/lib/security/credentials/xds/xds_credentials.cc +45 -0
  132. data/src/core/lib/security/credentials/xds/xds_credentials.h +51 -0
  133. data/src/core/lib/security/security_connector/fake/fake_security_connector.cc +6 -10
  134. data/src/core/lib/security/security_connector/ssl_utils.h +5 -0
  135. data/src/core/lib/surface/channel.cc +9 -31
  136. data/src/core/lib/surface/channel.h +6 -1
  137. data/src/core/lib/surface/init.cc +26 -9
  138. data/src/core/lib/surface/version.cc +2 -2
  139. data/src/core/lib/transport/bdp_estimator.h +2 -1
  140. data/src/core/lib/transport/connectivity_state.h +2 -2
  141. data/src/core/lib/transport/metadata.cc +11 -1
  142. data/src/core/plugin_registry/grpc_plugin_registry.cc +35 -20
  143. data/src/core/tsi/ssl_transport_security.cc +2 -2
  144. data/src/ruby/ext/grpc/rb_grpc_imports.generated.c +2 -2
  145. data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +3 -3
  146. data/src/ruby/lib/grpc/version.rb +1 -1
  147. data/third_party/boringssl-with-bazel/err_data.c +465 -463
  148. data/third_party/boringssl-with-bazel/src/crypto/asn1/asn1_lib.c +0 -6
  149. data/third_party/boringssl-with-bazel/src/crypto/dsa/dsa.c +9 -43
  150. data/third_party/boringssl-with-bazel/src/crypto/dsa/dsa_asn1.c +55 -4
  151. data/third_party/boringssl-with-bazel/src/crypto/dsa/internal.h +34 -0
  152. data/third_party/boringssl-with-bazel/src/crypto/evp/evp.c +4 -0
  153. data/third_party/boringssl-with-bazel/src/crypto/evp/p_dsa_asn1.c +6 -2
  154. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/digest/digest.c +2 -0
  155. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rsa/internal.h +4 -0
  156. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rsa/rsa.c +30 -10
  157. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rsa/rsa_impl.c +10 -15
  158. data/third_party/boringssl-with-bazel/src/crypto/hpke/hpke.c +98 -11
  159. data/third_party/boringssl-with-bazel/src/crypto/hpke/internal.h +51 -6
  160. data/third_party/boringssl-with-bazel/src/crypto/trust_token/internal.h +44 -2
  161. data/third_party/boringssl-with-bazel/src/crypto/trust_token/pmbtoken.c +221 -49
  162. data/third_party/boringssl-with-bazel/src/crypto/trust_token/trust_token.c +64 -20
  163. data/third_party/boringssl-with-bazel/src/crypto/x509/a_strex.c +3 -3
  164. data/third_party/boringssl-with-bazel/src/crypto/x509/algorithm.c +0 -8
  165. data/third_party/boringssl-with-bazel/src/crypto/x509/t_crl.c +3 -3
  166. data/third_party/boringssl-with-bazel/src/crypto/x509/t_x509.c +1 -1
  167. data/third_party/boringssl-with-bazel/src/crypto/x509/x509_cmp.c +7 -2
  168. data/third_party/boringssl-with-bazel/src/crypto/x509/x509_ext.c +21 -18
  169. data/third_party/boringssl-with-bazel/src/crypto/x509/x509_obj.c +1 -1
  170. data/third_party/boringssl-with-bazel/src/crypto/x509/x509_set.c +24 -3
  171. data/third_party/boringssl-with-bazel/src/crypto/x509/x509_trs.c +3 -3
  172. data/third_party/boringssl-with-bazel/src/crypto/x509/x509_txt.c +67 -67
  173. data/third_party/boringssl-with-bazel/src/crypto/x509/x509_v3.c +3 -3
  174. data/third_party/boringssl-with-bazel/src/crypto/x509/x509_vfy.c +29 -35
  175. data/third_party/boringssl-with-bazel/src/crypto/x509/x509cset.c +13 -2
  176. data/third_party/boringssl-with-bazel/src/crypto/x509/x509name.c +9 -8
  177. data/third_party/boringssl-with-bazel/src/crypto/x509/x_all.c +10 -10
  178. data/third_party/boringssl-with-bazel/src/crypto/x509/x_crl.c +2 -2
  179. data/third_party/boringssl-with-bazel/src/crypto/x509/x_name.c +28 -40
  180. data/third_party/boringssl-with-bazel/src/crypto/x509/x_x509.c +3 -1
  181. data/third_party/boringssl-with-bazel/src/crypto/x509v3/ext_dat.h +1 -4
  182. data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_conf.c +7 -3
  183. data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_genn.c +2 -2
  184. data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_info.c +1 -1
  185. data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_purp.c +55 -8
  186. data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_skey.c +1 -1
  187. data/third_party/boringssl-with-bazel/src/include/openssl/asn1.h +0 -1
  188. data/third_party/boringssl-with-bazel/src/include/openssl/base.h +1 -1
  189. data/third_party/boringssl-with-bazel/src/include/openssl/cipher.h +6 -0
  190. data/third_party/boringssl-with-bazel/src/include/openssl/crypto.h +1 -1
  191. data/third_party/boringssl-with-bazel/src/include/openssl/dh.h +12 -0
  192. data/third_party/boringssl-with-bazel/src/include/openssl/digest.h +9 -0
  193. data/third_party/boringssl-with-bazel/src/include/openssl/evp.h +4 -1
  194. data/third_party/boringssl-with-bazel/src/include/openssl/ssl.h +9 -2
  195. data/third_party/boringssl-with-bazel/src/include/openssl/trust_token.h +26 -6
  196. data/third_party/boringssl-with-bazel/src/include/openssl/x509.h +188 -78
  197. data/third_party/boringssl-with-bazel/src/include/openssl/x509v3.h +52 -43
  198. data/third_party/boringssl-with-bazel/src/ssl/handshake.cc +18 -18
  199. data/third_party/boringssl-with-bazel/src/ssl/handshake_client.cc +2 -3
  200. data/third_party/boringssl-with-bazel/src/ssl/handshake_server.cc +1 -1
  201. data/third_party/boringssl-with-bazel/src/ssl/internal.h +9 -9
  202. data/third_party/boringssl-with-bazel/src/ssl/ssl_cipher.cc +8 -9
  203. data/third_party/boringssl-with-bazel/src/ssl/tls13_both.cc +1 -2
  204. data/third_party/boringssl-with-bazel/src/ssl/tls13_client.cc +4 -8
  205. data/third_party/boringssl-with-bazel/src/ssl/tls13_server.cc +2 -2
  206. metadata +72 -42
  207. data/src/core/ext/filters/client_channel/lb_policy/xds/lrs.cc +0 -537
  208. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_routing.cc +0 -1141
  209. data/src/core/ext/upb-generated/gogoproto/gogo.upb.c +0 -17
  210. data/src/core/ext/upb-generated/gogoproto/gogo.upb.h +0 -29
  211. data/src/core/ext/xds/xds_channel.h +0 -46
  212. data/src/core/ext/xds/xds_channel_secure.cc +0 -103
  213. data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_pku.c +0 -110
  214. data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_sxnet.c +0 -274
@@ -283,6 +283,15 @@ OPENSSL_EXPORT int EVP_DigestFinalXOF(EVP_MD_CTX *ctx, uint8_t *out,
283
283
  // EVP_MD_meth_get_flags calls |EVP_MD_flags|.
284
284
  OPENSSL_EXPORT uint32_t EVP_MD_meth_get_flags(const EVP_MD *md);
285
285
 
286
+ // EVP_MD_CTX_set_flags does nothing.
287
+ OPENSSL_EXPORT void EVP_MD_CTX_set_flags(EVP_MD_CTX *ctx, int flags);
288
+
289
+ // EVP_MD_CTX_FLAG_NON_FIPS_ALLOW is meaningless. In OpenSSL it permits non-FIPS
290
+ // algorithms in FIPS mode. But BoringSSL FIPS mode doesn't prohibit algorithms
291
+ // (it's up the the caller to use the FIPS module in a fashion compliant with
292
+ // their needs). Thus this exists only to allow code to compile.
293
+ #define EVP_MD_CTX_FLAG_NON_FIPS_ALLOW 0
294
+
286
295
 
287
296
  struct evp_md_pctx_ops;
288
297
 
@@ -219,7 +219,9 @@ OPENSSL_EXPORT int EVP_marshal_public_key(CBB *cbb, const EVP_PKEY *key);
219
219
  //
220
220
  // The caller must check the type of the parsed private key to ensure it is
221
221
  // suitable and validate other desired key properties such as RSA modulus size
222
- // or EC curve.
222
+ // or EC curve. In particular, RSA private key operations scale cubicly, so
223
+ // applications accepting RSA private keys from external sources may need to
224
+ // bound key sizes (use |EVP_PKEY_bits| or |RSA_bits|) to avoid a DoS vector.
223
225
  //
224
226
  // A PrivateKeyInfo ends with an optional set of attributes. These are not
225
227
  // processed and so this function will silently ignore any trailing data in the
@@ -1115,5 +1117,6 @@ BSSL_NAMESPACE_END
1115
1117
  #define EVP_R_INVALID_PARAMETERS 133
1116
1118
  #define EVP_R_INVALID_PEER_KEY 134
1117
1119
  #define EVP_R_NOT_XOF_OR_INVALID_LENGTH 135
1120
+ #define EVP_R_EMPTY_PSK 136
1118
1121
 
1119
1122
  #endif // OPENSSL_HEADER_EVP_H
@@ -1293,8 +1293,8 @@ OPENSSL_EXPORT const SSL_CIPHER *SSL_get_cipher_by_value(uint16_t value);
1293
1293
  // cast to a |uint16_t| to get it.
1294
1294
  OPENSSL_EXPORT uint32_t SSL_CIPHER_get_id(const SSL_CIPHER *cipher);
1295
1295
 
1296
- // SSL_CIPHER_get_value returns |cipher|'s IANA-assigned number.
1297
- OPENSSL_EXPORT uint16_t SSL_CIPHER_get_value(const SSL_CIPHER *cipher);
1296
+ // SSL_CIPHER_get_protocol_id returns |cipher|'s IANA-assigned number.
1297
+ OPENSSL_EXPORT uint16_t SSL_CIPHER_get_protocol_id(const SSL_CIPHER *cipher);
1298
1298
 
1299
1299
  // SSL_CIPHER_is_aead returns one if |cipher| uses an AEAD cipher.
1300
1300
  OPENSSL_EXPORT int SSL_CIPHER_is_aead(const SSL_CIPHER *cipher);
@@ -4717,6 +4717,13 @@ OPENSSL_EXPORT int SSL_CTX_set_tlsext_status_arg(SSL_CTX *ctx, void *arg);
4717
4717
  SSL_R_TLSV1_ALERT_BAD_CERTIFICATE_HASH_VALUE
4718
4718
  #define SSL_R_TLSV1_CERTIFICATE_REQUIRED SSL_R_TLSV1_ALERT_CERTIFICATE_REQUIRED
4719
4719
 
4720
+ // SSL_CIPHER_get_value calls |SSL_CIPHER_get_protocol_id|.
4721
+ //
4722
+ // TODO(davidben): |SSL_CIPHER_get_value| was our name for this function, but
4723
+ // upstream added it as |SSL_CIPHER_get_protocol_id|. Switch callers to the new
4724
+ // name and remove this one.
4725
+ OPENSSL_EXPORT uint16_t SSL_CIPHER_get_value(const SSL_CIPHER *cipher);
4726
+
4720
4727
 
4721
4728
  // Nodejs compatibility section (hidden).
4722
4729
  //
@@ -40,6 +40,20 @@ extern "C" {
40
40
  // PMBTokens and P-384.
41
41
  OPENSSL_EXPORT const TRUST_TOKEN_METHOD *TRUST_TOKEN_experiment_v1(void);
42
42
 
43
+ // TRUST_TOKEN_experiment_v2_pp is an experimental Trust Tokens protocol using
44
+ // PMBTokens (with no private metadata) and P-384 with up to 6 keys, without RR
45
+ // verification.
46
+ //
47
+ // This version is incomplete and should not be used.
48
+ // TODO(svaldez): Update to use the PrivacyPass primitive
49
+ OPENSSL_EXPORT const TRUST_TOKEN_METHOD *TRUST_TOKEN_experiment_v2_pp(void);
50
+
51
+ // TRUST_TOKEN_experiment_v2_pmb is an experimental Trust Tokens protocol using
52
+ // PMBTokens and P-384 with up to 3 keys, without RR verification.
53
+ //
54
+ // This version is incomplete and should not be used.
55
+ OPENSSL_EXPORT const TRUST_TOKEN_METHOD *TRUST_TOKEN_experiment_v2_pmb(void);
56
+
43
57
  // trust_token_st represents a single-use token for the Trust Token protocol.
44
58
  // For the client, this is the token and its corresponding signature. For the
45
59
  // issuer, this is the token itself.
@@ -146,13 +160,19 @@ OPENSSL_EXPORT int TRUST_TOKEN_CLIENT_begin_redemption(
146
160
  const TRUST_TOKEN *token, const uint8_t *data, size_t data_len,
147
161
  uint64_t time);
148
162
 
149
- // TRUST_TOKEN_CLIENT_finish_redemption consumes |response| from the issuer and
150
- // verifies the SRR. If valid, it returns one and sets |*out_srr| and
151
- // |*out_srr_len| (respectively, |*out_sig| and |*out_sig_len|) to a
152
- // newly-allocated buffer containing the SRR (respectively, the SRR signature).
153
- // Otherwise, it returns zero.
163
+ // TRUST_TOKEN_CLIENT_finish_redemption consumes |response| from the issuer. In
164
+ // |TRUST_TOKEN_experiment_v1|, it then verifies the SRR and if valid sets
165
+ // |*out_rr| and |*out_rr_len| (respectively, |*out_sig| and |*out_sig_len|)
166
+ // to a newly-allocated buffer containing the SRR (respectively, the SRR
167
+ // signature). In other versions, it sets |*out_rr| and |*out_rr_len|
168
+ // (respectively, |*out_sig| and |*out_sig_len|) to a newly-allocated buffer
169
+ // containing the SRR (respectively, the SRR signature). It returns one on
170
+ // success or zero on failure.
171
+ //
172
+ // TODO(svaldez): Return the entire response in |*out_rr| and omit |*out_sig| in
173
+ // non-|TRUST_TOKEN_experiment_v1| versions.
154
174
  OPENSSL_EXPORT int TRUST_TOKEN_CLIENT_finish_redemption(
155
- TRUST_TOKEN_CLIENT *ctx, uint8_t **out_srr, size_t *out_srr_len,
175
+ TRUST_TOKEN_CLIENT *ctx, uint8_t **out_rr, size_t *out_rr_len,
156
176
  uint8_t **out_sig, size_t *out_sig_len, const uint8_t *response,
157
177
  size_t response_len);
158
178
 
@@ -146,7 +146,7 @@ struct X509_name_st {
146
146
  STACK_OF(X509_NAME_ENTRY) * entries;
147
147
  int modified; // true if 'bytes' needs to be built
148
148
  BUF_MEM *bytes;
149
- // unsigned long hash; Keep the hash around for lookups
149
+ // unsigned long hash; Keep the hash around for lookups
150
150
  unsigned char *canon_enc;
151
151
  int canon_enclen;
152
152
  } /* X509_NAME */;
@@ -470,6 +470,11 @@ struct Netscape_spki_st {
470
470
  extern "C" {
471
471
  #endif
472
472
 
473
+ // TODO(davidben): Document remaining functions, reorganize them, and define
474
+ // supported patterns for using |X509| objects in general. In particular, when
475
+ // it is safe to call mutating functions is a little tricky due to various
476
+ // internal caches.
477
+
473
478
  // X509_get_version returns the numerical value of |x509|'s version. That is,
474
479
  // it returns zero for X.509v1, one for X.509v2, and two for X.509v3. Unknown
475
480
  // versions are rejected by the parser, but a manually-created |X509| object may
@@ -477,16 +482,54 @@ extern "C" {
477
482
  // version, or -1 on overflow.
478
483
  OPENSSL_EXPORT long X509_get_version(const X509 *x509);
479
484
 
480
- // X509_get_notBefore returns |x509|'s notBefore value. Note this function is
481
- // not const-correct for legacy reasons. Use |X509_get0_notBefore| or
485
+ // X509_get0_serialNumber returns |x509|'s serial number.
486
+ OPENSSL_EXPORT const ASN1_INTEGER *X509_get0_serialNumber(const X509 *x509);
487
+
488
+ // X509_get0_notBefore returns |x509|'s notBefore time.
489
+ OPENSSL_EXPORT const ASN1_TIME *X509_get0_notBefore(const X509 *x509);
490
+
491
+ // X509_get0_notAfter returns |x509|'s notAfter time.
492
+ OPENSSL_EXPORT const ASN1_TIME *X509_get0_notAfter(const X509 *x509);
493
+
494
+ // X509_set1_notBefore sets |x509|'s notBefore time to |tm|. It returns one on
495
+ // success and zero on error.
496
+ OPENSSL_EXPORT int X509_set1_notBefore(X509 *x509, const ASN1_TIME *tm);
497
+
498
+ // X509_set1_notAfter sets |x509|'s notAfter time to |tm|. it returns one on
499
+ // success and zero on error.
500
+ OPENSSL_EXPORT int X509_set1_notAfter(X509 *x509, const ASN1_TIME *tm);
501
+
502
+ // X509_getm_notBefore returns a mutable pointer to |x509|'s notBefore time.
503
+ OPENSSL_EXPORT ASN1_TIME *X509_getm_notBefore(X509 *x509);
504
+
505
+ // X509_getm_notAfter returns a mutable pointer to |x509|'s notAfter time.
506
+ OPENSSL_EXPORT ASN1_TIME *X509_getm_notAfter(X509 *x);
507
+
508
+ // X509_get_notBefore returns |x509|'s notBefore time. Note this function is not
509
+ // const-correct for legacy reasons. Use |X509_get0_notBefore| or
482
510
  // |X509_getm_notBefore| instead.
483
511
  OPENSSL_EXPORT ASN1_TIME *X509_get_notBefore(const X509 *x509);
484
512
 
485
- // X509_get_notAfter returns |x509|'s notAfter value. Note this function is not
513
+ // X509_get_notAfter returns |x509|'s notAfter time. Note this function is not
486
514
  // const-correct for legacy reasons. Use |X509_get0_notAfter| or
487
515
  // |X509_getm_notAfter| instead.
488
516
  OPENSSL_EXPORT ASN1_TIME *X509_get_notAfter(const X509 *x509);
489
517
 
518
+ // X509_set_notBefore calls |X509_set1_notBefore|. Use |X509_set1_notBefore|
519
+ // instead.
520
+ OPENSSL_EXPORT int X509_set_notBefore(X509 *x509, const ASN1_TIME *tm);
521
+
522
+ // X509_set_notAfter calls |X509_set1_notAfter|. Use |X509_set1_notAfter|
523
+ // instead.
524
+ OPENSSL_EXPORT int X509_set_notAfter(X509 *x509, const ASN1_TIME *tm);
525
+
526
+ // X509_get0_uids sets |*out_issuer_uid| and |*out_subject_uid| to non-owning
527
+ // pointers to the issuerUID and subjectUID fields, respectively, of |x509|.
528
+ // Either output pointer may be NULL to skip the field.
529
+ OPENSSL_EXPORT void X509_get0_uids(const X509 *x509,
530
+ const ASN1_BIT_STRING **out_issuer_uid,
531
+ const ASN1_BIT_STRING **out_subject_uid);
532
+
490
533
  // X509_get_cert_info returns |x509|'s TBSCertificate structure. Note this
491
534
  // function is not const-correct for legacy reasons.
492
535
  //
@@ -498,6 +541,15 @@ OPENSSL_EXPORT X509_CINF *X509_get_cert_info(const X509 *x509);
498
541
  // |X509_get_pubkey| instead.
499
542
  #define X509_extract_key(x) X509_get_pubkey(x)
500
543
 
544
+ // X509_get_pathlen returns path length constraint from the basic constraints
545
+ // extension in |x509|. (See RFC5280, section 4.2.1.9.) It returns -1 if the
546
+ // constraint is not present, or if some extension in |x509| was invalid.
547
+ //
548
+ // Note that decoding an |X509| object will not check for invalid extensions. To
549
+ // detect the error case, call |X509_get_extensions_flags| and check the
550
+ // |EXFLAG_INVALID| bit.
551
+ OPENSSL_EXPORT long X509_get_pathlen(X509 *x509);
552
+
501
553
  // X509_REQ_get_version returns the numerical value of |req|'s version. That is,
502
554
  // it returns zero for a v1 request. If |req| is invalid, it may return another
503
555
  // value, or -1 on overflow.
@@ -521,15 +573,29 @@ OPENSSL_EXPORT long X509_CRL_get_version(const X509_CRL *crl);
521
573
  // X509_CRL_get0_lastUpdate returns |crl|'s lastUpdate time.
522
574
  OPENSSL_EXPORT const ASN1_TIME *X509_CRL_get0_lastUpdate(const X509_CRL *crl);
523
575
 
524
- // X509_CRL_get0_lastUpdate returns |crl|'s nextUpdate time.
576
+ // X509_CRL_get0_nextUpdate returns |crl|'s nextUpdate time, or NULL if |crl|
577
+ // has none.
525
578
  OPENSSL_EXPORT const ASN1_TIME *X509_CRL_get0_nextUpdate(const X509_CRL *crl);
526
579
 
580
+ // X509_CRL_set1_lastUpdate sets |crl|'s lastUpdate time to |tm|. It returns one
581
+ // on success and zero on error.
582
+ OPENSSL_EXPORT int X509_CRL_set1_lastUpdate(X509_CRL *crl, const ASN1_TIME *tm);
583
+
584
+ // X509_CRL_set1_nextUpdate sets |crl|'s nextUpdate time to |tm|. It returns one
585
+ // on success and zero on error.
586
+ OPENSSL_EXPORT int X509_CRL_set1_nextUpdate(X509_CRL *crl, const ASN1_TIME *tm);
587
+
588
+ // The following symbols are deprecated aliases to |X509_CRL_set1_*|.
589
+ #define X509_CRL_set_lastUpdate X509_CRL_set1_lastUpdate
590
+ #define X509_CRL_set_nextUpdate X509_CRL_set1_nextUpdate
591
+
527
592
  // X509_CRL_get_lastUpdate returns a mutable pointer to |crl|'s lastUpdate time.
528
- // Use |X509_CRL_get0_lastUpdate| or |X509_CRL_set_lastUpdate| instead.
593
+ // Use |X509_CRL_get0_lastUpdate| or |X509_CRL_set1_lastUpdate| instead.
529
594
  OPENSSL_EXPORT ASN1_TIME *X509_CRL_get_lastUpdate(X509_CRL *crl);
530
595
 
531
- // X509_CRL_get_nextUpdate returns a mutable pointer to |crl|'s nextUpdate time.
532
- // Use |X509_CRL_get0_nextUpdate| or |X509_CRL_set_nextUpdate| instead.
596
+ // X509_CRL_get_nextUpdate returns a mutable pointer to |crl|'s nextUpdate time,
597
+ // or NULL if |crl| has none. Use |X509_CRL_get0_nextUpdate| or
598
+ // |X509_CRL_set1_nextUpdate| instead.
533
599
  OPENSSL_EXPORT ASN1_TIME *X509_CRL_get_nextUpdate(X509_CRL *crl);
534
600
 
535
601
  // X509_CRL_get_issuer returns |crl|'s issuer name. Note this function is not
@@ -543,6 +609,10 @@ OPENSSL_EXPORT X509_NAME *X509_CRL_get_issuer(const X509_CRL *crl);
543
609
  // would break existing callers. For now, we match upstream.
544
610
  OPENSSL_EXPORT STACK_OF(X509_REVOKED) *X509_CRL_get_REVOKED(X509_CRL *crl);
545
611
 
612
+ // X509_CRL_get0_extensions returns |crl|'s extension list.
613
+ OPENSSL_EXPORT const STACK_OF(X509_EXTENSION) *
614
+ X509_CRL_get0_extensions(const X509_CRL *crl);
615
+
546
616
  // X509_CINF_set_modified marks |cinf| as modified so that changes will be
547
617
  // reflected in serializing the structure.
548
618
  //
@@ -586,26 +656,66 @@ OPENSSL_EXPORT void *X509_CRL_get_meth_data(X509_CRL *crl);
586
656
  // object.
587
657
  OPENSSL_EXPORT X509_PUBKEY *X509_get_X509_PUBKEY(const X509 *x509);
588
658
 
589
- OPENSSL_EXPORT const char *X509_verify_cert_error_string(long n);
590
-
591
- #ifndef OPENSSL_NO_EVP
592
- OPENSSL_EXPORT int X509_verify(X509 *a, EVP_PKEY *r);
593
-
594
- OPENSSL_EXPORT int X509_REQ_verify(X509_REQ *a, EVP_PKEY *r);
595
- OPENSSL_EXPORT int X509_CRL_verify(X509_CRL *a, EVP_PKEY *r);
596
- OPENSSL_EXPORT int NETSCAPE_SPKI_verify(NETSCAPE_SPKI *a, EVP_PKEY *r);
597
-
659
+ // X509_verify_cert_error_string returns |err| as a human-readable string, where
660
+ // |err| should be one of the |X509_V_*| values. If |err| is unknown, it returns
661
+ // a default description.
662
+ //
663
+ // TODO(davidben): Move this function to x509_vfy.h, with the |X509_V_*|
664
+ // definitions, or fold x509_vfy.h into this function.
665
+ OPENSSL_EXPORT const char *X509_verify_cert_error_string(long err);
666
+
667
+ // X509_verify checks that |x509| has a valid signature by |pkey|. It returns
668
+ // one if the signature is valid and zero otherwise. Note this function only
669
+ // checks the signature itself and does not perform a full certificate
670
+ // validation.
671
+ OPENSSL_EXPORT int X509_verify(X509 *x509, EVP_PKEY *pkey);
672
+
673
+ // X509_REQ_verify checks that |req| has a valid signature by |pkey|. It returns
674
+ // one if the signature is valid and zero otherwise.
675
+ OPENSSL_EXPORT int X509_REQ_verify(X509_REQ *req, EVP_PKEY *pkey);
676
+
677
+ // X509_CRL_verify checks that |crl| has a valid signature by |pkey|. It returns
678
+ // one if the signature is valid and zero otherwise.
679
+ OPENSSL_EXPORT int X509_CRL_verify(X509_CRL *crl, EVP_PKEY *pkey);
680
+
681
+ // NETSCAPE_SPKI_verify checks that |spki| has a valid signature by |pkey|. It
682
+ // returns one if the signature is valid and zero otherwise.
683
+ OPENSSL_EXPORT int NETSCAPE_SPKI_verify(NETSCAPE_SPKI *spki, EVP_PKEY *pkey);
684
+
685
+ // NETSCAPE_SPKI_b64_decode decodes |len| bytes from |str| as a base64-encoded
686
+ // Netscape signed public key and challenge (SPKAC) structure. It returns a
687
+ // newly-allocated |NETSCAPE_SPKI| structure with the result, or NULL on error.
688
+ // If |len| is 0 or negative, the length is calculated with |strlen| and |str|
689
+ // must be a NUL-terminated C string.
598
690
  OPENSSL_EXPORT NETSCAPE_SPKI *NETSCAPE_SPKI_b64_decode(const char *str,
599
691
  int len);
600
- OPENSSL_EXPORT char *NETSCAPE_SPKI_b64_encode(NETSCAPE_SPKI *x);
601
- OPENSSL_EXPORT EVP_PKEY *NETSCAPE_SPKI_get_pubkey(NETSCAPE_SPKI *x);
602
- OPENSSL_EXPORT int NETSCAPE_SPKI_set_pubkey(NETSCAPE_SPKI *x, EVP_PKEY *pkey);
603
692
 
604
- OPENSSL_EXPORT int NETSCAPE_SPKI_print(BIO *out, NETSCAPE_SPKI *spki);
605
-
606
- OPENSSL_EXPORT int X509_signature_dump(BIO *bp, const ASN1_STRING *sig,
693
+ // NETSCAPE_SPKI_b64_encode encodes |spki| as a base64-encoded Netscape signed
694
+ // public key and challenge (SPKAC) structure. It returns a newly-allocated
695
+ // NUL-terminated C string with the result, or NULL on error. The caller must
696
+ // release the memory with |OPENSSL_free| when done.
697
+ OPENSSL_EXPORT char *NETSCAPE_SPKI_b64_encode(NETSCAPE_SPKI *spki);
698
+
699
+ // NETSCAPE_SPKI_get_pubkey decodes and returns the public key in |spki| as an
700
+ // |EVP_PKEY|, or NULL on error. The resulting pointer is non-owning and valid
701
+ // until |spki| is released or mutated. The caller should take a reference with
702
+ // |EVP_PKEY_up_ref| to extend the lifetime.
703
+ OPENSSL_EXPORT EVP_PKEY *NETSCAPE_SPKI_get_pubkey(NETSCAPE_SPKI *spki);
704
+
705
+ // NETSCAPE_SPKI_set_pubkey sets |spki|'s public key to |pkey|. It returns one
706
+ // on success or zero on error. This function does not take ownership of |pkey|,
707
+ // so the caller may continue to manage its lifetime independently of |spki|.
708
+ OPENSSL_EXPORT int NETSCAPE_SPKI_set_pubkey(NETSCAPE_SPKI *spki,
709
+ EVP_PKEY *pkey);
710
+
711
+ // X509_signature_dump writes a human-readable representation of |sig| to |bio|,
712
+ // indented with |indent| spaces. It returns one on success and zero on error.
713
+ OPENSSL_EXPORT int X509_signature_dump(BIO *bio, const ASN1_STRING *sig,
607
714
  int indent);
608
- OPENSSL_EXPORT int X509_signature_print(BIO *bp, const X509_ALGOR *alg,
715
+
716
+ // X509_signature_print writes a human-readable representation of |alg| and
717
+ // |sig| to |bio|. It returns one on success and zero on error.
718
+ OPENSSL_EXPORT int X509_signature_print(BIO *bio, const X509_ALGOR *alg,
609
719
  const ASN1_STRING *sig);
610
720
 
611
721
  OPENSSL_EXPORT int X509_sign(X509 *x, EVP_PKEY *pkey, const EVP_MD *md);
@@ -627,7 +737,6 @@ OPENSSL_EXPORT int X509_REQ_digest(const X509_REQ *data, const EVP_MD *type,
627
737
  unsigned char *md, unsigned int *len);
628
738
  OPENSSL_EXPORT int X509_NAME_digest(const X509_NAME *data, const EVP_MD *type,
629
739
  unsigned char *md, unsigned int *len);
630
- #endif
631
740
 
632
741
  // X509_parse_from_buffer parses an X.509 structure from |buf| and returns a
633
742
  // fresh X509 or NULL on error. There must not be any trailing data in |buf|.
@@ -825,10 +934,9 @@ OPENSSL_EXPORT void X509_PKEY_free(X509_PKEY *a);
825
934
  DECLARE_ASN1_FUNCTIONS(NETSCAPE_SPKI)
826
935
  DECLARE_ASN1_FUNCTIONS(NETSCAPE_SPKAC)
827
936
 
828
- #ifndef OPENSSL_NO_EVP
829
937
  OPENSSL_EXPORT X509_INFO *X509_INFO_new(void);
830
938
  OPENSSL_EXPORT void X509_INFO_free(X509_INFO *a);
831
- OPENSSL_EXPORT char *X509_NAME_oneline(X509_NAME *a, char *buf, int size);
939
+ OPENSSL_EXPORT char *X509_NAME_oneline(const X509_NAME *a, char *buf, int size);
832
940
 
833
941
  OPENSSL_EXPORT int ASN1_digest(i2d_of_void *i2d, const EVP_MD *type, char *data,
834
942
  unsigned char *md, unsigned int *len);
@@ -849,25 +957,19 @@ OPENSSL_EXPORT int ASN1_item_sign_ctx(const ASN1_ITEM *it, X509_ALGOR *algor1,
849
957
  X509_ALGOR *algor2,
850
958
  ASN1_BIT_STRING *signature, void *asn,
851
959
  EVP_MD_CTX *ctx);
852
- #endif
853
960
 
854
961
  OPENSSL_EXPORT int X509_set_version(X509 *x, long version);
855
962
  OPENSSL_EXPORT int X509_set_serialNumber(X509 *x, ASN1_INTEGER *serial);
856
963
  OPENSSL_EXPORT ASN1_INTEGER *X509_get_serialNumber(X509 *x);
857
964
  OPENSSL_EXPORT int X509_set_issuer_name(X509 *x, X509_NAME *name);
858
- OPENSSL_EXPORT X509_NAME *X509_get_issuer_name(X509 *a);
965
+ OPENSSL_EXPORT X509_NAME *X509_get_issuer_name(const X509 *a);
859
966
  OPENSSL_EXPORT int X509_set_subject_name(X509 *x, X509_NAME *name);
860
- OPENSSL_EXPORT X509_NAME *X509_get_subject_name(X509 *a);
861
- OPENSSL_EXPORT int X509_set_notBefore(X509 *x, const ASN1_TIME *tm);
862
- OPENSSL_EXPORT const ASN1_TIME *X509_get0_notBefore(const X509 *x);
863
- OPENSSL_EXPORT ASN1_TIME *X509_getm_notBefore(X509 *x);
864
- OPENSSL_EXPORT int X509_set_notAfter(X509 *x, const ASN1_TIME *tm);
865
- OPENSSL_EXPORT const ASN1_TIME *X509_get0_notAfter(const X509 *x);
866
- OPENSSL_EXPORT ASN1_TIME *X509_getm_notAfter(X509 *x);
967
+ OPENSSL_EXPORT X509_NAME *X509_get_subject_name(const X509 *a);
867
968
  OPENSSL_EXPORT int X509_set_pubkey(X509 *x, EVP_PKEY *pkey);
868
969
  OPENSSL_EXPORT EVP_PKEY *X509_get_pubkey(X509 *x);
869
970
  OPENSSL_EXPORT ASN1_BIT_STRING *X509_get0_pubkey_bitstr(const X509 *x);
870
- OPENSSL_EXPORT STACK_OF(X509_EXTENSION) * X509_get0_extensions(const X509 *x);
971
+ OPENSSL_EXPORT const STACK_OF(X509_EXTENSION) *
972
+ X509_get0_extensions(const X509 *x);
871
973
  OPENSSL_EXPORT const X509_ALGOR *X509_get0_tbs_sigalg(const X509 *x);
872
974
 
873
975
  OPENSSL_EXPORT int X509_REQ_set_version(X509_REQ *x, long version);
@@ -911,8 +1013,6 @@ OPENSSL_EXPORT int X509_REQ_add1_attr_by_txt(X509_REQ *req,
911
1013
 
912
1014
  OPENSSL_EXPORT int X509_CRL_set_version(X509_CRL *x, long version);
913
1015
  OPENSSL_EXPORT int X509_CRL_set_issuer_name(X509_CRL *x, X509_NAME *name);
914
- OPENSSL_EXPORT int X509_CRL_set_lastUpdate(X509_CRL *x, const ASN1_TIME *tm);
915
- OPENSSL_EXPORT int X509_CRL_set_nextUpdate(X509_CRL *x, const ASN1_TIME *tm);
916
1016
  OPENSSL_EXPORT int X509_CRL_sort(X509_CRL *crl);
917
1017
  OPENSSL_EXPORT int X509_CRL_up_ref(X509_CRL *crl);
918
1018
 
@@ -931,6 +1031,10 @@ OPENSSL_EXPORT const ASN1_TIME *X509_REVOKED_get0_revocationDate(
931
1031
  OPENSSL_EXPORT int X509_REVOKED_set_revocationDate(X509_REVOKED *r,
932
1032
  ASN1_TIME *tm);
933
1033
 
1034
+ // X509_REVOKED_get0_extensions returns |r|'s extensions.
1035
+ OPENSSL_EXPORT const STACK_OF(X509_EXTENSION) *
1036
+ X509_REVOKED_get0_extensions(const X509_REVOKED *r);
1037
+
934
1038
  OPENSSL_EXPORT X509_CRL *X509_CRL_diff(X509_CRL *base, X509_CRL *newer,
935
1039
  EVP_PKEY *skey, const EVP_MD *md,
936
1040
  unsigned int flags);
@@ -970,12 +1074,12 @@ OPENSSL_EXPORT int X509_print_ex_fp(FILE *bp, X509 *x, unsigned long nmflag,
970
1074
  OPENSSL_EXPORT int X509_print_fp(FILE *bp, X509 *x);
971
1075
  OPENSSL_EXPORT int X509_CRL_print_fp(FILE *bp, X509_CRL *x);
972
1076
  OPENSSL_EXPORT int X509_REQ_print_fp(FILE *bp, X509_REQ *req);
973
- OPENSSL_EXPORT int X509_NAME_print_ex_fp(FILE *fp, X509_NAME *nm, int indent,
974
- unsigned long flags);
1077
+ OPENSSL_EXPORT int X509_NAME_print_ex_fp(FILE *fp, const X509_NAME *nm,
1078
+ int indent, unsigned long flags);
975
1079
  #endif
976
1080
 
977
- OPENSSL_EXPORT int X509_NAME_print(BIO *bp, X509_NAME *name, int obase);
978
- OPENSSL_EXPORT int X509_NAME_print_ex(BIO *out, X509_NAME *nm, int indent,
1081
+ OPENSSL_EXPORT int X509_NAME_print(BIO *bp, const X509_NAME *name, int obase);
1082
+ OPENSSL_EXPORT int X509_NAME_print_ex(BIO *out, const X509_NAME *nm, int indent,
979
1083
  unsigned long flags);
980
1084
  OPENSSL_EXPORT int X509_print_ex(BIO *bp, X509 *x, unsigned long nmflag,
981
1085
  unsigned long cflag);
@@ -987,21 +1091,22 @@ OPENSSL_EXPORT int X509_REQ_print_ex(BIO *bp, X509_REQ *x, unsigned long nmflag,
987
1091
  unsigned long cflag);
988
1092
  OPENSSL_EXPORT int X509_REQ_print(BIO *bp, X509_REQ *req);
989
1093
 
990
- OPENSSL_EXPORT int X509_NAME_entry_count(X509_NAME *name);
991
- OPENSSL_EXPORT int X509_NAME_get_text_by_NID(X509_NAME *name, int nid,
1094
+ OPENSSL_EXPORT int X509_NAME_entry_count(const X509_NAME *name);
1095
+ OPENSSL_EXPORT int X509_NAME_get_text_by_NID(const X509_NAME *name, int nid,
992
1096
  char *buf, int len);
993
- OPENSSL_EXPORT int X509_NAME_get_text_by_OBJ(X509_NAME *name,
1097
+ OPENSSL_EXPORT int X509_NAME_get_text_by_OBJ(const X509_NAME *name,
994
1098
  const ASN1_OBJECT *obj, char *buf,
995
1099
  int len);
996
1100
 
997
1101
  // NOTE: you should be passsing -1, not 0 as lastpos. The functions that use
998
1102
  // lastpos, search after that position on.
999
- OPENSSL_EXPORT int X509_NAME_get_index_by_NID(X509_NAME *name, int nid,
1103
+ OPENSSL_EXPORT int X509_NAME_get_index_by_NID(const X509_NAME *name, int nid,
1000
1104
  int lastpos);
1001
- OPENSSL_EXPORT int X509_NAME_get_index_by_OBJ(X509_NAME *name,
1105
+ OPENSSL_EXPORT int X509_NAME_get_index_by_OBJ(const X509_NAME *name,
1002
1106
  const ASN1_OBJECT *obj,
1003
1107
  int lastpos);
1004
- OPENSSL_EXPORT X509_NAME_ENTRY *X509_NAME_get_entry(X509_NAME *name, int loc);
1108
+ OPENSSL_EXPORT X509_NAME_ENTRY *X509_NAME_get_entry(const X509_NAME *name,
1109
+ int loc);
1005
1110
  OPENSSL_EXPORT X509_NAME_ENTRY *X509_NAME_delete_entry(X509_NAME *name,
1006
1111
  int loc);
1007
1112
  OPENSSL_EXPORT int X509_NAME_add_entry(X509_NAME *name, X509_NAME_ENTRY *ne,
@@ -1032,8 +1137,9 @@ OPENSSL_EXPORT int X509_NAME_ENTRY_set_object(X509_NAME_ENTRY *ne,
1032
1137
  OPENSSL_EXPORT int X509_NAME_ENTRY_set_data(X509_NAME_ENTRY *ne, int type,
1033
1138
  const unsigned char *bytes,
1034
1139
  int len);
1035
- OPENSSL_EXPORT ASN1_OBJECT *X509_NAME_ENTRY_get_object(X509_NAME_ENTRY *ne);
1036
- OPENSSL_EXPORT ASN1_STRING *X509_NAME_ENTRY_get_data(X509_NAME_ENTRY *ne);
1140
+ OPENSSL_EXPORT ASN1_OBJECT *X509_NAME_ENTRY_get_object(
1141
+ const X509_NAME_ENTRY *ne);
1142
+ OPENSSL_EXPORT ASN1_STRING *X509_NAME_ENTRY_get_data(const X509_NAME_ENTRY *ne);
1037
1143
 
1038
1144
  OPENSSL_EXPORT int X509v3_get_ext_count(const STACK_OF(X509_EXTENSION) * x);
1039
1145
  OPENSSL_EXPORT int X509v3_get_ext_by_NID(const STACK_OF(X509_EXTENSION) * x,
@@ -1051,59 +1157,63 @@ OPENSSL_EXPORT X509_EXTENSION *X509v3_delete_ext(STACK_OF(X509_EXTENSION) * x,
1051
1157
  OPENSSL_EXPORT STACK_OF(X509_EXTENSION) *
1052
1158
  X509v3_add_ext(STACK_OF(X509_EXTENSION) * *x, X509_EXTENSION *ex, int loc);
1053
1159
 
1054
- OPENSSL_EXPORT int X509_get_ext_count(X509 *x);
1055
- OPENSSL_EXPORT int X509_get_ext_by_NID(X509 *x, int nid, int lastpos);
1056
- OPENSSL_EXPORT int X509_get_ext_by_OBJ(X509 *x, ASN1_OBJECT *obj, int lastpos);
1057
- OPENSSL_EXPORT int X509_get_ext_by_critical(X509 *x, int crit, int lastpos);
1058
- OPENSSL_EXPORT X509_EXTENSION *X509_get_ext(X509 *x, int loc);
1160
+ OPENSSL_EXPORT int X509_get_ext_count(const X509 *x);
1161
+ OPENSSL_EXPORT int X509_get_ext_by_NID(const X509 *x, int nid, int lastpos);
1162
+ OPENSSL_EXPORT int X509_get_ext_by_OBJ(const X509 *x, const ASN1_OBJECT *obj,
1163
+ int lastpos);
1164
+ OPENSSL_EXPORT int X509_get_ext_by_critical(const X509 *x, int crit,
1165
+ int lastpos);
1166
+ OPENSSL_EXPORT X509_EXTENSION *X509_get_ext(const X509 *x, int loc);
1059
1167
  OPENSSL_EXPORT X509_EXTENSION *X509_delete_ext(X509 *x, int loc);
1060
1168
  OPENSSL_EXPORT int X509_add_ext(X509 *x, X509_EXTENSION *ex, int loc);
1061
- OPENSSL_EXPORT void *X509_get_ext_d2i(X509 *x, int nid, int *crit, int *idx);
1169
+ OPENSSL_EXPORT void *X509_get_ext_d2i(const X509 *x, int nid, int *crit, int *idx);
1062
1170
  OPENSSL_EXPORT int X509_add1_ext_i2d(X509 *x, int nid, void *value, int crit,
1063
1171
  unsigned long flags);
1064
1172
 
1065
- OPENSSL_EXPORT int X509_CRL_get_ext_count(X509_CRL *x);
1066
- OPENSSL_EXPORT int X509_CRL_get_ext_by_NID(X509_CRL *x, int nid, int lastpos);
1067
- OPENSSL_EXPORT int X509_CRL_get_ext_by_OBJ(X509_CRL *x, ASN1_OBJECT *obj,
1068
- int lastpos);
1069
- OPENSSL_EXPORT int X509_CRL_get_ext_by_critical(X509_CRL *x, int crit,
1173
+ OPENSSL_EXPORT int X509_CRL_get_ext_count(const X509_CRL *x);
1174
+ OPENSSL_EXPORT int X509_CRL_get_ext_by_NID(const X509_CRL *x, int nid, int lastpos);
1175
+ OPENSSL_EXPORT int X509_CRL_get_ext_by_OBJ(const X509_CRL *x,
1176
+ const ASN1_OBJECT *obj, int lastpos);
1177
+ OPENSSL_EXPORT int X509_CRL_get_ext_by_critical(const X509_CRL *x, int crit,
1070
1178
  int lastpos);
1071
- OPENSSL_EXPORT X509_EXTENSION *X509_CRL_get_ext(X509_CRL *x, int loc);
1179
+ OPENSSL_EXPORT X509_EXTENSION *X509_CRL_get_ext(const X509_CRL *x, int loc);
1072
1180
  OPENSSL_EXPORT X509_EXTENSION *X509_CRL_delete_ext(X509_CRL *x, int loc);
1073
1181
  OPENSSL_EXPORT int X509_CRL_add_ext(X509_CRL *x, X509_EXTENSION *ex, int loc);
1074
- OPENSSL_EXPORT void *X509_CRL_get_ext_d2i(X509_CRL *x, int nid, int *crit,
1182
+ OPENSSL_EXPORT void *X509_CRL_get_ext_d2i(const X509_CRL *x, int nid, int *crit,
1075
1183
  int *idx);
1076
1184
  OPENSSL_EXPORT int X509_CRL_add1_ext_i2d(X509_CRL *x, int nid, void *value,
1077
1185
  int crit, unsigned long flags);
1078
1186
 
1079
- OPENSSL_EXPORT int X509_REVOKED_get_ext_count(X509_REVOKED *x);
1080
- OPENSSL_EXPORT int X509_REVOKED_get_ext_by_NID(X509_REVOKED *x, int nid,
1187
+ OPENSSL_EXPORT int X509_REVOKED_get_ext_count(const X509_REVOKED *x);
1188
+ OPENSSL_EXPORT int X509_REVOKED_get_ext_by_NID(const X509_REVOKED *x, int nid,
1189
+ int lastpos);
1190
+ OPENSSL_EXPORT int X509_REVOKED_get_ext_by_OBJ(const X509_REVOKED *x,
1191
+ const ASN1_OBJECT *obj,
1081
1192
  int lastpos);
1082
- OPENSSL_EXPORT int X509_REVOKED_get_ext_by_OBJ(X509_REVOKED *x,
1083
- ASN1_OBJECT *obj, int lastpos);
1084
- OPENSSL_EXPORT int X509_REVOKED_get_ext_by_critical(X509_REVOKED *x, int crit,
1085
- int lastpos);
1086
- OPENSSL_EXPORT X509_EXTENSION *X509_REVOKED_get_ext(X509_REVOKED *x, int loc);
1193
+ OPENSSL_EXPORT int X509_REVOKED_get_ext_by_critical(const X509_REVOKED *x,
1194
+ int crit, int lastpos);
1195
+ OPENSSL_EXPORT X509_EXTENSION *X509_REVOKED_get_ext(const X509_REVOKED *x,
1196
+ int loc);
1087
1197
  OPENSSL_EXPORT X509_EXTENSION *X509_REVOKED_delete_ext(X509_REVOKED *x,
1088
1198
  int loc);
1089
1199
  OPENSSL_EXPORT int X509_REVOKED_add_ext(X509_REVOKED *x, X509_EXTENSION *ex,
1090
1200
  int loc);
1091
- OPENSSL_EXPORT void *X509_REVOKED_get_ext_d2i(X509_REVOKED *x, int nid,
1201
+ OPENSSL_EXPORT void *X509_REVOKED_get_ext_d2i(const X509_REVOKED *x, int nid,
1092
1202
  int *crit, int *idx);
1093
1203
  OPENSSL_EXPORT int X509_REVOKED_add1_ext_i2d(X509_REVOKED *x, int nid,
1094
1204
  void *value, int crit,
1095
1205
  unsigned long flags);
1096
1206
 
1097
1207
  OPENSSL_EXPORT X509_EXTENSION *X509_EXTENSION_create_by_NID(
1098
- X509_EXTENSION **ex, int nid, int crit, ASN1_OCTET_STRING *data);
1208
+ X509_EXTENSION **ex, int nid, int crit, const ASN1_OCTET_STRING *data);
1099
1209
  OPENSSL_EXPORT X509_EXTENSION *X509_EXTENSION_create_by_OBJ(
1100
1210
  X509_EXTENSION **ex, const ASN1_OBJECT *obj, int crit,
1101
- ASN1_OCTET_STRING *data);
1211
+ const ASN1_OCTET_STRING *data);
1102
1212
  OPENSSL_EXPORT int X509_EXTENSION_set_object(X509_EXTENSION *ex,
1103
1213
  const ASN1_OBJECT *obj);
1104
1214
  OPENSSL_EXPORT int X509_EXTENSION_set_critical(X509_EXTENSION *ex, int crit);
1105
1215
  OPENSSL_EXPORT int X509_EXTENSION_set_data(X509_EXTENSION *ex,
1106
- ASN1_OCTET_STRING *data);
1216
+ const ASN1_OCTET_STRING *data);
1107
1217
  OPENSSL_EXPORT ASN1_OBJECT *X509_EXTENSION_get_object(X509_EXTENSION *ex);
1108
1218
  OPENSSL_EXPORT ASN1_OCTET_STRING *X509_EXTENSION_get_data(X509_EXTENSION *ne);
1109
1219
  OPENSSL_EXPORT int X509_EXTENSION_get_critical(X509_EXTENSION *ex);
@@ -1190,9 +1300,9 @@ OPENSSL_EXPORT int X509_TRUST_add(int id, int flags,
1190
1300
  int (*ck)(X509_TRUST *, X509 *, int),
1191
1301
  char *name, int arg1, void *arg2);
1192
1302
  OPENSSL_EXPORT void X509_TRUST_cleanup(void);
1193
- OPENSSL_EXPORT int X509_TRUST_get_flags(X509_TRUST *xp);
1194
- OPENSSL_EXPORT char *X509_TRUST_get0_name(X509_TRUST *xp);
1195
- OPENSSL_EXPORT int X509_TRUST_get_trust(X509_TRUST *xp);
1303
+ OPENSSL_EXPORT int X509_TRUST_get_flags(const X509_TRUST *xp);
1304
+ OPENSSL_EXPORT char *X509_TRUST_get0_name(const X509_TRUST *xp);
1305
+ OPENSSL_EXPORT int X509_TRUST_get_trust(const X509_TRUST *xp);
1196
1306
 
1197
1307
 
1198
1308
  typedef struct rsa_pss_params_st {