Skip to content

Commit 03b6488

Browse files
authored
Update Update.h
1 parent 9fd1bf3 commit 03b6488

File tree

1 file changed

+2
-54
lines changed

1 file changed

+2
-54
lines changed

libraries/Update/src/Update.h

Lines changed: 2 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -25,23 +25,14 @@
2525
#define UPDATE_ERROR_NO_PARTITION (10)
2626
#define UPDATE_ERROR_BAD_ARGUMENT (11)
2727
#define UPDATE_ERROR_ABORT (12)
28-
#define UPDATE_ERROR_DECRYPT (13)
2928

3029
#define UPDATE_SIZE_UNKNOWN 0xFFFFFFFF
3130

3231
#define U_FLASH 0
3332
#define U_SPIFFS 100
3433
#define U_AUTH 200
3534

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
4536

4637
#define SPI_SECTORS_PER_BLOCK 16 // usually large erase block is 32k/64k
4738
#define SPI_FLASH_BLOCK_SIZE (SPI_SECTORS_PER_BLOCK * SPI_FLASH_SEC_SIZE)
@@ -63,15 +54,6 @@ class UpdateClass {
6354
*/
6455
bool begin(size_t size = UPDATE_SIZE_UNKNOWN, int command = U_FLASH, int ledPin = -1, uint8_t ledOn = LOW, const char *label = NULL);
6556

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-
7557
/*
7658
Writes a buffer to the flash and increments the address
7759
Returns the amount written
@@ -99,30 +81,6 @@ class UpdateClass {
9981
*/
10082
bool end(bool evenIfRemaining = false);
10183

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-
12684
/*
12785
Aborts the running update
12886
*/
@@ -137,9 +95,8 @@ class UpdateClass {
13795

13896
/*
13997
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
14198
*/
142-
bool setMD5(const char *expected_md5, bool calc_post_decryption = true);
99+
bool setMD5(const char *expected_md5);
143100

144101
/*
145102
returns the MD5 String of the successfully ended firmware
@@ -236,17 +193,13 @@ class UpdateClass {
236193
private:
237194
void _reset();
238195
void _abort(uint8_t err);
239-
void _cryptKeyTweak(size_t cryptAddress, uint8_t *tweaked_key);
240-
bool _decryptBuffer();
241196
bool _writeBuffer();
242197
bool _verifyHeader(uint8_t data);
243198
bool _verifyEnd();
244199
bool _enablePartition(const esp_partition_t *partition);
245200
bool _chkDataInBlock(const uint8_t *data, size_t len) const; // check if block contains any data or is empty
246201

247202
uint8_t _error;
248-
uint8_t *_cryptKey;
249-
uint8_t *_cryptBuffer;
250203
uint8_t *_buffer;
251204
uint8_t *_skipBuffer;
252205
size_t _bufferLen;
@@ -258,15 +211,10 @@ class UpdateClass {
258211
const esp_partition_t *_partition;
259212

260213
String _target_md5;
261-
bool _target_md5_decrypted = true;
262214
MD5Builder _md5;
263215

264216
int _ledPin;
265217
uint8_t _ledOn;
266-
267-
uint8_t _cryptMode;
268-
size_t _cryptAddress;
269-
uint8_t _cryptCfg;
270218
};
271219

272220
#if !defined(NO_GLOBAL_INSTANCES) && !defined(NO_GLOBAL_UPDATE)

0 commit comments

Comments
 (0)