• Linus Torvalds's avatar
    Merge tag 'tpmdd-next-20190625' of git://git.infradead.org/users/jjs/linux-tpmdd · 88492259
    Linus Torvalds authored
    Pull tpm updates from Jarkko Sakkinen:
     "This contains two critical bug fixes and support for obtaining TPM
      events triggered by ExitBootServices().
    
      For the latter I have to give a quite verbose explanation not least
      because I had to revisit all the details myself to remember what was
      going on in Matthew's patches.
    
      The preboot software stack maintains an event log that gets entries
      every time something gets hashed to any of the PCR registers. What
      gets hashed could be a component to be run or perhaps log of some
      actions taken just to give couple of coarse examples. In general,
      anything relevant for the boot process that the preboot software does
      gets hashed and a log entry with a specific event type [1].
    
      The main application for this is remote attestation and the reason why
      it is useful is nicely put in the very first section of [1]:
    
         "Attestation is used to provide information about the platform’s
          state to a challenger. However, PCR contents are difficult to
          interpret; therefore, attestation is typically more useful when
          the PCR contents are accompanied by a measurement log. While not
          trusted on their own, the measurement log contains a richer set of
          information than do the PCR contents. The PCR contents are used to
          provide the validation of the measurement log."
    
      Because EFI_TCG2_PROTOCOL.GetEventLog() is not available after calling
      ExitBootServices(), Linux EFI stub copies the event log to a custom
      configuration table. Unfortunately, ExitBootServices() also generates
      events and obviously these events do not get copied to that table.
      Luckily firmware does this for us by providing a configuration table
      identified by EFI_TCG2_FINAL_EVENTS_TABLE_GUID.
    
      This essentially contains necessary changes to provide the full event
      log for the use the user space that is concatenated from these two
      partial event logs [2]"
    
    [1] https://trustedcomputinggroup.org/resource/pc-client-specific-platform-firmware-profile-specification/
    [2] The final concatenation is done in drivers/char/tpm/eventlog/efi.c
    
    * tag 'tpmdd-next-20190625' of git://git.infradead.org/users/jjs/linux-tpmdd:
      tpm: Don't duplicate events from the final event log in the TCG2 log
      Abstract out support for locating an EFI config table
      tpm: Fix TPM 1.2 Shutdown sequence to prevent future TPM operations
      efi: Attempt to get the TCG2 event log in the boot stub
      tpm: Append the final event log to the TPM event log
      tpm: Reserve the TPM final events table
      tpm: Abstract crypto agile event size calculations
      tpm: Actually fail on TPM errors during "get random"
    88492259
efi.c 26.9 KB