<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>nrf5340 Hardware Security Features (Fuses and Bus Protections)</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/69075/nrf5340-hardware-security-features-fuses-and-bus-protections</link><description>When evulating the nrf5340 for one of our projects, two questions came up regarding some of the security features used to mitigate tampering and malicious code: 
 
 What is the state of the debug port on reset? Is there a window of time before the APPROTECT</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 07 Dec 2020 10:13:09 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/69075/nrf5340-hardware-security-features-fuses-and-bus-protections" /><item><title>RE: nrf5340 Hardware Security Features (Fuses and Bus Protections)</title><link>https://devzone.nordicsemi.com/thread/283484?ContentTypeID=1</link><pubDate>Mon, 07 Dec 2020 10:13:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9d2ef095-f589-477b-b2c1-ea00cc4c9f7a</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Yes,&amp;nbsp;with one reservation. Combining APPROTECT and ERASEPROTECT can be used to permanently prevent prevent&amp;nbsp;re-programming as well as debugging. But note that you may use firmware that allows an erase operation also in this case, by providing a key as described under &lt;a href="https://infocenter.nordicsemi.com/topic/nan_041/APP/nan_041/approtect_eraseprotect_enabled.html"&gt;Troubleshooting in nAN-41:APPROTECT and ERASEPROTECT are enabled&lt;/a&gt;&amp;nbsp;(this is for the nRF9160, but same applies to the nRF53 in this regard).&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf5340 Hardware Security Features (Fuses and Bus Protections)</title><link>https://devzone.nordicsemi.com/thread/283390?ContentTypeID=1</link><pubDate>Fri, 04 Dec 2020 19:10:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:acd3046c-f468-412f-85f6-d7e053c0ad7b</guid><dc:creator>mrrosen</dc:creator><description>&lt;p&gt;Thanks, that all makes sense. Then, writing to UICR.ERASEPROTECT will disable the ability to ERASEALL, and also, if APPROTECT is enabled as it is by default, will be unable to read/write to the flash via the debug port ever?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf5340 Hardware Security Features (Fuses and Bus Protections)</title><link>https://devzone.nordicsemi.com/thread/283388?ContentTypeID=1</link><pubDate>Fri, 04 Dec 2020 18:53:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:361b15fe-2e25-4f6f-b175-f8af0fff9b93</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;The new APPROTECT scheme is a bit complicated, so I&amp;nbsp;understand the confusion.&lt;/p&gt;
