Re: [PATCH v6 3/3] ima-evm-utils: Read keyid from the cert appended to the key file

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Vitaly,

On Tue, 2021-05-11 at 14:56 +0300, Vitaly Chikunov wrote:
> 
> diff --git a/src/libimaevm.c b/src/libimaevm.c
> index 1c03768..bfce7ef 100644
> --- a/src/libimaevm.c
> +++ b/src/libimaevm.c
> @@ -1021,10 +1021,12 @@ static int sign_hash_v2(const char *algo, const unsigned char *hash,
>  		return -1;
>  	}
> 
> -	if (imaevm_params.keyid)
> +	if (imaevm_params.keyid) {
>  		hdr->keyid = htonl(imaevm_params.keyid);
> -	else
> -		calc_keyid_v2(&hdr->keyid, name, pkey);
> +	} else {
> +		if (__read_keyid(&hdr->keyid, keyfile, KEYID_FILE_PEM_KEY))
> +			calc_keyid_v2(&hdr->keyid, name, pkey);
> +	}

If the call to  __read_keyid() was independent of the test and call to
calc_keyid_v2(), it would make reading code the easier to understand.

result = __read_keyid(...);
if (result  < 0)
    calc_keyid_v2(...);

thanks,

Mimi

> 
>  	st = "EVP_PKEY_CTX_new";
>  	if (!(ctx = EVP_PKEY_CTX_new(pkey, NULL)))





[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux Kernel]     [Linux Kernel Hardening]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]

  Powered by Linux