<?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>Secure AuthenticationのトピックRe: Concurrency issue with hmac init-update-finish</title>
    <link>https://community.nxp.com/t5/Secure-Authentication/Concurrency-issue-with-hmac-init-update-finish/m-p/1556927#M1012</link>
    <description>&lt;P&gt;Hey&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/59276"&gt;@Kan_Li&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;This also deletes all stored keys and performs factory reset - Not usable in production.&lt;/P&gt;</description>
    <pubDate>Mon, 21 Nov 2022 06:21:01 GMT</pubDate>
    <dc:creator>bug_squasher_77</dc:creator>
    <dc:date>2022-11-21T06:21:01Z</dc:date>
    <item>
      <title>Concurrency issue with hmac init-update-finish</title>
      <link>https://community.nxp.com/t5/Secure-Authentication/Concurrency-issue-with-hmac-init-update-finish/m-p/1556308#M1010</link>
      <description>&lt;P&gt;Hey,&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/59276"&gt;@Kan_Li&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Following up from&amp;nbsp;&lt;LI-MESSAGE title="CreateCryptoObject fails while doing sss_mac_init" uid="1525047" url="https://community.nxp.com/t5/Secure-Authentication/CreateCryptoObject-fails-while-doing-sss-mac-init/m-p/1525047#U1525047" discussion_style_icon_css="lia-mention-container-editor-message lia-img-icon-forum-thread lia-fa-icon lia-fa-forum lia-fa-thread lia-fa"&gt;&lt;/LI-MESSAGE&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;While doing some stress testing, I witnessed wrong HMAC would return.&lt;/P&gt;&lt;P&gt;Further investigation revealed that if one process is killed while calling sss_mac_update()&lt;BR /&gt;Very next process would return wrong HMAC.&lt;/P&gt;&lt;P&gt;For example, see the code in the screenshot,&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="bug_squasher_77_0-1668753612334.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/200898i5930F4648FEFAC91/image-size/medium?v=v2&amp;amp;px=400" role="button" title="bug_squasher_77_0-1668753612334.png" alt="bug_squasher_77_0-1668753612334.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;It will randomly kill the current process just after sss_mac_update, without cleanup. (Simulate systemd watchdog reset…)&lt;/P&gt;&lt;P&gt;The next hmac calculation gives wrong result without any error.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Digging into the source code, I see that CryptoObject is created inside sss_mac_init() and deleted inside sss_mac_context_free()&lt;/P&gt;&lt;P&gt;However, there is logic to reuse the context in sss_mac_init that is causing the issue.&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;There could be a way to disable this behavior.&amp;nbsp;Instead of reusing, I want to be able to delete existing and create new CryptoObject everytime there is mac_init&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Right now, I have implemented this workaround,&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="bug_squasher_77_1-1668753612335.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/200897i849D8F43411953CF/image-size/medium?v=v2&amp;amp;px=400" role="button" title="bug_squasher_77_1-1668753612335.png" alt="bug_squasher_77_1-1668753612335.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I am not sure if I should be using internal APIs or stick to first level sss_mac* APIs.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Summary.&lt;/P&gt;&lt;P&gt;- &lt;STRIKE&gt;Should I use&amp;nbsp;&lt;/STRIKE&gt;&lt;SPAN&gt;&lt;STRIKE&gt;SSSFTR_SE05X_CREATE_DELETE_CRYPTOOBJ ? The documentation says I need to initialize all CryptoObject at time of provisioning. I don't think it will achieve what I am looking for&lt;/STRIKE&gt;&lt;BR /&gt;- Should I use my workaround and use internal APIs?&lt;BR /&gt;- I want to control this behavior programmatically (or via compile time if not possible programmatically), so a feature request for se05x dev team.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Edit: I tested SSS_FTR_SE05x_CREATE_DELETE_CRYPTOOBJ=0, it simply refuses to calculate hmac with init-update-finish. Which is not what I am looking for.&lt;/P&gt;</description>
      <pubDate>Fri, 18 Nov 2022 07:43:27 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Secure-Authentication/Concurrency-issue-with-hmac-init-update-finish/m-p/1556308#M1010</guid>
      <dc:creator>bug_squasher_77</dc:creator>
      <dc:date>2022-11-18T07:43:27Z</dc:date>
    </item>
    <item>
      <title>Re: Concurrency issue with hmac init-update-finish</title>
      <link>https://community.nxp.com/t5/Secure-Authentication/Concurrency-issue-with-hmac-init-update-finish/m-p/1556924#M1011</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/206572"&gt;@bug_squasher_77&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Actually there is a macro of&amp;nbsp;EX_SSS_BOOT_DO_ERASE which enables similar operation as your workaround in the MW.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Kan_Li_0-1669011117066.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/201065i1CFF79D1873DD689/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Kan_Li_0-1669011117066.png" alt="Kan_Li_0-1669011117066.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Maybe you can reuse this mechanism as well? or you prefer to do it in your user application?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Have a great day,&lt;BR /&gt;Kan&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;-------------------------------------------------------------------------------&lt;BR /&gt;Note:&lt;BR /&gt;- If this post answers your question, please click the "Mark Correct" button. Thank you!&lt;BR /&gt;- We are following threads for 7 weeks after the last post, later replies are ignored&lt;BR /&gt;Please open a new thread and refer to the closed one, if you have a related question at a later point in time.&lt;BR /&gt;-------------------------------------------------------------------------------&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 21 Nov 2022 06:12:41 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Secure-Authentication/Concurrency-issue-with-hmac-init-update-finish/m-p/1556924#M1011</guid>
      <dc:creator>Kan_Li</dc:creator>
      <dc:date>2022-11-21T06:12:41Z</dc:date>
    </item>
    <item>
      <title>Re: Concurrency issue with hmac init-update-finish</title>
      <link>https://community.nxp.com/t5/Secure-Authentication/Concurrency-issue-with-hmac-init-update-finish/m-p/1556927#M1012</link>
      <description>&lt;P&gt;Hey&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/59276"&gt;@Kan_Li&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;This also deletes all stored keys and performs factory reset - Not usable in production.&lt;/P&gt;</description>
      <pubDate>Mon, 21 Nov 2022 06:21:01 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Secure-Authentication/Concurrency-issue-with-hmac-init-update-finish/m-p/1556927#M1012</guid>
      <dc:creator>bug_squasher_77</dc:creator>
      <dc:date>2022-11-21T06:21:01Z</dc:date>
    </item>
    <item>
      <title>Re: Concurrency issue with hmac init-update-finish</title>
      <link>https://community.nxp.com/t5/Secure-Authentication/Concurrency-issue-with-hmac-init-update-finish/m-p/1557070#M1014</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/206572"&gt;@bug_squasher_77&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I know, but maybe you can adjust it according to your application.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Have a great day,&lt;BR /&gt;Kan&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;-------------------------------------------------------------------------------&lt;BR /&gt;Note:&lt;BR /&gt;- If this post answers your question, please click the "Mark Correct" button. Thank you!&lt;BR /&gt;- We are following threads for 7 weeks after the last post, later replies are ignored&lt;BR /&gt;Please open a new thread and refer to the closed one, if you have a related question at a later point in time.&lt;BR /&gt;-------------------------------------------------------------------------------&lt;/P&gt;</description>
      <pubDate>Mon, 21 Nov 2022 09:31:38 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Secure-Authentication/Concurrency-issue-with-hmac-init-update-finish/m-p/1557070#M1014</guid>
      <dc:creator>Kan_Li</dc:creator>
      <dc:date>2022-11-21T09:31:38Z</dc:date>
    </item>
  </channel>
</rss>

