Skip to content

Encrypted improvements #619

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 21 commits into from
May 29, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 23 additions & 4 deletions encrypted/hello_encrypted/hello_encrypted.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,29 @@ int main() {
stdio_init_all();

#if PICO_CRT0_IMAGE_TYPE_TBYB
// If TBYB image, then buy it
uint8_t* buffer = malloc(4096);
rom_explicit_buy(buffer, 4096);
free(buffer);
boot_info_t boot_info = {};
int ret = rom_get_boot_info(&boot_info);
if (ret) {
// BOOT_TBYB_AND_UPDATE_FLAG_BUY_PENDING will always be set, but check anyway
if (boot_info.tbyb_and_update_info & BOOT_TBYB_AND_UPDATE_FLAG_BUY_PENDING) {
// Need to check flash_update_base is set to see if this is a TBYB update
uint32_t flash_update_base = boot_info.reboot_params[0];
if (flash_update_base) {
printf("Perform self-check... ");
if (1 == 1) {
printf("passed\n");
} else {
printf("failed - looping forever\n");
while (true) sleep_ms(1000);
}
}
uint32_t buf_size = flash_update_base ? 4096 : 0;
uint8_t* buffer = flash_update_base ? malloc(buf_size) : NULL;
int ret = rom_explicit_buy(buffer, buf_size);
assert(ret == 0);
if (buffer) free(buffer);
}
}
#endif
extern char secret_data[];

Expand Down