tpm2: Disable curves whose keysize is too small and than can be disabled

When ecc-min-size is given use it to disable all curves whose keysize is
too small and that can be disabled.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
This commit is contained in:
Stefan Berger 2024-07-26 13:03:48 -04:00 committed by Stefan Berger
parent 37c5b7d546
commit ea68ece7a7

View File

@ -440,6 +440,11 @@ RuntimeAlgorithmSetProfile(struct RuntimeAlgorithm *RuntimeAlgorithm,
retVal = TPM_RC_VALUE;
goto exit;
}
/* disable curves that can be disabled and not meet min. keysize */
if (RuntimeAlgorithm->algosMinimumKeySizes[TPM_ALG_ECC] >
s_EccAlgorithmProperties[curveId].keySize &&
s_EccAlgorithmProperties[curveId].canBeDisabled)
CLEAR_BIT(curveId, RuntimeAlgorithm->enabledEccCurves);
}
/* some consistency checks */