<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: HSE isntallSMR API question in S32 Design Studio</title>
    <link>https://community.nxp.com/t5/S32-Design-Studio/HSE-isntallSMR-API-question/m-p/1691734#M10619</link>
    <description>&lt;P&gt;Moreover, I print arguments before send HSE.&amp;nbsp;I'm not sure if it is any help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JasonChou_0-1690251512898.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/233365i1377762039DDB57A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="JasonChou_0-1690251512898.png" alt="JasonChou_0-1690251512898.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 25 Jul 2023 02:19:16 GMT</pubDate>
    <dc:creator>JasonChou</dc:creator>
    <dc:date>2023-07-25T02:19:16Z</dc:date>
    <item>
      <title>HSE isntallSMR API question</title>
      <link>https://community.nxp.com/t5/S32-Design-Studio/HSE-isntallSMR-API-question/m-p/1689302#M10594</link>
      <description>&lt;P&gt;Hi NXP,&lt;/P&gt;&lt;P&gt;I am trying to use C code to test SMR install API(service ID:&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;HSE_SRV_ID_SMR_ENTRY_INSTALL&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;), However, I always got service response A5AAA399 which meas parameter is incorrect.&lt;/P&gt;&lt;P&gt;there is so many Argument in this API, could someone help me to check?&lt;/P&gt;&lt;P&gt;the signature and address have benn vailded is this test.&lt;/P&gt;&lt;P&gt;the HSE FW version is&amp;nbsp; 0.2.6&lt;/P&gt;&lt;LI-CODE lang="c"&gt;    memcpy(
		(void *)&amp;amp;IVT,
		(const void *)BLOCK0_IVT_ADDRESS,
		0x100);

	uint32_t AppAddress = (uint32_t) app_start_real;

	SmrEntry[4].pSmrsrc=AppAddress; /* Start of APP code */
	SmrEntry[4].smrSize = 1024UL;     /* Length of APP code */
	SmrEntry[4].authKeyHandle = aaa_pub_HANDLE;
	SmrEntry[4].authScheme.sigScheme.signSch = HSE_SIGN_RSASSA_PSS;
	SmrEntry[4].authScheme.sigScheme.sch.rsaPss.hashAlgo = HSE_HASH_ALGO_SHA2_256;
	SmrEntry[4].authScheme.sigScheme.sch.rsaPss.saltLength = 32UL;
	SmrEntry[4].pInstAuthTag[0] = test_sign_real; /* signature tag address */
	SmrEntry[4].pInstAuthTag[1] = (uint32_t)NULL;             /* In this example, AES keys is used hence 2nd tag address is NULL */

	/**** RSA ****/
	srvResponse = RsaPssSignSrv(
		aaa_pri_HANDLE,
		32UL,
		HSE_HASH_ALGO_SHA2_256,
		SmrEntry[4].smrSize,
		(const uint8_t *)SmrEntry[4].pSmrSrc,
		FALSE,
		0U,
		&amp;amp;signLength,
		outputSig);
		
	debug_print("%s RsaPssSignSrv(1) = %x\r\n", sl_tag, srvResponse);
	if(FLASH_Erase(FLS_SWAP_OFFSET, S32K312_SECTOR_SIZE, MAX_ERASE_TIME) == E_OK){
		if(FLASH_Write(FLS_SWAP_OFFSET, sizeof(outputSig), outputSig, MAX_ERASE_TIME) == E_OK){
			debug_print("%s FLASH_Write = OK\r\n", sl_tag);
		}
		else{
			debug_print("%s FLASH_Write = NG\r\n", sl_tag);
		}
	}
	else{
		debug_print("%s FLASH_Erase = NG\r\n", sl_tag);
	}


	srvResponse = RsaPssVerSrv(
		aaa_pub_HANDLE,
		32UL,
		HSE_HASH_ALGO_SHA2_256,
		SmrEntry[4].smrSize,
		(const uint8_t *)SmrEntry[4].pSmrSrc,
		FALSE,
		0U,
		&amp;amp;signLength,
		(const uint8_t *)test_sign_real);
	debug_print("%s RsaPssVerSrv(1) = %x\r\n", sl_tag, srvResponse);




	srvResponse = HSE_InstallSmrEntry((4),
										(const hseSmrEntry_t *)&amp;amp;SmrEntry[4],
										(const uint8_t *)SmrEntry[4].pSmrSrc,
										SmrEntry[4].smrSize,
										(const uint8_t *)tag_addr[0][4],
										(const uint8_t *)tag_addr[1][4],
										tag_len[4],
										tag_len[4]);

	debug_print("%s HSE_InstallSmrEntry(0) = %x\r\n", sl_tag, srvResponse);&lt;/LI-CODE&gt;&lt;P&gt;And, here is result.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JasonChou_0-1689846564219.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/232663i3D4F2059C90A80BC/image-size/medium?v=v2&amp;amp;px=400" role="button" title="JasonChou_0-1689846564219.png" alt="JasonChou_0-1689846564219.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;Also, I refer to demo_app\services\src\secure_boot\hse_secure_boot.c which is below(&lt;SPAN&gt;Snippet&lt;/SPAN&gt;)&lt;/P&gt;&lt;LI-CODE lang="c"&gt;        srvResponse = HSE_InstallSmrEntry((Index),
                                          (const hseSmrEntry_t *)&amp;amp;smrEntry[Index],
                                          (const uint8_t *)smrEntry[Index].pSmrSrc,
                                          smrEntry[Index].smrSize,
                                          (const uint8 *)tag_addr[0][Index],
                                          (const uint8 *)tag_addr[1][Index],
                                          tag_len[Index],
                                          tag_len[Index]);&lt;/LI-CODE&gt;&lt;LI-CODE lang="c"&gt;                smrEntry[i].configFlags = HSE_SMR_CFG_FLAG_INSTALL_AUTH; /* Indicate that verification should be done on provided signature */
                smrEntry[i].pSmrDest = 0U;                               /* destination address shall be NULL for flashed based devices */
                smrEntry[i].checkPeriod = 0U;
                    smrEntry[i].pSmrsrc=AppAddress; /* Start of APP code */
                    smrEntry[i].smrSize = 1024UL;     /* Length of APP code */
                    smrEntry[i].authKeyHandle = HSE_DEMO_NVM_RSA2048_PUB_CUSTAUTH_HANDLE0;
                    smrEntry[i].authScheme.sigScheme.signSch = HSE_SIGN_RSASSA_PSS;
                    smrEntry[i].authScheme.sigScheme.sch.rsaPss.hashAlgo = HSE_HASH_ALGO_SHA2_256;
                    smrEntry[i].authScheme.sigScheme.sch.rsaPss.saltLength = SALT_LENGTH;
                    smrEntry[i].pInstAuthTag[0] = RSA_TAG_CODE_FLASH_ADDRESS; /* signature tag address */
                    smrEntry[i].pInstAuthTag[1] = (uint32_t)NULL;             /* In this example, AES keys is used hence 2nd tag address is NULL */&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 20 Jul 2023 09:50:00 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32-Design-Studio/HSE-isntallSMR-API-question/m-p/1689302#M10594</guid>
      <dc:creator>JasonChou</dc:creator>
      <dc:date>2023-07-20T09:50:00Z</dc:date>
    </item>
    <item>
      <title>Re: HSE isntallSMR API question</title>
      <link>https://community.nxp.com/t5/S32-Design-Studio/HSE-isntallSMR-API-question/m-p/1690084#M10601</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/218746"&gt;@JasonChou&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE class="lia-code-sample  language-c"&gt;&lt;CODE&gt;SmrEntry[4].pInstAuthTag[0] = test_sign_real; /* signature tag address */&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This should be a pointer to the signature only, not directly the value. Could you check this?&lt;/P&gt;
