cancel
Showing results for 
Search instead for 
Did you mean: 

Custom header in SBSFU

Esaab.1
Associate

Hello, 

 

Is it possible to custom the header of a firmware for SBSFU ? I want to add 2 variables but it's not working. I have authentification failure. But I don't change the size and position in the structure because I used the "reserved" bytes. (the size was 28 ,now 24 of "reserved" field)

The error is : "Fw header authentication error"


I have modified :  

  1.  2_Images_SECoreBin\Inc\se_def_metadata.h :
typedef struct

{

  uint8_t  SFUMagic[4U];           /*!< SFU Magic 'SFU1' / 'SFU2' / 'SFU3'*/

  uint16_t ProtocolVersion;        /*!< SFU Protocol version*/

  uint16_t FwVersion;              /*!< Firmware version*/

  uint32_t FwSize;                 /*!< Firmware size (bytes)*/

  uint32_t PartialFwOffset;        /*!< Offset (bytes) of partial firmware vs full firmware */

  uint32_t PartialFwSize;          /*!< Size of partial firmware */

  uint8_t  FwTag[SE_TAG_LEN];      /*!< Firmware Tag*/

  uint8_t  PartialFwTag[SE_TAG_LEN];/*!< Partial firmware Tag */

  uint8_t  InitVector[SE_IV_LEN];  /*!< IV used to encrypt firmware */

  uint16_t MinHwVersion;           /*!< Minimum Hardware Version */

  uint16_t MaxHwVersion;           /*!< Maximum Hardware Version */

  uint8_t  Reserved[24U];          /*!< Reserved for future use: 24 extra bytes to have a header size of 192 bytes */

  uint8_t  HeaderSignature[SE_HEADER_SIGN_LEN];  /*!< Signature of the full header message */

  uint8_t  FwImageState[3U][32U];  /*!< Firmware image state - see SE_FwStateTypeDef for details */

  uint8_t  PrevHeaderFingerprint[SE_FW_HEADER_FINGERPRINT_LEN]; /*!< Fingerprint of previous FW header (if this is an update, else 32*0x00) */

} SE_FwRawHeaderTypeDef

 

2. prepareimage.py to add the min and max value in binary : 

header = pack('<'+str(len(magic))+'sHHIII'+str(len(tag))+'s'+str(len(pfwtag))+'s'+str(len(nonce))+'sHH'+str(args.reserved)+'s',

                    magic, protocol, version, size, pfwoffset, pfwsize, tag, pfwtag, nonce,min_hw_version, max_hw_version, reserved)
0 REPLIES 0