lkml.org 
[lkml]   [2022]   [Mar]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH v7 2/5] ima: define a new template field named 'd-ngv2' and templates
From
Date
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;
> >


\
 
 \ /
  Last update: 2022-03-28 15:51    [W:0.058 / U:0.364 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site