@@ -63,6 +63,7 @@ class UpdateClass {
6363 */
6464 bool begin (size_t size = UPDATE_SIZE_UNKNOWN, int command = U_FLASH, int ledPin = -1 , uint8_t ledOn = LOW, const char *label = NULL );
6565
66+ #ifdef UPDATE_CRYPT
6667 /*
6768 Setup decryption configuration
6869 Crypt Key is 32bytes(256bits) block of data, use the same key as used to encrypt image file
@@ -71,6 +72,7 @@ class UpdateClass {
7172 Crypt Mode, used to select if image files should be decrypted or not
7273 */
7374 bool setupCrypt (const uint8_t *cryptKey = 0 , size_t cryptAddress = 0 , uint8_t cryptConfig = 0xf , int cryptMode = U_AES_DECRYPT_AUTO);
75+ #endif /* UPDATE_CRYPT */
7476
7577 /*
7678 Writes a buffer to the flash and increments the address
@@ -99,6 +101,7 @@ class UpdateClass {
99101 */
100102 bool end (bool evenIfRemaining = false );
101103
104+ #ifdef UPDATE_CRYPT
102105 /*
103106 sets AES256 key(32 bytes) used for decrypting image file
104107 */
@@ -122,6 +125,7 @@ class UpdateClass {
122125 void setCryptConfig (const uint8_t cryptConfig) {
123126 _cryptCfg = cryptConfig & 0x0f ;
124127 }
128+ #endif /* UPDATE_CRYPT */
125129
126130 /*
127131 Aborts the running update
@@ -139,7 +143,11 @@ class UpdateClass {
139143 sets the expected MD5 for the firmware (hexString)
140144 If calc_post_decryption is true, the update library will calculate the MD5 after the decryption, if false the calculation occurs before the decryption
141145 */
142- bool setMD5 (const char *expected_md5, bool calc_post_decryption = true );
146+ bool setMD5 (const char *expected_md5
147+ #ifdef UPDATE_CRYPT
148+ , bool calc_post_decryption = true
149+ #endif /* #ifdef UPDATE_CRYPT */
150+ );
143151
144152 /*
145153 returns the MD5 String of the successfully ended firmware
@@ -236,17 +244,21 @@ class UpdateClass {
236244private:
237245 void _reset ();
238246 void _abort (uint8_t err);
247+ #ifdef UPDATE_CRYPT
239248 void _cryptKeyTweak (size_t cryptAddress, uint8_t *tweaked_key);
240249 bool _decryptBuffer ();
250+ #endif /* UPDATE_CRYPT */
241251 bool _writeBuffer ();
242252 bool _verifyHeader (uint8_t data);
243253 bool _verifyEnd ();
244254 bool _enablePartition (const esp_partition_t *partition);
245255 bool _chkDataInBlock (const uint8_t *data, size_t len) const ; // check if block contains any data or is empty
246256
247257 uint8_t _error;
258+ #ifdef UPDATE_CRYPT
248259 uint8_t *_cryptKey;
249260 uint8_t *_cryptBuffer;
261+ #endif /* UPDATE_CRYPT */
250262 uint8_t *_buffer;
251263 uint8_t *_skipBuffer;
252264 size_t _bufferLen;
@@ -258,15 +270,19 @@ class UpdateClass {
258270 const esp_partition_t *_partition;
259271
260272 String _target_md5;
273+ #ifdef UPDATE_CRYPT
261274 bool _target_md5_decrypted = true ;
275+ #endif /* UPDATE_CRYPT */
262276 MD5Builder _md5;
263277
264278 int _ledPin;
265279 uint8_t _ledOn;
266280
281+ #ifdef UPDATE_CRYPT
267282 uint8_t _cryptMode;
268283 size_t _cryptAddress;
269284 uint8_t _cryptCfg;
285+ #endif /* UPDATE_CRYPT */
270286};
271287
272288#if !defined(NO_GLOBAL_INSTANCES) && !defined(NO_GLOBAL_UPDATE)
0 commit comments