Skip to content

Commit 3709085

Browse files
committed
Switch sense of SRAM clearing for encrypt
Put default back to clearing, with --no-clear to disable clearing
1 parent fad392e commit 3709085

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

main.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -562,6 +562,7 @@ struct _settings {
562562
bool otp_key_page_set = false;
563563
bool fast_rosc = false;
564564
bool use_mbedtls = false;
565+
bool no_clear_sram = false;
565566
uint16_t otp_key_page = 29;
566567
} encrypt;
567568

@@ -920,7 +921,7 @@ struct encrypt_command : public cmd {
920921
(
921922
option("--hash").set(settings.seal.hash) % "Hash the encrypted file" +
922923
option("--sign").set(settings.seal.sign) % "Sign the encrypted file" +
923-
option("--clear").set(settings.seal.clear_sram) % "Clear all of SRAM on load" +
924+
option("--no-clear").set(settings.encrypt.no_clear_sram) % "Don't clear all of SRAM on load" +
924925
option("--pin-xip-sram").set(settings.seal.pin_xip_sram) % "Pin XIP SRAM on load"
925926
).min(0).doc_non_optional(true) % "Signing Configuration" +
926927
named_file_selection_x("infile", 0) % "File to load from" +
@@ -5238,6 +5239,9 @@ bool encrypt_command::execute(device_map &devices) {
52385239
bool keyIsShare = false;
52395240
bool ivFromFile = true;
52405241

5242+
// Set settings.seal.clear_sram to opposite of settings.encrypt.no_clear_sram
5243+
settings.seal.clear_sram = !settings.encrypt.no_clear_sram;
5244+
52415245
aes_key_t aes_key;
52425246
aes_key_share_t aes_key_share;
52435247
std::vector<uint8_t> iv_salt;

0 commit comments

Comments
 (0)