mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2025-11-24 02:05:01 +00:00
Get rid of some crufty macros.
These were macros that were never used, or that were only set to one thing and could be substituted up front. I left in code guarded by the HAVE_ENDIAN_H and HAVE_LITTLE_ENDIAN macros even though those are never defined because they guard a reportedly significantly faster implementation of some functionality, at least according to a comment in the source. It would be a good idea to enable that code path and see if it really does make a big difference before removing it entirely. BUG=None TEST=Built for Link, Daisy, and the host with FEATURES=test. Built depthcharge for Link and booted in normal mode. BRANCH=None Change-Id: I934a4dd0da169ac018ba07350d56924ab88b1acc Signed-off-by: Gabe Black <gabeblack@google.com> Reviewed-on: https://gerrit.chromium.org/gerrit/45687 Reviewed-by: Randall Spangler <rspangler@chromium.org> Commit-Queue: Gabe Black <gabeblack@chromium.org> Tested-by: Gabe Black <gabeblack@chromium.org>
This commit is contained in:
@@ -130,15 +130,12 @@ int LoadFirmware(VbCommonParams *cparams, VbSelectFirmwareParams *fparams,
|
||||
}
|
||||
|
||||
/* Verify the key block */
|
||||
VBPERFSTART("VB_VKB");
|
||||
if ((0 != KeyBlockVerify(key_block, vblock_size,
|
||||
root_key, 0))) {
|
||||
VBDEBUG(("Key block verification failed.\n"));
|
||||
*check_result = VBSD_LF_CHECK_VERIFY_KEYBLOCK;
|
||||
VBPERFEND("VB_VKB");
|
||||
continue;
|
||||
}
|
||||
VBPERFEND("VB_VKB");
|
||||
|
||||
/* Check for rollback of key version. */
|
||||
key_version = key_block->data_key.key_version;
|
||||
@@ -169,7 +166,6 @@ int LoadFirmware(VbCommonParams *cparams, VbSelectFirmwareParams *fparams,
|
||||
}
|
||||
|
||||
/* Verify the preamble, which follows the key block. */
|
||||
VBPERFSTART("VB_VPB");
|
||||
preamble = (VbFirmwarePreambleHeader *)
|
||||
((uint8_t *)key_block + key_block->key_block_size);
|
||||
if ((0 != VerifyFirmwarePreamble(
|
||||
@@ -179,10 +175,8 @@ int LoadFirmware(VbCommonParams *cparams, VbSelectFirmwareParams *fparams,
|
||||
VBDEBUG(("Preamble verfication failed.\n"));
|
||||
*check_result = VBSD_LF_CHECK_VERIFY_PREAMBLE;
|
||||
RSAPublicKeyFree(data_key);
|
||||
VBPERFEND("VB_VPB");
|
||||
continue;
|
||||
}
|
||||
VBPERFEND("VB_VPB");
|
||||
|
||||
/* Check for rollback of firmware version. */
|
||||
combined_version = (uint32_t)((key_version << 16) |
|
||||
@@ -230,7 +224,6 @@ int LoadFirmware(VbCommonParams *cparams, VbSelectFirmwareParams *fparams,
|
||||
VbError_t rv;
|
||||
|
||||
/* Read the firmware data */
|
||||
VBPERFSTART("VB_RFD");
|
||||
DigestInit(&lfi->body_digest_context,
|
||||
data_key->algorithm);
|
||||
lfi->body_size_accum = 0;
|
||||
@@ -243,7 +236,6 @@ int LoadFirmware(VbCommonParams *cparams, VbSelectFirmwareParams *fparams,
|
||||
"index %d\n", index));
|
||||
*check_result = VBSD_LF_CHECK_GET_FW_BODY;
|
||||
RSAPublicKeyFree(data_key);
|
||||
VBPERFEND("VB_RFD");
|
||||
continue;
|
||||
}
|
||||
if (lfi->body_size_accum !=
|
||||
@@ -253,13 +245,10 @@ int LoadFirmware(VbCommonParams *cparams, VbSelectFirmwareParams *fparams,
|
||||
(int)preamble->body_signature.data_size));
|
||||
*check_result = VBSD_LF_CHECK_HASH_WRONG_SIZE;
|
||||
RSAPublicKeyFree(data_key);
|
||||
VBPERFEND("VB_RFD");
|
||||
continue;
|
||||
}
|
||||
VBPERFEND("VB_RFD");
|
||||
|
||||
/* Verify firmware data */
|
||||
VBPERFSTART("VB_VFD");
|
||||
body_digest = DigestFinal(&lfi->body_digest_context);
|
||||
if (0 != VerifyDigest(body_digest,
|
||||
&preamble->body_signature,
|
||||
@@ -268,11 +257,9 @@ int LoadFirmware(VbCommonParams *cparams, VbSelectFirmwareParams *fparams,
|
||||
*check_result = VBSD_LF_CHECK_VERIFY_BODY;
|
||||
RSAPublicKeyFree(data_key);
|
||||
VbExFree(body_digest);
|
||||
VBPERFEND("VB_VFD");
|
||||
continue;
|
||||
}
|
||||
VbExFree(body_digest);
|
||||
VBPERFEND("VB_VFD");
|
||||
}
|
||||
|
||||
/* Done with the data key, so can free it now */
|
||||
|
||||
Reference in New Issue
Block a user