Git Product home page Git Product logo

tpm2-tcti-uefi's Introduction

Linux Build Status codecov

Overview

This is an implementation of a TCTI module for use with the TCG TPM2 Software Stack (TSS2) in the UEFI environment. This library is built as a static archive libtss2-tcti-uefi.a suitable for linking with UEFI applications.

API Stability

Methods for hiding symbols in a static arcive from users are not portable and so this implementation makes no effort to do so. This does not imply that all symbols from the archive present part of a stable API. The only stable API exposed is the TCTI as specified by the TCG. This is a single function called Tss2_Tcti_Uefi_Init. All other symbols are subject to change without notice.

Build and Installation Instructions

Instructions to build and install libtss2-tcti-uefi.a are available in the INSTALL file.

Source Layout

├── example - sample code using UEFI TCG2 protocol and tpm2-tss libraries
├── src - source code and headers for libtss2-tcti-uefi.a
└── test - unit tests

Getting in Touch

If you're looking to discuss the source code in this project or get some questions answered you should join the 01.org TPM2 mailing list:

We also have an IRC channel set up on FreeNode called #tpm2.0-tss.

Test Cases

Test strategy and cases are documented in docs/test.md.

Examples

Several example UEFI executables are provided for reference and documented in docs/example.md.

tpm2-tcti-uefi's People

Contributors

dilyanpalauzov avatar flihp avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

tpm2-tcti-uefi's Issues

getcap chars vs wchars

Some output from the tpm2-get-cap-fixed.efi example application produces weird output. This is most likely caused by the TPM2 returning chars while all of UEFI uses wchars. Probably something we can convert using mbstowcs.

Unable to run EFI application LibLocateProtocol status: 0xE

Not sure how to run the efi applications. I'm sure I'm missing something here.

UEFI Interactive Shell v2.2
EDK II
UEFI v2.70 (EDK II, 0x00010000)
Mapping table
      FS0: Alias(s):HD1a1:;BLK3:
          PciRoot(0x0)/Pci(0x1,0x1)/Ata(0x0)/HD(1,MBR,0xBE1AFDFA,0x3F,0xFBFC1)
     BLK2: Alias(s):
          PciRoot(0x0)/Pci(0x1,0x1)/Ata(0x0)
     BLK4: Alias(s):
          PciRoot(0x0)/Pci(0x1,0x1)/Ata(0x0)
     BLK0: Alias(s):
          PciRoot(0x0)/Pci(0x1,0x0)/Floppy(0x0)
     BLK1: Alias(s):
          PciRoot(0x0)/Pci(0x1,0x0)/Floppy(0x1)
Press ESC in 5 seconds to skip startup.nsh or any other key to continue.
Shell> fs0:
FS0:\> ls
Directory of: FS0:\
12/13/2018  11:43                 207  compat.h
12/13/2018  11:43              49,909  get-capability.efi
12/13/2018  11:43           2,856,248  tpm2-get-capability.so
12/13/2018  10:43              32,768  get-capability.o
12/13/2018  10:27              10,959  tpm2-get-capability.c
12/13/2018  10:27                 545  tss2-util.h
12/13/2018  11:43             273,292  tpm2-get-capability.efi
12/13/2018  10:27               1,227  get-capability.c
12/13/2018  11:43              55,608  tpm2-get-capability.o
12/13/2018  10:27                 408  compat.c
12/13/2018  11:43 <DIR>         8,192  .deps
12/13/2018  10:43              36,688  tss2-util.o
12/13/2018  09:26               3,075  tss2-util.c
12/13/2018  19:43               1,958  NvVars
12/13/2018  11:43           2,213,168  get-capability.so
12/13/2018  10:43              27,896  compat.o
         15 File(s)   5,563,956 bytes
          1 Dir(s)
FS0:\> tpm2-get-capability.efi
LibLocateProtocol status: 0xE
FS0:\> get-capability
LibLocateProtocol status: 0xE
FS0:\> load get-capability.efi
Image 'FS0:\get-capability.efi' is not a driver.
FS0:\>

QEMU: Image format not specified

WARNING: Image format was not specified for 'json:{"fat-type": 0, "dir": "./example", "driver": "vvfat", "floppy": false, "rw": true}' and probing guessed raw.
         Automatically detecting the format is dangerous for raw images, write operations on block 0 will be restricted.
         Specify the 'raw' format explicitly to remove the restrictions.

edk2 build

Figure out how to integrate this library (and the required tss2 ones) into edk2. Edk2 is not particularly friendly to integrating external libraries. The assumption of static linking seems to have caused a similar assumption about all code being "in-tree". We should probably look to the OpenSSL integration as a reference.

integration test harness

Running the example UEFI applications under Qemu with OVMF is super handy (see #21) . The remaining tasks to turn this approach into a proper integration test harness should be considered / discussed here.

support crypto-agile pre-boot event log

#48 added a tool to dump the event log but it only supports the SHA1-only format. The OVMF firmware supports the newer format (I think), and the spec for the format is in the TCG EFI Protocol Specification in section 5.2. Just need to write the code.

support target tripple?

The build process for UEFI applications, or at least the process I've used for this project, is a bit convoluted. This was based on the build process described here: http://www.rodsbooks.com/linux-uefi/. Having to use objdump to transform the shared object to the EFI executable using this method works but ideally we'd be able to use the target triple. I don't know "the right way" to do this though. There's probably a good example out there I just haven't found it. The build system for Grub2 may be a good reference.

swtpm seccomp failure

Upstream changes in swtpm build seem to be causing CI failures. Previously if libseccomp wasn't installed the build would disable the code that required it. Doesn't seem to be the case any longer though.

Wrong operator used in get_eventlog_format_high?

Just had a look at the code and noticed that this should probably be the binary & instead of the boolean &&:

if (caps.SupportedEventLogs && EFI_TCG2_EVENT_LOG_FORMAT_TCG_2)
*format = EFI_TCG2_EVENT_LOG_FORMAT_TCG_2;
else if (caps.SupportedEventLogs && EFI_TCG2_EVENT_LOG_FORMAT_TCG_1_2)
*format = EFI_TCG2_EVENT_LOG_FORMAT_TCG_1_2;

test output shouldn't end up in /tmp

The integration test script needs to grow up a bit. The most useful output from the test cases ends up in a log file under /tmp. This is a lot harder to find than it needs to be. Try to get this into the default .log file for the test. If that's a PITA a new log file under $(srcdir)/test named appropriately is a close second.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.