Skip to content

Commit

Permalink
Initial commit, source code, readme, and descriptor files added
Browse files Browse the repository at this point in the history
  • Loading branch information
ttamanji committed Dec 7, 2022
0 parents commit 14775af
Show file tree
Hide file tree
Showing 4 changed files with 664 additions and 0 deletions.
37 changes: 37 additions & 0 deletions License.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@

// Copyright (c) 2017 Finnbarr P. Murphy. All rights reserved.
//
// Retrieve and print TPM 2.0 PCR digests
//
// License: BSD License
//
// Routines containing an underbar in the name were ported from Intel Open Source Technology
// Center tpm2.0-tools and modified for UDK2015 environment and my requirements.
//
// Original tpm2.0-tools license is:
//
// Copyright (c) 2015, Intel Corporation
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// * Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of Intel Corporation nor the names of its contributors
// may be used to endorse or promote products derived from this software
// without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
84 changes: 84 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
# ShowPCR

This program will print out the PCR values while in the EFI shell.

By default this program will output PCR7 as a SHA256 digest with no options, use options below to specify PCR and hash algorithm.

Usage: ShowPCR.efi [-all] [--pcr] [n] digest_algorithm

--all : Shows all PCR values from 0-23

--pcr : pick an individual PCR value to output

## Build instructions

## Prerequisites

Use apt to get the following packages
```
sudo apt-get install build-essential git uuid-dev iasl nasm
```

### Preparing EDK2

1) Clone EDK2 into your favorite location and cd into it, I prefer my home directory

```
git clone https://github.com/tianocore/edk2.git && cd edk2
```

2) Clone submodules, make EDK2, and then setup

```
git submodule update --init
make -C BaseTools
source edksetup.sh
```
3) We now must now configure our build settings, using your favorite text editor navigate Conf/target

On line 44 Set:
```
TARGET_ARCH = X64
```

...then on line 54 set:
```
TOOL_CHAIN_TAG = GCC5
```

Congrats! Your EDK2 setup is now complete, now on to building ShowPCR!

## Build ShowPCR

1) Prep our build enviornment variables
```
export EDK_TOOLS_PATH=<edk2_root>/BaseTools
source edksetup.sh BaseTools
```
2) Navigate to the following and clone ShowPCR
```
cd <edk2 root>/EmulatorPkg/Application
git clone https://aci-github.cisco.com/atom/showpcr
```
3) Add our inf file to the Package Interface using your favorite text editor:
```
<edk2_root>/EmulatorPkg/EmulatorPkg.dsc
```
Just past the "Entry Point" section of Libaray Classes add the following

```
ShellCEntryLib|ShellPkg/Library/UefiShellCEntryLib/UefiShellCEntryLib.inf
```
and after the "LibraryClasses" section (ln 416) add the following:
```
EmulatorPkg/Application/showpcr/showpcr.inf
```


...and finally run the command
```
build
```

showpcr will now be located in <edk2_root>/Build/EmulatorX64/DEBUG_GCC5/X64/showpcr.efi

Loading

0 comments on commit 14775af

Please sign in to comment.