mirror of
https://github.com/stefanberger/libtpms
synced 2026-08-07 19:47:22 +00:00
tpm2: Allow to runtime-disable SM4 symmetric encryption algorithm
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
This commit is contained in:
parent
5a02cd2ea3
commit
01d5759990
@ -129,7 +129,7 @@ static const struct {
|
||||
[TPM_ALG_SHA384] = HASH(ALG_SHA384, "sha384", false, 1),
|
||||
[TPM_ALG_SHA512] = HASH(ALG_SHA512, "sha512", false, 1),
|
||||
[TPM_ALG_NULL] = OTHER(true, "null", false, 1),
|
||||
[TPM_ALG_SM4] = SYMMETRIC(ALG_SM4, "sm4", s_KeySizesSM4, false, 0), // not supported
|
||||
[TPM_ALG_SM4] = SYMMETRIC(ALG_SM4, "sm4", s_KeySizesSM4, true, 0), // not supported
|
||||
[TPM_ALG_RSASSA] = SIGNING(ALG_RSASSA, "rsassa", false, 1),
|
||||
[TPM_ALG_RSAES] = ENCRYPTING(ALG_RSAES, "rsaes", false, 1),
|
||||
[TPM_ALG_RSAPSS] = SIGNING(ALG_RSAPSS, "rsapss", false, 1),
|
||||
|
||||
@ -2733,12 +2733,19 @@ TPMI_SM4_KEY_BITS_Unmarshal(TPMI_SM4_KEY_BITS *target, BYTE **buffer, INT32 *siz
|
||||
if (rc == TPM_RC_SUCCESS) {
|
||||
switch (*target) {
|
||||
case 128:
|
||||
if (!RuntimeAlgorithmKeySizeCheckEnabled(&g_RuntimeProfile.RuntimeAlgorithm, // libtpms added begin
|
||||
TPM_ALG_SM4,
|
||||
*target)) {
|
||||
rc = TPM_RC_VALUE;
|
||||
} // libtpms added end
|
||||
break;
|
||||
default:
|
||||
rc = TPM_RC_VALUE;
|
||||
*target = orig_target; // libtpms added
|
||||
}
|
||||
}
|
||||
if (rc != TPM_RC_SUCCESS) { // libtpms added begin
|
||||
*target = orig_target;
|
||||
} // libtpms added end
|
||||
return rc;
|
||||
}
|
||||
#endif
|
||||
|
||||
Loading…
Reference in New Issue
Block a user