[quote user="mrrosen"]For the APPROTECT, doesnt APPROTECT need to be disabled in order to flash the chip?[/quote]
&lt;p&gt;&amp;nbsp;Yes.&lt;/p&gt;
[quote user="mrrosen"]If so, if its enabled by default, without doing a ERASEALL, how can you program the device (isnt the AHB-AP access needed to write to the flash)?[/quote]
&lt;p&gt;You cannot program an empty device without first doing an ERASEALL.&lt;/p&gt;
[quote user="mrrosen"]Also, while the ERASEALL enables the AHB-AP, once the device loses power&amp;nbsp;or preforms a hard reset, the APPROTECT would be 0xFFFFFFFF, thus disabling AHB-AP and making the chip unflashable, correct?[/quote]
&lt;p&gt;Yes that is correct, unless you have written to UICR and flashed firmware that unlocks debugging.&amp;nbsp;&lt;/p&gt;
[quote user="mrrosen"]And even if APPROTECT isnt in a state disabling the AHB-AP, if firmware is also required to enable the AHB-AP, wouldnt the chip be unflashable still?[/quote]
&lt;p&gt;Yes, that is correct if you do a power cycle, reset or detach and reattach the debugger before attempting to program. A key here is that the normal&amp;nbsp;condition for disabling APPROTECT (disabled in both UICR and CTRL-AP.APPROTECT.DISABLE) does not apply after an ERASEALL. When the IC is in a state where ERASEALL has occurred and there has been no reset and the debug session is active, you can program it.&lt;/p&gt;
&lt;p&gt;The&amp;nbsp;result&amp;nbsp;of this is that in order to flash a device you must issue an ERASEALL, and then at the same time program the firmware. If you want to be able to subsequently debug, the you must enable APPROTECT in UICR while programing, and flash a piece of firmware that enables debugging by writing to CTRL-AP.APPROTECT.DISABLE. (For instance using nrfjprog, this is how it is doen behind the scenes when you call nrfjprog with the --recover option with a nRF5340 Engineering D or Rev 1 SoC.)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf5340 Hardware Security Features (Fuses and Bus Protections)</title><link>https://devzone.nordicsemi.com/thread/283378?ContentTypeID=1</link><pubDate>Fri, 04 Dec 2020 16:57:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:da45d686-3606-492f-bd88-6214f884a1dc</guid><dc:creator>mrrosen</dc:creator><description>&lt;p&gt;For the DCNF question, I now see what you mean; thanks, I was misreading the note thinking those registers were only accessibly from the network domain, not that they were not accessible from the network domain.&lt;/p&gt;
&lt;p&gt;For the APPROTECT, doesnt APPROTECT need to be disabled in order to flash the chip? If so, if its enabled by default, without doing a ERASEALL, how can you program the device (isnt the AHB-AP access needed to write to the flash)? Also, while the ERASEALL enables the AHB-AP, once the device loses power&amp;nbsp;or preforms a hard reset, the APPROTECT would be 0xFFFFFFFF, thus disabling AHB-AP and making the chip unflashable, correct? And even if APPROTECT isnt in a state disabling the AHB-AP, if firmware is also required to enable the AHB-AP, wouldnt the chip be unflashable still? (Sorry for the misunderstanding, I might just be getting tangled up with the APPROTECT disabled means the the AHB-AP is enabled)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf5340 Hardware Security Features (Fuses and Bus Protections)</title><link>https://devzone.nordicsemi.com/thread/283374?ContentTypeID=1</link><pubDate>Fri, 04 Dec 2020 16:37:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5b815b37-a629-4b7c-8c46-7b2b510e45b3</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
[quote user="mrrosen"]By default, APPROTECT is disabled correct (ie, it is not disabling the debug port)?[/quote]
&lt;p&gt;No, that is not correct. By default APPROTECT is enabled, as the magic word it not written to either the APPROTECT UICR and the CTRL-AP.APPROTECT.DISABLE registers. For instance, after a full erase, the UICR register is all FF&amp;#39;s (it&amp;#39;s flash).&amp;nbsp;&lt;/p&gt;
[quote user="mrrosen"]Also, once enabled in the UICR, the CTRL-AP.APPROTECT.DISABLE overrides the UICR, correct?[/quote]
&lt;p&gt;No. APPROTECT must be disabled both in UICR and CTRL-AP.APPROTECT.DISABLE. If the magic word is not present in &lt;em&gt;both&lt;/em&gt; registers, APPROTECT will stay enabled, preventing debugger access.&lt;/p&gt;
[quote user="mrrosen"]If so, what happens when you do a complete chip erase and reset the chip, is it bricked since there is no firmware to write to the register?[/quote]
&lt;p&gt;No, this is handled by a special case. As stated in the &lt;a href="https://infocenter.nordicsemi.com/topic/ps_nrf5340/debugandtrace.html?cp=3_0_0_7_1#access_port_protection"&gt;Access port protection&lt;/a&gt; section in the PS:&amp;nbsp; &amp;quot;&lt;em&gt;The access port is also open after the completion of the CTRL-AP.ERASEALL operation. After completing the erase operation, CTRL-AP will temporarily unprotect AHB-AP&lt;/em&gt;&amp;quot;.&lt;/p&gt;
[quote user="mrrosen"]but those seemed to be mapped to the network core domain (so on the APB in the network side), not the application core domain, meaning the application core cannot access them, correct?[/quote]
&lt;p&gt;Not exactly. You can see from the &lt;a href="https://infocenter.nordicsemi.com/topic/ps_nrf5340/dcnf.html?cp=3_0_0_6_7_1#topic"&gt;Registers section in the DCND chapter&lt;/a&gt; in the PS that there are three instances of all the registers, with separate base addresses for&amp;nbsp;application secure domain,&amp;nbsp;application non-secure domain and network. (Except EXTCODE, which does not exist for the network core).&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf5340 Hardware Security Features (Fuses and Bus Protections)</title><link>https://devzone.nordicsemi.com/thread/283368?ContentTypeID=1</link><pubDate>Fri, 04 Dec 2020 16:10:41 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:197ab859-770a-478f-a004-da973f6df1b0</guid><dc:creator>mrrosen</dc:creator><description>&lt;p&gt;For the first question. I want to make sure I understand the APPROTECT UICR and the CTRL-AP.APPROTECT.DISABLE registers. By default, APPROTECT is disabled correct (ie, it is not disabling the debug port)? I thought it was but the document changed suggesting otherwise (&lt;a href="https://infocenter.nordicsemi.com/topic/ps_nrf5340/chapters/uicr/doc/uicr.html?cp=3_0_0_4_3_2_0_0#register.APPROTECT)"&gt;https://infocenter.nordicsemi.com/topic/ps_nrf5340/chapters/uicr/doc/uicr.html?cp=3_0_0_4_3_2_0_0#register.APPROTECT)&lt;/a&gt;. Also, once enabled in the UICR, the CTRL-AP.APPROTECT.DISABLE overrides the UICR, correct? Or is this a separate register that must be set by the firmware to enable the debug port at all? If so, what happens when you do a complete chip erase and reset the chip, is it bricked since there is no firmware to write to the register?&lt;br /&gt;&lt;br /&gt;For the second question, I understand we need to write to the EXTPERI/EXTRAM/EXTCORE registers but those seemed to be mapped to the network core domain (so on the APB in the network side), not the application core domain, meaning the application core cannot access them, correct? (&lt;a href="https://infocenter.nordicsemi.com/topic/ps_nrf5340/dcnf.html?cp=3_0_0_6_7_0#concept_protection"&gt;https://infocenter.nordicsemi.com/topic/ps_nrf5340/dcnf.html?cp=3_0_0_6_7_0#concept_protection&lt;/a&gt;)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf5340 Hardware Security Features (Fuses and Bus Protections)</title><link>https://devzone.nordicsemi.com/thread/283315?ContentTypeID=1</link><pubDate>Fri, 04 Dec 2020 13:17:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a2681fee-dd8a-4625-901f-eaa7e58df056</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
[quote user=""]What is the state of the debug port on reset? Is there a window of time before the APPROTECT fuse is used by the hardware to disable the port and reset were the port might be accessible?[/quote]
&lt;p&gt;The default state of the debug port on reset is that debug access is disabled/locked. It will only be subsequently enabled/opened when certain criteria are met:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Magic word is written to NRF_UICR_S-&amp;gt;APPROTECT in the&amp;nbsp;persistent User information configuration registers (UICR) &lt;strong&gt;&lt;em&gt;and&lt;/em&gt;&lt;/strong&gt;&amp;nbsp;firmware allows enabling the debug port by writing magic word to CTRL-AP.APPROTECT.DISABLE.&lt;/li&gt;
&lt;li&gt;Temporarily after a CTRL-AP.ERASEALL operation.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The configuration&amp;nbsp;is independent for the network core an application core but handled in the same way.&amp;nbsp;There are&amp;nbsp;corresponding&amp;nbsp;registers to&amp;nbsp;those already mentioned that apply to the application core secure domain. This is described in more detail under &lt;a style="font-family:inherit;" href="https://infocenter.nordicsemi.com/topic/ps_nrf5340/debugandtrace.html?cp=3_0_0_7_1#access_port_protection"&gt;Access port protection&lt;/a&gt;&lt;span style="font-family:inherit;"&gt;.&lt;/span&gt;&lt;/p&gt;
[quote user=""]For the DCNF that blocks the network core from reaching the app domain, are those registers only accessible from the network domain? Is there a way for the app core to block traffic from the network domain?[/quote]
&lt;p&gt;The application core DCNF is able to block traffic from network core, using the application core&amp;#39;s DCNF peripheral and the EXTPERI/EXTRAM/EXTCODE registers.&lt;/p&gt;
&lt;p&gt;The following figure (Figure 26 from the nRF5340 product specification) shows the input connections to the AMLI from the network core. It is the EXTPERI[0], EXTRAM[0] and EXTCODE[0] registers that can be configured to prevent the network core accessing the application core ports.&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/7024.image.png" /&gt;&lt;/p&gt;
&lt;p&gt;If more precise access control is required, it is possible to use the Arm TrustZone security features of the nRF5340. E.g. by configuring the network core to be a non-secure domain, the &lt;a href="https://infocenter.nordicsemi.com/topic/ps_nrf5340/spu.html?cp=3_0_0_6_31"&gt;System protection unit (SPU)&lt;/a&gt; provides configuration registers to grant access from network core only to peripherals and memories configured as non-secure.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>