From a8259973c60a7df199ccfb74a484255200f671b8 Mon Sep 17 00:00:00 2001 From: Evan Feenstra Date: Fri, 25 Aug 2023 08:51:50 -0700 Subject: [PATCH] put tls behind feature flag --- deploy.sh | 2 +- sphinx-key/Cargo.toml | 1 + sphinx-key/src/conn/mqtt.rs | 9 +++++++-- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/deploy.sh b/deploy.sh index f391bea..38592c6 100755 --- a/deploy.sh +++ b/deploy.sh @@ -63,7 +63,7 @@ then echo "Make sure the ESP is connected with a data USB cable, and try again." exit 1 fi -esptool.py erase_flash && +# esptool.py erase_flash && git pull && cd factory && cargo espflash flash --release --port $PORT && diff --git a/sphinx-key/Cargo.toml b/sphinx-key/Cargo.toml index d1d54b1..1b697fc 100644 --- a/sphinx-key/Cargo.toml +++ b/sphinx-key/Cargo.toml @@ -10,6 +10,7 @@ default = ["std"] no_persist = [] pingpong = [] std = ["sphinx-signer"] +tls = [] [dependencies] hex = "0.4.3" diff --git a/sphinx-key/src/conn/mqtt.rs b/sphinx-key/src/conn/mqtt.rs index 07381b2..5bec1ce 100644 --- a/sphinx-key/src/conn/mqtt.rs +++ b/sphinx-key/src/conn/mqtt.rs @@ -24,16 +24,21 @@ pub fn make_client( tx: mpsc::Sender, ) -> Result>> { log::info!("make_client with id {}", client_id); - let conf = MqttClientConfiguration { + let mut conf = MqttClientConfiguration { client_id: Some(client_id), buffer_size: 4096, task_stack: 12288, username: Some(username), password: Some(password), - crt_bundle_attach: Some(esp_idf_sys::esp_crt_bundle_attach), + // crt_bundle_attach: Some(esp_idf_sys::esp_crt_bundle_attach), ..Default::default() }; + #[cfg(feature = "tls")] + { + conf.crt_bundle_attach = Some(esp_idf_sys::esp_crt_bundle_attach); + } + let mut mqtturl = broker.to_string(); if !(mqtturl.starts_with("mqtt://") || mqtturl.starts_with("mqtts://")) { let scheme = if mqtturl.contains("8883") {