&lt;P&gt;Thanks,&lt;/P&gt;
&lt;P&gt;Lukas&lt;/P&gt;</description>
      <pubDate>Fri, 21 Jul 2023 06:34:43 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32-Design-Studio/HSE-isntallSMR-API-question/m-p/1690084#M10601</guid>
      <dc:creator>lukaszadrapa</dc:creator>
      <dc:date>2023-07-21T06:34:43Z</dc:date>
    </item>
    <item>
      <title>Re: HSE isntallSMR API question</title>
      <link>https://community.nxp.com/t5/S32-Design-Studio/HSE-isntallSMR-API-question/m-p/1690183#M10603</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/37795"&gt;@lukaszadrapa&lt;/a&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Thanks for reply,&lt;/P&gt;&lt;P&gt;sorry for missing definition of argument. this parameter(test_sign_real) is follow on demo code(&lt;SPAN&gt;hse_secure_boot.c), here is the definitions&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;FONT face="arial black,avant garde"&gt;My test code&lt;/FONT&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;#define app_start_real             0x500000UL
#define test_sign_real             0x440000UL
#define test_HANDLE         GET_KEY_HANDLE(HSE_KEY_CATALOG_ID_NVM,3,0)
static const uint32_t tag_addr[2U][5U] =
{
    {0, 0, 0, 0, test_sign_real},
    {0, 0, 0, 0, 0}};
static const uint32_t tag_len[] =
    {
        16U, 16U, 16U, 32U, 512U};&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial black,avant garde"&gt;demo code(&lt;SPAN&gt;hse_secure_boot.c)&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;#define RSA_TAG_CODE_FLASH_ADDRESS 0x00454100UL
static const uint32_t tag_addr[2U][5U] =
    {
        {CMAC_TAG_CODE_FLASH_ADDRESS, GMAC_TAG_CODE_FLASH_ADDRESS, HMAC_TAG_CODE_FLASH_ADDRESS, ECC_TAG1_CODE_FLASH_ADDRESS, RSA_TAG_CODE_FLASH_ADDRESS},
        {0, 0, 0, ECC_TAG2_CODE_FLASH_ADDRESS, 0}};

