Skip to content

Commit 62cf2a0

Browse files
paulmelnikowhanumantmk
authored andcommitted
Conditionally compile SSL and SASL
This allows building *.[ch] even when libssl and/or libsasl are not available. This helps get the library to build for iOS, and similarly would be helpful for building the library under any third-party build system. Sort of an aside: on Mac OS libssl is deprecated. iOS has never shipped with it. On Mac OS the headers are in /usr/include but aren't available when building an iOS project. Ideally, someday, libmongoc would support both libssl and Common Crypto, Apple's implementation.
1 parent 3f27034 commit 62cf2a0

File tree

6 files changed

+18
-0
lines changed

6 files changed

+18
-0
lines changed

src/mongoc/mongoc-b64-private.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,11 @@ b64_ntop (uint8_t const *src,
3434
void
3535
b64_initialize_rmap (void);
3636

37+
#ifdef MONGOC_ENABLE_SSL
3738
int
3839
b64_pton (char const *src,
3940
uint8_t *target,
4041
size_t targsize);
42+
#endif
4143

4244
#endif /* MONGOC_B64_PRIVATE_H */

src/mongoc/mongoc-rand.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
* limitations under the License.
1515
*/
1616

17+
#ifdef MONGOC_ENABLE_SSL
18+
1719
#include "mongoc-rand.h"
1820
#include "mongoc-rand-private.h"
1921

@@ -40,3 +42,5 @@ void mongoc_rand_add(const void* buf, int num, double entropy) {
4042
int mongoc_rand_status(void) {
4143
return RAND_status();
4244
}
45+
46+
#endif

src/mongoc/mongoc-sasl.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17+
#ifdef MONGOC_ENABLE_SASL
1718

1819
#include <string.h>
1920

@@ -346,3 +347,5 @@ _mongoc_sasl_step (mongoc_sasl_t *sasl,
346347

347348
return true;
348349
}
350+
351+
#endif

src/mongoc/mongoc-scram.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
* limitations under the License.
1414
*/
1515

16+
#ifdef MONGOC_ENABLE_SSL
1617

1718
#include <string.h>
1819

@@ -799,3 +800,5 @@ _mongoc_scram_step (mongoc_scram_t *scram,
799800

800801
return true;
801802
}
803+
804+
#endif

src/mongoc/mongoc-ssl.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17+
#ifdef MONGOC_ENABLE_SSL
1718

1819
#include <bson.h>
1920
#include <limits.h>
@@ -548,3 +549,5 @@ _mongoc_ssl_thread_cleanup (void)
548549
}
549550
OPENSSL_free (gMongocSslThreadLocks);
550551
}
552+
553+
#endif

src/mongoc/mongoc-stream-tls.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17+
#ifdef MONGOC_ENABLE_SSL
1718

1819
#include <bson.h>
1920

@@ -799,3 +800,5 @@ mongoc_stream_tls_new (mongoc_stream_t *base_stream,
799800

800801
return (mongoc_stream_t *)tls;
801802
}
803+
804+
#endif

0 commit comments

Comments
 (0)