mirror of
https://github.com/stefanberger/libtpms
synced 2026-08-10 04:57:38 +00:00
tpm2: Add missing EC Curve cases in Unmarshal function
Add missing EC Curve cases in Unmarshal function. Also, don't accept curves that are not usable during runtime because OpenSSL may not support them. Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
This commit is contained in:
parent
f13a6396b4
commit
dae596cb3c
@ -41,7 +41,9 @@
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "Tpm.h" // libtpms added
|
||||
#include "Unmarshal_fp.h"
|
||||
#include "CryptEccMain_fp.h" // libtpms added
|
||||
|
||||
TPM_RC
|
||||
UINT8_Unmarshal(UINT8 *target, BYTE **buffer, INT32 *size)
|
||||
@ -3522,12 +3524,30 @@ TPMI_ECC_CURVE_Unmarshal(TPMI_ECC_CURVE *target, BYTE **buffer, INT32 *size)
|
||||
#if ECC_BN_P256
|
||||
case TPM_ECC_BN_P256:
|
||||
#endif
|
||||
#if ECC_BN_P638 // libtpms added begin
|
||||
case TPM_ECC_BN_P638:
|
||||
#endif
|
||||
#if ECC_NIST_P192
|
||||
case TPM_ECC_NIST_P192:
|
||||
#endif
|
||||
#if ECC_NIST_P224
|
||||
case TPM_ECC_NIST_P224:
|
||||
#endif // libtpms added end
|
||||
#if ECC_NIST_P256
|
||||
case TPM_ECC_NIST_P256:
|
||||
#endif
|
||||
#if ECC_NIST_P384
|
||||
case TPM_ECC_NIST_P384:
|
||||
#endif
|
||||
#if ECC_NIST_P521 // libtpms added begin
|
||||
case TPM_ECC_NIST_P521:
|
||||
#endif
|
||||
#if ECC_SM2_P256
|
||||
case TPM_ECC_SM2_P256:
|
||||
#endif
|
||||
if (!CryptEccIsCurveRuntimeUsable(*target))
|
||||
rc = TPM_RC_CURVE;
|
||||
// libtpms added end
|
||||
break;
|
||||
default:
|
||||
rc = TPM_RC_CURVE;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user