This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

LP-AM243: AES CBC

Part Number: LP-AM243

Tool/software:

Hi,

Is it possible to encrypt and decrypt more than 64KB using AES CBC?

The AM64x MCU+ SDK (Ver09.01.00) states that the maximum length is 64KB-1,

but I would like to encrypt and decrypt an application (1-2MB) using AES CBC. Is there any way to do this?

Or would it be better to encrypt and decrypt using a different method instead of using CBC?

Regards,
Yukinobu

  • Hi Yukinobu,

    Thanks for your query.

    Currently, the subject matter expert is out of office. Response to this thread will be delayed. Please expect responses in several business days.

    Thanks for your cooperation.

    Regards,

    Tushar

  • Hi Yukinobu,

    The AM64x MCU+ SDK (Ver09.01.00) states that the maximum length is 64KB-1,

    This is the maximum packet length. In case you want to encrypt/decrypt more data, it must be processed in chunks of maximum lengths like it is already done in the SA2UL driver.

    So, you may encrypt/decrypt 1-2MB data by increasing the buffers length accordingly.

    Regards,

    Prashant

  • Hi Prashant,

    I apologize for the late reply.
    I will check the answer you gave me.

    Regards,
    Yukinobu

  • Hi Yukinobu,

    Thanks for the update. Let me know if you need any further clarifications!!

    Regards,

    Prashant

  • Hi Prashant,

    I added debug code to check encryption/decryption of 64KB or more and extended the MSRAM size to 0xd0000,
    but the following error occurred, and I get a startup error with SBL UART.

    C:\ti\mcu_plus_sdk_am243x_09_02_01_05\tools\boot>python uart_bootloader.py -p COM4 --bootloader=../../../../Users/hasinoguti/workspace_v12/sbl_uart_am243x-lp_r5fss0-0_nortos_ti-arm-clang/sbl_uart.Debug.hs.tiimage --file=../../../../Users/hasinoguti/workspace_v12/crypto_aes_cbc_256_am243x-lp_r5fss0-0_nortos_ti-arm-clang/Debug/crypto_aes_cbc_256_am243x-lp_r5fss0-0_nortos_ti-arm-clang.appimage.hs
    
    Sending the UART bootloader ../../../../Users/hasinoguti/workspace_v12/sbl_uart_am243x-lp_r5fss0-0_nortos_ti-arm-clang/sbl_uart.Debug.hs.tiimage ...
    Sending ../../../../Users/hasinoguti/workspace_v12/sbl_uart_am243x-lp_r5fss0-0_nortos_ti-arm-clang/sbl_uart.Debug.hs.tiimage: 33133
    Sending ../../../../Users/hasinoguti/workspace_v12/sbl_uart_am243x-lp_r5fss0-0_nortos_ti-arm-clang/sbl_uart.Debug.hs.tiimage: 33236
    Sending ../../../../Users/hasinoguti/workspace_v12/sbl_uart_am243x-lp_r5fss0-0_nortos_ti-arm-clang/sbl_uart.Debug.hs.tiimage: 33236
    Sending ../../../../Users/hasinoguti/workspace_v12/sbl_uart_am243x-lp_r5fss0-0_nortos_ti-arm-clang/sbl_uart.Debug.hs.tiimage: 33339
    Sending ../../../../Users/hasinoguti/workspace_v12/sbl_uart_am243x-lp_r5fss0-0_nortos_ti-arm-clang/sbl_uart.Debug.hs.tiimage: 33339
                                                                                                                                       
    Sent bootloader ../../../../Users/hasinoguti/workspace_v12/sbl_uart_am243x-lp_r5fss0-0_nortos_ti-arm-clang/sbl_uart.Debug.hs.tiimage of size 331284 bytes in 38.1140137s.
    Sending the application ../../../../Users/hasinoguti/workspace_v12/crypto_aes_cbc_256_am243x-lp_r5fss0-0_nortos_ti-arm-clang/Debug/crypto_aes_cbc_256_am243x-lp_r5fss0-0_nortos_ti-arm-clang.appimage.hs ...
    
    Sending ../../../../Users/hasinoguti/workspace_v12/crypto_aes_cbc_256_am243x-lp_r5fss0-0_nortos_ti-arm-clang/Debug/crypto_aes_cbc_2
    Sending ../../../../Users/hasinoguti/workspace_v12/crypto_aes_cbc_256_am243x-lp_r5fss0-0_nortos_ti-arm-clang/Debug/crypto_aes_cbc_2
    Sending ../../../../Users/hasinoguti/workspace_v12/crypto_aes_cbc_256_am243x-lp_r5fss0-0_nortos_ti-arm-clang/Debug/crypto_aes_cbc_2
    Sending ../../../../Users/hasinoguti/workspace_v12/crypto_aes_cbc_256_am243x-lp_r5fss0-0_nortos_ti-arm-clang/Debug/crypto_aes_cbc_2
    Sending ../../../../Users/hasinoguti/workspace_v12/crypto_aes_cbc_256_am243x-lp_r5fss0-0_nortos_ti-arm-clang/Debug/crypto_aes_cbc_2
    Sending ../../../../Users/hasinoguti/workspace_v12/crypto_aes_cbc_256_am243x-lp_r5fss0-0_nortos_ti-arm-clang/Debug/crypto_aes_cbc_2
    Sending ../../../../Users/hasinoguti/workspace_v12/crypto_aes_cbc_256_am243x-lp_r5fss0-0_nortos_ti-arm-clang/Debug/crypto_aes_cbc_2
    Sending ../../../../Users/hasinoguti/workspace_v12/crypto_aes_cbc_256_am243x-lp_r5fss0-0_nortos_ti-arm-clang/Debug/crypto_aes_cbc_2
    Sending ../../../../Users/hasinoguti/workspace_v12/crypto_aes_cbc_256_am243x-lp_r5fss0-0_nortos_ti-arm-clang/Debug/crypto_aes_cbc_2
    Sending ../../../../Users/hasinoguti/workspace_v12/crypto_aes_cbc_256_am243x-lp_r5fss0-0_nortos_ti-arm-clang/Debug/crypto_aes_cbc_2
                                                                                                                                       
    Sent application ../../../../Users/hasinoguti/workspace_v12/crypto_aes_cbc_256_am243x-lp_r5fss0-0_nortos_ti-arm-clang/Debug/crypto_aes_cbc_256_am243x-lp_r5fss0-0_nortos_ti-arm-clang.appimage.hs of size 704186 bytes in 64.3728077s.
    
    [STATUS] ERROR: Application load FAILED, file size exceeds LIMIT on the EVM !!!
    
    


    The size of the created appimage is 688KB.

    What should I fix if the size exceeds the limit?

    Regards,
    Yukinobu

     

  • Hi Yukinobu,

    The default SBL_UART can not boot an appimage of size more than 384KB & so you see the failure. Instead of SBL UART, you may use SBL OSPI to boot the example.

    Regards,

    Prashant

  • Hi Prashant,


    I can now boot from OSPI, but
    the following error occurs during startup.

    Is this because the MSRAM is located at 70018000?

    Where should I place the MSRAM?

    Regards,
    Yukinobu

  • Hi Yukinobu,

    The MSRAM first two banks (0x70000000 - 0x70080000) are reserved for SBL & should not be used by application at load time.

    I have a couple of questions here:

    1) The AES example has the following default memory regions but you seem to have different memory layout for this example. Could you please let me know the modifications you have done.

    MEMORY
    {
        R5F_VECS   : ORIGIN = 0x0 , LENGTH = 0x40 
        R5F_TCMA   : ORIGIN = 0x40 , LENGTH = 0x7FC0 
        R5F_TCMB0   : ORIGIN = 0x41010000 , LENGTH = 0x8000 
        NON_CACHE_MEM   : ORIGIN = 0x70060000 , LENGTH = 0x8000 
        MSRAM   : ORIGIN = 0x70080000 , LENGTH = 0x40000 
        USER_SHM_MEM   : ORIGIN = 0x701D0000 , LENGTH = 0x180 
        LOG_SHM_MEM   : ORIGIN = 0x701D0180 , LENGTH = 0x3E80 
        RTOS_NORTOS_IPC_SHM_MEM   : ORIGIN = 0x701D4000 , LENGTH = 0xC000 
        FLASH   : ORIGIN = 0x60100000 , LENGTH = 0x80000 
    
        /* For memory Regions not defined in this core but shared by other cores with the current core */
    
    
    }

    2) The application size seems to be 3MB while the MSRAM is of only 2MB. The application load will fail in any case unless you are using some other memory as well probably DDR. Is that the case?

    3) Are you able to run the AES example without any modifications at all?

    Regards,

    Prashant