mirror of
https://github.com/esphome/esphome.git
synced 2025-09-29 08:32:26 +01:00
stack it
This commit is contained in:
@@ -724,11 +724,11 @@ bool ESPHomeOTAComponent::prepare_auth_nonce_(HashBase *hasher) {
|
|||||||
// Calculate required buffer size using the hasher
|
// Calculate required buffer size using the hasher
|
||||||
const size_t hex_size = hasher->get_size() * 2;
|
const size_t hex_size = hasher->get_size() * 2;
|
||||||
const size_t nonce_len = hasher->get_size() / 4;
|
const size_t nonce_len = hasher->get_size() / 4;
|
||||||
// Buffer needs to hold max of:
|
// Buffer layout:
|
||||||
// - During send: auth_type (1) + nonce (hex_size)
|
// - auth_type (1 byte) + nonce (hex_size) - sent in AUTH_SEND
|
||||||
// - During read: cnonce (hex_size) + response (hex_size)
|
// - cnonce (hex_size) + response (hex_size) - read in AUTH_READ at offset 1+hex_size
|
||||||
// So max is hex_size * 2
|
// Total: 1 + hex_size + (hex_size * 2)
|
||||||
const size_t auth_buf_size = hex_size * 2;
|
const size_t auth_buf_size = 1 + hex_size + hex_size * 2;
|
||||||
this->auth_buf_ = std::make_unique<uint8_t[]>(auth_buf_size);
|
this->auth_buf_ = std::make_unique<uint8_t[]>(auth_buf_size);
|
||||||
this->auth_buf_pos_ = 0;
|
this->auth_buf_pos_ = 0;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user