Skip to content

Commit

Permalink
ESP32: Add support for the 3/4 key encoding scheme
Browse files Browse the repository at this point in the history
 * Add calculated redundancy values when writing eFuse blocks 1-3
 * Perform 192 -> 256 bit key extension when encrypting images for flashing

Fixes cesanta/mos-tool#37

CL: mos: ESP32: Add support for the 3/4 key encoding scheme

PUBLISHED_FROM=16639fb25d5200550ad2097929239d896e188b5b
  • Loading branch information
Deomid Ryabkov authored and cesantabot committed Mar 4, 2019
1 parent 81c647a commit 8a02301
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
21 changes: 21 additions & 0 deletions common/platforms/esp/stub_flasher.c
Original file line number Diff line number Diff line change
Expand Up @@ -470,6 +470,27 @@ uint8_t cmd_loop(void) {
resp = 0;
break;
}
case CMD_READ_REG: {
len = SLIP_recv(args, sizeof(args));
if (len == 4) {
uint32_t value = READ_PERI_REG((uint32_t *) args[0]);
SLIP_send(&value, sizeof(value));
resp = 0;
} else {
resp = 0x91;
}
break;
}
case CMD_WRITE_REG: {
len = SLIP_recv(args, sizeof(args));
if (len == 8) {
WRITE_PERI_REG((uint32_t *) args[0], args[1]);
resp = 0;
} else {
resp = 0xa1;
}
break;
}
}
SLIP_send(&resp, 1);
} while (cmd != CMD_BOOT_FW && cmd != CMD_REBOOT);
Expand Down
18 changes: 18 additions & 0 deletions common/platforms/esp/stub_flasher.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,24 @@ enum stub_cmd {
* Output: arguments.
*/
CMD_ECHO = 8,

/*
* Read register value.
*
* Args: register address.
* Input: None.
* Output: register value.
*/
CMD_READ_REG = 9,

/*
* Write register value.
*
* Args: register address, value.
* Input: None.
* Output: None.
*/
CMD_WRITE_REG = 10,
};

#endif /* CS_COMMON_PLATFORMS_ESP8266_STUBS_STUB_FLASHER_H_ */

0 comments on commit 8a02301

Please sign in to comment.