mirror of
https://github.com/acidanthera/audk.git
synced 2025-07-29 16:44:10 +02:00
SecurityPkg/DxeImageVerificationHandler: remove "else" after return/break
In the code structure if (condition) { // // block1 // return; } else { // // block2 // } nesting "block2" in an "else" branch is superfluous, and harms readability. It can be transformed to: if (condition) { // // block1 // return; } // // block2 // with identical behavior, and improved readability (less nesting). The same applies to "break" (instead of "return") in a loop body. Perform these transformations on DxeImageVerificationHandler(). This patch is a no-op for behavior. Use git show -b -W for reviewing it more easily. Cc: Chao Zhang <chao.b.zhang@intel.com> Cc: Jian J Wang <jian.j.wang@intel.com> Cc: Jiewen Yao <jiewen.yao@intel.com> Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2129 Signed-off-by: Laszlo Ersek <lersek@redhat.com> Message-Id: <20200116190705.18816-3-lersek@redhat.com> Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com> [lersek@redhat.com: push with Mike's R-b due to Chinese New Year Holiday: <https://edk2.groups.io/g/devel/message/53429>; msgid <d3fbb76dabed4e1987c512c328c82810@intel.com>]
This commit is contained in:
parent
1e0f973b65
commit
eccb856f01
@ -1621,7 +1621,8 @@ DxeImageVerificationHandler (
|
|||||||
//
|
//
|
||||||
if (Policy == ALWAYS_EXECUTE) {
|
if (Policy == ALWAYS_EXECUTE) {
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
} else if (Policy == NEVER_EXECUTE) {
|
}
|
||||||
|
if (Policy == NEVER_EXECUTE) {
|
||||||
return EFI_ACCESS_DENIED;
|
return EFI_ACCESS_DENIED;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1833,7 +1834,8 @@ DxeImageVerificationHandler (
|
|||||||
DEBUG ((DEBUG_INFO, "DxeImageVerificationLib: Image is signed but %s hash of image is found in DBX.\n", mHashTypeStr));
|
DEBUG ((DEBUG_INFO, "DxeImageVerificationLib: Image is signed but %s hash of image is found in DBX.\n", mHashTypeStr));
|
||||||
IsVerified = FALSE;
|
IsVerified = FALSE;
|
||||||
break;
|
break;
|
||||||
} else if (!IsVerified) {
|
}
|
||||||
|
if (!IsVerified) {
|
||||||
if (IsSignatureFoundInDatabase (EFI_IMAGE_SECURITY_DATABASE, mImageDigest, &mCertType, mImageDigestSize)) {
|
if (IsSignatureFoundInDatabase (EFI_IMAGE_SECURITY_DATABASE, mImageDigest, &mCertType, mImageDigestSize)) {
|
||||||
IsVerified = TRUE;
|
IsVerified = TRUE;
|
||||||
} else {
|
} else {
|
||||||
@ -1851,7 +1853,7 @@ DxeImageVerificationHandler (
|
|||||||
|
|
||||||
if (IsVerified) {
|
if (IsVerified) {
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
} else {
|
}
|
||||||
Status = EFI_ACCESS_DENIED;
|
Status = EFI_ACCESS_DENIED;
|
||||||
if (Action == EFI_IMAGE_EXECUTION_AUTH_SIG_FAILED || Action == EFI_IMAGE_EXECUTION_AUTH_SIG_FOUND) {
|
if (Action == EFI_IMAGE_EXECUTION_AUTH_SIG_FAILED || Action == EFI_IMAGE_EXECUTION_AUTH_SIG_FOUND) {
|
||||||
//
|
//
|
||||||
@ -1870,7 +1872,6 @@ DxeImageVerificationHandler (
|
|||||||
Signature = (EFI_SIGNATURE_DATA *) ((UINT8 *) SignatureList + sizeof (EFI_SIGNATURE_LIST));
|
Signature = (EFI_SIGNATURE_DATA *) ((UINT8 *) SignatureList + sizeof (EFI_SIGNATURE_LIST));
|
||||||
CopyMem (Signature->SignatureData, mImageDigest, mImageDigestSize);
|
CopyMem (Signature->SignatureData, mImageDigest, mImageDigestSize);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
Done:
|
Done:
|
||||||
if (Status != EFI_SUCCESS) {
|
if (Status != EFI_SUCCESS) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user