25
25
#define UPDATE_ERROR_NO_PARTITION (10 )
26
26
#define UPDATE_ERROR_BAD_ARGUMENT (11 )
27
27
#define UPDATE_ERROR_ABORT (12 )
28
- #define UPDATE_ERROR_DECRYPT (13 )
29
28
30
29
#define UPDATE_SIZE_UNKNOWN 0xFFFFFFFF
31
30
32
31
#define U_FLASH 0
33
32
#define U_SPIFFS 100
34
33
#define U_AUTH 200
35
34
36
- #define ENCRYPTED_BLOCK_SIZE 16
37
- #define ENCRYPTED_TWEAK_BLOCK_SIZE 32
38
- #define ENCRYPTED_KEY_SIZE 32
39
-
40
- #define U_AES_DECRYPT_NONE 0
41
- #define U_AES_DECRYPT_AUTO 1
42
- #define U_AES_DECRYPT_ON 2
43
- #define U_AES_DECRYPT_MODE_MASK 3
44
- #define U_AES_IMAGE_DECRYPTING_BIT 4
35
+ #define ENCRYPTED_BLOCK_SIZE 16
45
36
46
37
#define SPI_SECTORS_PER_BLOCK 16 // usually large erase block is 32k/64k
47
38
#define SPI_FLASH_BLOCK_SIZE (SPI_SECTORS_PER_BLOCK * SPI_FLASH_SEC_SIZE)
@@ -63,15 +54,6 @@ class UpdateClass {
63
54
*/
64
55
bool begin (size_t size = UPDATE_SIZE_UNKNOWN, int command = U_FLASH, int ledPin = -1 , uint8_t ledOn = LOW, const char *label = NULL );
65
56
66
- /*
67
- Setup decryption configuration
68
- Crypt Key is 32bytes(256bits) block of data, use the same key as used to encrypt image file
69
- Crypt Address, use the same value as used to encrypt image file
70
- Crypt Config, use the same value as used to encrypt image file
71
- Crypt Mode, used to select if image files should be decrypted or not
72
- */
73
- bool setupCrypt (const uint8_t *cryptKey = 0 , size_t cryptAddress = 0 , uint8_t cryptConfig = 0xf , int cryptMode = U_AES_DECRYPT_AUTO);
74
-
75
57
/*
76
58
Writes a buffer to the flash and increments the address
77
59
Returns the amount written
@@ -99,30 +81,6 @@ class UpdateClass {
99
81
*/
100
82
bool end (bool evenIfRemaining = false );
101
83
102
- /*
103
- sets AES256 key(32 bytes) used for decrypting image file
104
- */
105
- bool setCryptKey (const uint8_t *cryptKey);
106
-
107
- /*
108
- sets crypt mode used on image files
109
- */
110
- bool setCryptMode (const int cryptMode);
111
-
112
- /*
113
- sets address used for decrypting image file
114
- */
115
- void setCryptAddress (const size_t cryptAddress) {
116
- _cryptAddress = cryptAddress & 0x00fffff0 ;
117
- }
118
-
119
- /*
120
- sets crypt config used for decrypting image file
121
- */
122
- void setCryptConfig (const uint8_t cryptConfig) {
123
- _cryptCfg = cryptConfig & 0x0f ;
124
- }
125
-
126
84
/*
127
85
Aborts the running update
128
86
*/
@@ -137,9 +95,8 @@ class UpdateClass {
137
95
138
96
/*
139
97
sets the expected MD5 for the firmware (hexString)
140
- 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
98
*/
142
- bool setMD5 (const char *expected_md5, bool calc_post_decryption = true );
99
+ bool setMD5 (const char *expected_md5);
143
100
144
101
/*
145
102
returns the MD5 String of the successfully ended firmware
@@ -236,17 +193,13 @@ class UpdateClass {
236
193
private:
237
194
void _reset ();
238
195
void _abort (uint8_t err);
239
- void _cryptKeyTweak (size_t cryptAddress, uint8_t *tweaked_key);
240
- bool _decryptBuffer ();
241
196
bool _writeBuffer ();
242
197
bool _verifyHeader (uint8_t data);
243
198
bool _verifyEnd ();
244
199
bool _enablePartition (const esp_partition_t *partition);
245
200
bool _chkDataInBlock (const uint8_t *data, size_t len) const ; // check if block contains any data or is empty
246
201
247
202
uint8_t _error;
248
- uint8_t *_cryptKey;
249
- uint8_t *_cryptBuffer;
250
203
uint8_t *_buffer;
251
204
uint8_t *_skipBuffer;
252
205
size_t _bufferLen;
@@ -258,15 +211,10 @@ class UpdateClass {
258
211
const esp_partition_t *_partition;
259
212
260
213
String _target_md5;
261
- bool _target_md5_decrypted = true ;
262
214
MD5Builder _md5;
263
215
264
216
int _ledPin;
265
217
uint8_t _ledOn;
266
-
267
- uint8_t _cryptMode;
268
- size_t _cryptAddress;
269
- uint8_t _cryptCfg;
270
218
};
271
219
272
220
#if !defined(NO_GLOBAL_INSTANCES) && !defined(NO_GLOBAL_UPDATE)
0 commit comments