Fix secure otp build for non rp2350.

Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
This commit is contained in:
Pol Henarejos 2024-11-08 19:45:50 +01:00
parent 621d5553e1
commit 9018ebb55d
No known key found for this signature in database
GPG key ID: C0095B7870A4CCD3
3 changed files with 10 additions and 3 deletions

View file

@ -168,8 +168,10 @@ int otp_enable_secure_boot(uint8_t bootkey, bool secure_lock) {
uint8_t flagsp2[] = { page2v, page2v, page2v, 0x00 };
PICOKEY_CHECK(otp_write_data_raw(OTP_DATA_PAGE2_LOCK1_ROW, flagsp2, sizeof(flagsp2)));
}
#elif defined(ESP_PLATFORM)
// TODO: Implement secure boot for ESP32-S3
#endif // PICO_RP2350
goto err;
err:
if (ret != PICOKEY_OK) {
return ret;

View file

@ -32,8 +32,6 @@ extern uint8_t* otp_buffer_raw(uint16_t row);
extern bool is_empty_otp_buffer(uint16_t row, uint16_t len);
extern int otp_write_data(uint16_t row, uint8_t *data, uint16_t len);
extern int otp_write_data_raw(uint16_t row, uint8_t *data, uint16_t len);
extern int otp_enable_secure_boot(uint8_t bootkey, bool secure_lock);
extern void init_otp_files();
#elif defined(ESP_PLATFORM)
@ -44,6 +42,9 @@ extern void init_otp_files();
#endif
extern int otp_enable_secure_boot(uint8_t bootkey, bool secure_lock);
extern void init_otp_files();
extern const uint8_t *otp_key_1;
extern const uint8_t *otp_key_2;

View file

@ -78,6 +78,7 @@ int cmd_write() {
return SW_OK();
}
#if defined(PICO_RP2350) || defined(ESP_PLATFORM)
int cmd_secure() {
if (apdu.nc != 0) {
return SW_WRONG_LENGTH();
@ -92,13 +93,16 @@ int cmd_secure() {
}
return SW_OK();
}
#endif
#define INS_WRITE 0x1C
#define INS_SECURE 0x1D
static const cmd_t cmds[] = {
{ INS_WRITE, cmd_write },
#if defined(PICO_RP2350) || defined(ESP_PLATFORM)
{ INS_SECURE, cmd_secure },
#endif
{ 0x00, 0x0 }
};