From acb561633405ad3976bc425133f25bdaafbb496c Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Fri, 19 Sep 2025 17:00:03 -0600 Subject: [PATCH] make member --- esphome/components/esphome/ota/ota_esphome.cpp | 10 +++++----- esphome/components/esphome/ota/ota_esphome.h | 1 + 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/esphome/components/esphome/ota/ota_esphome.cpp b/esphome/components/esphome/ota/ota_esphome.cpp index d638b030e9..0eef0f0a57 100644 --- a/esphome/components/esphome/ota/ota_esphome.cpp +++ b/esphome/components/esphome/ota/ota_esphome.cpp @@ -120,7 +120,7 @@ template<> struct HashTraits { }; #endif -template bool perform_hash_auth(ESPHomeOTAComponent *ota, const std::string &password) { +template bool ESPHomeOTAComponent::perform_hash_auth_(const std::string &password) { using Traits = HashTraits; // Minimize stack usage by reusing buffers @@ -137,7 +137,7 @@ template bool perform_hash_auth(ESPHomeOTAComponent *ota, co // Send auth request type buf[0] = Traits::AUTH_REQUEST; - ota->writeall_(buf, 1); + this->writeall_(buf, 1); HashClass hasher; hasher.init(); @@ -173,7 +173,7 @@ template bool perform_hash_auth(ESPHomeOTAComponent *ota, co ESP_LOGV("esphome.ota", "Auth: %s Nonce is %s", Traits::NAME, hex_buffer1); // Send nonce - if (!ota->writeall_(reinterpret_cast(hex_buffer1), Traits::HEX_SIZE)) { + if (!this->writeall_(reinterpret_cast(hex_buffer1), Traits::HEX_SIZE)) { ESP_LOGW("esphome.ota", "Auth: Writing %s nonce failed", Traits::NAME); return false; } @@ -184,7 +184,7 @@ template bool perform_hash_auth(ESPHomeOTAComponent *ota, co hasher.add(hex_buffer1, Traits::HEX_SIZE); // Add nonce // Receive cnonce into hex_buffer2 - if (!ota->readall_(reinterpret_cast(hex_buffer2), Traits::HEX_SIZE)) { + if (!this->readall_(reinterpret_cast(hex_buffer2), Traits::HEX_SIZE)) { ESP_LOGW("esphome.ota", "Auth: Reading %s cnonce failed", Traits::NAME); return false; } @@ -201,7 +201,7 @@ template bool perform_hash_auth(ESPHomeOTAComponent *ota, co ESP_LOGV("esphome.ota", "Auth: %s Result is %s", Traits::NAME, hex_buffer1); // Receive response - reuse hex_buffer2 - if (!ota->readall_(reinterpret_cast(hex_buffer2), Traits::HEX_SIZE)) { + if (!this->readall_(reinterpret_cast(hex_buffer2), Traits::HEX_SIZE)) { ESP_LOGW("esphome.ota", "Auth: Reading %s response failed", Traits::NAME); return false; } diff --git a/esphome/components/esphome/ota/ota_esphome.h b/esphome/components/esphome/ota/ota_esphome.h index f5a3e43ae3..8bfb1658b2 100644 --- a/esphome/components/esphome/ota/ota_esphome.h +++ b/esphome/components/esphome/ota/ota_esphome.h @@ -30,6 +30,7 @@ class ESPHomeOTAComponent : public ota::OTAComponent { protected: void handle_handshake_(); void handle_data_(); + template bool perform_hash_auth_(const std::string &password); bool readall_(uint8_t *buf, size_t len); bool writeall_(const uint8_t *buf, size_t len); void log_socket_error_(const LogString *msg);