34 Commits

Author SHA1 Message Date
aborwank
6ca7a860b9 Revert "fix: [TPM] correcting cfg data and key hash" (#2122)
This reverts commit 2f277eb9f1.

Due to entire binaries being dumped in eventlog, many event
getting skipped for space constraint. Hence reverting.

Signed-off-by: Antara Borwankar <antara.borwankar@intel.com>
2024-01-23 22:46:55 -07:00
Antara Borwankar
2f277eb9f1 fix: [TPM] correcting cfg data and key hash
issue: https://jira.devtools.intel.com/browse/IOTGSECSW-2031

Signed-off-by: Antara Borwankar <antara.borwankar@intel.com>
2024-01-22 10:09:15 -07:00
sean-m-mcginn
1a46ef1771 Sync TpmLib with latest EDK2 stable release (#1938)
* Sync TpmLib with latest EDK2 stable release

The changes include:
- Adding a retry mechanism for TPM commands
- Adding a mechanism to put TPM in idle state after CRB command

Signed-off-by: Sean McGinn <sean.mcginn@intel.com>

* Add active PCR count log

Log number of active PCRs whenever supported
and active PCRs are retrieved

Signed-off-by: Sean McGinn <sean.mcginn@intel.com>

* Add API for checking if TPM command is supported

Signed-off-by: Sean McGinn <sean.mcginn@intel.com>

* Fix spacing in header for PCR info function

Signed-off-by: Sean McGinn <sean.mcginn@intel.com>

* Fix copyright years

Signed-off-by: Sean McGinn <sean.mcginn@intel.com>

---------

Signed-off-by: Sean McGinn <sean.mcginn@intel.com>
2023-07-10 11:51:46 -07:00
Vincent Chen
12f21059dc [TGL/EHL] add debug prints for TSN components loading
It was not easy to figure out from boot log whether TSN
components are loaded successfully or not. Add debug prints
to indicate the loading status.

Signed-off-by: Vincent Chen <vincent.chen@intel.com>
2023-05-23 15:56:07 -07:00
sean-m-mcginn
598f12347f [ADL] Additional TPM-related cleanup (#1881)
Update copyright years
Initialize pointers to NULL
Check pointers for NULL before de-reference
Standardize debug logs

Signed-off-by: Sean McGinn <sean.mcginn@intel.com>
2023-04-26 11:39:22 -07:00
sean-m-mcginn
ba9da25442 [ADL] Update TPM event logging to match BIOS (#1859)
* [ADL] Update TPM event logging to match BIOS

If measured boot disabled via BtG profile but enabled via SBL
config flag, skip logging startup locality TPM event

If measured boot enabled via BtG profile or SBL config flag, log
CRTM version TPM event

Set startup locality based off startup locality on ACM policy status

Log detail and authority PCR events based off SCTRM status on ACM
policy status

Signed-off-by: Sean McGinn <sean.mcginn@intel.com>

* Initialize startup locality and remove measured boot check

Initialize startup locality variable used in setting up event
log

Remove measured boot check as it is not seen in BIOS and it
occurs at higher level

Signed-off-by: Sean McGinn <sean.mcginn@intel.com>

---------

Signed-off-by: Sean McGinn <sean.mcginn@intel.com>
2023-04-20 16:37:18 -07:00
Sean McGinn
04e872d77b Remove unnecessary continue statement in TPM library
Signed-off-by: Sean McGinn <sean.mcginn@intel.com>
2023-03-28 15:55:01 -07:00
Sean McGinn
b8830af723 Enhance TPM2 Logs
Show error message whenever an unsupported PCR bank is used

Signed-off-by: Sean McGinn <sean.mcginn@intel.com>
2023-03-28 15:55:01 -07:00
Sean McGinn
e207c062d9 Change SecureBootPolicy TPM Event Type
Whenever EV_EFI_VARIABLE_DRIVER_CONFIG is specified as TPM event type,
the data that accompanies it is expected to be an UEFI variable in the
appropriate format

This change fixes an erroneously typed TPM event so that the tpm2_eventlog
command works in Linux

Signed-off-by: Sean McGinn <sean.mcginn@intel.com>
2023-03-28 15:55:01 -07:00
Sean McGinn
f3d515cd32 Cast FW blob pointers to UINTN then UINT64
Signed-off-by: Sean McGinn <sean.mcginn@intel.com>
2023-03-06 10:48:47 -07:00
Sean McGinn
0c4dca2a82 Log the correct TPM2 event type for stage hashing
In BIOS, all stage measurements are of type
EV_EFI_PLATFORM_FIRMWARE_BLOB. This change aligns SBL
with BIOS.

Signed-off-by: Sean McGinn <sean.mcginn@intel.com>
2023-03-06 10:48:47 -07:00
Subash Lakkimsetti
0eceb0cfe7 Update Universal payload hob for secure boot. (#1695)
Universal paayload hobs are updated for secure boot
and measured boot. Event logs Hobs are created to consume
by TCG2Dxe in uefi payload.

Signed-off-by: Subash Lakkimsetti <subash.lakkimsetti@intel.com>

Signed-off-by: Subash Lakkimsetti <subash.lakkimsetti@intel.com>
2022-10-06 08:48:06 -07:00
Mike Crowe
990e3e81e6 Use LF line endings in the repository
Convert the line endings stored for all text files in the repository to
LF. The majority previously used DOS-style CRLF line endings. Add a
.gitattributes file to enforce this and treat certain extensions as
never being text files.

Update PatchCheck.py to insist on LF line endings rather than CRLF.
However, its other checks fail on this commit due to lots of
pre-existing complaints that it only notices because the line endings
have changed.

Silicon/QemuSocPkg/FspBin/Patches/0001-Build-QEMU-FSP-2.0-binaries.patch
needs to be treated as binary since it contains a mixture of line
endings.

This change has implications depending on the client platform you are
using the repository from:

* Windows

The usual configuration for Git on Windows means that text files will
be checked out to the work tree with DOS-style CRLF line endings. If
that's not the case then you can configure Git to do so for the entire
machine with:

 git config --global core.autocrlf true

or for just the repository with:

 git config core.autocrlf true

Line endings will be normalised to LF when they are committed to the
repository. If you commit a text file with only LF line endings then it
will be converted to CRLF line endings in your work tree.

* Linux, MacOS and other Unices

The usual configuration for Git on such platforms is to check files out
of the repository with LF line endings. This is probably the right thing
for you. In the unlikely even that you are using Git on Unix but editing
or compiling on Windows for some reason then you may need to tweak your
configuration to force the use of CRLF line endings as described above.

* General

For more information see
https://docs.github.com/en/get-started/getting-started-with-git/configuring-git-to-handle-line-endings .

Fixes: https://github.com/slimbootloader/slimbootloader/issues/1400
Signed-off-by: Mike Crowe <mac@mcrowe.com>
2021-11-10 12:46:42 -08:00
Sachin Agrawal
e3cedba233 Handle TPMStartup error during S3 resume
As per TCG spec, if a Tpm2Startup(TPM_SU_STATE) fails during
S3 resume, a host reset should be done.

When BootGuard is enabled, ACM will notify of this failure via Bit46 in
BootGuardBootStatus register.


Signed-off-by: Sachin Agrawal <sachin.agrawal@intel.com>
2021-01-11 12:43:11 -08:00
Subash Lakkimsetti
5804d9a18a Measure firmware debugger launch
Platform debug mode is extended to PCR[7]
as part of secure boot policy. Updated bit setting
to LoaderPlatformInfo for payloads to consume.
Debug mode is checked in payload.

ArchitecturalMsr.h ported fom EDK2 repo.

Signed-off-by: Subash Lakkimsetti <subash.lakkimsetti@intel.com>
2020-05-05 15:07:15 -07:00
Himanshu Sahdev aka CunningLearner
74aa53e77a TpmLib: Add appropriate comparison checks
Signed-off-by: Himanshu Sahdev aka CunningLearner <sahdev.himan@gmail.com>
2020-05-05 15:04:20 -07:00
Himanshu Sahdev aka CunningLearner
f11d4be58e TpmLib/Tpm2Capability.c: Fix typos
Signed-off-by: Himanshu Sahdev aka CunningLearner <sahdev.himan@gmail.com>
2020-05-05 15:04:20 -07:00
Aiden Park
3ec0361920 Fix pointer type cast errors from Visual Studio (#617)
Visual Studio reports more pointer type cast errors with 64-bit build.
This will cover the issue on the existing targets.

Signed-off-by: Aiden Park <aiden.park@intel.com>
2020-03-27 11:03:28 -07:00
Aiden Park
29446a1c2a Pointer type cast for both 32/64-bit operation (#615)
This patch allows both 32/64-bit addressing properly.
- Pointer type cast with UINTN
- Add missing EFIAPI for APIs

Signed-off-by: Aiden Park <aiden.park@intel.com>
2020-03-26 17:30:55 -07:00
Guo Dong
833ecbc46b Format update by coding style
1)  Replace TAB with spaces
2)  Convert CR, LF or LFCR to CRLF
3)  Remove trailing spaces
4)  Updated below strings:
       "EFI_D_INFO"  -> "DEBUG_INFO",
       "EFI_D_WARN"  -> "DEBUG_WARN",
       "EFI_D_ERROR" -> "DEBUG_ERROR",

Signed-off-by: Guo Dong <guo.dong@intel.com>
2020-02-07 22:43:45 -07:00
Subash Lakkimsetti
776aef4078 KlocWork issue fixes in security libraries
Signed-off-by: Subash Lakkimsetti <subash.lakkimsetti@intel.com>
2020-02-04 14:40:17 -07:00
Maurice Ma
faa172e67e Add missing header files in INF
In order to sync up with EDK201911 stable release, it is required
to add missing header files in the INF file. Otherwise, the build
will throw warnings. This patch added the missing headers in INF
files.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2020-02-03 15:49:48 -08:00
Subash Lakkimsetti
d111dcb12a Measured boot update for Linux OS Image
Unified interface is added in TpmLib to extend stage and
OS Image digest. For Container OS Image this interface
is added as callback functionality. IAS image utilizes same
functionality to extend TPM digest.

Signed-off-by: Subash Lakkimsetti <subash.lakkimsetti@intel.com>
2020-01-28 09:35:46 -07:00
Subash Lakkimsetti
d2acdab100 TPMLib and Measured boot updates (#539)
- Added GetHashToExtend to bootloader common API to
  retrive digest to extend
- Hash calculations for stage component and config date updated
  to use bootloader common API
- Added functionality to extend KeyHashManifest digest

Signed-off-by: Subash Lakkimsetti <subash.lakkimsetti@intel.com>
2020-01-22 13:53:44 -08:00
Subash Lakkimsetti
f9e542a72c Update firmware component stage hash extend
LoadComponentCallback is extended to perfom TPM extend
for firmware component stages. Component callback would be
invoked after authentication.

TpmExtendStageHash would extend hash based on hash validity.
TpmExtendConfigData is added to handle the Config data blob extend.

Signed-off-by: Subash Lakkimsetti <subash.lakkimsetti@intel.com>
2020-01-13 08:30:45 -08:00