Skip to content

Commit

Permalink
FmpDevicePkg FmpDxe: Use local variable to store test key digest size
Browse files Browse the repository at this point in the history
Some static tool reports "the condition in 'if' statement is constant".

This patch updates the code to use local variable to store test key
digest size. It can pass the static tool's check.

Cc: Michael D Kinney <[email protected]>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Star Zeng <[email protected]>
Reviewed-by: Michael D Kinney <[email protected]>
  • Loading branch information
lzeng14 authored and mdkinney committed Aug 2, 2018
1 parent a6d7326 commit d7fb5a4
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion FmpDevicePkg/FmpDxe/DetectTestKey.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,14 @@ DetectTestKey (
UINT8 *PublicKeyDataXdrEnd;
VOID *HashContext;
UINT8 Digest[SHA256_DIGEST_SIZE];
UINTN TestKeyDigestSize;

//
// If PcdFmpDeviceTestKeySha256Digest is not exacty SHA256_DIGEST_SIZE bytes,
// then skip the test key detection.
//
if (PcdGetSize (PcdFmpDeviceTestKeySha256Digest) != SHA256_DIGEST_SIZE) {
TestKeyDigestSize = PcdGetSize (PcdFmpDeviceTestKeySha256Digest);
if (TestKeyDigestSize != SHA256_DIGEST_SIZE) {
return;
}

Expand Down

0 comments on commit d7fb5a4

Please sign in to comment.