imx-ele-apps/aes_usage test with 50MB file fails

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

imx-ele-apps/aes_usage test with 50MB file fails

284 Views
HH_Mov
Contributor III

As a test of the HSM on the i.MX93 the aes_usage test was ran with a 50MB file being en/decrypted.

However running the decryption on target resulted in:

./ele_aes_usage decrypt CTR /tmp/dummy-file.enc /tmp/dummy-file 0x3FFFFFFF > /dev/null
[ 1179.264527] fsl-se-fw se-fw2: hsm1_ch0: Not enough space in shared memory
[ 1179.271346] fsl-se-fw se-fw2: hsm1_ch0: Not enough space in shared memory
cipher_with_ele_cipher failed ret:0xff

(Encrypting a file resulted in the same issue)

For info: The reserved space for ele is 1MB

hexdump -C /proc/device-tree/reserved-memory/ele-reserved\@a4120000/reg
00000000  00 00 00 00 a4 12 00 00  00 00 00 00 00 10 00 00  |................|
00000010

 

Is this a configuration issue, or should the decryption of a large file be handled differently ?

0 Kudos
Reply
3 Replies

245 Views
HH_Mov
Contributor III

Additional info:

The aes_usage app allocates output buffer space based on the size of the input.
Using a file of 125MB and more than 650MB of free RAM, this should not be an issue.

0 Kudos
Reply

224 Views
Manuel_Salas
NXP TechSupport
NXP TechSupport

Hello @HH_Mov 

I hope you are doing very well.

 

Kindly share your BSP version. 

Are you using a pre-compiled image? or did you compile your own (if so, please share the steps you followed)?

 

Best regards,

Salas.

0 Kudos
Reply

173 Views
HH_Mov
Contributor III

Hello Salas,

It is a custom yocto ScarthGap build, based on the karo and imx layers.

Running "ELE firmware version 2.0.0-64d8ef47" and Linux 6.6.52

The aes_usage app is obtained from: https://github.com/nxp-imx-support/imx_sec_apps.git: Branch master

With a few adaptations to make it run (e.g. nvm_daemon is started via init scripts in our case), and build using the sdk generated by our yocto build.

Did a small test using a file containing a short text string ("Alle appels zijn oranje"), encrypted on host and imported the aes key from the key_import example on target (0x3FFFFFFF).

./ele_aes_usage decrypt CBC another-cipher.txt another-secret-message.txt 0x3FFFFFFF


The result was: 

Alle appels zijn oranje;m^▒▒▒F▒▒▒}▒ϸ▒▒



Then tested using a 50MB binary (encrypted on host).

./ele_aes_usage decrypt CTR /tmp/binary.bin.enc /tmp/binary.bin 0x3FFFFFFF > /dev/null
[ 1179.264527] fsl-se-fw se-fw2: hsm1_ch0: Not enough space in shared memory
[ 1179.271346] fsl-se-fw se-fw2: hsm1_ch0: Not enough space in shared memory
cipher_with_ele_cipher failed ret:0xff



Then tested encrypting the binary.bin on target (to rule out something wrong with the encryption on host)

 

./ele_aes_usage encrypt CTR /tmp/binary.bin /tmp/binary.bin.enc 0x3FFFFFFF
Hello, World! Oct 13 2025:06:28:33 b83e779
message preview:
hsqs

SAB Error: SAB C[ 1573.976753] fsl-se-fw se-fw2: hsm1_ch0: Not enough space in shared memory
MD [0x30] Resp [[ 1573.983856] fsl-se-fw se-fw2: hsm1_ch0: Not enough space in shared memory
0xf29] - The key store is already opened by a user (load operation).

Key store already created, trying to load it...

SAB Error: SAB CMD [0x62] Resp [0x29] - General Error.

hsm cipher failed, ret: 0xff
cipher_with_ele_cipher failed ret:0xff



Best Regards,

Hugo


