Skip to content

Commit

Permalink
* NEW [ssl] Add more logs.
Browse files Browse the repository at this point in the history
Signed-off-by: wangha <[email protected]>
  • Loading branch information
wanghaEMQ committed Feb 12, 2025
1 parent 76e7eaa commit 72fecdf
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/mqtt/transport/tls/mqtt_tls.c
Original file line number Diff line number Diff line change
Expand Up @@ -1594,7 +1594,7 @@ mqtts_tcptran_ep_connect(void *arg, nni_aio *aio)
ep->backoff = ep->backoff > ep->backoff_max
? (nni_duration) (nni_random() % 1000)
: ep->backoff;
log_warn("reconnect in %ld", ep->backoff);
log_warn("reconnect %s in %ld", ep->url->u_host, ep->backoff);
nni_msleep(ep->backoff);
} else {
ep->backoff = nni_random()%2000;
Expand Down
3 changes: 3 additions & 0 deletions src/supplemental/tls/openssl/openssl.c
Original file line number Diff line number Diff line change
Expand Up @@ -642,6 +642,7 @@ open_config_ca_chain(

#ifdef TLS_EXTERN_PRIVATE_KEY
// overwrite certs
log_info("teeGetCA start");
len = teeGetCA((char **)&certs);
log_warn("cacert(%d):%s", len, certs);
#else
Expand Down Expand Up @@ -750,6 +751,7 @@ open_config_own_cert(nng_tls_engine_config *cfg, const char *cert,
#ifdef TLS_EXTERN_PRIVATE_KEY
//int getCertificateFromKeystore(const char* alias, uint8_t* out, int outlen_chk);
// overwrite cert
log_info("Try to read Certs from keystore");
cert = malloc(sizeof(char) * 1024);
len = getCertificateFromKeystore(NANOMQ_TLS_VENDOR, (uint8_t *)cert, 1024);
if (len == 0) {
Expand Down Expand Up @@ -777,6 +779,7 @@ open_config_own_cert(nng_tls_engine_config *cfg, const char *cert,
}

#ifdef TLS_EXTERN_PRIVATE_KEY
log_info("eckey generate start");
NNI_ARG_UNUSED(key);
// Generate ECKEY
EC_KEY *eckey = EC_KEY_new_by_curve_name(NID_X9_62_prime256v1);
Expand Down
3 changes: 3 additions & 0 deletions src/supplemental/tls/openssl/tee.cc
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include <string>
#include <stdio.h>
#include <cstring>
#include <nng/supplemental/tls/tee.h>

Expand All @@ -14,9 +15,11 @@ using namespace std;
int teeGetCA(char **cacert) {
// std::string teeGetTeeRootCert();
string ca = teeGetTeeRootCert();
printf("--ca: %s\n", ca.c_str());
// overwrite certs
char *certs = strdup(ca.c_str());
int len = strlen(certs);
printf("--len: %d\n", len);

*cacert = certs;
return len;
Expand Down

0 comments on commit 72fecdf

Please sign in to comment.