Skip to content

Commit

Permalink
Fix partial encryption
Browse files Browse the repository at this point in the history
Move unencrypted files at the beginning
  • Loading branch information
radurentea committed Dec 18, 2024
1 parent d6d6fb4 commit 537a4b0
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/flash/flashTask.ts
Original file line number Diff line number Diff line change
Expand Up @@ -220,28 +220,28 @@ export class FlashTask {
flasherArgs.push(flashFile.address, binPath);
}
} else {
// If only some files need encryption, then use --encrypt-files flag
flasherArgs.push("--encrypt-files");
// First add encrypted files
for (const flashFile of encryptedFlashSections) {
// If only some files need encryption, handle them separately
// First add all unencrypted files normally
const unencryptedSections = this.model.flashSections.filter(
(section) => !section.encrypted
);
for (const flashFile of unencryptedSections) {
let binPath = replacePathSep
? flashFile.binFilePath.replace(/\//g, "\\")
: flashFile.binFilePath;
flasherArgs.push(flashFile.address, binPath);
}
// Then add unencrypted files

const unencryptedSections = this.model.flashSections.filter(
(section) => !section.encrypted
);
for (const flashFile of unencryptedSections) {
// Then add encrypted files after the --encrypt-files flag
flasherArgs.push("--encrypt-files");
for (const flashFile of encryptedFlashSections) {
let binPath = replacePathSep
? flashFile.binFilePath.replace(/\//g, "\\")
: flashFile.binFilePath;
flasherArgs.push(flashFile.address, binPath);
}
}
} else {
// No encryption needed, just add all files
for (const flashFile of this.model.flashSections) {
let binPath = replacePathSep
? flashFile.binFilePath.replace(/\//g, "\\")
Expand Down

0 comments on commit 537a4b0

Please sign in to comment.