<?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 Crypto_Ipw_encrypt func problem in S32K</title>
    <link>https://community.nxp.com/t5/S32K/Crypto-Ipw-encrypt-func-problem/m-p/1398039#M13625</link>
    <description>&lt;P&gt;Hello, can anybody explain to me this thing? In Crypto_Ipw_Encrypt function there's a next check:&lt;/P&gt;&lt;P&gt;if ( (Std_ReturnType)E_OK == sVerifyKey.eFound )&lt;BR /&gt;{&lt;BR /&gt;sVerifyKeyElement = Crypto_Ipw_VerifyKeyElementId ( sVerifyKey.u32Counter, 5U );&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;Here notice the 5 that function passes as parameter. Inside the Crypto_Ipw_VerifyKeyElementId this condition:&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;if ( u32keyElementId == Crypto_aKeyElementList[Crypto_aKeyList[u32KeyIndex]-&amp;gt;pCryptoKeyElementList-&amp;gt;u32CryptoKeyElements[u32Counter]]-&amp;gt;u32CryptoKeyElementId )&lt;BR /&gt;{&lt;BR /&gt;sVerifyKeyElement.eFound = (Std_ReturnType)E_OK;&lt;BR /&gt;sVerifyKeyElement.u32Counter = Crypto_aKeyList[u32KeyIndex]-&amp;gt;pCryptoKeyElementList-&amp;gt;u32CryptoKeyElements[u32Counter];&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;which sends error if you dont have&amp;nbsp;Crypto_aKeyElementList[] with id=5, but what to do if I have only two keys or one? I still have to do 5 id's in config? Since Im writing my own configs this is really confusing&lt;/P&gt;</description>
    <pubDate>Wed, 12 Jan 2022 10:29:02 GMT</pubDate>
    <dc:creator>Kanaqw</dc:creator>
    <dc:date>2022-01-12T10:29:02Z</dc:date>
    <item>
      <title>Crypto_Ipw_encrypt func problem</title>
      <link>https://community.nxp.com/t5/S32K/Crypto-Ipw-encrypt-func-problem/m-p/1398039#M13625</link>
      <description>&lt;P&gt;Hello, can anybody explain to me this thing? In Crypto_Ipw_Encrypt function there's a next check:&lt;/P&gt;&lt;P&gt;if ( (Std_ReturnType)E_OK == sVerifyKey.eFound )&lt;BR /&gt;{&lt;BR /&gt;sVerifyKeyElement = Crypto_Ipw_VerifyKeyElementId ( sVerifyKey.u32Counter, 5U );&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;Here notice the 5 that function passes as parameter. Inside the Crypto_Ipw_VerifyKeyElementId this condition:&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;if ( u32keyElementId == Crypto_aKeyElementList[Crypto_aKeyList[u32KeyIndex]-&amp;gt;pCryptoKeyElementList-&amp;gt;u32CryptoKeyElements[u32Counter]]-&amp;gt;u32CryptoKeyElementId )&lt;BR /&gt;{&lt;BR /&gt;sVerifyKeyElement.eFound = (Std_ReturnType)E_OK;&lt;BR /&gt;sVerifyKeyElement.u32Counter = Crypto_aKeyList[u32KeyIndex]-&amp;gt;pCryptoKeyElementList-&amp;gt;u32CryptoKeyElements[u32Counter];&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;which sends error if you dont have&amp;nbsp;Crypto_aKeyElementList[] with id=5, but what to do if I have only two keys or one? I still have to do 5 id's in config? Since Im writing my own configs this is really confusing&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jan 2022 10:29:02 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32K/Crypto-Ipw-encrypt-func-problem/m-p/1398039#M13625</guid>
      <dc:creator>Kanaqw</dc:creator>
      <dc:date>2022-01-12T10:29:02Z</dc:date>
    </item>
    <item>
      <title>Re: Crypto_Ipw_encrypt func problem</title>
      <link>https://community.nxp.com/t5/S32K/Crypto-Ipw-encrypt-func-problem/m-p/1399560#M13650</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/191531"&gt;@Kanaqw&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;I supposed you're doing the CBC encryption. This algorithm requires an initial value, or an initialization vector (&lt;A href="https://en.wikipedia.org/wiki/Block_cipher_mode_of_operation" target="_blank"&gt;https://en.wikipedia.org/wiki/Block_cipher_mode_of_operation&lt;/A&gt;). As a result, the key used for CBC encryption requires two key elements: one is the key material (key element ID =1) and the other is the init vector (key element ID = 5).&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="namnguyenviet_0-1642176997814.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/167674i387D520BB58184FB/image-size/medium?v=v2&amp;amp;px=400" role="button" title="namnguyenviet_0-1642176997814.png" alt="namnguyenviet_0-1642176997814.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;(Source: AUTOSAR_SWS_CryptoServiceManager.pdf)&lt;/P&gt;
&lt;P&gt;In order to configure the key for CBC encryption, you can configure one key with two key elements. For example, let's say that you want to configure KEY_8 as the CBC encryption key. You can do as follow:&lt;/P&gt;
&lt;P&gt;1. In CryptoKeyElement, add two elements&lt;/P&gt;
&lt;P&gt;- One is the keyElement for key material, CryptoKeyElementID must be 1&lt;/P&gt;
&lt;P&gt;- The other is the keyElement for initial vector, CryptoKeyElementID must be 5. You can also configure the value for this initial vector in CryptoKeyElementInitValue - if it's blank then the initial vector is 0&lt;/P&gt;
&lt;P&gt;2. In CryptoKeyType, add a KeyType, contains two above KeyElements&lt;/P&gt;
&lt;P&gt;3. In CryptoKey, add a new key, with CryptoKeyId = 11 (KEY_8).and refer to the above KeyType&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="MicrosoftTeams-image (8).png" style="width: 999px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/167675iD168A8BE0DE7D635/image-size/large?v=v2&amp;amp;px=999" role="button" title="MicrosoftTeams-image (8).png" alt="MicrosoftTeams-image (8).png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;/P&gt;
&lt;P&gt;Nam&lt;/P&gt;</description>
      <pubDate>Fri, 14 Jan 2022 16:24:33 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32K/Crypto-Ipw-encrypt-func-problem/m-p/1399560#M13650</guid>
      <dc:creator>namnguyenviet</dc:creator>
      <dc:date>2022-01-14T16:24:33Z</dc:date>
    </item>
  </channel>
</rss>

