@@ -65,6 +65,7 @@ ref_castable! {
65
65
impl rustls_supported_ciphersuite {
66
66
/// Return a 16-bit unsigned integer corresponding to this cipher suite's assignment from
67
67
/// <https://www.iana.org/assignments/tls-parameters/tls-parameters.xhtml#tls-parameters-4>.
68
+ ///
68
69
/// The bytes from the assignment are interpreted in network order.
69
70
#[ no_mangle]
70
71
pub extern "C" fn rustls_supported_ciphersuite_get_suite (
@@ -81,10 +82,11 @@ impl rustls_supported_ciphersuite {
81
82
}
82
83
}
83
84
84
- /// Returns the name of the ciphersuite as a `rustls_str`. If the provided
85
- /// ciphersuite is invalid, the rustls_str will contain the empty string. The
86
- /// lifetime of the `rustls_str` is the lifetime of the program, it does not
87
- /// need to be freed.
85
+ /// Returns the name of the ciphersuite as a `rustls_str`.
86
+ ///
87
+ /// If the provided ciphersuite is invalid, the `rustls_str` will contain the
88
+ /// empty string. The lifetime of the `rustls_str` is the lifetime of the program,
89
+ /// it does not need to be freed.
88
90
#[ no_mangle]
89
91
pub extern "C" fn rustls_supported_ciphersuite_get_name (
90
92
supported_ciphersuite : * const rustls_supported_ciphersuite ,
@@ -103,10 +105,12 @@ pub extern "C" fn rustls_all_ciphersuites_len() -> usize {
103
105
ALL_CIPHER_SUITES . len ( )
104
106
}
105
107
106
- /// Get a pointer to a member of rustls' list of supported cipher suites. This will return non-NULL
107
- /// for i < rustls_all_ciphersuites_len().
108
- /// The returned pointer is valid for the lifetime of the program and may be used directly when
109
- /// building a ClientConfig or ServerConfig.
108
+ /// Get a pointer to a member of rustls' list of supported cipher suites.
109
+ ///
110
+ /// This will return non-NULL for i < rustls_all_ciphersuites_len().
111
+ ///
112
+ /// The returned pointer is valid for the lifetime of the program and may
113
+ /// be used directly when building a ClientConfig or ServerConfig.
110
114
#[ no_mangle]
111
115
pub extern "C" fn rustls_all_ciphersuites_get_entry (
112
116
i : size_t ,
@@ -123,10 +127,12 @@ pub extern "C" fn rustls_default_ciphersuites_len() -> usize {
123
127
DEFAULT_CIPHER_SUITES . len ( )
124
128
}
125
129
126
- /// Get a pointer to a member of rustls' list of supported cipher suites. This will return non-NULL
127
- /// for i < rustls_default_ciphersuites_len().
128
- /// The returned pointer is valid for the lifetime of the program and may be used directly when
129
- /// building a ClientConfig or ServerConfig.
130
+ /// Get a pointer to a member of rustls' list of supported cipher suites.
131
+ ///
132
+ /// This will return non-NULL for i < rustls_default_ciphersuites_len().
133
+ ///
134
+ /// The returned pointer is valid for the lifetime of the program and may
135
+ /// be used directly when building a ClientConfig or ServerConfig.
130
136
#[ no_mangle]
131
137
pub extern "C" fn rustls_default_ciphersuites_get_entry (
132
138
i : size_t ,
@@ -137,10 +143,11 @@ pub extern "C" fn rustls_default_ciphersuites_get_entry(
137
143
}
138
144
}
139
145
140
- /// Rustls' list of supported cipher suites. This is an array of pointers, and
141
- /// its length is given by `RUSTLS_ALL_CIPHER_SUITES_LEN`. The pointers will
142
- /// always be valid. The contents and order of this array may change between
143
- /// releases.
146
+ /// Rustls' list of supported cipher suites.
147
+ ///
148
+ /// This is an array of pointers, and its length is given by
149
+ /// `RUSTLS_ALL_CIPHER_SUITES_LEN`. The pointers will always be valid.
150
+ /// The contents and order of this array may change between releases.
144
151
#[ no_mangle]
145
152
pub static mut RUSTLS_ALL_CIPHER_SUITES : [ * const rustls_supported_ciphersuite ; 9 ] = [
146
153
& rustls:: crypto:: ring:: cipher_suite:: TLS13_AES_256_GCM_SHA384 as * const SupportedCipherSuite
@@ -167,10 +174,11 @@ pub static mut RUSTLS_ALL_CIPHER_SUITES: [*const rustls_supported_ciphersuite; 9
167
174
#[ no_mangle]
168
175
pub static RUSTLS_ALL_CIPHER_SUITES_LEN : usize = unsafe { RUSTLS_ALL_CIPHER_SUITES . len ( ) } ;
169
176
170
- /// Rustls' list of default cipher suites. This is an array of pointers, and
171
- /// its length is given by `RUSTLS_DEFAULT_CIPHER_SUITES_LEN`. The pointers
172
- /// will always be valid. The contents and order of this array may change
173
- /// between releases.
177
+ /// Rustls' list of default cipher suites.
178
+ ///
179
+ /// This is an array of pointers, and its length is given by
180
+ /// `RUSTLS_DEFAULT_CIPHER_SUITES_LEN`. The pointers will always be valid.
181
+ /// The contents and order of this array may change between releases.
174
182
#[ no_mangle]
175
183
pub static mut RUSTLS_DEFAULT_CIPHER_SUITES : [ * const rustls_supported_ciphersuite ; 9 ] = [
176
184
& rustls:: crypto:: ring:: cipher_suite:: TLS13_AES_256_GCM_SHA384 as * const SupportedCipherSuite
@@ -200,13 +208,15 @@ pub static RUSTLS_DEFAULT_CIPHER_SUITES_LEN: usize = unsafe { RUSTLS_DEFAULT_CIP
200
208
arc_castable ! {
201
209
/// The complete chain of certificates to send during a TLS handshake,
202
210
/// plus a private key that matches the end-entity (leaf) certificate.
211
+ ///
203
212
/// Corresponds to `CertifiedKey` in the Rust API.
204
213
/// <https://docs.rs/rustls/latest/rustls/sign/struct.CertifiedKey.html>
205
214
pub struct rustls_certified_key( CertifiedKey ) ;
206
215
}
207
216
208
217
impl rustls_certified_key {
209
218
/// Build a `rustls_certified_key` from a certificate chain and a private key.
219
+ ///
210
220
/// `cert_chain` must point to a buffer of `cert_chain_len` bytes, containing
211
221
/// a series of PEM-encoded certificates, with the end-entity (leaf)
212
222
/// certificate first.
@@ -262,8 +272,10 @@ impl rustls_certified_key {
262
272
}
263
273
}
264
274
265
- /// Return the i-th rustls_certificate in the rustls_certified_key. 0 gives the
266
- /// end-entity certificate. 1 and higher give certificates from the chain.
275
+ /// Return the i-th rustls_certificate in the rustls_certified_key.
276
+ ///
277
+ /// 0 gives the end-entity certificate. 1 and higher give certificates from the chain.
278
+ ///
267
279
/// Indexes higher than the last available certificate return NULL.
268
280
///
269
281
/// The returned certificate is valid until the rustls_certified_key is freed.
@@ -282,8 +294,11 @@ impl rustls_certified_key {
282
294
}
283
295
284
296
/// Create a copy of the rustls_certified_key with the given OCSP response data
285
- /// as DER encoded bytes. The OCSP response may be given as NULL to clear any
286
- /// possibly present OCSP data from the cloned key.
297
+ /// as DER encoded bytes.
298
+ ///
299
+ /// The OCSP response may be given as NULL to clear any possibly present OCSP
300
+ /// data from the cloned key.
301
+ ///
287
302
/// The cloned key is independent from its original and needs to be freed
288
303
/// by the application.
289
304
#[ no_mangle]
@@ -312,11 +327,13 @@ impl rustls_certified_key {
312
327
}
313
328
}
314
329
315
- /// "Free" a certified_key previously returned from
316
- /// rustls_certified_key_build. Since certified_key is actually an
317
- /// atomically reference-counted pointer, extant certified_key may still
318
- /// hold an internal reference to the Rust object. However, C code must
319
- /// consider this pointer unusable after "free"ing it.
330
+ /// "Free" a certified_key previously returned from `rustls_certified_key_build`.
331
+ ///
332
+ /// Since certified_key is actually an atomically reference-counted pointer,
333
+ /// extant certified_key may still hold an internal reference to the Rust object.
334
+ ///
335
+ /// However, C code must consider this pointer unusable after "free"ing it.
336
+ ///
320
337
/// Calling with NULL is fine. Must not be called twice with the same value.
321
338
#[ no_mangle]
322
339
pub extern "C" fn rustls_certified_key_free ( key : * const rustls_certified_key ) {
@@ -528,8 +545,9 @@ impl rustls_root_cert_store_builder {
528
545
}
529
546
530
547
/// Free a `rustls_root_cert_store_builder` previously returned from
531
- /// `rustls_root_cert_store_builder_new`. Calling with NULL is fine. Must not be
532
- /// called twice with the same value.
548
+ /// `rustls_root_cert_store_builder_new`.
549
+ ///
550
+ /// Calling with NULL is fine. Must not be called twice with the same value.
533
551
#[ no_mangle]
534
552
pub extern "C" fn rustls_root_cert_store_builder_free (
535
553
builder : * mut rustls_root_cert_store_builder ,
@@ -548,6 +566,7 @@ arc_castable! {
548
566
549
567
impl rustls_root_cert_store {
550
568
/// Free a rustls_root_cert_store previously returned from rustls_root_cert_store_builder_build.
569
+ ///
551
570
/// Calling with NULL is fine. Must not be called twice with the same value.
552
571
#[ no_mangle]
553
572
pub extern "C" fn rustls_root_cert_store_free ( store : * const rustls_root_cert_store ) {
@@ -590,21 +609,25 @@ pub(crate) struct ClientCertVerifierBuilder {
590
609
}
591
610
592
611
box_castable ! {
593
- /// A client certificate verifier being constructed. A builder can be modified by,
594
- /// e.g. `rustls_web_pki_client_cert_verifier_builder_add_crl`. Once you're
595
- /// done configuring settings, call `rustls_web_pki_client_cert_verifier_builder_build`
596
- /// to turn it into a `rustls_client_cert_verifier`. This object is not safe
597
- /// for concurrent mutation.
612
+ /// A client certificate verifier being constructed.
613
+ ///
614
+ /// A builder can be modified by, e.g. `rustls_web_pki_client_cert_verifier_builder_add_crl`.
615
+ ///
616
+ /// Once you're done configuring settings, call `rustls_web_pki_client_cert_verifier_builder_build`
617
+ /// to turn it into a `rustls_client_cert_verifier`.
618
+ ///
619
+ /// This object is not safe for concurrent mutation.
598
620
///
599
621
/// See <https://docs.rs/rustls/latest/rustls/server/struct.ClientCertVerifierBuilder.html>
600
622
/// for more information.
601
623
pub struct rustls_web_pki_client_cert_verifier_builder( Option <ClientCertVerifierBuilder >) ;
602
624
}
603
625
604
626
impl rustls_web_pki_client_cert_verifier_builder {
605
- /// Create a `rustls_web_pki_client_cert_verifier_builder`. Caller owns the memory and may
606
- /// eventually call `rustls_web_pki_client_cert_verifier_builder_free` to free it, whether or
607
- /// not `rustls_web_pki_client_cert_verifier_builder_build` was called.
627
+ /// Create a `rustls_web_pki_client_cert_verifier_builder`.
628
+ ///
629
+ /// Caller owns the memory and may eventually call `rustls_web_pki_client_cert_verifier_builder_free`
630
+ /// to free it, whether or not `rustls_web_pki_client_cert_verifier_builder_build` was called.
608
631
///
609
632
/// Without further modification the builder will produce a client certificate verifier that
610
633
/// will require a client present a client certificate that chains to one of the trust anchors
@@ -838,8 +861,9 @@ impl rustls_web_pki_client_cert_verifier_builder {
838
861
}
839
862
840
863
/// Free a `rustls_client_cert_verifier_builder` previously returned from
841
- /// `rustls_client_cert_verifier_builder_new`. Calling with NULL is fine. Must not be
842
- /// called twice with the same value.
864
+ /// `rustls_client_cert_verifier_builder_new`.
865
+ ///
866
+ /// Calling with NULL is fine. Must not be called twice with the same value.
843
867
#[ no_mangle]
844
868
pub extern "C" fn rustls_web_pki_client_cert_verifier_builder_free (
845
869
builder : * mut rustls_web_pki_client_cert_verifier_builder ,
@@ -851,11 +875,12 @@ impl rustls_web_pki_client_cert_verifier_builder {
851
875
}
852
876
853
877
box_castable ! {
854
- /// A server certificate verifier being constructed. A builder can be modified by,
855
- /// e.g. `rustls_web_pki_server_cert_verifier_builder_add_crl`. Once you're
856
- /// done configuring settings, call `rustls_web_pki_server_cert_verifier_builder_build`
857
- /// to turn it into a `rustls_server_cert_verifier`. This object is not safe
858
- /// for concurrent mutation.
878
+ /// A server certificate verifier being constructed.
879
+ ///
880
+ /// A builder can be modified by, e.g. `rustls_web_pki_server_cert_verifier_builder_add_crl`.
881
+ ///
882
+ /// Once you're done configuring settings, call `rustls_web_pki_server_cert_verifier_builder_build`
883
+ /// to turn it into a `rustls_server_cert_verifier`. This object is not safe for concurrent mutation.
859
884
///
860
885
/// See <https://docs.rs/rustls/latest/rustls/client/struct.ServerCertVerifierBuilder.html>
861
886
/// for more information.
@@ -870,9 +895,10 @@ pub(crate) struct ServerCertVerifierBuilder {
870
895
}
871
896
872
897
impl ServerCertVerifierBuilder {
873
- /// Create a `rustls_web_pki_server_cert_verifier_builder`. Caller owns the memory and may
874
- /// free it with `rustls_web_pki_server_cert_verifier_builder_free`, regardless of whether
875
- /// `rustls_web_pki_server_cert_verifier_builder_build` was called.
898
+ /// Create a `rustls_web_pki_server_cert_verifier_builder`.
899
+ ///
900
+ /// Caller owns the memory and may free it with `rustls_web_pki_server_cert_verifier_builder_free`,
901
+ /// regardless of whether `rustls_web_pki_server_cert_verifier_builder_build` was called.
876
902
///
877
903
/// Without further modification the builder will produce a server certificate verifier that
878
904
/// will require a server present a certificate that chains to one of the trust anchors
@@ -1031,8 +1057,9 @@ impl ServerCertVerifierBuilder {
1031
1057
}
1032
1058
1033
1059
/// Free a `rustls_server_cert_verifier_builder` previously returned from
1034
- /// `rustls_server_cert_verifier_builder_new`. Calling with NULL is fine. Must not be
1035
- /// called twice with the same value.
1060
+ /// `rustls_server_cert_verifier_builder_new`.
1061
+ ///
1062
+ /// Calling with NULL is fine. Must not be called twice with the same value.
1036
1063
#[ no_mangle]
1037
1064
pub extern "C" fn rustls_web_pki_server_cert_verifier_builder_free (
1038
1065
builder : * mut rustls_web_pki_server_cert_verifier_builder ,
@@ -1076,6 +1103,7 @@ impl rustls_server_cert_verifier {
1076
1103
1077
1104
/// Free a `rustls_server_cert_verifier` previously returned from
1078
1105
/// `rustls_server_cert_verifier_builder_build` or `rustls_platform_server_cert_verifier`.
1106
+ ///
1079
1107
/// Calling with NULL is fine. Must not be called twice with the same value.
1080
1108
#[ no_mangle]
1081
1109
pub extern "C" fn rustls_server_cert_verifier_free ( verifier : * mut rustls_server_cert_verifier ) {
0 commit comments