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.

RTOS/CC3220SF-LAUNCHXL: sl_FsClose and sl_FsWrite to sys/mcuflashimg.bin

Part Number: CC3220SF-LAUNCHXL
Other Parts Discussed in Thread: UNIFLASH

Tool/software: TI-RTOS

Hi,

I asked this earlier but still looking for some clarification.

I have two images on my flash and I am trying to copy one over the other. (more specifically, second image over   sys/mcuflashimg.bin )

I can open both files and I am able to write but when I close mcuflashimg.bin I get the error  SL_ERROR_FS_WRONG_SIGNATURE_SECURITY_ALERT (-10289).  I think this is related to the signature I am trying to use to close the file.    I followed the steps that were mentioned in another article ( http://dev.ti.com/tirex/content/simplelink_academy_cc32xxsdk_1_13_00_29/modules/wifi_secure_file_system/wifi_secure_file_system.html ) that described creating the signature for my mcuflashimg.bin.  TEST_CERTIFICATE is defined as "dummy-trusted-cert".   I am assuming that if I write over mcuflashimg.bin that I would need the signature of that file.

I create the signature using this command:   openssl dgst -hex -c -sha1 -keyform DER -sign dummy-trusted-cert-key -out signature.hex.sign mcuflashimg.bin.  Note:  I attach a sha1 hash to the image then I create a signature for the entire image.  Not sure if there are additional bytes that I need to include before creating the signature. 

Here are the command I am use to open and close mcuflashimg.bin:

prod_lFileHandle = sl_FsOpen(MCU_LOCATION, SL_FS_WRITE ,0);

sl_FsWrite( prod_lFileHandle, (i*4096) , copied_buffer, 4096);

Status = sl_FsClose(prod_lFileHandle, TEST_CERTIFICATE, (const unsigned char *)originalSignature, sizeof(originalSignature));  

Thanks,

Kevin

  • Thanks Aaron,

    I have read through the Document and I have some questions.

    Currently, I am creating a digest from mcuflashimg.bin.  Do I create a signature from just the digest or the image+digest?  From the document, it seems like I only create signature from the digest.

    This is the command I am using to write the image to flash:

    C:/ti/uniflash_4.2.2/dslite.bat --mode cc3220 project add_file --fs_path /sys/mcuflashimg.bin --flags failsafe,publicwrite,secure --name UniFlash-CC3220SF-Dev --file %CD%/../stream_cc3220_application/' + build_folder + '/stream_cc3220_application.bin --project_path %CD%/projects  --priv C:/ti/simplelink_cc32xx_sdk_1_50_00_06/tools/cc32xx_tools/certificate-playground/dummy-trusted-cert-key --cert dummy-trusted-cert' 

    So when I close the file I use after write:

    sl_FsClose(prod_lFileHandle, TEST_CERTIFICATE, (const unsigned char *)originalSignature, sizeof(originalSignature));  // TEST_CERTIFICATE is "dummy-trusted-cert"

    I have also written the certificates to flash with the following commands:

    //dummy-trusted-cert

    'C:/ti/uniflash_4.2.2/dslite.bat --mode cc3220 project add_file --fs_path dummy-trusted-cert --name UniFlash-CC3220SF-Dev --file C:/ti/simplelink_cc32xx_sdk_1_50_00_06/tools/cc32xx_tools/certificate-playground/dummy-trusted-cert --project_path %CD%/projects',

    //dummy-trusted-ca-cert 

    'C:/ti/uniflash_4.2.2/dslite.bat --mode cc3220 project add_file --fs_path dummy-trusted-ca-cert --name UniFlash-CC3220SF-Dev --file C:/ti/simplelink_cc32xx_sdk_1_50_00_06/tools/cc32xx_tools/certificate-playground/dummy-trusted-ca-cert --project_path %CD%/projects',

    //dummy-root-ca-cert

    'C:/ti/uniflash_4.2.2/dslite.bat --mode cc3220 project add_file --fs_path dummy-root-ca-cert --name UniFlash-CC3220SF-Dev --file C:/ti/simplelink_cc32xx_sdk_1_50_00_06/tools/cc32xx_tools/certificate-playground/dummy-root-ca-cert --project_path %CD%/projects',

    Does this look correct?

    The command I use to create the signature is:

    openssl dgst -hex -c -sha1 -keyform DER -sign dummy-trusted-cert-key -out test.bin.sign  mcuflashimg.bin

    I am guessing that I am no passing in the correct image and not creating a signature correctly.

    Thanks

    Kevin

  • See questions above: I am still having issues trying to copy and an image that already is on the flash over mcuflashimg.bin.