Re: [PATCH v6 2/3] ima-evm-utils: Allow manual setting keyid from a cert file

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

 



On Tue, 2021-05-11 at 14:56 +0300, Vitaly Chikunov wrote:
> 
> +/**
> + * imaevm_read_keyid() - Read 32-bit keyid from the cert file.
> + * @certfile:	File possibly containing certificate in DER/PEM format.
> + *
> + * Try to read keyid from Subject Key Identifier (SKID) of certificate.
> + * Autodetect if cert is in PEM or DER encoding.
> + *
> + * Return: 0 on error;
> + *         32-bit keyid as unsigned integer in host order.
> + */
> +uint32_t imaevm_read_keyid(const char *certfile)
> +{
> +	uint32_t keyid_raw = 0;
> +
> +	__read_keyid(&keyid_raw, certfile, KEYID_FILE_UNK_CERT);
> +	return ntohl(keyid_raw);

On error, __read_keyid() returns < 0, but the return value isn't
checked before calling ntohl.  In either case, is imaevm_params.keyid
suppose to be big endian byte order?  If so, the call to htonl in
sign_hash_v2() would be unnecessary.

thanks,

Mimi




[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