Hi Quach,

 

Thanks for reporting this bug.

The fix looks good to me. Would you like to create that patch to the trusted-firmware-m repo?

 

Regards,

Sherry Zhang

 

From: Quach, Brian via TF-M <tf-m@lists.trustedfirmware.org>
Sent: Thursday, December 7, 2023 1:55 AM
To: tf-m@lists.trustedfirmware.org
Cc: Chung, Peter <peter.chung@ti.com>
Subject: [TF-M] compile error when PS_ENCRYPTION=OFF

 

Hi, if I set PS_ENCRYPTION=OFF

 

set(PS_ENCRYPTION                     OFF   CACHE BOOL      "Enable encryption for Protected Storage partition")

 

 

I see this compile error:

 

In file included from /home/brian/gits/spe/source/third_party/tfm/secure_fw/partitions/internal_trusted_storage/tfm_internal_trusted_storage.c:32:

/home/brian/gits/spe/source/third_party/tfm/secure_fw/partitions/internal_trusted_storage/../protected_storage/ps_object_defs.h:48:31: error: 'PS_TAG_LEN_BYTES' undeclared here (not in a function)

   48 | #define PS_TAG_IV_LEN_MAX   ((PS_TAG_LEN_BYTES > PS_IV_LEN_BYTES) ? \

      |                               ^~~~~~~~~~~~~~~~

/home/brian/gits/spe/source/third_party/tfm/secure_fw/partitions/internal_trusted_storage/../protected_storage/ps_object_defs.h:60:20: note: in expansion of macro 'PS_TAG_IV_LEN_MAX'

   60 |     uint8_t tag_iv[PS_TAG_IV_LEN_MAX];

      |                    ^~~~~~~~~~~~~~~~~

/home/brian/gits/spe/source/third_party/tfm/secure_fw/partitions/internal_trusted_storage/../protected_storage/ps_object_defs.h:48:50: error: 'PS_IV_LEN_BYTES' undeclared here (not in a function)

   48 | #define PS_TAG_IV_LEN_MAX   ((PS_TAG_LEN_BYTES > PS_IV_LEN_BYTES) ? \

      |                                                  ^~~~~~~~~~~~~~~

/home/brian/gits/spe/source/third_party/tfm/secure_fw/partitions/internal_trusted_storage/../protected_storage/ps_object_defs.h:60:20: note: in expansion of macro 'PS_TAG_IV_LEN_MAX'

   60 |     uint8_t tag_iv[PS_TAG_IV_LEN_MAX];

      |                    ^~~~~~~~~~~~~~~~~

make[7]: *** [secure_fw/partitions/internal_trusted_storage/CMakeFiles/tfm_psa_rot_partition_its.dir/build.make:90: secure_fw/partitions/internal_trusted_storage/CMakeFiles/tfm_psa_rot_partition_its.dir/tfm_internal_trusted_storage.o] Error 1

 

I think the correct fix is to add the following highlighted code to ps_object_defs.h.   Patch is attached.

/*!

 * \struct ps_object_t

 *

 * \brief The object to be written to the file system below. Made up of the

 *        object header and the object data.

 */

struct ps_object_t {

    struct ps_obj_header_t header;         /*!< Object header */

    uint8_t data[PS_MAX_OBJECT_DATA_SIZE]; /*!< Object data */

#ifdef PS_ENCRYPTION

    uint8_t tag_iv[PS_TAG_IV_LEN_MAX];

#endif

};

 

 

Regards,

 

Brian Quach

SimpleLink MCU

Texas Instruments Inc.