[ESP32] encrypted_ota: Call abort API when aborting OTA and some refactoring (#28778)
* [ESP32] encrypted_ota: Call abort API when aborting and some refactoring
* Make DecryptEnd return an error and honour it
* Restyled by clang-format
---------
Co-authored-by: Restyled.io <commits@restyled.io>
diff --git a/src/platform/ESP32/OTAImageProcessorImpl.h b/src/platform/ESP32/OTAImageProcessorImpl.h
index 03e1367..4162711 100644
--- a/src/platform/ESP32/OTAImageProcessorImpl.h
+++ b/src/platform/ESP32/OTAImageProcessorImpl.h
@@ -67,7 +67,14 @@
OTAImageHeaderParser mHeaderParser;
#if CONFIG_ENABLE_ENCRYPTED_OTA
- void EndDecryption();
+ CHIP_ERROR DecryptStart();
+ CHIP_ERROR DecryptEnd();
+ void DecryptAbort();
+
+ // This API decrypts the blockToDecrypt, dynamically allocates the memory for storing the
+ // plain text, and return that in decryptedBlock.
+ // Caller shall free the memory after use by calling free() on decryptedBlock.data()
+ CHIP_ERROR DecryptBlock(const ByteSpan & blockToDecrypt, ByteSpan & decryptedBlock);
CharSpan mKey;
bool mEncryptedOTAEnabled = false;