The following macros are supplied to calculate the size of data types that hold attribute information.
/*
* SA_ATTR_STR_ARRAY_SIZE(N) - calculate the size required
* for a sec_attr_enc_str_array_t with N sec_attr_enc_printstring_p_t-s.
*/
#define SA_ATTR_STR_ARRAY_SIZE(N) ( sizeof(sec_attr_enc_str_array_t) + \
(((N) - 1) * sizeof(sec_attr_enc_printstring_p_t)) )
/*
* SA_ATTR_BYTES_SIZE(N) - calculate the size required
* for a sec_attr_enc_bytes_t with byte string length of N.
*/
#define SA_ATTR_BYTES_SIZE(N) ( sizeof(sec_attr_enc_bytes_t) + (N) - 1 )
/*
* SA_ATTR_IDATA_SIZE(N) - calculate the size required
* for a sec_attr_i18n_data_t with byte string length of N.
*/
#define SA_ATTR_IDATA_SIZE(N) ( sizeof(sec_attr_i18n_data_t) + (N) - 1 )
/*
* SA_ATTR_SET_SIZE(N) - calculate the size required
* for a sec_attr_enc_attr_set_t with N members (uuids).
*/
#define SA_ATTR_SET_SIZE(N) ( sizeof(sec_attr_enc_attr_set_t) + \
(((N) - 1) * sizeof(uuid_t)) )