mirror of
https://github.com/stefanberger/libtpms
synced 2026-01-11 16:51:29 +00:00
tpm2: Print error message when invalid hash algorithm id appears (Coverity)
In case a hash algorithm id has a value >= 64 print out and error. This should never occur since any hash algorithm id should have been set through unmarshalling or by TPM 2-internal code. Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
This commit is contained in:
parent
ee141c60e0
commit
e3520059cf
@ -863,7 +863,12 @@ pcrbanks_algs_active(const TPML_PCR_SELECTION *pcrAllocated)
|
||||
for(i = 0; i < pcrAllocated->count; i++) {
|
||||
for (j = 0; j < pcrAllocated->pcrSelections[i].sizeofSelect; j++) {
|
||||
if (pcrAllocated->pcrSelections[i].pcrSelect[j]) {
|
||||
algs_active |= ((UINT64)1 << pcrAllocated->pcrSelections[i].hash);
|
||||
if (pcrAllocated->pcrSelections[i].hash >= 64) {
|
||||
TPMLIB_LogTPM2Error("pcrbanks_algs_active: invalid hash alg id: %d\n",
|
||||
pcrAllocated->pcrSelections[i].hash);
|
||||
} else {
|
||||
algs_active |= ((UINT64)1 << pcrAllocated->pcrSelections[i].hash);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user