mirror of
https://github.com/esphome/esphome.git
synced 2026-09-11 15:27:33 +00:00
Document the key clear window instead of guarding it
This commit is contained in:
@@ -41,15 +41,10 @@ ESPHomeOTAComponent::NoiseSession::~NoiseSession() {
|
||||
* "NoiseOTAInit" | magic(5) | OK,version | client_features | FEATURE_FLAGS,server_flags
|
||||
*/
|
||||
bool ESPHomeOTAComponent::noise_start_session_(uint8_t server_feature_flags) {
|
||||
#ifdef USE_OTA_ENCRYPTION_PROVISIONED
|
||||
// The key can be cleared between the offer and the client taking it; a
|
||||
// missing key must not turn into a handshake on the all-zeros key
|
||||
if (!this->noise_context_().has_psk()) {
|
||||
ESP_LOGW(TAG, "Key cleared");
|
||||
this->cleanup_connection_();
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
// Not guarded against a provisioned key being cleared between the offer and
|
||||
// here: the clear is deferred 100 ms and the ack write rarely blocks, and a
|
||||
// session on the zero key that load_psk then fills in fails the real
|
||||
// client's MAC. Yaml keys cannot change, so no check is needed there.
|
||||
// Default-init: the frame buffer is always written before it is read, so
|
||||
// skip zeroing its 132 bytes
|
||||
// NOLINTNEXTLINE(clang-analyzer-cplusplus.NewDeleteLeaks)
|
||||
|
||||
Reference in New Issue
Block a user