Skip to content

Commit b120eff

Browse files
expressvpn-raihaan-mxv-raihaan-m
authored andcommitted
api: add he_enable_debugging function
1 parent aeeb6ac commit b120eff

File tree

5 files changed

+33
-1
lines changed

5 files changed

+33
-1
lines changed

3rd_party_deps.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
--disable-dilithium
1212
--enable-aes-bitsliced
1313
--enable-curve25519
14+
--enable-debug
1415
--enable-dtls
1516
--enable-dtls13
1617
--enable-dtls-frag-ch

ios/autotools-ios-helper.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,9 @@ build() {
6666
--enable-aes-bitsliced \
6767
--enable-experimental \
6868
--enable-sha3 \
69-
--enable-kyber=all,original,ml-kem
69+
--enable-kyber=all,original,ml-kem \
70+
--enable-debug
71+
7072
make clean
7173
mkdir -p "${EXEC_PREFIX}"
7274
make V=1 -j"${MAKE_JOBS}" --debug=j

public/he.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -644,6 +644,14 @@ he_return_code_t he_init(void);
644644
*/
645645
he_return_code_t he_cleanup(void);
646646

647+
typedef void (*he_log_cb_t)(const int log_level, const char *const log_msg);
648+
649+
/**
650+
* @brief Enable WolfSSL debug logging and set the log callback
651+
* @return HE_SUCCESS on success, HE_ERR_FAILED on any error.
652+
*/
653+
he_return_code_t he_enable_debugging(he_log_cb_t log_cb);
654+
647655
/**
648656
* @brief Checks whether the client context has the basic configuration to allow Helium to connect.
649657
* @param ctx A pointer to a valid SSL context configuration

src/he/ssl_ctx.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,19 @@ he_return_code_t he_cleanup() {
5252
return HE_SUCCESS;
5353
}
5454

55+
he_return_code_t he_enable_debugging(he_log_cb_t log_cb) {
56+
int rc = wolfSSL_Debugging_ON();
57+
if(rc) {
58+
return HE_ERR_FAILED;
59+
}
60+
if(log_cb) {
61+
if(wolfSSL_SetLoggingCb(log_cb)) {
62+
return HE_ERR_FAILED;
63+
}
64+
};
65+
return HE_SUCCESS;
66+
}
67+
5568
static he_return_code_t he_ssl_ctx_is_valid_common(he_ssl_ctx_t *ctx) {
5669
if(!ctx) {
5770
return HE_ERR_NULL_POINTER;

src/he/ssl_ctx.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,14 @@ he_return_code_t he_init(void);
5555
*/
5656
he_return_code_t he_cleanup(void);
5757

58+
typedef void (*he_log_cb_t)(const int log_level, const char *const log_msg);
59+
60+
/**
61+
* @brief Enable WolfSSL debug logging and set the log callback
62+
* @return HE_SUCCESS on success, HE_ERR_FAILED on any error.
63+
*/
64+
he_return_code_t he_enable_debugging(he_log_cb_t log_cb);
65+
5866
/**
5967
* @brief Checks whether the client context has the basic configuration to allow Helium to connect.
6068
* @param ctx A pointer to a valid SSL context configuration

0 commit comments

Comments
 (0)