<?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>Hashing Key is TF-m</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/98637/hashing-key-is-tf-m</link><description>Hi, 
 I am looking into using TF-m/PSA in Nordic nRF9160 for our product. One of the requirements is to store a symmetric key as the SHA256 hashing key. I started with the sample in tfm_hello_world, where there is a call to psa_hash_compute() to calculate</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 14 Apr 2023 15:01:15 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/98637/hashing-key-is-tf-m" /><item><title>RE: Hashing Key is TF-m</title><link>https://devzone.nordicsemi.com/thread/420556?ContentTypeID=1</link><pubDate>Fri, 14 Apr 2023 15:01:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:355f65a4-e507-4c91-ac42-ea7152af60e1</guid><dc:creator>Amanda Hsieh</dc:creator><description>&lt;p&gt;Hi,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;SHA-256 is a deterministic hashing algorithm but the result of calling SHA-256 is a &amp;quot;digest&amp;quot; and I don&amp;#39;t think it is common to refer to that as a key.&lt;/p&gt;
&lt;p&gt;There are multiple options of keeping a hash-digest following the nRF9160. I will list out the options. You don&amp;#39;t need to use the PSA Crypto APIs (psa_import_key) for this.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Use some data in the OTP region to keep the hash digest and implement an ARoT to give access to this in the S-world, or alternatively use the ARoT to do the whole operation they want to do (like a custom security service). &lt;strong&gt;Note that this may limit the number of upgrades you can do if downgrade protection is used in the DFU&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Use a CPU-accessible slot in KMU (Don&amp;#39;t lock it only for CryptoCell usage) and make the same type of ARoT to either give direct access to the digest or make a custom ARoT functionality to do the operation using this digest&lt;/li&gt;
&lt;li&gt;Use PSA PS (Protected Storage) API provided by TF-M to store the hash-digest without permissions to make it erasable. Data in PSA PS will be accessible from the NS world&lt;/li&gt;
&lt;li&gt;Use psa_import_key but give usage permissions to export the digest key (so NS world can get access to it)&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Final notes: Only option 1 and 2 can be done in a production line without having any application running on the device. This is a huge benefit. But as you see, the OTP and the KMU is a secure-only peripheral so there needs to be a secure service when TrustZone is enabled (with TF-M)&lt;/p&gt;
&lt;p&gt;Option 3 and 4 work without any specialized ARoT service and the business-logic of handling this SHA-256 digest will be in the NS image. This means that this hash for sure is readable in the NS image. So the concept of &amp;quot;key&amp;quot; is further diminished as everyone will have access to it.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;-Amanda H.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Hashing Key is TF-m</title><link>https://devzone.nordicsemi.com/thread/420185?ContentTypeID=1</link><pubDate>Thu, 13 Apr 2023 10:50:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a30ef20d-6172-403b-9c0e-b7edb1194acf</guid><dc:creator>WhiteCloud2</dc:creator><description>&lt;p&gt;Thanks for the note.&lt;/p&gt;
&lt;p&gt;The provisioning_image example demonstrates writing the identity key and the implementation id. However, I am looking for the key used for hashing. I did change the identity key and implementation id and get the same hashing value for a given string. That I think confirms that they are not the hashing key.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Hashing Key is TF-m</title><link>https://devzone.nordicsemi.com/thread/420058?ContentTypeID=1</link><pubDate>Wed, 12 Apr 2023 21:00:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3d0aa05d-e7b7-454a-bc91-91afe7414be3</guid><dc:creator>Amanda Hsieh</dc:creator><description>&lt;p&gt;Hi,&amp;nbsp;&lt;/p&gt;
[quote user=""]Could someone shed some light into it? Where is the key stored?[/quote]
&lt;p&gt;The key is managed and stored in the&amp;nbsp;&lt;a href="https://infocenter.nordicsemi.com/topic/ps_nrf5340/kmu.html?cp=4_0_0_6_16"&gt;key management unit&lt;/a&gt;&amp;nbsp;(KMU). See more&lt;span&gt;&amp;nbsp;information in&lt;/span&gt;&lt;a href="https://infocenter.nordicsemi.com/topic/ps_nrf5340/kmu.html?cp=3_0_0_6_16"&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;KMU documentation&lt;/a&gt;&lt;span&gt;.&lt;/span&gt;&lt;/p&gt;
[quote user=""]how do I provision it?[/quote]
&lt;p&gt;&lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/samples/tfm/provisioning_image/README.html"&gt;Provisioning image sample&lt;/a&gt; and &lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/samples/tfm/tfm_psa_template/README.html"&gt;PSA template&lt;/a&gt;&amp;nbsp;are good samples to start as you did.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Regards,&lt;br /&gt;Amanda H.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>