File tree Expand file tree Collapse file tree 2 files changed +63
-0
lines changed
Expand file tree Collapse file tree 2 files changed +63
-0
lines changed Original file line number Diff line number Diff line change @@ -411,6 +411,32 @@ int wolfBoot_set_encrypt_key(const uint8_t *key, const uint8_t *nonce);
411411int wolfBoot_get_encrypt_key (uint8_t * key , uint8_t * nonce );
412412int wolfBoot_erase_encrypt_key (void );
413413
414+ #ifndef __WOLFBOOT
415+
416+ /* Applications can access update success/trigger and flash erase/write
417+ * via non-secure callable, to facilitate updates
418+ */
419+
420+ /* Call wolfBoot_success from non-secure application */
421+ void wolfBoot_nsc_success (void );
422+
423+ /* Call wolfBoot_update_trigger from non-secure application */
424+ void wolfBoot_nsc_update_trigger (void );
425+
426+ /* Erase one or more sectors in the update partition.
427+ * - address: offset within the update partition ('0' corresponds to PARTITION_UPDATE_ADDRESS)
428+ * - len: size, in bytes
429+ */
430+ int wolfBoot_nsc_erase_update (uint32_t address , uint32_t len );
431+
432+ /* Write the content of buffer `buf` and size `len` to the update partition,
433+ * at offset address, from non-secure application
434+ * - address: offset within the update partition ('0' corresponds to PARTITION_UPDATE_ADDRESS)
435+ * - len: size, in bytes
436+ */
437+ int wolfBoot_nsc_write_update (uint32_t address , const uint8_t * buf , uint32_t len );
438+ #endif /* !__WOLFBOOT */
439+
414440
415441#ifdef __cplusplus
416442}
Original file line number Diff line number Diff line change @@ -1984,3 +1984,40 @@ int wolfBoot_ram_decrypt(uint8_t *src, uint8_t *dst)
19841984}
19851985#endif /* MMU */
19861986#endif /* EXT_ENCRYPTED */
1987+
1988+ #if defined(WOLFCRYPT_SECURE_MODE )
1989+ __attribute__((cmse_nonsecure_entry ))
1990+ void wolfBoot_nsc_success (void )
1991+ {
1992+ wolfBoot_success ();
1993+ }
1994+
1995+ __attribute__((cmse_nonsecure_entry ))
1996+ void wolfBoot_nsc_update_trigger (void )
1997+ {
1998+ wolfBoot_update_trigger ();
1999+ }
2000+
2001+ __attribute__((cmse_nonsecure_entry ))
2002+ int wolfBoot_nsc_erase_update (uint32_t address , uint32_t len )
2003+ {
2004+ if (address > WOLFBOOT_PARTITION_SIZE )
2005+ return -1 ;
2006+ if (address + len > WOLFBOOT_PARTITION_SIZE )
2007+ return -1 ;
2008+ hal_flash_erase (address + WOLFBOOT_PARTITION_UPDATE_ADDRESS , len );
2009+
2010+ }
2011+
2012+ __attribute__((cmse_nonsecure_entry ))
2013+ int wolfBoot_nsc_write_update (uint32_t address , const uint8_t * buf , uint32_t len )
2014+ {
2015+ if (address > WOLFBOOT_PARTITION_SIZE )
2016+ return -1 ;
2017+ if (address + len > WOLFBOOT_PARTITION_SIZE )
2018+ return -1 ;
2019+ hal_flash_write (address + WOLFBOOT_PARTITION_UPDATE_ADDRESS , buf , len );
2020+ }
2021+
2022+ #endif
2023+
You can’t perform that action at this time.
0 commit comments