@@ -675,6 +675,10 @@ _state_machine_run (_state_machine_t *state_machine,
675
675
return ret ;
676
676
}
677
677
678
+ /* _parse_one_tls_opts parses one TLS document.
679
+ * @iter is an iterator at the start of a KMS provider key/value pair.
680
+ * @out_opt is written to on success, and left unmodified on error.
681
+ * Returns false and sets @error on error. */
678
682
static bool
679
683
_parse_one_tls_opts (bson_iter_t * iter ,
680
684
mongoc_ssl_opt_t * out_opt ,
@@ -749,6 +753,12 @@ _parse_one_tls_opts (bson_iter_t *iter,
749
753
return ok ;
750
754
}
751
755
756
+ /* _parse_all_tls_opts initializes TLS options for all KMS providers.
757
+ * @tls_opts is the BSON document passed through
758
+ * mongoc_client_encryption_opts_set_tls_opts or
759
+ * mongoc_auto_encryption_opts_set_tls_opts.
760
+ * Defaults to using mongoc_ssl_opt_get_default() if options are not passed for
761
+ * a provider. Returns false and sets @error on error. */
752
762
static bool
753
763
_parse_all_tls_opts (_mongoc_crypt_t * crypt ,
754
764
const bson_t * tls_opts ,
@@ -757,18 +767,6 @@ _parse_all_tls_opts (_mongoc_crypt_t *crypt,
757
767
bson_iter_t iter ;
758
768
bool ok = false;
759
769
760
- if (!tls_opts ) {
761
- return true;
762
- }
763
-
764
- if (!bson_iter_init (& iter , tls_opts )) {
765
- bson_set_error (error ,
766
- MONGOC_ERROR_CLIENT_SIDE_ENCRYPTION ,
767
- MONGOC_ERROR_CLIENT_INVALID_ENCRYPTION_ARG ,
768
- "Error starting iteration of TLS options" );
769
- goto fail ;
770
- }
771
-
772
770
_mongoc_ssl_opts_copy_to (mongoc_ssl_opt_get_default (),
773
771
& crypt -> aws_tls_opt ,
774
772
false /* copy internal */ );
@@ -785,6 +783,17 @@ _parse_all_tls_opts (_mongoc_crypt_t *crypt,
785
783
& crypt -> kmip_tls_opt ,
786
784
false /* copy internal */ );
787
785
786
+ if (!tls_opts ) {
787
+ return true;
788
+ }
789
+
790
+ if (!bson_iter_init (& iter , tls_opts )) {
791
+ bson_set_error (error ,
792
+ MONGOC_ERROR_CLIENT_SIDE_ENCRYPTION ,
793
+ MONGOC_ERROR_CLIENT_INVALID_ENCRYPTION_ARG ,
794
+ "Error starting iteration of TLS options" );
795
+ goto fail ;
796
+ }
788
797
789
798
while (bson_iter_next (& iter )) {
790
799
const char * key ;
0 commit comments