inclusive: change usage of sanity

Google is working to change its source code to use more inclusive
language. To that end, replace the term "sanity" with inclusive
alternatives.

BUG=b:163883397
BRANCH=None
TEST=grep -ir sanity
TEST=make runtests

Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
Change-Id: I708a044d89050c442f14fb11a8ae5e98490d56af
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2353420
Reviewed-by: Julius Werner <jwerner@chromium.org>
This commit is contained in:
Daisuke Nojiri 2020-08-12 15:46:30 -07:00 committed by Commit Bot
parent faf9cd3bbb
commit 053592bd3d
40 changed files with 123 additions and 122 deletions

View File

@ -113,8 +113,8 @@ static int SetEntryAttributes(struct drive *drive,
static int CgptCheckAddValidity(struct drive *drive) {
int gpt_retval;
if (GPT_SUCCESS != (gpt_retval = GptSanityCheck(&drive->gpt))) {
Error("GptSanityCheck() returned %d: %s\n",
if (GPT_SUCCESS != (gpt_retval = GptValidityCheck(&drive->gpt))) {
Error("GptValidityCheck() returned %d: %s\n",
gpt_retval, GptError(gpt_retval));
return -1;
}

View File

@ -25,8 +25,8 @@ int CgptGetBootPartitionNumber(CgptBootParams *params) {
params->drive_size))
return CGPT_FAILED;
if (GPT_SUCCESS != (gpt_retval = GptSanityCheck(&drive.gpt))) {
Error("GptSanityCheck() returned %d: %s\n",
if (GPT_SUCCESS != (gpt_retval = GptValidityCheck(&drive.gpt))) {
Error("GptValidityCheck() returned %d: %s\n",
gpt_retval, GptError(gpt_retval));
retval = CGPT_FAILED;
goto done;
@ -106,8 +106,8 @@ int CgptBoot(CgptBootParams *params) {
}
if (params->partition) {
if (GPT_SUCCESS != (gpt_retval = GptSanityCheck(&drive.gpt))) {
Error("GptSanityCheck() returned %d: %s\n",
if (GPT_SUCCESS != (gpt_retval = GptValidityCheck(&drive.gpt))) {
Error("GptValidityCheck() returned %d: %s\n",
gpt_retval, GptError(gpt_retval));
goto done;
}

View File

@ -1042,8 +1042,8 @@ int CgptGetNumNonEmptyPartitions(CgptShowParams *params) {
params->drive_size))
return CGPT_FAILED;
if (GPT_SUCCESS != (gpt_retval = GptSanityCheck(&drive.gpt))) {
Error("GptSanityCheck() returned %d: %s\n",
if (GPT_SUCCESS != (gpt_retval = GptValidityCheck(&drive.gpt))) {
Error("GptValidityCheck() returned %d: %s\n",
gpt_retval, GptError(gpt_retval));
retval = CGPT_FAILED;
goto done;

View File

@ -20,8 +20,8 @@ int CgptEdit(CgptEditParams *params) {
params->drive_size))
return CGPT_FAILED;
if (GPT_SUCCESS != (gpt_retval = GptSanityCheck(&drive.gpt))) {
Error("GptSanityCheck() returned %d: %s\n",
if (GPT_SUCCESS != (gpt_retval = GptValidityCheck(&drive.gpt))) {
Error("GptValidityCheck() returned %d: %s\n",
gpt_retval, GptError(gpt_retval));
goto bad;
}

View File

@ -120,7 +120,7 @@ static int gpt_search(CgptFindParams *params, struct drive *drive,
int retval = 0;
char partlabel[GPT_PARTNAME_LEN];
if (GPT_SUCCESS != GptSanityCheck(&drive->gpt)) {
if (GPT_SUCCESS != GptValidityCheck(&drive->gpt)) {
return 0;
}

View File

@ -21,8 +21,8 @@ int CgptLegacy(CgptLegacyParams *params) {
params->drive_size))
return CGPT_FAILED;
if (GPT_SUCCESS != (gpt_retval = GptSanityCheck(&drive.gpt))) {
Error("GptSanityCheck() returned %d: %s\n",
if (GPT_SUCCESS != (gpt_retval = GptValidityCheck(&drive.gpt))) {
Error("GptValidityCheck() returned %d: %s\n",
gpt_retval, GptError(gpt_retval));
goto bad;
}

View File

@ -111,8 +111,8 @@ int CgptPrioritize(CgptPrioritizeParams *params) {
params->drive_size))
return CGPT_FAILED;
if (GPT_SUCCESS != (gpt_retval = GptSanityCheck(&drive.gpt))) {
Error("GptSanityCheck() returned %d: %s\n",
if (GPT_SUCCESS != (gpt_retval = GptValidityCheck(&drive.gpt))) {
Error("GptValidityCheck() returned %d: %s\n",
gpt_retval, GptError(gpt_retval));
goto bad;
}

View File

@ -19,9 +19,9 @@ int CgptRepair(CgptRepairParams *params) {
params->drive_size))
return CGPT_FAILED;
int gpt_retval = GptSanityCheck(&drive.gpt);
int gpt_retval = GptValidityCheck(&drive.gpt);
if (params->verbose)
printf("GptSanityCheck() returned %d: %s\n",
printf("GptValidityCheck() returned %d: %s\n",
gpt_retval, GptError(gpt_retval));
GptRepair(&drive.gpt);

View File

@ -180,8 +180,8 @@ static void EntriesDetails(struct drive *drive, const int secondary, int raw) {
static int GptShow(struct drive *drive, CgptShowParams *params) {
int gpt_retval;
if (GPT_SUCCESS != (gpt_retval = GptSanityCheck(&drive->gpt))) {
Error("GptSanityCheck() returned %d: %s\n",
if (GPT_SUCCESS != (gpt_retval = GptValidityCheck(&drive->gpt))) {
Error("GptValidityCheck() returned %d: %s\n",
gpt_retval, GptError(gpt_retval));
return CGPT_FAILED;
}

View File

@ -267,7 +267,7 @@ vb2_error_t vb2_verify_keyblock(struct vb2_keyblock *block, uint32_t size,
struct vb2_signature *sig = &block->keyblock_signature;
vb2_error_t rv;
/* Sanity check keyblock before attempting signature check of data */
/* Validity check keyblock before attempting signature check of data */
VB2_TRY(vb2_check_keyblock(block, size, sig));
VB2_DEBUG("Checking keyblock signature...\n");
@ -290,7 +290,7 @@ vb2_error_t vb2_verify_fw_preamble(struct vb2_fw_preamble *preamble,
VB2_DEBUG("Verifying preamble.\n");
/* Sanity checks before attempting signature of data */
/* Validity checks before attempting signature of data */
if(size < sizeof(*preamble)) {
VB2_DEBUG("Not enough data for preamble header\n");
return VB2_ERROR_PREAMBLE_TOO_SMALL_FOR_HEADER;

View File

@ -415,11 +415,11 @@ static vb2_error_t recovery_to_dev_finalize(struct vb2_ui_context *ui)
{
VB2_DEBUG("Physical presence confirmed!\n");
/* Sanity check, should never happen. */
/* Validity check, should never happen. */
if (ui->state->screen->id != VB2_SCREEN_RECOVERY_TO_DEV ||
(vb2_get_sd(ui->ctx)->flags & VB2_SD_FLAG_DEV_MODE_ENABLED) ||
!vb2_allow_recovery(ui->ctx)) {
VB2_DEBUG("ERROR: Dev transition sanity check failed\n");
VB2_DEBUG("ERROR: Dev transition validity check failed\n");
return VB2_REQUEST_UI_CONTINUE;
}
@ -630,7 +630,7 @@ vb2_error_t vb2_ui_developer_mode_boot_external_action(
{
vb2_error_t rv;
/* Sanity check, should never happen. */
/* Validity check, should never happen. */
if (!(ui->ctx->flags & VB2_CONTEXT_DEVELOPER_MODE) ||
!vb2_dev_boot_allowed(ui->ctx) ||
!vb2_dev_boot_external_allowed(ui->ctx)) {

View File

@ -371,7 +371,7 @@ vb2_error_t vb2_verify_data(const uint8_t *data, uint32_t size,
const struct vb2_workbuf *wb);
/**
* Check the sanity of a keyblock structure.
* Check the validity of a keyblock structure.
*
* Verifies all the header fields. Does not verify key index or keyblock
* flags. Should be called before verifying the keyblock data itself using
@ -388,7 +388,7 @@ vb2_error_t vb2_check_keyblock(const struct vb2_keyblock *block, uint32_t size,
/**
* Verify a keyblock using a public key.
*
* Header fields are also checked for sanity. Does not verify key index or key
* Header fields are also checked for validity. Does not verify key index or key
* block flags. Signature inside block is destroyed during check.
*
* @param block Keyblock to verify
@ -402,7 +402,7 @@ vb2_error_t vb2_verify_keyblock(struct vb2_keyblock *block, uint32_t size,
const struct vb2_workbuf *wb);
/**
* Check the sanity of a firmware preamble using a public key.
* Check the validity of a firmware preamble using a public key.
*
* The signature in the preamble is destroyed during the check.
*

View File

@ -19,9 +19,9 @@ int GptInit(GptData *gpt)
gpt->current_kernel = CGPT_KERNEL_ENTRY_NOT_FOUND;
gpt->current_priority = 999;
retval = GptSanityCheck(gpt);
retval = GptValidityCheck(gpt);
if (GPT_SUCCESS != retval) {
VB2_DEBUG("GptInit() failed sanity check\n");
VB2_DEBUG("GptInit() failed validity check\n");
return retval;
}

View File

@ -237,7 +237,7 @@ int HeaderFieldsSame(GptHeader *h1, GptHeader *h2)
return 0;
}
int GptSanityCheck(GptData *gpt)
int GptValidityCheck(GptData *gpt)
{
int retval;
GptHeader *header1 = (GptHeader *)(gpt->primary_header);

View File

@ -129,11 +129,11 @@ int HeaderFieldsSame(GptHeader *h1, GptHeader *h2);
*
* On error, returns a GPT_ERROR_* return code.
*/
int GptSanityCheck(GptData *gpt);
int GptValidityCheck(GptData *gpt);
/**
* Repair GPT data by copying from one set of valid headers/entries to the
* other. Assumes GptSanityCheck() has been run to determine which headers
* other. Assumes GptValidityCheck() has been run to determine which headers
* and/or entries are already valid.
*
* The caller must make sure that even if one of the entries table is invalid

View File

@ -257,8 +257,8 @@ static uint32_t AddRequestAuthBlock(struct auth_session* auth_session,
return TPM_E_AUTHFAIL;
}
/* Sanity check to make sure the command buffer has sufficient space to
* add the auth block at the end of the command. */
/* Validity check to make sure the command buffer has sufficient space
* to add the auth block at the end of the command. */
if (command_buffer_size < kTpmRequestHeaderLength) {
return TPM_E_BUFFER_SIZE;
}

View File

@ -73,7 +73,7 @@ vb2_error_t VbTryLoadKernel(struct vb2_context *ctx, uint32_t get_info_flags)
for (i = 0; i < disk_count; i++) {
VB2_DEBUG("trying disk %d\n", (int)i);
/*
* Sanity-check what we can. FWIW, VbTryLoadKernel() is always
* Validity-check what we can. FWIW, VbTryLoadKernel() is always
* called with only a single bit set in get_info_flags.
*
* Ensure that we got a partition with only the flags we asked

View File

@ -626,10 +626,10 @@ vb2_error_t LoadKernel(struct vb2_context *ctx, LoadKernelParams *params)
VB2_DEBUG("Good partition %d\n", params->partition_number);
shcall.check_result = VBSD_LKC_CHECK_GOOD_PARTITION;
/*
* Sanity check - only store a new TPM version if we found one.
* If lowest_version is still at its initial value, we didn't
* find one; for example, we're in developer mode and just
* didn't look.
* Validity check - only store a new TPM version if we found
* one. If lowest_version is still at its initial value, we
* didn't find one; for example, we're in developer mode and
* just didn't look.
*/
if (lowest_version != LOWEST_TPM_VERSION &&
lowest_version > sd->kernel_version)

View File

@ -300,7 +300,7 @@ static vb2_error_t vb2_developer_ui(struct vb2_context *ctx)
/* See if we should disable virtual dev-mode switch. */
VB2_DEBUG("sd->flags=%#x\n", sd->flags);
/* Sanity check, should never fail. */
/* Validity check, should never fail. */
VB2_ASSERT(sd->flags & VB2_SD_FLAG_DEV_MODE_ENABLED);
/* Stop the countdown while we go ask... */

View File

@ -389,7 +389,7 @@ static vb2_error_t altfw_action(struct vb2_context *ctx)
/* Action that enables developer mode and reboots. */
static vb2_error_t to_dev_action(struct vb2_context *ctx)
{
/* Sanity check, should never happen. */
/* Validity check, should never happen. */
if ((vb2_get_sd(ctx)->flags & VB2_SD_FLAG_DEV_MODE_ENABLED) ||
!vb2_allow_recovery(ctx))
return VB2_REQUEST_UI_CONTINUE;

View File

@ -48,7 +48,7 @@ vb2_error_t vb2_unpack_key(struct vb2_public_key *key,
/**
* Verify a keyblock using its hash.
*
* Header fields are also checked for sanity. Does not verify key index or key
* Header fields are also checked for validity. Does not verify key index or key
* block flags. Use this for self-signed keyblocks in developer mode.
*
* @param block Keyblock to verify
@ -62,7 +62,7 @@ vb2_error_t vb2_verify_keyblock_hash(const struct vb2_keyblock *block,
const struct vb2_workbuf *wb);
/**
* Check the sanity of a kernel preamble using a public key.
* Check the validity of a kernel preamble using a public key.
*
* The signature in the preamble is destroyed during the check.
*

View File

@ -46,7 +46,7 @@ vb2_error_t vb2_verify_keyblock_hash(const struct vb2_keyblock *block,
uint8_t *digest;
uint32_t digest_size;
/* Sanity check keyblock before attempting hash check of data */
/* Validity check keyblock before attempting hash check of data */
VB2_TRY(vb2_check_keyblock(block, size, sig));
VB2_DEBUG("Checking keyblock hash...\n");

View File

@ -46,7 +46,7 @@ vb2_error_t vb2_unpack_key_buffer(struct vb2_public_key *key,
if (!vb2_aligned(buf32, sizeof(uint32_t)))
return VB2_ERROR_UNPACK_KEY_ALIGN;
/* Sanity check key array size */
/* Validity check key array size */
key->arrsize = buf32[0];
if (key->arrsize * sizeof(uint32_t) != vb2_rsa_sig_size(key->sig_alg))
return VB2_ERROR_UNPACK_KEY_ARRAY_SIZE;

View File

@ -273,7 +273,7 @@ uint32_t vb2ex_tpm_send_recv(const uint8_t* request, uint32_t request_length,
#endif
#ifndef NDEBUG
/* sanity checks */
/* validity checks */
tag = TpmTag(request);
response_tag = TpmTag(response);
assert(

View File

@ -63,7 +63,7 @@ static int parse_size_opts(uint32_t len,
VB2_DEBUG("rw_size 0x%08x\n", rw_size);
VB2_DEBUG("rw_offset 0x%08x\n", rw_offset);
/* Now let's do some sanity checks. */
/* Now let's do some validity checks. */
if (ro_size > len || ro_offset > len - ro_size ||
rw_size > len || rw_offset > len - rw_size) {
printf("size/offset values are bogus\n");

View File

@ -322,7 +322,7 @@ uint8_t *unpack_kernel_partition(uint8_t *kpart_data,
uint64_t vmlinuz_header_address = 0;
uint32_t now = 0;
/* Sanity-check the keyblock */
/* Validity-check the keyblock */
struct vb2_keyblock *keyblock = (struct vb2_keyblock *)kpart_data;
VB2_DEBUG("Keyblock is %#x bytes\n", keyblock->keyblock_size);
now += keyblock->keyblock_size;
@ -383,7 +383,7 @@ uint8_t *unpack_kernel_partition(uint8_t *kpart_data,
g_kernel_blob_data = kpart_data + now;
g_kernel_blob_size = preamble->body_signature.data_size;
/* Sanity check */
/* Validity check */
if (kpart_size < now + g_kernel_blob_size) {
fprintf(stderr,
"kernel body size %u exceeds partition end\n",

View File

@ -315,7 +315,7 @@ vb2_error_t vb2_unpack_key_data(struct vb2_public_key *key,
key->arrsize = buf32[0];
/* Sanity check key array size */
/* Validity check key array size */
if (key->arrsize * sizeof(uint32_t) != vb2_rsa_sig_size(key->sig_alg))
return VB2_ERROR_UNPACK_KEY_ARRAY_SIZE;

View File

@ -113,7 +113,7 @@ vb2_error_t vb2_copy_packed_key(struct vb2_packed_key *dest,
struct vb2_packed_key *vb2_read_packed_key(const char *filename);
/**
* Sanity-check a packed key structure.
* Validity-check a packed key structure.
*
* @param key Key to check
* @param size Size of key buffer in bytes

View File

@ -399,7 +399,7 @@ vb2_error_t vb21_packed_key_read(struct vb21_packed_key **key_ptr,
if (vb2_read_file(filename, &buf, &size))
return VB2_ERROR_READ_PACKED_KEY_DATA;
/* Sanity check: make sure key unpacks properly */
/* Validity check: make sure key unpacks properly */
if (vb21_unpack_key(&key, buf, size))
return VB2_ERROR_READ_PACKED_KEY;

View File

@ -21,7 +21,7 @@ extern "C" {
* Return the description of an object starting with a vb21_struct_common
* header.
*
* Does not sanity-check the buffer; merely returns the pointer.
* Does not validity-check the buffer; merely returns the pointer.
*
* @param buf Pointer to common object
* @return A pointer to description or an empty string if none.

View File

@ -59,7 +59,7 @@ check_keyval_in_list() {
}
# Usage: lsb_syntaxcheck path-to-lsb-file
# Enforces a number of basic sanity checks on the overall format and contents
# Enforces a number of basic validity checks on the overall format and contents
# of the lsb-release file:
# - Every line is "key=value".
# - No space after key, no space before value.

View File

@ -48,7 +48,8 @@ DEFINE_string partitions "" \
"List of partitions to examine (default: $DEFAULT_PARTITIONS)" ""
DEFINE_boolean recovery_key "$FLAGS_FALSE" \
"Use recovery key to sign image (to boot from USB)" ""
DEFINE_boolean force "$FLAGS_FALSE" "Skip sanity checks and make the change" "f"
DEFINE_boolean force "$FLAGS_FALSE" \
"Skip validity checks and make the change" "f"
DEFINE_boolean default_rw_root "${FLAGS_TRUE}" \
"When --remove_rootfs_verification is set, change root mount option to RW." ""
@ -334,8 +335,8 @@ resign_ssd_kernel() {
return $resigned_kernels
}
sanity_check_crossystem_flags() {
debug_msg "crossystem sanity check"
validity_check_crossystem_flags() {
debug_msg "crossystem validity check"
if [ -n "${FLAGS_save_config}" ]; then
debug_msg "not resigning kernel."
return
@ -360,8 +361,8 @@ sanity_check_crossystem_flags() {
return $FLAGS_FALSE
}
sanity_check_live_partitions() {
debug_msg "Partition sanity check"
validity_check_live_partitions() {
debug_msg "Partition validity check"
if [ "$FLAGS_partitions" = "$ROOTDEV_KERNEL" ]; then
debug_msg "only for current active partition - safe."
return
@ -387,8 +388,8 @@ sanity_check_live_partitions() {
return $FLAGS_FALSE
}
sanity_check_live_firmware() {
debug_msg "Firmware compatibility sanity check"
validity_check_live_firmware() {
debug_msg "Firmware compatibility validity check"
if [ "$(crossystem mainfw_type)" = "developer" ]; then
debug_msg "developer type firmware in active."
return
@ -471,12 +472,12 @@ main() {
die "No valid kernel partitions on ${FLAGS_image} (${FLAGS_partitions})."
FLAGS_partitions="$valid_partitions"
# Sanity checks
# Validity checks
if [ "$FLAGS_force" = "$FLAGS_TRUE" ]; then
echo "
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! INFO: ALL SANITY CHECKS WERE BYPASSED. YOU ARE ON YOUR OWN. !
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! INFO: ALL VALIDITY CHECKS WERE BYPASSED. YOU ARE ON YOUR OWN. !
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
" >&2
local i
for i in $(seq 5 -1 1); do
@ -484,9 +485,9 @@ main() {
sleep 1
done
echo ""
elif ! sanity_check_live_firmware ||
! sanity_check_live_partitions ||
! sanity_check_crossystem_flags; then
elif ! validity_check_live_firmware ||
! validity_check_live_partitions ||
! validity_check_crossystem_flags; then
die "IMAGE ${FLAGS_image} IS NOT MODIFIED."
fi
fi

View File

@ -53,7 +53,7 @@ sign_framework_apks() {
info "Start signing framework apks"
# Counters for sanity check.
# Counters for validity check.
local counter_platform=0
local counter_media=0
local counter_shared=0
@ -133,7 +133,7 @@ build flavor '${flavor_prop}'."
info "Found ${counter_shared} shared APKs."
info "Found ${counter_releasekey} release APKs."
info "Found ${counter_total} total APKs."
# Sanity check.
# Validity check.
if [[ ${counter_platform} -lt 2 || ${counter_media} -lt 2 ||
${counter_shared} -lt 2 || ${counter_releasekey} -lt 2 ||
${counter_total} -lt 25 ]]; then
@ -174,7 +174,7 @@ update_sepolicy() {
cp "${xml}" "${orig}"
sudo sed -i -E "s/${pattern}/\1${new_cert}"'\2/g' "${xml}"
# Sanity check.
# Validity check.
if cmp "${xml}" "${orig}"; then
die "Failed to replace SELinux policy cert"
fi
@ -267,7 +267,7 @@ main() {
replace_ota_cert "${system_mnt}" "${key_dir}/releasekey.x509.pem"
reapply_file_security_context "${system_mnt}" "${root_fs_dir}"
# Sanity check.
# Validity check.
snapshot_file_properties "${system_mnt}" > "${working_dir}/properties.new"
local d
if ! d=$(diff "${working_dir}"/properties.{orig,new}); then
@ -281,7 +281,7 @@ main() {
if [[ -f "${packages_cache}" ]]; then
if type -P aapt &>/dev/null; then
info "Regenerating packages cache ${packages_cache}"
# For the sanity check.
# For the validity check.
local packages_before=$(grep "<package " "${packages_cache}" | wc -l)
local vendor_mnt=$(make_temp_dir)
local vendor_img="${android_dir}/vendor.raw.img"

View File

@ -321,7 +321,7 @@ update_stateful_partition_vblock() {
sudo umount "${stateful_dir}"
}
# Do a sanity check on the image's rootfs
# Do a validity check on the image's rootfs
# ARGS: Image
verify_image_rootfs() {
local rootfs=$1

View File

@ -3,7 +3,7 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# Script that sanity checks a keyset to ensure actual key versions
# Script that validity checks a keyset to ensure actual key versions
# match those set in key.versions.
# Load common constants and variables.
@ -16,7 +16,7 @@ if [ $# -ne 1 ]; then
cat <<EOF
Usage: $0 <keyset directory>
Sanity check a keyset directory for key versions.
Validity check a keyset directory for key versions.
EOF
exit 1
fi

View File

@ -850,8 +850,8 @@ static int OverlappedPartitionTest(void) {
return TEST_OK;
}
/* Test both sanity checking and repair. */
static int SanityCheckTest(void)
/* Test both validity checking and repair. */
static int ValidityCheckTest(void)
{
GptData *gpt = GetEmptyGptData();
GptHeader *h1 = (GptHeader *)gpt->primary_header;
@ -861,13 +861,13 @@ static int SanityCheckTest(void)
/* Unmodified test data is completely sane */
BuildTestGptData(gpt);
EXPECT(GPT_SUCCESS == GptSanityCheck(gpt));
EXPECT(GPT_SUCCESS == GptValidityCheck(gpt));
EXPECT(MASK_BOTH == gpt->valid_headers);
EXPECT(MASK_BOTH == gpt->valid_entries);
EXPECT(MASK_NONE == gpt->ignored);
/* Repair doesn't damage it */
GptRepair(gpt);
EXPECT(GPT_SUCCESS == GptSanityCheck(gpt));
EXPECT(GPT_SUCCESS == GptValidityCheck(gpt));
EXPECT(MASK_BOTH == gpt->valid_headers);
EXPECT(MASK_BOTH == gpt->valid_entries);
EXPECT(0 == gpt->ignored);
@ -876,19 +876,19 @@ static int SanityCheckTest(void)
/* Invalid sector size should fail */
BuildTestGptData(gpt);
gpt->sector_bytes = 1023;
EXPECT(GPT_ERROR_INVALID_SECTOR_SIZE == GptSanityCheck(gpt));
EXPECT(GPT_ERROR_INVALID_SECTOR_SIZE == GptValidityCheck(gpt));
/* Modify headers */
BuildTestGptData(gpt);
gpt->primary_header[0]++;
gpt->secondary_header[0]++;
EXPECT(GPT_ERROR_INVALID_HEADERS == GptSanityCheck(gpt));
EXPECT(GPT_ERROR_INVALID_HEADERS == GptValidityCheck(gpt));
EXPECT(0 == gpt->valid_headers);
EXPECT(0 == gpt->valid_entries);
EXPECT(0 == gpt->ignored);
/* Repair can't fix completely busted headers */
GptRepair(gpt);
EXPECT(GPT_ERROR_INVALID_HEADERS == GptSanityCheck(gpt));
EXPECT(GPT_ERROR_INVALID_HEADERS == GptValidityCheck(gpt));
EXPECT(0 == gpt->valid_headers);
EXPECT(0 == gpt->valid_entries);
EXPECT(0 == gpt->ignored);
@ -896,12 +896,12 @@ static int SanityCheckTest(void)
BuildTestGptData(gpt);
gpt->primary_header[0]++;
EXPECT(GPT_SUCCESS == GptSanityCheck(gpt));
EXPECT(GPT_SUCCESS == GptValidityCheck(gpt));
EXPECT(MASK_SECONDARY == gpt->valid_headers);
EXPECT(MASK_SECONDARY == gpt->valid_entries);
EXPECT(0 == gpt->ignored);
GptRepair(gpt);
EXPECT(GPT_SUCCESS == GptSanityCheck(gpt));
EXPECT(GPT_SUCCESS == GptValidityCheck(gpt));
EXPECT(MASK_BOTH == gpt->valid_headers);
EXPECT(MASK_BOTH == gpt->valid_entries);
EXPECT(0 == gpt->ignored);
@ -909,12 +909,12 @@ static int SanityCheckTest(void)
BuildTestGptData(gpt);
gpt->secondary_header[0]++;
EXPECT(GPT_SUCCESS == GptSanityCheck(gpt));
EXPECT(GPT_SUCCESS == GptValidityCheck(gpt));
EXPECT(MASK_PRIMARY == gpt->valid_headers);
EXPECT(MASK_PRIMARY == gpt->valid_entries);
EXPECT(0 == gpt->ignored);
GptRepair(gpt);
EXPECT(GPT_SUCCESS == GptSanityCheck(gpt));
EXPECT(GPT_SUCCESS == GptValidityCheck(gpt));
EXPECT(MASK_BOTH == gpt->valid_headers);
EXPECT(MASK_BOTH == gpt->valid_entries);
EXPECT(0 == gpt->ignored);
@ -927,12 +927,12 @@ static int SanityCheckTest(void)
BuildTestGptData(gpt);
h1->size++;
RefreshCrc32(gpt);
EXPECT(GPT_SUCCESS == GptSanityCheck(gpt));
EXPECT(GPT_SUCCESS == GptValidityCheck(gpt));
EXPECT(MASK_PRIMARY == gpt->valid_headers);
EXPECT(MASK_BOTH == gpt->valid_entries);
EXPECT(0 == gpt->ignored);
GptRepair(gpt);
EXPECT(GPT_SUCCESS == GptSanityCheck(gpt));
EXPECT(GPT_SUCCESS == GptValidityCheck(gpt));
EXPECT(MASK_BOTH == gpt->valid_headers);
EXPECT(MASK_BOTH == gpt->valid_entries);
EXPECT(0 == gpt->ignored);
@ -942,13 +942,13 @@ static int SanityCheckTest(void)
BuildTestGptData(gpt);
gpt->primary_entries[0]++;
gpt->secondary_entries[0]++;
EXPECT(GPT_ERROR_INVALID_ENTRIES == GptSanityCheck(gpt));
EXPECT(GPT_ERROR_INVALID_ENTRIES == GptValidityCheck(gpt));
EXPECT(MASK_BOTH == gpt->valid_headers);
EXPECT(MASK_NONE == gpt->valid_entries);
EXPECT(0 == gpt->ignored);
/* Repair can't fix both copies of entries being bad, either. */
GptRepair(gpt);
EXPECT(GPT_ERROR_INVALID_ENTRIES == GptSanityCheck(gpt));
EXPECT(GPT_ERROR_INVALID_ENTRIES == GptValidityCheck(gpt));
EXPECT(MASK_BOTH == gpt->valid_headers);
EXPECT(MASK_NONE == gpt->valid_entries);
EXPECT(0 == gpt->ignored);
@ -956,12 +956,12 @@ static int SanityCheckTest(void)
BuildTestGptData(gpt);
gpt->primary_entries[0]++;
EXPECT(GPT_SUCCESS == GptSanityCheck(gpt));
EXPECT(GPT_SUCCESS == GptValidityCheck(gpt));
EXPECT(MASK_BOTH == gpt->valid_headers);
EXPECT(MASK_SECONDARY == gpt->valid_entries);
EXPECT(0 == gpt->ignored);
GptRepair(gpt);
EXPECT(GPT_SUCCESS == GptSanityCheck(gpt));
EXPECT(GPT_SUCCESS == GptValidityCheck(gpt));
EXPECT(MASK_BOTH == gpt->valid_headers);
EXPECT(MASK_BOTH == gpt->valid_entries);
EXPECT(0 == gpt->ignored);
@ -969,12 +969,12 @@ static int SanityCheckTest(void)
BuildTestGptData(gpt);
gpt->secondary_entries[0]++;
EXPECT(GPT_SUCCESS == GptSanityCheck(gpt));
EXPECT(GPT_SUCCESS == GptValidityCheck(gpt));
EXPECT(MASK_BOTH == gpt->valid_headers);
EXPECT(MASK_PRIMARY == gpt->valid_entries);
EXPECT(0 == gpt->ignored);
GptRepair(gpt);
EXPECT(GPT_SUCCESS == GptSanityCheck(gpt));
EXPECT(GPT_SUCCESS == GptValidityCheck(gpt));
EXPECT(MASK_BOTH == gpt->valid_headers);
EXPECT(MASK_BOTH == gpt->valid_entries);
EXPECT(0 == gpt->ignored);
@ -991,7 +991,7 @@ static int SanityCheckTest(void)
RefreshCrc32(gpt);
tempptr = gpt->primary_entries;
gpt->primary_entries = gpt->secondary_entries;
EXPECT(GPT_SUCCESS == GptSanityCheck(gpt));
EXPECT(GPT_SUCCESS == GptValidityCheck(gpt));
EXPECT(MASK_SECONDARY == gpt->valid_headers);
EXPECT(MASK_BOTH == gpt->valid_entries);
EXPECT(0 == gpt->ignored);
@ -1001,12 +1001,12 @@ static int SanityCheckTest(void)
BuildTestGptData(gpt);
gpt->primary_header[0]++;
gpt->primary_entries[0]++;
EXPECT(GPT_SUCCESS == GptSanityCheck(gpt));
EXPECT(GPT_SUCCESS == GptValidityCheck(gpt));
EXPECT(MASK_SECONDARY == gpt->valid_headers);
EXPECT(MASK_SECONDARY == gpt->valid_entries);
EXPECT(0 == gpt->ignored);
GptRepair(gpt);
EXPECT(GPT_SUCCESS == GptSanityCheck(gpt));
EXPECT(GPT_SUCCESS == GptValidityCheck(gpt));
EXPECT(MASK_BOTH == gpt->valid_headers);
EXPECT(MASK_BOTH == gpt->valid_entries);
EXPECT(0 == gpt->ignored);
@ -1015,12 +1015,12 @@ static int SanityCheckTest(void)
BuildTestGptData(gpt);
gpt->secondary_header[0]++;
gpt->secondary_entries[0]++;
EXPECT(GPT_SUCCESS == GptSanityCheck(gpt));
EXPECT(GPT_SUCCESS == GptValidityCheck(gpt));
EXPECT(MASK_PRIMARY == gpt->valid_headers);
EXPECT(MASK_PRIMARY == gpt->valid_entries);
EXPECT(0 == gpt->ignored);
GptRepair(gpt);
EXPECT(GPT_SUCCESS == GptSanityCheck(gpt));
EXPECT(GPT_SUCCESS == GptValidityCheck(gpt));
EXPECT(MASK_BOTH == gpt->valid_headers);
EXPECT(MASK_BOTH == gpt->valid_entries);
EXPECT(0 == gpt->ignored);
@ -1033,12 +1033,12 @@ static int SanityCheckTest(void)
BuildTestGptData(gpt);
gpt->secondary_entries[0]++;
RefreshCrc32(gpt);
EXPECT(GPT_SUCCESS == GptSanityCheck(gpt));
EXPECT(GPT_SUCCESS == GptValidityCheck(gpt));
EXPECT(MASK_PRIMARY == gpt->valid_headers);
EXPECT(MASK_PRIMARY == gpt->valid_entries);
EXPECT(0 == gpt->ignored);
GptRepair(gpt);
EXPECT(GPT_SUCCESS == GptSanityCheck(gpt));
EXPECT(GPT_SUCCESS == GptValidityCheck(gpt));
EXPECT(MASK_BOTH == gpt->valid_headers);
EXPECT(MASK_BOTH == gpt->valid_entries);
EXPECT(0 == gpt->ignored);
@ -1047,13 +1047,13 @@ static int SanityCheckTest(void)
/* Test unloaded entry array. */
BuildTestGptData(gpt);
gpt->primary_entries = NULL;
EXPECT(GPT_SUCCESS == GptSanityCheck(gpt));
EXPECT(GPT_SUCCESS == GptValidityCheck(gpt));
EXPECT(MASK_SECONDARY == gpt->valid_entries);
EXPECT(0 == gpt->ignored);
gpt = GetEmptyGptData();
BuildTestGptData(gpt);
gpt->secondary_entries = NULL;
EXPECT(GPT_SUCCESS == GptSanityCheck(gpt));
EXPECT(GPT_SUCCESS == GptValidityCheck(gpt));
EXPECT(MASK_PRIMARY == gpt->valid_entries);
EXPECT(0 == gpt->ignored);
gpt = GetEmptyGptData();
@ -1061,13 +1061,13 @@ static int SanityCheckTest(void)
/* Test unloaded header. */
BuildTestGptData(gpt);
gpt->primary_header = NULL;
EXPECT(GPT_SUCCESS == GptSanityCheck(gpt));
EXPECT(GPT_SUCCESS == GptValidityCheck(gpt));
EXPECT(MASK_SECONDARY == gpt->valid_headers);
EXPECT(0 == gpt->ignored);
gpt = GetEmptyGptData();
BuildTestGptData(gpt);
gpt->secondary_header = NULL;
EXPECT(GPT_SUCCESS == GptSanityCheck(gpt));
EXPECT(GPT_SUCCESS == GptValidityCheck(gpt));
EXPECT(MASK_PRIMARY == gpt->valid_headers);
EXPECT(0 == gpt->ignored);
gpt = GetEmptyGptData();
@ -1078,7 +1078,7 @@ static int SanityCheckTest(void)
memset(gpt->primary_header, 0, sizeof(GptHeader));
memcpy(h1->signature, GPT_HEADER_SIGNATURE_IGNORED,
GPT_HEADER_SIGNATURE_SIZE);
EXPECT(GPT_SUCCESS == GptSanityCheck(gpt));
EXPECT(GPT_SUCCESS == GptValidityCheck(gpt));
EXPECT(MASK_BOTH == gpt->valid_headers);
EXPECT(MASK_BOTH == gpt->valid_entries);
EXPECT(MASK_PRIMARY == gpt->ignored);
@ -1090,7 +1090,7 @@ static int SanityCheckTest(void)
memset(gpt->secondary_header, 0, sizeof(GptHeader));
memcpy(h2->signature, GPT_HEADER_SIGNATURE_IGNORED,
GPT_HEADER_SIGNATURE_SIZE);
EXPECT(GPT_SUCCESS == GptSanityCheck(gpt));
EXPECT(GPT_SUCCESS == GptValidityCheck(gpt));
EXPECT(MASK_BOTH == gpt->valid_headers);
EXPECT(MASK_BOTH == gpt->valid_entries);
EXPECT(MASK_SECONDARY == gpt->ignored);
@ -1102,7 +1102,7 @@ static int SanityCheckTest(void)
GPT_HEADER_SIGNATURE_SIZE);
memcpy(h2->signature, GPT_HEADER_SIGNATURE_IGNORED,
GPT_HEADER_SIGNATURE_SIZE);
EXPECT(GPT_ERROR_INVALID_HEADERS == GptSanityCheck(gpt));
EXPECT(GPT_ERROR_INVALID_HEADERS == GptValidityCheck(gpt));
EXPECT(0 == gpt->valid_headers);
EXPECT(0 == gpt->valid_entries);
EXPECT(MASK_BOTH == gpt->ignored);
@ -1115,7 +1115,7 @@ static int SanityCheckTest(void)
memcpy(h1->signature, GPT_HEADER_SIGNATURE_IGNORED,
GPT_HEADER_SIGNATURE_SIZE);
gpt->secondary_entries[0]++;
EXPECT(GPT_ERROR_INVALID_ENTRIES == GptSanityCheck(gpt));
EXPECT(GPT_ERROR_INVALID_ENTRIES == GptValidityCheck(gpt));
EXPECT(MASK_SECONDARY == gpt->valid_headers);
EXPECT(0 == gpt->valid_entries);
EXPECT(MASK_PRIMARY == gpt->ignored);
@ -1620,7 +1620,7 @@ int main(int argc, char *argv[])
{ TEST_CASE(EntriesCrcTest), },
{ TEST_CASE(ValidEntryTest), },
{ TEST_CASE(OverlappedPartitionTest), },
{ TEST_CASE(SanityCheckTest), },
{ TEST_CASE(ValidityCheckTest), },
{ TEST_CASE(NoValidKernelEntryTest), },
{ TEST_CASE(EntryAttributeGetSetTest), },
{ TEST_CASE(EntryTypeTest), },

View File

@ -3,7 +3,7 @@
* found in the LICENSE file.
*/
/* Timing test for various TPM operations. This is mostly a sanity check to
/* Timing test for various TPM operations. This is mostly a validity check to
* make sure the part doesn't have ridicolously bad timing on simple
* operations.
*/

View File

@ -196,15 +196,15 @@ static void verify_keyblock_hash_tests(void)
TEST_SUCC(vb2_verify_keyblock_hash(kb, kb->keyblock_size, &wb),
"Keyblock hash good");
/* Sanity check keyblock */
/* Validity check keyblock */
reset_common_data(FOR_KEYBLOCK);
kb->magic[0] ^= 0xd0;
TEST_EQ(vb2_verify_keyblock_hash(kb, kb->keyblock_size, &wb),
VB2_ERROR_KEYBLOCK_MAGIC, "Keyblock sanity check");
VB2_ERROR_KEYBLOCK_MAGIC, "Keyblock validity check");
/*
* Sanity check should be looking at the keyblock hash struct, not the
* keyblock signature struct.
* Validity check should be looking at the keyblock hash struct, not
* the keyblock signature struct.
*/
reset_common_data(FOR_KEYBLOCK);
kb->keyblock_hash.data_size = sizeof(*kb) - 1;

View File

@ -17,10 +17,10 @@ static void get_recovery_reason_string_tests(void)
TEST_PTR_NEQ(vb2_get_recovery_reason_string(i), NULL,
"Non-null reason");
/* Sanity check on one of the strings */
/* Validity check on one of the strings */
TEST_EQ(strcmp(vb2_get_recovery_reason_string(VB2_RECOVERY_GBB_HEADER),
"Error parsing GBB header"), 0,
"Recovery reason sanity check");
"Recovery reason validity check");
}
int main(void)

View File

@ -39,9 +39,9 @@ use_v0_secdata_kernel() {
return 0
fi
# First some sanity checks: X -eq X checks that X is a number. cut may return
# the whole string if no delimiter found, so major != minor checks that the
# version was at least somewhat correctly formatted.
# First some validity checks: X -eq X checks that X is a number. cut may
# return the whole string if no delimiter found, so major != minor checks that
# the version was at least somewhat correctly formatted.
if [ $major -eq $major ] && [ $minor -eq $minor ] && [ $major -ne $minor ]; then
# Now what we really care about: is this firmware older than CL:2041695?
if [ $major -lt 12953 ]; then
@ -147,7 +147,7 @@ restart_daemon_if_needed() {
# MAIN PROGRAM
# ------------
# Sanity check: are we executing in a recovery image?
# validity check: are we executing in a recovery image?
if [ -e $dot_recovery ]; then
quit "This is a developer utility, it should never run on a (production) recovery image"