<?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>i.MX Processors中的主题 Re: AES Encryption/Decryption using imx-secure-enclave library</title>
    <link>https://community.nxp.com/t5/i-MX-Processors/AES-Encryption-Decryption-using-imx-secure-enclave-library/m-p/2081092#M236355</link>
    <description>It should be:&lt;BR /&gt;if (se_get_soc_id() == SOC_IMX95)&lt;BR /&gt;&lt;BR /&gt;Here is the code that skips what I want to do on an i.MX91:&lt;BR /&gt;&lt;A href="https://github.com/nxp-imx/imx-secure-enclave/blob/1130c8bb820881ad037ba3f060e7fa70635fae3c/test/common/test_cipher.c#L329" target="_blank"&gt;https://github.com/nxp-imx/imx-secure-enclave/blob/1130c8bb820881ad037ba3f060e7fa70635fae3c/test/common/test_cipher.c#L329&lt;/A&gt;</description>
    <pubDate>Tue, 15 Apr 2025 20:31:26 GMT</pubDate>
    <dc:creator>JohnKlug</dc:creator>
    <dc:date>2025-04-15T20:31:26Z</dc:date>
    <item>
      <title>AES Encryption/Decryption using imx-secure-enclave library</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/AES-Encryption-Decryption-using-imx-secure-enclave-library/m-p/2080249#M236296</link>
      <description>&lt;P&gt;I am trying to use something like hsm_do_cipher or hsm_cipher_one_go to encrypt with AES 256 a small amount of data (32 bytes).&lt;BR /&gt;&lt;BR /&gt;When I tried hsm_do_cipher I get an error that the handle is bad.&amp;nbsp; If I use hsm_cipher_one_go I get a bad parameter error.&lt;BR /&gt;&lt;BR /&gt;I tried to use this code to create my test:&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://github.com/nxp-imx/imx-secure-enclave/blob/1130c8bb820881ad037ba3f060e7fa70635fae3c/test/hsm/hsm_test.c#L620" target="_blank"&gt;https://github.com/nxp-imx/imx-secure-enclave/blob/1130c8bb820881ad037ba3f060e7fa70635fae3c/test/hsm/hsm_test.c#L620&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;I get this error from hsm_cipher_one_go:&lt;/P&gt;&lt;LI-CODE lang="c"&gt;SAB Error: SAB CMD [0x62] Resp [0x429] - MU sanity check failed / Invalid parameters.

aesencrypt: aesencrypt.c:164: hsm_do_cipher failed, err=0x4&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there a way to determine what is wrong with my parameters?&amp;nbsp; I see no errors when I create my key in a separate program.&amp;nbsp; Files are created under /etc/ele.&lt;BR /&gt;Here is my code setting up the cipher_args:&lt;/P&gt;&lt;LI-CODE lang="c"&gt;    memset(&amp;amp;cipher_args,0,sizeof cipher_args);
    cipher_args.key_identifier = KEYID;
    cipher_args.iv = SM2_IDENTIFIER;
    cipher_args.iv_size = sizeof(SM2_IDENTIFIER);
    cipher_args.flags = HSM_CIPHER_ONE_GO_FLAGS_ENCRYPT;
    cipher_args.cipher_algo = HSM_CIPHER_ONE_GO_ALGO_ECB;
    cipher_args.input = sp;
    cipher_args.input_size = slength;
    cipher_args.output = od;
    cipher_args.output_size = slength;&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 14 Apr 2025 22:45:10 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/AES-Encryption-Decryption-using-imx-secure-enclave-library/m-p/2080249#M236296</guid>
      <dc:creator>JohnKlug</dc:creator>
      <dc:date>2025-04-14T22:45:10Z</dc:date>
    </item>
    <item>
      <title>Re: AES Encryption/Decryption using imx-secure-enclave library</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/AES-Encryption-Decryption-using-imx-secure-enclave-library/m-p/2081089#M236354</link>
      <description>I see that the test I copied has this at the start:&lt;BR /&gt;&lt;BR /&gt;f (se_get_soc_id() == SOC_IMX95)&lt;BR /&gt;do_cipher_stream_opaquekey_test(key_store_hdl, key_mgmt_hdl);&lt;BR /&gt;&lt;BR /&gt;So this probably prevents this test from running on the i.MX91. So why is the filter on imx95 present? Can you use the keystore with AES encryption on an i.MX91? Is there an example anywhere?</description>
      <pubDate>Tue, 15 Apr 2025 20:19:19 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/AES-Encryption-Decryption-using-imx-secure-enclave-library/m-p/2081089#M236354</guid>
      <dc:creator>JohnKlug</dc:creator>
      <dc:date>2025-04-15T20:19:19Z</dc:date>
    </item>
    <item>
      <title>Re: AES Encryption/Decryption using imx-secure-enclave library</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/AES-Encryption-Decryption-using-imx-secure-enclave-library/m-p/2081092#M236355</link>
      <description>It should be:&lt;BR /&gt;if (se_get_soc_id() == SOC_IMX95)&lt;BR /&gt;&lt;BR /&gt;Here is the code that skips what I want to do on an i.MX91:&lt;BR /&gt;&lt;A href="https://github.com/nxp-imx/imx-secure-enclave/blob/1130c8bb820881ad037ba3f060e7fa70635fae3c/test/common/test_cipher.c#L329" target="_blank"&gt;https://github.com/nxp-imx/imx-secure-enclave/blob/1130c8bb820881ad037ba3f060e7fa70635fae3c/test/common/test_cipher.c#L329&lt;/A&gt;</description>
      <pubDate>Tue, 15 Apr 2025 20:31:26 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/AES-Encryption-Decryption-using-imx-secure-enclave-library/m-p/2081092#M236355</guid>
      <dc:creator>JohnKlug</dc:creator>
      <dc:date>2025-04-15T20:31:26Z</dc:date>
    </item>
    <item>
      <title>Re: AES Encryption/Decryption using imx-secure-enclave library</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/AES-Encryption-Decryption-using-imx-secure-enclave-library/m-p/2081148#M236358</link>
      <description>I found code that I could use:&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://github.com/nxp-imx/imx-secure-enclave/blob/1130c8bb820881ad037ba3f060e7fa70635fae3c/test/common/test_cipher.c#L295" target="_blank"&gt;https://github.com/nxp-imx/imx-secure-enclave/blob/1130c8bb820881ad037ba3f060e7fa70635fae3c/test/common/test_cipher.c#L295&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;I found that 8 bytes of input data will cause the function hsm_do_hash() to fail with an invalid argument message. 16 bytes does work.&lt;BR /&gt;&lt;BR /&gt;It would be nice if key_identifier requirements were spelled out, iv_size does not have limits, neither does input_size.</description>
      <pubDate>Tue, 15 Apr 2025 23:29:05 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/AES-Encryption-Decryption-using-imx-secure-enclave-library/m-p/2081148#M236358</guid>
      <dc:creator>JohnKlug</dc:creator>
      <dc:date>2025-04-15T23:29:05Z</dc:date>
    </item>
  </channel>
</rss>

