On Mon, 2022-03-28 at 14:14 +0800, Guozihua (Scott) wrote: > > @@ -265,26 +285,39 @@ int ima_parse_buf(void *bufstartp, void *bufendp, void **bufcurp, > > } > > > > static int ima_eventdigest_init_common(const u8 *digest, u32 digestsize, > > - u8 hash_algo, > > + u8 digest_type, u8 hash_algo, > > struct ima_field_data *field_data) > > { > > /* > > * digest formats: > > * - DATA_FMT_DIGEST: digest > > * - DATA_FMT_DIGEST_WITH_ALGO: [<hash algo>] + ':' + '\0' + digest, > > + * - DATA_FMT_DIGEST_WITH_TYPE_AND_ALGO: > > + * [<digest type> + ':' + <hash algo>] + ':' + '\0' + digest, > > + * where <hash type> is either "ima" or "verity", > > * where <hash algo> is provided if the hash algorithm is not > > * SHA1 or MD5 > > */ > > - u8 buffer[CRYPTO_MAX_ALG_NAME + 2 + IMA_MAX_DIGEST_SIZE] = { 0 }; > > + u8 buffer[DIGEST_TYPE_NAME_LEN_MAX + CRYPTO_MAX_ALG_NAME + 2 + > > + IMA_MAX_DIGEST_SIZE] = { 0 }; > > Hi Mimi, > > Shouldn't this contains an additional ":", Thus should +1 again? The length of the CRYPTO_MAX_ALG_NAME includes room for the terminating NULL. In this case, the terminating NULL isn't needed. It's replaced with the ':'. thanks, Mimi > > > enum data_formats fmt = DATA_FMT_DIGEST; > > u32 offset = 0; > >