diff options
author | Joel Kitching <kitching@google.com> | 2018-08-02 16:21:17 +0800 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2018-08-03 01:31:21 -0700 |
commit | 9ad8a41b8cedef9ac1f0513992ce6958eb86c257 (patch) | |
tree | 2a1fe0e028829dc579840dce386047ce661ac6d3 /firmware | |
parent | c239374ac3e1af342c10f4f3244bc98d76c2413a (diff) | |
download | vboot-9ad8a41b8cedef9ac1f0513992ce6958eb86c257.tar.gz |
vboot: bulk fix tabs and spacing inconsistency
Problem files were found with:
find . -name '*.c' -o -name '*.h' | xargs grep '^ [^*]'
and edited manually.
Ignores utility/ and cgpt/, since they seem to globally adhere
to a two-space tab convention.
BUG=None
TEST=make clean runtests
TEST=emerge vboot_reference depthcharge
Change-Id: I5a678484a119c8f1911f717e1968bdb4f1a0810f
Reviewed-on: https://chromium-review.googlesource.com/1160131
Commit-Ready: Joel Kitching <kitching@chromium.org>
Tested-by: Joel Kitching <kitching@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Diffstat (limited to 'firmware')
29 files changed, 227 insertions, 227 deletions
diff --git a/firmware/2lib/2rsa.c b/firmware/2lib/2rsa.c index c349d4e2..f54e83c3 100644 --- a/firmware/2lib/2rsa.c +++ b/firmware/2lib/2rsa.c @@ -48,9 +48,9 @@ int vb2_mont_ge(const struct vb2_public_key *key, uint32_t *a) * Montgomery c[] += a * b[] / R % mod */ static void montMulAdd(const struct vb2_public_key *key, - uint32_t *c, - const uint32_t a, - const uint32_t *b) + uint32_t *c, + const uint32_t a, + const uint32_t *b) { uint64_t A = (uint64_t)a * b[0] + c[0]; uint32_t d0 = (uint32_t)A * key->n0inv; @@ -95,9 +95,9 @@ static void montMulAdd0(const struct vb2_public_key *key, * Montgomery c[] = a[] * b[] / R % mod */ static void montMul(const struct vb2_public_key *key, - uint32_t *c, - const uint32_t *a, - const uint32_t *b) + uint32_t *c, + const uint32_t *a, + const uint32_t *b) { uint32_t i; for (i = 0; i < key->arrsize; ++i) { diff --git a/firmware/2lib/2sha512.c b/firmware/2lib/2sha512.c index fedc8b7a..e1f2601f 100644 --- a/firmware/2lib/2sha512.c +++ b/firmware/2lib/2sha512.c @@ -170,8 +170,8 @@ void vb2_sha512_init(struct vb2_sha512_context *ctx) } static void vb2_sha512_transform(struct vb2_sha512_context *ctx, - const uint8_t *message, - unsigned int block_nb) + const uint8_t *message, + unsigned int block_nb) { /* Note that these arrays use 88*8=704 bytes of stack */ uint64_t w[80]; diff --git a/firmware/2lib/include/2api.h b/firmware/2lib/include/2api.h index f338fa41..1a75b355 100644 --- a/firmware/2lib/include/2api.h +++ b/firmware/2lib/include/2api.h @@ -227,7 +227,7 @@ struct vb2_context { /********************************************************************** * Fields caller may examine after calling vb2api_fw_phase1(). Caller - * must set these fields to 0 before calling any vboot functions. + * must set these fields to 0 before calling any vboot functions. */ /* diff --git a/firmware/2lib/include/2nvstorage.h b/firmware/2lib/include/2nvstorage.h index f4f3e04c..05183d52 100644 --- a/firmware/2lib/include/2nvstorage.h +++ b/firmware/2lib/include/2nvstorage.h @@ -103,8 +103,8 @@ enum vb2_nv_param { * (0=no, 1=yes). */ VB2_NV_TRY_RO_SYNC, - /* Cut off battery and shutdown on next boot. */ - VB2_NV_BATTERY_CUTOFF_REQUEST, + /* Cut off battery and shutdown on next boot. */ + VB2_NV_BATTERY_CUTOFF_REQUEST, /* Maximum kernel version to roll forward to */ VB2_NV_KERNEL_MAX_ROLLFORWARD, diff --git a/firmware/2lib/include/2nvstorage_fields.h b/firmware/2lib/include/2nvstorage_fields.h index 16626b8d..981bbda4 100644 --- a/firmware/2lib/include/2nvstorage_fields.h +++ b/firmware/2lib/include/2nvstorage_fields.h @@ -52,7 +52,7 @@ enum vb2_nv_offset { /* CRC must be last field */ VB2_NV_OFFS_CRC_V2 = 63, - }; +}; /* Fields in VB2_NV_OFFS_HEADER (unused = 0x04) */ #define VB2_NV_HEADER_WIPEOUT 0x08 diff --git a/firmware/2lib/include/2return_codes.h b/firmware/2lib/include/2return_codes.h index f754cded..b60c41a2 100644 --- a/firmware/2lib/include/2return_codes.h +++ b/firmware/2lib/include/2return_codes.h @@ -28,7 +28,7 @@ enum vb2_return_code { /* Mock error for testing */ VB2_ERROR_MOCK, - /********************************************************************** + /********************************************************************** * SHA errors */ VB2_ERROR_SHA = VB2_ERROR_BASE + 0x010000, @@ -45,7 +45,7 @@ enum vb2_return_code { /* Digest size buffer too small in vb2_digest_finalize() */ VB2_ERROR_SHA_FINALIZE_DIGEST_SIZE, - /********************************************************************** + /********************************************************************** * RSA errors */ VB2_ERROR_RSA = VB2_ERROR_BASE + 0x020000, @@ -74,7 +74,7 @@ enum vb2_return_code { /* Bad size calculation in vb2_check_padding() */ VB2_ERROR_RSA_PADDING_SIZE, - /********************************************************************** + /********************************************************************** * NV storage errors */ VB2_ERROR_NV = VB2_ERROR_BASE + 0x030000, @@ -85,7 +85,7 @@ enum vb2_return_code { /* Bad CRC in vb2_nv_check_crc() */ VB2_ERROR_NV_CRC, - /********************************************************************** + /********************************************************************** * Secure data storage errors */ VB2_ERROR_SECDATA = VB2_ERROR_BASE + 0x040000, @@ -135,7 +135,7 @@ enum vb2_return_code { /* Called vb2_secdatak_set() with uninitialized secdatak */ VB2_ERROR_SECDATAK_SET_UNINITIALIZED, - /********************************************************************** + /********************************************************************** * Common code errors */ VB2_ERROR_COMMON = VB2_ERROR_BASE + 0x050000, @@ -262,7 +262,7 @@ enum vb2_return_code { /* Null public key buffer passed to vb2_unpack_key_buffer() */ VB2_ERROR_UNPACK_KEY_BUFFER, - /********************************************************************** + /********************************************************************** * Keyblock verification errors (all in vb2_verify_keyblock()) */ VB2_ERROR_KEYBLOCK = VB2_ERROR_BASE + 0x060000, @@ -303,7 +303,7 @@ enum vb2_return_code { /* No signature matching key ID */ VB2_ERROR_KEYBLOCK_SIG_ID, - /********************************************************************** + /********************************************************************** * Preamble verification errors (all in vb2_verify_preamble()) */ VB2_ERROR_PREAMBLE = VB2_ERROR_BASE + 0x070000, @@ -350,7 +350,7 @@ enum vb2_return_code { /* Vmlinuz header outside signed portion of body */ VB2_ERROR_PREAMBLE_VMLINUZ_HEADER_OUTSIDE, - /********************************************************************** + /********************************************************************** * Misc higher-level code errors */ VB2_ERROR_MISC = VB2_ERROR_BASE + 0x080000, @@ -497,7 +497,7 @@ enum vb2_return_code { /* Expected and image hashes are different size in ec_sync_phase1() */ VB2_ERROR_EC_HASH_SIZE, - /********************************************************************** + /********************************************************************** * API-level errors */ VB2_ERROR_API = VB2_ERROR_BASE + 0x090000, @@ -580,7 +580,7 @@ enum vb2_return_code { /* Digest buffer passed into vb2api_check_hash incorrect. */ VB2_ERROR_API_CHECK_DIGEST_SIZE, - /********************************************************************** + /********************************************************************** * Errors which may be generated by implementations of vb2ex functions. * Implementation may also return its own specific errors, which should * NOT be in the range VB2_ERROR_BASE...VB2_ERROR_MAX to avoid @@ -607,12 +607,12 @@ enum vb2_return_code { VB2_ERROR_EX_HWCRYPTO_UNSUPPORTED, - /********************************************************************** + /********************************************************************** * Errors generated by host library (non-firmware) start here. */ VB2_ERROR_HOST_BASE = 0x20000000, - /********************************************************************** + /********************************************************************** * Errors generated by host library misc functions */ VB2_ERROR_HOST_MISC = VB2_ERROR_HOST_BASE + 0x010000, @@ -638,7 +638,7 @@ enum vb2_return_code { /* Unable to convert string to struct vb_id */ VB2_ERROR_STR_TO_ID, - /********************************************************************** + /********************************************************************** * Errors generated by host library key functions */ VB2_ERROR_HOST_KEY = VB2_ERROR_HOST_BASE + 0x020000, @@ -736,7 +736,7 @@ enum vb2_return_code { /* Unable to copy packed key */ VB2_ERROR_PACKED_KEY_COPY, - /********************************************************************** + /********************************************************************** * Errors generated by host library signature functions */ VB2_ERROR_HOST_SIG = VB2_ERROR_HOST_BASE + 0x030000, @@ -777,7 +777,7 @@ enum vb2_return_code { /* Not enough buffer space to hold signature in vb2_sign_object() */ VB2_SIGN_OBJECT_OVERFLOW, - /********************************************************************** + /********************************************************************** * Errors generated by host library keyblock functions */ VB2_ERROR_HOST_KEYBLOCK = VB2_ERROR_HOST_BASE + 0x040000, @@ -794,7 +794,7 @@ enum vb2_return_code { /* Unable to sign keyblock in vb2_create_keyblock() */ VB2_KEYBLOCK_CREATE_SIGN, - /********************************************************************** + /********************************************************************** * Errors generated by host library firmware preamble functions */ VB2_ERROR_HOST_FW_PREAMBLE = VB2_ERROR_HOST_BASE + 0x050000, @@ -808,7 +808,7 @@ enum vb2_return_code { /* Unable to sign preamble in vb2_create_fw_preamble() */ VB2_FW_PREAMBLE_CREATE_SIGN, - /********************************************************************** + /********************************************************************** * Errors generated by unit test functions */ VB2_ERROR_UNIT_TEST = VB2_ERROR_HOST_BASE + 0x060000, @@ -816,7 +816,7 @@ enum vb2_return_code { /* Unable to open an input file needed for a unit test */ VB2_ERROR_TEST_INPUT_FILE, - /********************************************************************** + /********************************************************************** * Highest non-zero error generated inside vboot library. Note that * error codes passed through vboot when it calls external APIs may * still be outside this range. diff --git a/firmware/bdb/bdb_struct.h b/firmware/bdb/bdb_struct.h index fbb0c2e1..b9b4b852 100644 --- a/firmware/bdb/bdb_struct.h +++ b/firmware/bdb/bdb_struct.h @@ -126,7 +126,7 @@ struct bdb_key { /* Key version */ uint32_t key_version; - /* Description; null-terminated ASCII */ + /* Description; null-terminated ASCII */ char description[128]; /* diff --git a/firmware/bdb/rsa.c b/firmware/bdb/rsa.c index 61757dac..35bfcb47 100644 --- a/firmware/bdb/rsa.c +++ b/firmware/bdb/rsa.c @@ -50,9 +50,9 @@ static int mont_ge(const struct public_key *key, uint32_t *a) * Montgomery c[] += a * b[] / R % mod */ static void montMulAdd(const struct public_key *key, - uint32_t *c, - const uint32_t a, - const uint32_t *b) + uint32_t *c, + const uint32_t a, + const uint32_t *b) { uint64_t A = (uint64_t)a * b[0] + c[0]; uint32_t d0 = (uint32_t)A * key->n0inv; @@ -78,9 +78,9 @@ static void montMulAdd(const struct public_key *key, * Montgomery c[] = a[] * b[] / R % mod */ static void montMul(const struct public_key *key, - uint32_t *c, - const uint32_t *a, - const uint32_t *b) + uint32_t *c, + const uint32_t *a, + const uint32_t *b) { uint32_t i; for (i = 0; i < key->arrsize; ++i) { @@ -133,7 +133,7 @@ static const uint8_t sha256_tail[] = { }; static int check_padding(const uint8_t *sig, const struct public_key *key, - uint32_t pad_size) + uint32_t pad_size) { /* Determine padding to use depending on the signature type */ const uint32_t tail_size = sizeof(sha256_tail); diff --git a/firmware/include/bmpblk_header.h b/firmware/include/bmpblk_header.h index bdc118a0..a010f071 100644 --- a/firmware/include/bmpblk_header.h +++ b/firmware/include/bmpblk_header.h @@ -112,7 +112,7 @@ typedef struct ImageInfo { */ uint32_t compressed_size; uint32_t reserved; - /* NOTE: The actual image content (if any) follows immediately. */ + /* NOTE: The actual image content (if any) follows immediately. */ } __attribute__((packed)) ImageInfo; /* Constants for ImageInfo.tag */ diff --git a/firmware/include/tlcl.h b/firmware/include/tlcl.h index 28508c3f..1e1e401d 100644 --- a/firmware/include/tlcl.h +++ b/firmware/include/tlcl.h @@ -38,7 +38,7 @@ uint32_t TlclLibClose(void); * Perform a raw TPM request/response transaction. */ uint32_t TlclSendReceive(const uint8_t *request, uint8_t *response, - int max_length); + int max_length); /** * Return the size of a TPM request or response packet. @@ -91,8 +91,8 @@ uint32_t TlclDefineSpace(uint32_t index, uint32_t perm, uint32_t size); * passed via [auth_policy]. The TPM error code is returned. */ uint32_t TlclDefineSpaceEx(const uint8_t* owner_auth, uint32_t owner_auth_size, - uint32_t index, uint32_t perm, uint32_t size, - const void* auth_policy, uint32_t auth_policy_size); + uint32_t index, uint32_t perm, uint32_t size, + const void* auth_policy, uint32_t auth_policy_size); /** * Initializes [auth_policy] to require PCR binding of the given @@ -104,8 +104,8 @@ uint32_t TlclDefineSpaceEx(const uint8_t* owner_auth, uint32_t owner_auth_size, * return, also for the case of insufficient buffer size. */ uint32_t TlclInitNvAuthPolicy(uint32_t pcr_selection_bitmap, - const uint8_t pcr_values[][TPM_PCR_DIGEST], - void* auth_policy, uint32_t* auth_policy_size); + const uint8_t pcr_values[][TPM_PCR_DIGEST], + void* auth_policy, uint32_t* auth_policy_size); /** * Write [length] bytes of [data] to space at [index]. The TPM error code is @@ -194,7 +194,7 @@ uint32_t TlclSetDeactivated(uint8_t flag); * be NULL. The TPM error code is returned. */ uint32_t TlclGetFlags(uint8_t *disable, uint8_t *deactivated, - uint8_t *nvlocked); + uint8_t *nvlocked); /** * Set the bGlobalLock flag, which only a reboot can clear. The TPM error @@ -221,7 +221,7 @@ uint32_t TlclGetPermissions(uint32_t index, uint32_t *permissions); * sufficient, the return value will be TPM_E_BUFFER_SIZE. */ uint32_t TlclGetSpaceInfo(uint32_t index, uint32_t *attributes, uint32_t *size, - void* auth_policy, uint32_t* auth_policy_size); + void* auth_policy, uint32_t* auth_policy_size); /** * Get the entire set of permanent flags. @@ -255,8 +255,8 @@ uint32_t TlclGetRandom(uint8_t *data, uint32_t length, uint32_t *size); * *vendor_specific_buf_size to the length of the filled data. */ uint32_t TlclGetVersion(uint32_t* vendor, uint64_t* firmware_version, - uint8_t* vendor_specific_buf, - size_t* vendor_specific_buf_size); + uint8_t* vendor_specific_buf, + size_t* vendor_specific_buf_size); /** * Issues the IFX specific FieldUpgradeInfoRequest2 TPM_FieldUpgrade subcommand @@ -271,8 +271,8 @@ uint32_t TlclIFXFieldUpgradeInfo(TPM_IFX_FIELDUPGRADEINFO *info); * Read the public half of the EK. */ uint32_t TlclReadPubek(uint32_t* public_exponent, - uint8_t* modulus, - uint32_t* modulus_size); + uint8_t* modulus, + uint32_t* modulus_size); /** * Takes ownership of the TPM. [enc_owner_auth] and [enc_srk_auth] are the owner @@ -280,8 +280,8 @@ uint32_t TlclReadPubek(uint32_t* public_exponent, * text [owner_auth] needs to be passed as well for command auth. */ uint32_t TlclTakeOwnership(uint8_t enc_owner_auth[TPM_RSA_2048_LEN], - uint8_t enc_srk_auth[TPM_RSA_2048_LEN], - uint8_t owner_auth[TPM_AUTH_DATA_LEN]); + uint8_t enc_srk_auth[TPM_RSA_2048_LEN], + uint8_t owner_auth[TPM_AUTH_DATA_LEN]); /** * Create a delegation family with the specified [family_label]. @@ -294,7 +294,7 @@ uint32_t TlclCreateDelegationFamily(uint8_t family_label); * updated to indicate actual number of table entries available. */ uint32_t TlclReadDelegationFamilyTable(TPM_FAMILY_TABLE_ENTRY *table, - uint32_t* table_size); + uint32_t* table_size); #endif /* TPM2_MODE */ #endif /* CHROMEOS_ENVIRONMENT */ diff --git a/firmware/include/tpm1_tss_constants.h b/firmware/include/tpm1_tss_constants.h index 3deef34e..54642ba6 100644 --- a/firmware/include/tpm1_tss_constants.h +++ b/firmware/include/tpm1_tss_constants.h @@ -96,7 +96,7 @@ typedef uint32_t TPM_FAMILY_FLAGS; #define TPM_LOC_ZERO (((uint32_t)1)<<0) #define TPM_ALL_LOCALITIES (TPM_LOC_ZERO | TPM_LOC_ONE | TPM_LOC_TWO \ - | TPM_LOC_THREE | TPM_LOC_FOUR) /* 0x1f */ + | TPM_LOC_THREE | TPM_LOC_FOUR) /* 0x1f */ #define TPM_PHYSICAL_PRESENCE_LOCK ((uint16_t) 0x0004) #define TPM_PHYSICAL_PRESENCE_PRESENT ((uint16_t) 0x0008) @@ -116,28 +116,28 @@ typedef uint32_t TPM_FAMILY_FLAGS; typedef struct tdTPM_DIGEST { - uint8_t digest[TPM_SHA1_160_HASH_LEN]; + uint8_t digest[TPM_SHA1_160_HASH_LEN]; } TPM_DIGEST; typedef TPM_DIGEST TPM_COMPOSITE_HASH; typedef struct tdTPM_PCR_SELECTION { - uint16_t sizeOfSelect; - uint8_t pcrSelect[3]; + uint16_t sizeOfSelect; + uint8_t pcrSelect[3]; } __attribute__((packed)) TPM_PCR_SELECTION; typedef struct tdTPM_NV_ATTRIBUTES { - TPM_STRUCTURE_TAG tag; - TPM_NV_PER_ATTRIBUTES attributes; + TPM_STRUCTURE_TAG tag; + TPM_NV_PER_ATTRIBUTES attributes; } __attribute__((packed)) TPM_NV_ATTRIBUTES; typedef struct tdTPM_PCR_INFO_SHORT { - TPM_PCR_SELECTION pcrSelection; - TPM_LOCALITY_SELECTION localityAtRelease; - TPM_COMPOSITE_HASH digestAtRelease; + TPM_PCR_SELECTION pcrSelection; + TPM_LOCALITY_SELECTION localityAtRelease; + TPM_COMPOSITE_HASH digestAtRelease; } __attribute__((packed)) TPM_PCR_INFO_SHORT; typedef struct tdTPM_PERMANENT_FLAGS @@ -176,51 +176,51 @@ typedef struct tdTPM_STCLEAR_FLAGS{ typedef struct tdTPM_NV_DATA_PUBLIC { - TPM_STRUCTURE_TAG tag; - TPM_NV_INDEX nvIndex; - TPM_PCR_INFO_SHORT pcrInfoRead; - TPM_PCR_INFO_SHORT pcrInfoWrite; - TPM_NV_ATTRIBUTES permission; - TPM_BOOL bReadSTClear; - TPM_BOOL bWriteSTClear; - TPM_BOOL bWriteDefine; - uint32_t dataSize; + TPM_STRUCTURE_TAG tag; + TPM_NV_INDEX nvIndex; + TPM_PCR_INFO_SHORT pcrInfoRead; + TPM_PCR_INFO_SHORT pcrInfoWrite; + TPM_NV_ATTRIBUTES permission; + TPM_BOOL bReadSTClear; + TPM_BOOL bWriteSTClear; + TPM_BOOL bWriteDefine; + uint32_t dataSize; } TPM_NV_DATA_PUBLIC; typedef struct tdTPM_NONCE { - uint8_t nonce[TPM_SHA1BASED_NONCE_LEN]; + uint8_t nonce[TPM_SHA1BASED_NONCE_LEN]; } TPM_NONCE; typedef struct tdTPM_FAMILY_TABLE_ENTRY { - TPM_STRUCTURE_TAG tag; - TPM_FAMILY_LABEL familyLabel; - TPM_FAMILY_ID familyID; - TPM_FAMILY_VERIFICATION verificationCount; - TPM_FAMILY_FLAGS flags; + TPM_STRUCTURE_TAG tag; + TPM_FAMILY_LABEL familyLabel; + TPM_FAMILY_ID familyID; + TPM_FAMILY_VERIFICATION verificationCount; + TPM_FAMILY_FLAGS flags; } TPM_FAMILY_TABLE_ENTRY; typedef struct tdTPM_IFX_FIRMWAREPACKAGE { - uint32_t FwPackageIdentifier; - uint32_t Version; - uint32_t StaleVersion; + uint32_t FwPackageIdentifier; + uint32_t Version; + uint32_t StaleVersion; } TPM_IFX_FIRMWAREPACKAGE; typedef struct tdTPM_IFX_FIELDUPGRADEINFO { - uint16_t wMaxDataSize; - TPM_IFX_FIRMWAREPACKAGE sBootloaderFirmwarePackage; - TPM_IFX_FIRMWAREPACKAGE sFirmwarePackages[2]; - uint16_t wSecurityModuleStatus; - TPM_IFX_FIRMWAREPACKAGE sProcessFirmwarePackage; - uint16_t wFieldUpgradeCounter; + uint16_t wMaxDataSize; + TPM_IFX_FIRMWAREPACKAGE sBootloaderFirmwarePackage; + TPM_IFX_FIRMWAREPACKAGE sFirmwarePackages[2]; + uint16_t wSecurityModuleStatus; + TPM_IFX_FIRMWAREPACKAGE sProcessFirmwarePackage; + uint16_t wFieldUpgradeCounter; } TPM_IFX_FIELDUPGRADEINFO; typedef struct tdTPM_NV_AUTH_POLICY { - TPM_PCR_INFO_SHORT pcr_info_read; - TPM_PCR_INFO_SHORT pcr_info_write; + TPM_PCR_INFO_SHORT pcr_info_read; + TPM_PCR_INFO_SHORT pcr_info_write; } TPM_NV_AUTH_POLICY; #define TPM_IFX_FieldUpgradeInfoRequest2 ((uint8_t) 0x11) diff --git a/firmware/include/vboot_api.h b/firmware/include/vboot_api.h index aa408cd1..73e2706d 100644 --- a/firmware/include/vboot_api.h +++ b/firmware/include/vboot_api.h @@ -306,7 +306,7 @@ typedef struct VbSelectAndLoadKernelParams { * Returns VBERROR_SUCCESS if success, non-zero if error; on error, caller * should reboot. */ VbError_t VbSelectAndLoadKernel(VbCommonParams *cparams, - VbSelectAndLoadKernelParams *kparams); + VbSelectAndLoadKernelParams *kparams); /** * Verify Kernel Image loaded in memory. @@ -419,7 +419,7 @@ VbError_t VbExTpmOpen(void); * exit, response_length is set to the actual received response length in * bytes. */ VbError_t VbExTpmSendReceive(const uint8_t *request, uint32_t request_length, - uint8_t *response, uint32_t *response_length); + uint8_t *response, uint32_t *response_length); #ifdef CHROMEOS_ENVIRONMENT @@ -538,7 +538,7 @@ typedef struct VbDiskInfo { * VbExDiskFreeInfo() is called. */ VbError_t VbExDiskGetInfo(VbDiskInfo **infos_ptr, uint32_t *count, - uint32_t disk_flags); + uint32_t disk_flags); /** * Free a disk information list [infos] previously returned by @@ -547,7 +547,7 @@ VbError_t VbExDiskGetInfo(VbDiskInfo **infos_ptr, uint32_t *count, * list need not remain valid after this call. */ VbError_t VbExDiskFreeInfo(VbDiskInfo *infos, - VbExDiskHandle_t preserve_handle); + VbExDiskHandle_t preserve_handle); /** * Read lba_count LBA sectors, starting at sector lba_start, from the disk, @@ -561,7 +561,7 @@ VbError_t VbExDiskFreeInfo(VbDiskInfo *infos, * crash. */ VbError_t VbExDiskRead(VbExDiskHandle_t handle, uint64_t lba_start, - uint64_t lba_count, void *buffer); + uint64_t lba_count, void *buffer); /** * Write lba_count LBA sectors, starting at sector lba_start, to the disk, from @@ -575,7 +575,7 @@ VbError_t VbExDiskRead(VbExDiskHandle_t handle, uint64_t lba_start, * crash. */ VbError_t VbExDiskWrite(VbExDiskHandle_t handle, uint64_t lba_start, - uint64_t lba_count, const void *buffer); + uint64_t lba_count, const void *buffer); /* Streaming read interface */ typedef void *VbExStream_t; diff --git a/firmware/lib/ec_sync.c b/firmware/lib/ec_sync.c index 3c70ae15..b72403db 100644 --- a/firmware/lib/ec_sync.c +++ b/firmware/lib/ec_sync.c @@ -485,7 +485,7 @@ VbError_t ec_sync_phase3(struct vb2_context *ctx) return rv; /* Check if we need to cut-off battery. This must be done after EC - * firmware updating and before kernel started. */ + * firmware updating and before kernel started. */ if (vb2_nv_get(ctx, VB2_NV_BATTERY_CUTOFF_REQUEST)) { VB2_DEBUG("Request to cut-off battery\n"); vb2_nv_set(ctx, VB2_NV_BATTERY_CUTOFF_REQUEST, 0); diff --git a/firmware/lib/include/utility.h b/firmware/lib/include/utility.h index 590c60af..ca9bcd7e 100644 --- a/firmware/lib/include/utility.h +++ b/firmware/lib/include/utility.h @@ -16,8 +16,8 @@ #ifdef VBOOT_DEBUG #define VbAssert(expr) do { if (!(expr)) { \ - VbExError("assert fail: %s at %s:%d\n", \ - #expr, __FILE__, __LINE__); }} while(0) + VbExError("assert fail: %s at %s:%d\n", \ + #expr, __FILE__, __LINE__); }} while(0) #else #define VbAssert(expr) #endif @@ -34,7 +34,7 @@ * forming the most and least signficant 16-bit words. */ #define CombineUint16Pair(msw,lsw) (((uint32_t)(msw) << 16) | \ - (((lsw)) & 0xFFFF)) + (((lsw)) & 0xFFFF)) /* Return the minimum of (a) or (b). */ #define Min(a, b) (((a) < (b)) ? (a) : (b)) @@ -52,7 +52,7 @@ * Returns the length of the stored string, not counting the terminating null. */ uint32_t Uint64ToString(char *buf, uint32_t bufsize, uint64_t value, - uint32_t radix, uint32_t zero_pad_width); + uint32_t radix, uint32_t zero_pad_width); /** * Concatenate <src> onto <dest>, which has space for <destlen> characters diff --git a/firmware/lib/include/vboot_common.h b/firmware/lib/include/vboot_common.h index 44dba262..deaa8d92 100644 --- a/firmware/lib/include/vboot_common.h +++ b/firmware/lib/include/vboot_common.h @@ -136,7 +136,7 @@ uint64_t VbSharedDataReserve(VbSharedDataHeader *header, uint64_t size); * Returns 0 if success, non-zero if error. */ int VbSharedDataSetKernelKey(VbSharedDataHeader *header, - const VbPublicKey *src); + const VbPublicKey *src); /** * Check whether recovery is allowed or not. diff --git a/firmware/lib/tpm2_lite/marshaling.c b/firmware/lib/tpm2_lite/marshaling.c index ab374951..63b83937 100644 --- a/firmware/lib/tpm2_lite/marshaling.c +++ b/firmware/lib/tpm2_lite/marshaling.c @@ -268,10 +268,10 @@ static void unmarshal_get_capability(void **buffer, int *size, * room in the buffer. */ - /* - * Marshaling an arbitrary blob requires its size in addition to common - * parameter set. - */ +/* + * Marshaling an arbitrary blob requires its size in addition to common + * parameter set. + */ static void marshal_blob(void **buffer, void *blob, size_t blob_size, int *buffer_space) { diff --git a/firmware/lib/tpm2_lite/tlcl.c b/firmware/lib/tpm2_lite/tlcl.c index 9c0ab887..a05ef77f 100644 --- a/firmware/lib/tpm2_lite/tlcl.c +++ b/firmware/lib/tpm2_lite/tlcl.c @@ -51,7 +51,7 @@ static uint32_t tpm_get_response(TPM_CC command, res = VbExTpmSendReceive(cr_buffer, out_size, cr_buffer, &in_size); if (res != TPM_SUCCESS) { VB2_DEBUG("tpm transaction failed for %#x with error %#x\n", - command, res); + command, res); return res; } @@ -127,7 +127,7 @@ uint32_t TlclLibClose(void) } uint32_t TlclSendReceive(const uint8_t *request, uint8_t *response, - int max_length) + int max_length) { uint32_t rv, resp_size; @@ -255,8 +255,8 @@ uint32_t TlclSetEnable(void) } uint32_t TlclGetFlags(uint8_t* disable, - uint8_t* deactivated, - uint8_t *nvlocked) + uint8_t* deactivated, + uint8_t *nvlocked) { /* For TPM2 the flags are always the same */ if (disable) @@ -314,7 +314,7 @@ uint32_t TlclGetPermissions(uint32_t index, uint32_t *permissions) } uint32_t TlclGetSpaceInfo(uint32_t index, uint32_t *attributes, uint32_t *size, - void* auth_policy, uint32_t* auth_policy_size) + void* auth_policy, uint32_t* auth_policy_size) { uint32_t rv; struct nv_read_public_response *resp; @@ -563,8 +563,8 @@ size_t tlcl_vendor_string_parse(uint32_t value, uint8_t* buf) } uint32_t TlclGetVersion(uint32_t* vendor, uint64_t* firmware_version, - uint8_t* vendor_specific_buf, - size_t* vendor_specific_buf_size) + uint8_t* vendor_specific_buf, + size_t* vendor_specific_buf_size) { uint32_t result = tlcl_get_tpm_property(TPM_PT_MANUFACTURER, vendor); if (result != TPM_SUCCESS) diff --git a/firmware/lib/tpm_lite/include/tlcl_internal.h b/firmware/lib/tpm_lite/include/tlcl_internal.h index 5db556a8..28eff1d9 100644 --- a/firmware/lib/tpm_lite/include/tlcl_internal.h +++ b/firmware/lib/tpm_lite/include/tlcl_internal.h @@ -16,7 +16,7 @@ #define kEncAuthLength 20 #define kPcrDigestLength 20 #define kTpmRequestAuthBlockLength \ - (sizeof(uint32_t) + sizeof(TPM_NONCE) + 1 + TPM_AUTH_DATA_LEN) + (sizeof(uint32_t) + sizeof(TPM_NONCE) + 1 + TPM_AUTH_DATA_LEN) #define kTpmResponseAuthBlockLength (sizeof(TPM_NONCE) + 1 + TPM_AUTH_DATA_LEN) @@ -28,10 +28,10 @@ */ __attribute__((unused)) static inline void ToTpmUint32(uint8_t *buffer, uint32_t x) { - buffer[0] = (uint8_t)(x >> 24); - buffer[1] = (uint8_t)((x >> 16) & 0xff); - buffer[2] = (uint8_t)((x >> 8) & 0xff); - buffer[3] = (uint8_t)(x & 0xff); + buffer[0] = (uint8_t)(x >> 24); + buffer[1] = (uint8_t)((x >> 16) & 0xff); + buffer[2] = (uint8_t)((x >> 8) & 0xff); + buffer[3] = (uint8_t)(x & 0xff); } /* @@ -39,10 +39,10 @@ static inline void ToTpmUint32(uint8_t *buffer, uint32_t x) { */ __attribute__((unused)) static inline void FromTpmUint32(const uint8_t *buffer, uint32_t *x) { - *x = ((buffer[0] << 24) | - (buffer[1] << 16) | - (buffer[2] << 8) | - buffer[3]); + *x = ((buffer[0] << 24) | + (buffer[1] << 16) | + (buffer[2] << 8) | + buffer[3]); } /* @@ -50,10 +50,10 @@ static inline void FromTpmUint32(const uint8_t *buffer, uint32_t *x) { */ __attribute__((unused)) static inline uint32_t ReadTpmUint32(const uint8_t **buffer) { - uint32_t value; - FromTpmUint32(*buffer, &value); - *buffer += sizeof(value); - return value; + uint32_t value; + FromTpmUint32(*buffer, &value); + *buffer += sizeof(value); + return value; } /* @@ -61,8 +61,8 @@ static inline uint32_t ReadTpmUint32(const uint8_t **buffer) { */ __attribute__((unused)) static inline void ToTpmUint16(uint8_t *buffer, uint16_t x) { - buffer[0] = (uint8_t)(x >> 8); - buffer[1] = (uint8_t)(x & 0xff); + buffer[0] = (uint8_t)(x >> 8); + buffer[1] = (uint8_t)(x & 0xff); } /* @@ -70,7 +70,7 @@ static inline void ToTpmUint16(uint8_t *buffer, uint16_t x) { */ __attribute__((unused)) static inline void FromTpmUint16(const uint8_t *buffer, uint16_t *x) { - *x = (buffer[0] << 8) | buffer[1]; + *x = (buffer[0] << 8) | buffer[1]; } /* @@ -78,10 +78,10 @@ static inline void FromTpmUint16(const uint8_t *buffer, uint16_t *x) { */ __attribute__((unused)) static inline uint16_t ReadTpmUint16(const uint8_t **buffer) { - uint16_t value; - FromTpmUint16(*buffer, &value); - *buffer += sizeof(value); - return value; + uint16_t value; + FromTpmUint16(*buffer, &value); + *buffer += sizeof(value); + return value; } #endif /* TPM_LITE_TLCL_INTERNAL_H_ */ diff --git a/firmware/lib/tpm_lite/include/tlcl_structures.h b/firmware/lib/tpm_lite/include/tlcl_structures.h index 8a17ccc8..7356c439 100644 --- a/firmware/lib/tpm_lite/include/tlcl_structures.h +++ b/firmware/lib/tpm_lite/include/tlcl_structures.h @@ -1,180 +1,180 @@ /* This file is automatically generated */ const struct s_tpm_delegate_read_table_cmd{ - uint8_t buffer[10]; + uint8_t buffer[10]; } tpm_delegate_read_table_cmd = {{0x0, 0xc1, 0x0, 0x0, 0x0, 0xa, 0x0, 0x0, 0x0, 0xdb, }, }; const struct s_tpm_create_delegation_family_cmd{ - uint8_t buffer[23]; - uint16_t familyLabel; + uint8_t buffer[23]; + uint16_t familyLabel; } tpm_create_delegation_family_cmd = {{0x0, 0xc1, 0x0, 0x0, 0x0, 0x17, 0x0, 0x0, 0x0, 0xd2, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1, }, 22, }; const struct s_tpm_takeownership_cmd{ - uint8_t buffer[624]; - uint16_t encOwnerAuth; - uint16_t encSrkAuth; + uint8_t buffer[624]; + uint16_t encOwnerAuth; + uint16_t encSrkAuth; } tpm_takeownership_cmd = {{0x0, 0xc2, 0x0, 0x0, 0x2, 0x70, 0x0, 0x0, 0x0, 0xd, 0x0, 0x5, 0x0, 0x0, 0x1, 0x0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x0, 0x0, 0x1, 0x0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x0, 0x28, 0x0, 0x0, 0x0, 0x11, 0x0, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1, 0x0, 0x3, 0x0, 0x1, 0x0, 0x0, 0x0, 0xc, 0x0, 0x0, 0x8, 0x0, 0x0, 0x0, 0x0, 0x2, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, }, 16, 276, }; const struct s_tpm_osap_cmd{ - uint8_t buffer[36]; - uint16_t entityType; - uint16_t entityValue; - uint16_t nonceOddOSAP; + uint8_t buffer[36]; + uint16_t entityType; + uint16_t entityValue; + uint16_t nonceOddOSAP; } tpm_osap_cmd = {{0x0, 0xc1, 0x0, 0x0, 0x0, 0x24, 0x0, 0x0, 0x0, 0xb, }, 10, 12, 16, }; const struct s_tpm_oiap_cmd{ - uint8_t buffer[10]; + uint8_t buffer[10]; } tpm_oiap_cmd = {{0x0, 0xc1, 0x0, 0x0, 0x0, 0xa, 0x0, 0x0, 0x0, 0xa, }, }; const struct s_tpm_ifx_fieldupgradeinforequest2_cmd{ - uint8_t buffer[13]; + uint8_t buffer[13]; } tpm_ifx_fieldupgradeinforequest2_cmd = {{0x0, 0xc1, 0x0, 0x0, 0x0, 0xd, 0x0, 0x0, 0x0, 0xaa, 0x11, 0x0, 0x0, }, }; const struct s_tpm_getversionval_cmd{ - uint8_t buffer[18]; + uint8_t buffer[18]; } tpm_getversionval_cmd = {{0x0, 0xc1, 0x0, 0x0, 0x0, 0x12, 0x0, 0x0, 0x0, 0x65, 0x0, 0x0, 0x0, 0x1a, 0x0, 0x0, 0x0, 0x0, }, }; const struct s_tpm_extend_cmd{ - uint8_t buffer[34]; - uint16_t pcrNum; - uint16_t inDigest; + uint8_t buffer[34]; + uint16_t pcrNum; + uint16_t inDigest; } tpm_extend_cmd = {{0x0, 0xc1, 0x0, 0x0, 0x0, 0x22, 0x0, 0x0, 0x0, 0x14, }, 10, 14, }; const struct s_tpm_get_random_cmd{ - uint8_t buffer[14]; - uint16_t bytesRequested; + uint8_t buffer[14]; + uint16_t bytesRequested; } tpm_get_random_cmd = {{0x0, 0xc1, 0x0, 0x0, 0x0, 0xe, 0x0, 0x0, 0x0, 0x46, }, 10, }; const struct s_tpm_getownership_cmd{ - uint8_t buffer[22]; + uint8_t buffer[22]; } tpm_getownership_cmd = {{0x0, 0xc1, 0x0, 0x0, 0x0, 0x16, 0x0, 0x0, 0x0, 0x65, 0x0, 0x0, 0x0, 0x5, 0x0, 0x0, 0x0, 0x4, 0x0, 0x0, 0x1, 0x11, }, }; const struct s_tpm_getspaceinfo_cmd{ - uint8_t buffer[22]; - uint16_t index; + uint8_t buffer[22]; + uint16_t index; } tpm_getspaceinfo_cmd = {{0x0, 0xc1, 0x0, 0x0, 0x0, 0x16, 0x0, 0x0, 0x0, 0x65, 0x0, 0x0, 0x0, 0x11, 0x0, 0x0, 0x0, 0x4, }, 18, }; const struct s_tpm_getstclearflags_cmd{ - uint8_t buffer[22]; + uint8_t buffer[22]; } tpm_getstclearflags_cmd = {{0x0, 0xc1, 0x0, 0x0, 0x0, 0x16, 0x0, 0x0, 0x0, 0x65, 0x0, 0x0, 0x0, 0x4, 0x0, 0x0, 0x0, 0x4, 0x0, 0x0, 0x1, 0x9, }, }; const struct s_tpm_getflags_cmd{ - uint8_t buffer[22]; + uint8_t buffer[22]; } tpm_getflags_cmd = {{0x0, 0xc1, 0x0, 0x0, 0x0, 0x16, 0x0, 0x0, 0x0, 0x65, 0x0, 0x0, 0x0, 0x4, 0x0, 0x0, 0x0, 0x4, 0x0, 0x0, 0x1, 0x8, }, }; const struct s_tpm_physicalsetdeactivated_cmd{ - uint8_t buffer[11]; - uint16_t deactivated; + uint8_t buffer[11]; + uint16_t deactivated; } tpm_physicalsetdeactivated_cmd = {{0x0, 0xc1, 0x0, 0x0, 0x0, 0xb, 0x0, 0x0, 0x0, 0x72, }, 10, }; const struct s_tpm_physicalenable_cmd{ - uint8_t buffer[10]; + uint8_t buffer[10]; } tpm_physicalenable_cmd = {{0x0, 0xc1, 0x0, 0x0, 0x0, 0xa, 0x0, 0x0, 0x0, 0x6f, }, }; const struct s_tpm_physicaldisable_cmd{ - uint8_t buffer[10]; + uint8_t buffer[10]; } tpm_physicaldisable_cmd = {{0x0, 0xc1, 0x0, 0x0, 0x0, 0xa, 0x0, 0x0, 0x0, 0x70, }, }; const struct s_tpm_forceclear_cmd{ - uint8_t buffer[10]; + uint8_t buffer[10]; } tpm_forceclear_cmd = {{0x0, 0xc1, 0x0, 0x0, 0x0, 0xa, 0x0, 0x0, 0x0, 0x5d, }, }; const struct s_tpm_readpubek_cmd{ - uint8_t buffer[30]; - uint16_t antiReplay; + uint8_t buffer[30]; + uint16_t antiReplay; } tpm_readpubek_cmd = {{0x0, 0xc1, 0x0, 0x0, 0x0, 0x1e, 0x0, 0x0, 0x0, 0x7c, }, 10, }; const struct s_tpm_continueselftest_cmd{ - uint8_t buffer[10]; + uint8_t buffer[10]; } tpm_continueselftest_cmd = {{0x0, 0xc1, 0x0, 0x0, 0x0, 0xa, 0x0, 0x0, 0x0, 0x53, }, }; const struct s_tpm_selftestfull_cmd{ - uint8_t buffer[10]; + uint8_t buffer[10]; } tpm_selftestfull_cmd = {{0x0, 0xc1, 0x0, 0x0, 0x0, 0xa, 0x0, 0x0, 0x0, 0x50, }, }; const struct s_tpm_resume_cmd{ - uint8_t buffer[12]; + uint8_t buffer[12]; } tpm_resume_cmd = {{0x0, 0xc1, 0x0, 0x0, 0x0, 0xc, 0x0, 0x0, 0x0, 0x99, 0x0, 0x2, }, }; const struct s_tpm_savestate_cmd{ - uint8_t buffer[10]; + uint8_t buffer[10]; } tpm_savestate_cmd = {{0x0, 0xc1, 0x0, 0x0, 0x0, 0xa, 0x0, 0x0, 0x0, 0x98, }, }; const struct s_tpm_startup_cmd{ - uint8_t buffer[12]; + uint8_t buffer[12]; } tpm_startup_cmd = {{0x0, 0xc1, 0x0, 0x0, 0x0, 0xc, 0x0, 0x0, 0x0, 0x99, 0x0, 0x1, }, }; const struct s_tpm_finalizepp_cmd{ - uint8_t buffer[12]; + uint8_t buffer[12]; } tpm_finalizepp_cmd = {{0x0, 0xc1, 0x0, 0x0, 0x0, 0xc, 0x40, 0x0, 0x0, 0xa, 0x2, 0xa0, }, }; const struct s_tpm_pplock_cmd{ - uint8_t buffer[12]; + uint8_t buffer[12]; } tpm_pplock_cmd = {{0x0, 0xc1, 0x0, 0x0, 0x0, 0xc, 0x40, 0x0, 0x0, 0xa, 0x0, 0x4, }, }; const struct s_tpm_ppenable_cmd{ - uint8_t buffer[12]; + uint8_t buffer[12]; } tpm_ppenable_cmd = {{0x0, 0xc1, 0x0, 0x0, 0x0, 0xc, 0x40, 0x0, 0x0, 0xa, 0x0, 0x20, }, }; const struct s_tpm_ppassert_cmd{ - uint8_t buffer[12]; + uint8_t buffer[12]; } tpm_ppassert_cmd = {{0x0, 0xc1, 0x0, 0x0, 0x0, 0xc, 0x40, 0x0, 0x0, 0xa, 0x0, 0x8, }, }; const struct s_tpm_pcr_read_cmd{ - uint8_t buffer[14]; - uint16_t pcrNum; + uint8_t buffer[14]; + uint16_t pcrNum; } tpm_pcr_read_cmd = {{0x0, 0xc1, 0x0, 0x0, 0x0, 0xe, 0x0, 0x0, 0x0, 0x15, }, 10, }; const struct s_tpm_nv_read_cmd{ - uint8_t buffer[22]; - uint16_t index; - uint16_t length; + uint8_t buffer[22]; + uint16_t index; + uint16_t length; } tpm_nv_read_cmd = {{0x0, 0xc1, 0x0, 0x0, 0x0, 0x16, 0x0, 0x0, 0x0, 0xcf, }, 10, 18, }; const struct s_tpm_nv_write_cmd{ - uint8_t buffer[256]; - uint16_t index; - uint16_t length; - uint16_t data; + uint8_t buffer[256]; + uint16_t index; + uint16_t length; + uint16_t data; } tpm_nv_write_cmd = {{0x0, 0xc1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xcd, }, 10, 18, 22, }; const struct s_tpm_nv_definespace_cmd{ - uint8_t buffer[101]; - uint16_t index; - uint16_t pcr_info_read; - uint16_t pcr_info_write; - uint16_t perm; - uint16_t size; + uint8_t buffer[101]; + uint16_t index; + uint16_t pcr_info_read; + uint16_t pcr_info_write; + uint16_t perm; + uint16_t size; } tpm_nv_definespace_cmd = {{0x0, 0xc1, 0x0, 0x0, 0x0, 0x65, 0x0, 0x0, 0x0, 0xcc, 0x0, 0x18, 0, 0, 0, 0, 0x0, 0x3, 0, 0, 0, 0x1f, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x0, 0x3, 0, 0, 0, 0x1f, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x0, 0x17, }, 12, 16, 42, 70, 77, }; diff --git a/firmware/lib/tpm_lite/include/tpm_error_messages.h b/firmware/lib/tpm_lite/include/tpm_error_messages.h index 14cb86be..834ba2d0 100644 --- a/firmware/lib/tpm_lite/include/tpm_error_messages.h +++ b/firmware/lib/tpm_lite/include/tpm_error_messages.h @@ -16,9 +16,9 @@ #define TPM_E_NON_FATAL 0x800
typedef struct tpm_error_info {
- const char* name;
- uint32_t code;
- const char* description;
+ const char* name;
+ uint32_t code;
+ const char* description;
} tpm_error_info;
tpm_error_info tpm_error_table[] = {
@@ -245,6 +245,6 @@ because the ordinal required resources that have not been tested" }, { "TPM_DEFEND_LOCK_RUNNING", TPM_E_BASE + TPM_E_NON_FATAL + 3,
"The TPM is defending against dictionary attacks and is in some\n\
time-out period" },
- };
+};
#endif /* TPM_ERROR_MESSAGES_H */
diff --git a/firmware/lib/tpm_lite/mocked_tlcl.c b/firmware/lib/tpm_lite/mocked_tlcl.c index 0abcb7c9..917532d1 100644 --- a/firmware/lib/tpm_lite/mocked_tlcl.c +++ b/firmware/lib/tpm_lite/mocked_tlcl.c @@ -145,8 +145,8 @@ uint32_t TlclGetSTClearFlags(TPM_STCLEAR_FLAGS* vflags) } uint32_t TlclGetFlags(uint8_t* disable, - uint8_t* deactivated, - uint8_t *nvlocked) + uint8_t* deactivated, + uint8_t *nvlocked) { *disable = 0; *deactivated = 0; @@ -160,7 +160,7 @@ uint32_t TlclSetGlobalLock(void) } uint32_t TlclExtend(int pcr_num, const uint8_t* in_digest, - uint8_t* out_digest) + uint8_t* out_digest) { memcpy(out_digest, in_digest, kPcrDigestLength); return TPM_SUCCESS; @@ -187,8 +187,8 @@ uint32_t TlclGetRandom(uint8_t* data, uint32_t length, uint32_t *size) } uint32_t TlclGetVersion(uint32_t* vendor, uint64_t* firmware_version, - uint8_t* vendor_specific_buf, - size_t* vendor_specific_buf_size) + uint8_t* vendor_specific_buf, + size_t* vendor_specific_buf_size) { *vendor = 0x4e4f4e45; *firmware_version = 0x1; @@ -206,7 +206,7 @@ int TlclPacketSize(const uint8_t* packet) } uint32_t TlclSendReceive(const uint8_t* request, uint8_t* response, - int max_length) + int max_length) { return TPM_SUCCESS; } diff --git a/firmware/lib/tpm_lite/tlcl.c b/firmware/lib/tpm_lite/tlcl.c index d7dfade9..7643ce7b 100644 --- a/firmware/lib/tpm_lite/tlcl.c +++ b/firmware/lib/tpm_lite/tlcl.c @@ -65,7 +65,7 @@ static inline int TpmReturnCode(const uint8_t* buffer) * DOING_SELFTEST errors are returned. */ static uint32_t TlclSendReceiveNoRetry(const uint8_t* request, - uint8_t* response, int max_length) + uint8_t* response, int max_length) { uint32_t response_length = max_length; @@ -110,7 +110,7 @@ static uint32_t TlclSendReceiveNoRetry(const uint8_t* request, * error code if error. In the firmware, waits for the self test to complete * if needed. In the host, reports the first error without retries. */ uint32_t TlclSendReceive(const uint8_t* request, uint8_t* response, - int max_length) + int max_length) { uint32_t result = TlclSendReceiveNoRetry(request, response, max_length); /* When compiling for the firmware, hide command failures due to the @@ -560,7 +560,7 @@ uint32_t TlclInitNvAuthPolicy(uint32_t pcr_selection_bitmap, * the most unlikely one to be used in practice, i.e. the spec says * locality 3 is for "Auxiliary components. Use of this is optional and, * if used, it is implementation dependent." - */ + */ policy->pcr_info_read.localityAtRelease = TPM_ALL_LOCALITIES & ~TPM_LOC_THREE; @@ -786,8 +786,8 @@ uint32_t TlclGetSTClearFlags(TPM_STCLEAR_FLAGS* vflags) } uint32_t TlclGetFlags(uint8_t* disable, - uint8_t* deactivated, - uint8_t *nvlocked) + uint8_t* deactivated, + uint8_t *nvlocked) { TPM_PERMANENT_FLAGS pflags; uint32_t result = TlclGetPermanentFlags(&pflags); @@ -813,7 +813,7 @@ uint32_t TlclSetGlobalLock(void) } uint32_t TlclExtend(int pcr_num, const uint8_t* in_digest, - uint8_t* out_digest) + uint8_t* out_digest) { struct s_tpm_extend_cmd cmd; uint8_t response[kTpmResponseHeaderLength + kPcrDigestLength]; @@ -990,8 +990,8 @@ uint32_t TlclGetRandom(uint8_t* data, uint32_t length, uint32_t *size) } uint32_t TlclGetVersion(uint32_t* vendor, uint64_t* firmware_version, - uint8_t* vendor_specific_buf, - size_t* vendor_specific_buf_size) + uint8_t* vendor_specific_buf, + size_t* vendor_specific_buf_size) { uint8_t response[TPM_LARGE_ENOUGH_COMMAND_SIZE]; uint32_t result = TlclSendReceive(tpm_getversionval_cmd.buffer, @@ -1313,7 +1313,7 @@ uint32_t TlclCreateDelegationFamily(uint8_t family_label) } uint32_t TlclReadDelegationFamilyTable(TPM_FAMILY_TABLE_ENTRY *table, - uint32_t* table_size) + uint32_t* table_size) { uint8_t response[TPM_LARGE_ENOUGH_COMMAND_SIZE]; uint32_t result = TlclSendReceive(tpm_delegate_read_table_cmd.buffer, diff --git a/firmware/lib/vboot_api_kernel.c b/firmware/lib/vboot_api_kernel.c index 3ae3cd4d..516b1e44 100644 --- a/firmware/lib/vboot_api_kernel.c +++ b/firmware/lib/vboot_api_kernel.c @@ -407,7 +407,7 @@ static void vb2_kernel_cleanup(struct vb2_context *ctx, VbCommonParams *cparams) } VbError_t VbSelectAndLoadKernel(VbCommonParams *cparams, - VbSelectAndLoadKernelParams *kparams) + VbSelectAndLoadKernelParams *kparams) { VbError_t retval = vb2_kernel_setup(cparams, kparams); if (retval) @@ -606,7 +606,7 @@ VbError_t VbVerifyMemoryBootImage(VbCommonParams *cparams, retval = VBERROR_SUCCESS; -fail: + fail: vb2_kernel_cleanup(&ctx, cparams); if (NULL != kernel_subkey) free(kernel_subkey); diff --git a/firmware/lib/vboot_common.c b/firmware/lib/vboot_common.c index f336f2c0..f0c4ea6a 100644 --- a/firmware/lib/vboot_common.c +++ b/firmware/lib/vboot_common.c @@ -61,9 +61,9 @@ const uint8_t *GetSignatureDataC(const VbSignature *sig) */ int VerifyMemberInside(const void *parent, uint64_t parent_size, - const void *member, uint64_t member_size, - uint64_t member_data_offset, - uint64_t member_data_size) + const void *member, uint64_t member_size, + uint64_t member_data_offset, + uint64_t member_data_size) { uint64_t end = OffsetOf(parent, member); @@ -90,7 +90,7 @@ int VerifyMemberInside(const void *parent, uint64_t parent_size, } int VerifyPublicKeyInside(const void *parent, uint64_t parent_size, - const VbPublicKey *key) + const VbPublicKey *key) { return VerifyMemberInside(parent, parent_size, key, sizeof(VbPublicKey), @@ -98,7 +98,7 @@ int VerifyPublicKeyInside(const void *parent, uint64_t parent_size, } int VerifySignatureInside(const void *parent, uint64_t parent_size, - const VbSignature *sig) + const VbSignature *sig) { return VerifyMemberInside(parent, parent_size, sig, sizeof(VbSignature), diff --git a/firmware/lib/vboot_display.c b/firmware/lib/vboot_display.c index 947fb42f..b34976d1 100644 --- a/firmware/lib/vboot_display.c +++ b/firmware/lib/vboot_display.c @@ -141,7 +141,7 @@ const char *RecoveryReasonString(uint8_t code) case VB2_RECOVERY_RO_INVALID_RW_CHECK_MIN + VBSD_LF_CHECK_NOT_DONE: return "RW firmware check not done"; case VB2_RECOVERY_RO_INVALID_RW_CHECK_MIN + VBSD_LF_CHECK_DEV_MISMATCH: - return "RW firmware developer flag mismatch"; + return "RW firmware developer flag mismatch"; case VB2_RECOVERY_RO_INVALID_RW_CHECK_MIN + VBSD_LF_CHECK_REC_MISMATCH: return "RW firmware recovery flag mismatch"; case VB2_RECOVERY_RO_INVALID_RW_CHECK_MIN + @@ -467,5 +467,5 @@ VbError_t VbCheckDisplayKey(struct vb2_context *ctx, uint32_t key) (void)VbDisplayScreen(ctx, disp_current_screen, 1); } - return VBERROR_SUCCESS; + return VBERROR_SUCCESS; } diff --git a/firmware/lib/vboot_ui.c b/firmware/lib/vboot_ui.c index 5eb78f0a..640c4ff8 100644 --- a/firmware/lib/vboot_ui.c +++ b/firmware/lib/vboot_ui.c @@ -474,10 +474,10 @@ static VbError_t recovery_ui(struct vb2_context *ctx) shared->flags & VBSD_HONOR_VIRT_DEV_SWITCH && !(shared->flags & VBSD_BOOT_DEV_SWITCH_ON) && (shared->flags & VBSD_BOOT_REC_SWITCH_ON)) { - if (!(shared->flags & + if (!(shared->flags & VBSD_BOOT_REC_SWITCH_VIRTUAL) && VbExGetSwitches( - VB_INIT_FLAG_REC_BUTTON_PRESSED)) { + VB_INIT_FLAG_REC_BUTTON_PRESSED)) { /* * Is the recovery button stuck? In * any case we don't like this. Beep diff --git a/firmware/stub/tpm_lite_stub.c b/firmware/stub/tpm_lite_stub.c index c063858f..647034e6 100644 --- a/firmware/stub/tpm_lite_stub.c +++ b/firmware/stub/tpm_lite_stub.c @@ -230,7 +230,7 @@ VbError_t VbExTpmOpen(void) } VbError_t VbExTpmSendReceive(const uint8_t* request, uint32_t request_length, - uint8_t* response, uint32_t* response_length) + uint8_t* response, uint32_t* response_length) { /* * In a real firmware implementation, this function should contain @@ -280,12 +280,12 @@ VbError_t VbExTpmSendReceive(const uint8_t* request, uint32_t request_length, tag = TpmTag(request); response_tag = TpmTag(response); assert( - (tag == TPM_TAG_RQU_COMMAND && - response_tag == TPM_TAG_RSP_COMMAND) || - (tag == TPM_TAG_RQU_AUTH1_COMMAND && - response_tag == TPM_TAG_RSP_AUTH1_COMMAND) || - (tag == TPM_TAG_RQU_AUTH2_COMMAND && - response_tag == TPM_TAG_RSP_AUTH2_COMMAND)); + (tag == TPM_TAG_RQU_COMMAND && + response_tag == TPM_TAG_RSP_COMMAND) || + (tag == TPM_TAG_RQU_AUTH1_COMMAND && + response_tag == TPM_TAG_RSP_AUTH1_COMMAND) || + (tag == TPM_TAG_RQU_AUTH2_COMMAND && + response_tag == TPM_TAG_RSP_AUTH2_COMMAND)); assert(*response_length == TpmResponseSize(response)); #endif diff --git a/firmware/stub/vboot_api_stub.c b/firmware/stub/vboot_api_stub.c index e424e66c..1dbeca0f 100644 --- a/firmware/stub/vboot_api_stub.c +++ b/firmware/stub/vboot_api_stub.c @@ -140,7 +140,7 @@ VbError_t VbExEcEnteringMode(int devidx, enum VbEcBootMode_t mode) VbError_t VbExEcVbootDone(int in_recovery) { - return VBERROR_SUCCESS; + return VBERROR_SUCCESS; } VbError_t VbExEcBatteryCutOff(void) diff --git a/firmware/stub/vboot_api_stub_disk.c b/firmware/stub/vboot_api_stub_disk.c index e23b54a8..975b42ad 100644 --- a/firmware/stub/vboot_api_stub_disk.c +++ b/firmware/stub/vboot_api_stub_disk.c @@ -16,7 +16,7 @@ VbError_t VbExDiskGetInfo(VbDiskInfo** infos_ptr, uint32_t* count, - uint32_t disk_flags) + uint32_t disk_flags) { *infos_ptr = NULL; *count = 0; @@ -25,21 +25,21 @@ VbError_t VbExDiskGetInfo(VbDiskInfo** infos_ptr, uint32_t* count, VbError_t VbExDiskFreeInfo(VbDiskInfo* infos_ptr, - VbExDiskHandle_t preserve_handle) + VbExDiskHandle_t preserve_handle) { return VBERROR_SUCCESS; } VbError_t VbExDiskRead(VbExDiskHandle_t handle, uint64_t lba_start, - uint64_t lba_count, void* buffer) + uint64_t lba_count, void* buffer) { return VBERROR_SUCCESS; } VbError_t VbExDiskWrite(VbExDiskHandle_t handle, uint64_t lba_start, - uint64_t lba_count, const void* buffer) + uint64_t lba_count, const void* buffer) { return VBERROR_SUCCESS; } |