From fe3ca12d06a534e5f10587a52730f5fd43dab831 Mon Sep 17 00:00:00 2001 From: Star Zeng Date: Fri, 16 Oct 2015 01:46:19 +0000 Subject: SecurityPkg: Use PcdSet##S to instead of PcdSet## PcdSet## has no error status returned, then the caller has no idea about whether the set operation is successful or not. PcdSet##S were added to return error status and PcdSet## APIs were put in ifndef DISABLE_NEW_DEPRECATED_INTERFACES condition. To adopt PcdSet##S and further code development with DISABLE_NEW_DEPRECATED_INTERFACES defined, we need to Replace PcdSet## usage with PcdSet##S. Normally, DynamicDefault PCD set is expected to be success, but DynamicHii PCD set failure is a legal case. PcdTpmInitializationPolicy/PcdTcg2HashAlgorithmBitmap/PcdTpm2HashMask/PcdTpmInstanceGuid all have set operation in PEI phase, PEI phase does not allow DynamicHii PCD set, so DynamicDefault is expected for them and use PcdSet##S to instead of PcdSet## and assert when set failure. Cc: Jiewen Yao Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Star Zeng Reviewed-by: Jiewen Yao git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18614 6f19259b-4bc3-4df7-8a09-765794883524 --- .../Library/HashLibBaseCryptoRouter/HashLibBaseCryptoRouterPei.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'SecurityPkg/Library/HashLibBaseCryptoRouter/HashLibBaseCryptoRouterPei.c') diff --git a/SecurityPkg/Library/HashLibBaseCryptoRouter/HashLibBaseCryptoRouterPei.c b/SecurityPkg/Library/HashLibBaseCryptoRouter/HashLibBaseCryptoRouterPei.c index 98c07933d8..c3d487958b 100644 --- a/SecurityPkg/Library/HashLibBaseCryptoRouter/HashLibBaseCryptoRouterPei.c +++ b/SecurityPkg/Library/HashLibBaseCryptoRouter/HashLibBaseCryptoRouterPei.c @@ -258,6 +258,7 @@ RegisterHashInterfaceLib ( HASH_INTERFACE_HOB LocalHashInterfaceHob; UINT32 HashMask; UINT32 BiosSupportedHashMask; + EFI_STATUS Status; // // Check allow @@ -280,7 +281,8 @@ RegisterHashInterfaceLib ( return EFI_OUT_OF_RESOURCES; } BiosSupportedHashMask = PcdGet32 (PcdTcg2HashAlgorithmBitmap); - PcdSet32 (PcdTcg2HashAlgorithmBitmap, BiosSupportedHashMask | HashMask); + Status = PcdSet32S (PcdTcg2HashAlgorithmBitmap, BiosSupportedHashMask | HashMask); + ASSERT_EFI_ERROR (Status); // // Check duplication -- cgit v1.2.3