static const uint32_t tag_len[] =
    {
        16U, 16U, 16U, 32U, 256U};&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Basically, It's the same except the value.&lt;/P&gt;&lt;P&gt;I try demo code in Trace32, and it's work, but I still don't know the different between my test code and demo code...&lt;/P&gt;</description>
      <pubDate>Fri, 21 Jul 2023 07:39:16 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32-Design-Studio/HSE-isntallSMR-API-question/m-p/1690183#M10603</guid>
      <dc:creator>JasonChou</dc:creator>
      <dc:date>2023-07-21T07:39:16Z</dc:date>
    </item>
    <item>
      <title>Re: HSE isntallSMR API question</title>
      <link>https://community.nxp.com/t5/S32-Design-Studio/HSE-isntallSMR-API-question/m-p/1691155#M10612</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/218746"&gt;@JasonChou&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;One more thing that comes into my mind - most of similar issues when it does not work in own project is caused by cache memory. &lt;BR /&gt;It is important to force descriptors/data sent to/from Messaging Unit to non-cacheable region. To check if it is related to the cache memory, you can try to disable the cache by DC bit in core register CCR Configuration and Control Register. Please let me know if it helps or not. &lt;BR /&gt;Regards,&lt;BR /&gt;Lukas&lt;/P&gt;</description>
      <pubDate>Mon, 24 Jul 2023 07:51:37 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32-Design-Studio/HSE-isntallSMR-API-question/m-p/1691155#M10612</guid>
      <dc:creator>lukaszadrapa</dc:creator>
      <dc:date>2023-07-24T07:51:37Z</dc:date>
    </item>
    <item>
      <title>Re: HSE isntallSMR API question</title>
      <link>https://community.nxp.com/t5/S32-Design-Studio/HSE-isntallSMR-API-question/m-p/1691710#M10618</link>
      <description>Hi &lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/37795"&gt;@lukaszadrapa&lt;/a&gt;&lt;BR /&gt;All I get document doesn't mention about core register CCR Configuration and Control Register&lt;BR /&gt;&lt;BR /&gt;However, I found there are three function called "sys_m7_cache_xxx" which will be called when defined MPU_ENABLE/D_CACHE_ENABLE/I_CACHE_ENABLE in system.c file.&lt;BR /&gt;And, I tried to call comment sys_m7_cache_init() which wanted to disable the cache. the result is still the same...</description>
      <pubDate>Tue, 25 Jul 2023 02:07:18 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32-Design-Studio/HSE-isntallSMR-API-question/m-p/1691710#M10618</guid>
      <dc:creator>JasonChou</dc:creator>
      <dc:date>2023-07-25T02:07:18Z</dc:date>
    </item>
    <item>
      <title>Re: HSE isntallSMR API question</title>
      <link>https://community.nxp.com/t5/S32-Design-Studio/HSE-isntallSMR-API-question/m-p/1691734#M10619</link>
      <description>&lt;P&gt;Moreover, I print arguments before send HSE.&amp;nbsp;I'm not sure if it is any help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JasonChou_0-1690251512898.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/233365i1377762039DDB57A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="JasonChou_0-1690251512898.png" alt="JasonChou_0-1690251512898.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 25 Jul 2023 02:19:16 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32-Design-Studio/HSE-isntallSMR-API-question/m-p/1691734#M10619</guid>
      <dc:creator>JasonChou</dc:creator>
      <dc:date>2023-07-25T02:19:16Z</dc:date>
    </item>
    <item>
      <title>Re: HSE isntallSMR API question</title>
      <link>https://community.nxp.com/t5/S32-Design-Studio/HSE-isntallSMR-API-question/m-p/1692013#M10621</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/218746"&gt;@JasonChou&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;it's core registers, so it's described in the core manuals:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="lukaszadrapa_0-1690271071155.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/233459i3465B15DA9D62B2C/image-size/medium?v=v2&amp;amp;px=400" role="button" title="lukaszadrapa_0-1690271071155.png" alt="lukaszadrapa_0-1690271071155.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.ddi0489d/index.html" target="_blank"&gt;http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.ddi0489d/index.html&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0646b/index.html" target="_blank"&gt;http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0646b/index.html&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;hseSmrEntry_t (your&amp;nbsp;SmrEntry[4]) has more items which I can't see in the code. You can find details in API RM. Could you check how those items are initialized?&lt;/P&gt;
&lt;P&gt;And maybe you can take a look also at these examples:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://www.nxp.com/webapp/Download?colCode=S32K3_HSE_DemoExamples" target="_blank"&gt;https://www.nxp.com/webapp/Download?colCode=S32K3_HSE_DemoExamples&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;This one could help:&lt;/P&gt;
&lt;P&gt;c:\NXP\S32K3_HSE_DemoExamples_1_0_0\S32K3_HSE_DemoExamples\Secure_Boot\S32K344_Advanced_SecureBoot\&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Lukas&lt;/P&gt;</description>
      <pubDate>Tue, 25 Jul 2023 07:47:43 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32-Design-Studio/HSE-isntallSMR-API-question/m-p/1692013#M10621</guid>
      <dc:creator>lukaszadrapa</dc:creator>
      <dc:date>2023-07-25T07:47:43Z</dc:date>
    </item>
  </channel>
</rss>