0 Kudos
Reply
%3CLINGO-SUB%20id%3D%22lingo-sub-2183889%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3Eimx-ele-apps%2Faes_usage%20test%20with%2050MB%20file%20fails%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2183889%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EAs%20a%20test%20of%20the%20HSM%20on%20the%20i.MX93%20the%20aes_usage%20test%20was%20ran%20with%20a%2050MB%20file%20being%20en%2Fdecrypted.%3C%2FP%3E%3CP%3EHowever%20running%20the%20decryption%20on%20target%20resulted%20in%3A%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-markup%22%3E%3CCODE%3E.%2Fele_aes_usage%20decrypt%20CTR%20%2Ftmp%2Fdummy-file.enc%20%2Ftmp%2Fdummy-file%200x3FFFFFFF%20%26gt%3B%20%2Fdev%2Fnull%0A%5B%201179.264527%5D%20fsl-se-fw%20se-fw2%3A%20hsm1_ch0%3A%20Not%20enough%20space%20in%20shared%20memory%0A%5B%201179.271346%5D%20fsl-se-fw%20se-fw2%3A%20hsm1_ch0%3A%20Not%20enough%20space%20in%20shared%20memory%0Acipher_with_ele_cipher%20failed%20ret%3A0xff%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E(Encrypting%20a%20file%20resulted%20in%20the%20same%20issue)%3CBR%20%2F%3E%3CBR%20%2F%3EFor%20info%3A%20The%20reserved%20space%20for%20ele%20is%201MB%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-markup%22%3E%3CCODE%3Ehexdump%20-C%20%2Fproc%2Fdevice-tree%2Freserved-memory%2Fele-reserved%5C%40a4120000%2Freg%0A00000000%20%2000%2000%2000%2000%20a4%2012%2000%2000%20%2000%2000%2000%2000%2000%2010%2000%2000%20%20%7C................%7C%0A00000010%3C%2FCODE%3E%3C%2FPRE%3E%3CBR%20%2F%3E%3CP%3EIs%20this%20a%20configuration%20issue%2C%20or%20should%20the%20decryption%20of%20a%20large%20file%20be%20handled%20differently%20%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2188949%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20imx-ele-apps%2Faes_usage%20test%20with%2050MB%20file%20fails%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2188949%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHello%20Salas%2C%3C%2FP%3E%3CP%3EIt%20is%20a%20custom%20yocto%20ScarthGap%20build%2C%20based%20on%20the%20karo%20and%20imx%20layers.%3CBR%20%2F%3E%3CBR%20%2F%3ERunning%20%22ELE%20firmware%20version%202.0.0-64d8ef47%22%20and%20Linux%206.6.52%3CBR%20%2F%3E%3CBR%20%2F%3EThe%20aes_usage%20app%20is%20obtained%20from%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2Fnxp-imx-support%2Fimx_sec_apps.git%3A%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3E%3A%20https%3A%2F%2Fgithub.com%2Fnxp-imx-support%2Fimx_sec_apps.git%3A%3C%2FA%3E%26nbsp%3BBranch%20master%3CBR%20%2F%3E%3CBR%20%2F%3EWith%20a%20few%20adaptations%20to%20make%20it%20run%20(e.g.%20nvm_daemon%20is%20started%20via%20init%20scripts%20in%20our%20case)%2C%20and%20build%20using%20the%20sdk%20generated%20by%20our%20yocto%20build.%3CBR%20%2F%3E%3CBR%20%2F%3EDid%20a%20small%20test%20using%20a%20file%20containing%20a%20short%20text%20string%20(%22Alle%20appels%20zijn%20oranje%22)%2C%20encrypted%20on%20host%20and%20imported%20the%20aes%20key%20from%20the%20key_import%20example%20on%20target%20(0x3FFFFFFF).%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-markup%22%3E%3CCODE%3E.%2Fele_aes_usage%20decrypt%20CBC%20another-cipher.txt%20another-secret-message.txt%200x3FFFFFFF%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%3CBR%20%2F%3EThe%20result%20was%3A%26nbsp%3B%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-markup%22%3E%3CCODE%3EAlle%20appels%20zijn%20oranje%3Bm%5E%E2%96%92%E2%96%92%E2%96%92F%E2%96%92%E2%96%92%E2%96%92%7D%E2%96%92%CF%B8%E2%96%92%E2%96%92%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%3CBR%20%2F%3E%3CBR%20%2F%3EThen%20tested%20using%20a%2050MB%20binary%20(encrypted%20on%20host).%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-markup%22%3E%3CCODE%3E.%2Fele_aes_usage%20decrypt%20CTR%20%2Ftmp%2Fbinary.bin.enc%20%2Ftmp%2Fbinary.bin%200x3FFFFFFF%20%26gt%3B%20%2Fdev%2Fnull%0A%5B%201179.264527%5D%20fsl-se-fw%20se-fw2%3A%20hsm1_ch0%3A%20Not%20enough%20space%20in%20shared%20memory%0A%5B%201179.271346%5D%20fsl-se-fw%20se-fw2%3A%20hsm1_ch0%3A%20Not%20enough%20space%20in%20shared%20memory%0Acipher_with_ele_cipher%20failed%20ret%3A0xff%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%3CBR%20%2F%3E%3CBR%20%2F%3EThen%20tested%20encrypting%20the%20binary.bin%20on%20target%20(to%20rule%20out%20something%20wrong%20with%20the%20encryption%20on%20host)%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FP%3E%3CBR%20%2F%3E%3CPRE%20class%3D%22lia-code-sample%20language-markup%22%3E%3CCODE%3E.%2Fele_aes_usage%20encrypt%20CTR%20%2Ftmp%2Fbinary.bin%20%2Ftmp%2Fbinary.bin.enc%200x3FFFFFFF%0AHello%2C%20World!%20Oct%2013%202025%3A06%3A28%3A33%20b83e779%0Amessage%20preview%3A%0Ahsqs%0A%0ASAB%20Error%3A%20SAB%20C%5B%201573.976753%5D%20fsl-se-fw%20se-fw2%3A%20hsm1_ch0%3A%20Not%20enough%20space%20in%20shared%20memory%0AMD%20%5B0x30%5D%20Resp%20%5B%5B%201573.983856%5D%20fsl-se-fw%20se-fw2%3A%20hsm1_ch0%3A%20Not%20enough%20space%20in%20shared%20memory%0A0xf29%5D%20-%20The%20key%20store%20is%20already%20opened%20by%20a%20user%20(load%20operation).%0A%0AKey%20store%20already%20created%2C%20trying%20to%20load%20it...%0A%0ASAB%20Error%3A%20SAB%20CMD%20%5B0x62%5D%20Resp%20%5B0x29%5D%20-%20General%20Error.%0A%0Ahsm%20cipher%20failed%2C%20ret%3A%200xff%0Acipher_with_ele_cipher%20failed%20ret%3A0xff%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%3CBR%20%2F%3E%3CBR%20%2F%3EBest%20Regards%2C%3CBR%20%2F%3E%3CBR%20%2F%3EHugo%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2186257%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20imx-ele-apps%2Faes_usage%20test%20with%2050MB%20file%20fails%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2186257%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHello%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F252198%22%20target%3D%22_blank%22%3E%40HH_Mov%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EI%20hope%20you%20are%20doing%20very%20well.%3C%2FP%3E%0A%3CBR%20%2F%3E%0A%3CP%3EKindly%20share%20your%20BSP%20version.%26nbsp%3B%3C%2FP%3E%0A%3CP%3EAre%20you%20using%20a%20pre-compiled%20image%3F%20or%20did%20you%20compile%20your%20own%20(if%20so%2C%20please%20share%20the%20steps%20you%20followed)%3F%3C%2FP%3E%0A%3CBR%20%2F%3E%0A%3CP%3EBest%20regards%2C%3C%2FP%3E%0A%3CP%3ESalas.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2184577%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20imx-ele-apps%2Faes_usage%20test%20with%2050MB%20file%20fails%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2184577%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EAdditional%20info%3A%3C%2FP%3E%3CP%3EThe%20aes_usage%20app%20allocates%20output%20buffer%20space%20based%20on%20the%20size%20of%20the%20input.%3CBR%20%2F%3EUsing%20a%20file%20of%20125MB%20and%20more%20than%20650MB%20of%20free%20RAM%2C%20this%20should%20not%20be%20an%20issue.%3C%2FP%3E%3C%2FLINGO-BODY%3E