@@ -63,6 +63,7 @@ class UpdateClass {
63
63
*/
64
64
bool begin (size_t size = UPDATE_SIZE_UNKNOWN, int command = U_FLASH, int ledPin = -1 , uint8_t ledOn = LOW, const char *label = NULL );
65
65
66
+ #ifdef UPDATE_CRYPT
66
67
/*
67
68
Setup decryption configuration
68
69
Crypt Key is 32bytes(256bits) block of data, use the same key as used to encrypt image file
@@ -71,6 +72,7 @@ class UpdateClass {
71
72
Crypt Mode, used to select if image files should be decrypted or not
72
73
*/
73
74
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 */
74
76
75
77
/*
76
78
Writes a buffer to the flash and increments the address
@@ -99,6 +101,7 @@ class UpdateClass {
99
101
*/
100
102
bool end (bool evenIfRemaining = false );
101
103
104
+ #ifdef UPDATE_CRYPT
102
105
/*
103
106
sets AES256 key(32 bytes) used for decrypting image file
104
107
*/
@@ -122,6 +125,7 @@ class UpdateClass {
122
125
void setCryptConfig (const uint8_t cryptConfig) {
123
126
_cryptCfg = cryptConfig & 0x0f ;
124
127
}
128
+ #endif /* UPDATE_CRYPT */
125
129
126
130
/*
127
131
Aborts the running update
@@ -139,7 +143,11 @@ class UpdateClass {
139
143
sets the expected MD5 for the firmware (hexString)
140
144
If calc_post_decryption is true, the update library will calculate the MD5 after the decryption, if false the calculation occurs before the decryption
141
145
*/
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
+ );
143
151
144
152
/*
145
153
returns the MD5 String of the successfully ended firmware
@@ -236,17 +244,21 @@ class UpdateClass {
236
244
private:
237
245
void _reset ();
238
246
void _abort (uint8_t err);
247
+ #ifdef UPDATE_CRYPT
239
248
void _cryptKeyTweak (size_t cryptAddress, uint8_t *tweaked_key);
240
249
bool _decryptBuffer ();
250
+ #endif /* UPDATE_CRYPT */
241
251
bool _writeBuffer ();
242
252
bool _verifyHeader (uint8_t data);
243
253
bool _verifyEnd ();
244
254
bool _enablePartition (const esp_partition_t *partition);
245
255
bool _chkDataInBlock (const uint8_t *data, size_t len) const ; // check if block contains any data or is empty
246
256
247
257
uint8_t _error;
258
+ #ifdef UPDATE_CRYPT
248
259
uint8_t *_cryptKey;
249
260
uint8_t *_cryptBuffer;
261
+ #endif /* UPDATE_CRYPT */
250
262
uint8_t *_buffer;
251
263
uint8_t *_skipBuffer;
252
264
size_t _bufferLen;
@@ -258,15 +270,19 @@ class UpdateClass {
258
270
const esp_partition_t *_partition;
259
271
260
272
String _target_md5;
273
+ #ifdef UPDATE_CRYPT
261
274
bool _target_md5_decrypted = true ;
275
+ #endif /* UPDATE_CRYPT */
262
276
MD5Builder _md5;
263
277
264
278
int _ledPin;
265
279
uint8_t _ledOn;
266
280
281
+ #ifdef UPDATE_CRYPT
267
282
uint8_t _cryptMode;
268
283
size_t _cryptAddress;
269
284
uint8_t _cryptCfg;
285
+ #endif /* UPDATE_CRYPT */
270
286
};
271
287
272
288
#if !defined(NO_GLOBAL_INSTANCES) && !defined(NO_GLOBAL_UPDATE)
0 commit comments