mirror of
https://git.code.sf.net/p/linux-ima/ima-evm-utils
synced 2025-06-30 21:02:33 +02:00
Change PCR iterator from int to uint32_t
PCR numbers are naturally unsigned values. Further, they are 32 bits, even on 64-bit machines. This change eliminates the need for negative value and overflow tests. The parameter name is changed from j and idx to pcr_handle, which is more descriptive and is similar to the parameter name used in the TPM 2.0 specification. Signed-off-by: Ken Goldman <kgoldman@us.ibm.com> Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
This commit is contained in:
12
src/evmctl.c
12
src/evmctl.c
@ -1914,7 +1914,8 @@ static int read_tpm_banks(int num_banks, struct tpm_bank_info *bank)
|
||||
{
|
||||
int tpm_enabled = 0;
|
||||
char *errmsg = NULL;
|
||||
int i, j;
|
||||
int i;
|
||||
uint32_t pcr_handle;
|
||||
int err;
|
||||
|
||||
/* If --pcrs was specified, read only from the specified file(s) */
|
||||
@ -1934,9 +1935,12 @@ static int read_tpm_banks(int num_banks, struct tpm_bank_info *bank)
|
||||
/* Read PCRs from multiple TPM 2.0 banks */
|
||||
for (i = 0; i < num_banks; i++) {
|
||||
err = 0;
|
||||
for (j = 0; j < NUM_PCRS && !err; j++) {
|
||||
err = tpm2_pcr_read(bank[i].algo_name, j,
|
||||
bank[i].pcr[j], bank[i].digest_size,
|
||||
for (pcr_handle = 0;
|
||||
pcr_handle < NUM_PCRS && !err;
|
||||
pcr_handle++) {
|
||||
err = tpm2_pcr_read(bank[i].algo_name, pcr_handle,
|
||||
bank[i].pcr[pcr_handle],
|
||||
bank[i].digest_size,
|
||||
&errmsg);
|
||||
if (err) {
|
||||
log_debug("Failed to read %s PCRs: (%s)\n",
|
||||
|
Reference in New Issue
Block a user