Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp2655924imj; Mon, 11 Feb 2019 06:33:32 -0800 (PST) X-Google-Smtp-Source: AHgI3IYftBXyq/xGW3gt32I8L2YOibyMY5W3S4A7+3VHMLA/W2uhuJRDD16SXYjlqRvSkzZLSwTA X-Received: by 2002:a62:4bd5:: with SMTP id d82mr10958304pfj.85.1549895612005; Mon, 11 Feb 2019 06:33:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549895611; cv=none; d=google.com; s=arc-20160816; b=AZBxauBCxNLdau251AftL3+ew2ZLxB4gLOv8hOJBEVSogzPwqxmbtbdvc4otz7J+DS qlrBkh2B2Ahi7yZ/fDXqH2YnxO/ELVWYL+uRceqhpCClm2Z/TyBWQ859JLkaQ2x4qWq+ njFaCZUphKu548EVXBDLdgJddPoBie4dAUIyoN6jhoJWPEkwQfpalblaMaO2PR91+OJl I4a2eAga6Pzr0NGxpeHZUKlU/bUB1h6kofrp05hbFUmzgdh61sthwBVSQ6Y/SpQ0U7hO MZbA4sz/5TNcZN6TlUCs644+o6JQ+5uRdpX3zJI6Cqpf0aGyrd5WEX0+7OAP2ENsAo9E 3FQQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature; bh=ID2+altBHwpRMSebDiExrpvSLmkUDj1M10qr+jHAcQI=; b=ToxyJMLP0Y+EbfBrkmk6XQEL4QeE+bmLX5Fb3B+XCi+n8ETdfj+26cr7F2blvwxyVN Gt1GRHD524AHRl9bdZ6z/r0XNjIgQ0bN1wAxuib6V7onpiAZOJc9zLqPd+8wqesQzniE dbujG2J1j1Law05f0ZfFyAqkpv2XlPKJrLgYZbfTHdnxxdgreYJadgnKjc/OTvphPq9z 3NrqmLtR9zSmYaeoewl+dO/TYdEBqBhVoriWbRJJOHN7MVrQGOnbc8S038FYEm5/W+HP wQdySTA+6zm+3x8XyyPzAKMBpDaBl0/RrIESG2bnD/dpyITw0P7HqhaFtyKydBQILd+w 2Miw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@semihalf-com.20150623.gappssmtp.com header.s=20150623 header.b=adXXiIkM; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n26si1529167pfb.88.2019.02.11.06.33.14; Mon, 11 Feb 2019 06:33:31 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@semihalf-com.20150623.gappssmtp.com header.s=20150623 header.b=adXXiIkM; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728808AbfBKObZ (ORCPT + 99 others); Mon, 11 Feb 2019 09:31:25 -0500 Received: from mail-lj1-f194.google.com ([209.85.208.194]:34881 "EHLO mail-lj1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729721AbfBKObX (ORCPT ); Mon, 11 Feb 2019 09:31:23 -0500 Received: by mail-lj1-f194.google.com with SMTP id j13-v6so8946202ljc.2 for ; Mon, 11 Feb 2019 06:31:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=semihalf-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=ID2+altBHwpRMSebDiExrpvSLmkUDj1M10qr+jHAcQI=; b=adXXiIkMkKJy8YnUOfH9rF3o+RkZ4jHw6UQEBlqLpbSmzVEs1G0cqN/d0lv4mgDEJz ZOcNm86TK17cNvPfiix9omZLZwmry7OiRuHGOrnhA1CD1+BQraTaDasRu/O+7nRzLsQ4 rYF6e84YzqAPKXVq/Wk5Co6XPJwrp0fhzOYsBBA6JPs9XM4a6JKfc9ixNhAwGnwIkQbZ ohLmmAKGIZuuMxYKPS8wftf2UhUrgR7qTF3aWf9zpj6rheJlnLO3xW3ryrtERQH9WQUm rniY7ZGWY0QupIYmcVdmDvIaWwUkL8mPAxJA5X4UOEhAQrPPRBL877d/lbqTho5VkWHf l5fA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=ID2+altBHwpRMSebDiExrpvSLmkUDj1M10qr+jHAcQI=; b=WbMsZ/Sj7thuerXcunRL4nZNYmdHWwDEoYwPiouoxn5QwcQeZsunausiUAcnT+PFVN 7cJUKHBdegb7UkJuiIC87Anf6v8W6xw5qQggaspFVItUCEnTTM/3IgdrGQCNINFYBebP cyR54zkmLRf/kwimddDP3X4EyY3ODJcQ0wJ5fEx+TKN+rPWRjcfNZjdecNNHJP32MQNP OgXdp9dmMHZ/KW0/WhePdaxcM/lyfIGmvUr91VhNR2Ihqgc49vqInSJHNX2aJK5jycGH iLvShNWXnngAVEAQbz89PbdmXLDUbS2pGhMrZYPdN8U5We1oJ3O6zcVKfG4cBuxQ5Znm yYlQ== X-Gm-Message-State: AHQUAuZL3ZBkQw+7GvSoQL85wEgpv8qCsJAXZ1m9o8UWTqwJPFjE7Rj5 wI8KNVA/lWPbjvd2EjsH8DG6LA== X-Received: by 2002:a2e:8103:: with SMTP id d3-v6mr10052992ljg.98.1549895481145; Mon, 11 Feb 2019 06:31:21 -0800 (PST) Received: from bsz-kubuntu.semihalf.local (31-172-191-173.noc.fibertech.net.pl. [31.172.191.173]) by smtp.gmail.com with ESMTPSA id z6sm2322373lfa.87.2019.02.11.06.31.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 11 Feb 2019 06:31:20 -0800 (PST) From: bsz@semihalf.com To: linux-efi@vger.kernel.org, linux-integrity@vger.kernel.org, linux-kernel@vger.kernel.org, peterhuewe@gmx.de, jarkko.sakkinen@linux.intel.com, ard.biesheuvel@linaro.org Cc: tweek@google.com, mingo@kernel.org, hdegoede@redhat.com, leif.lindholm@linaro.org, mw@semihalf.com, Bartosz Szczepanek Subject: [PATCH 0/5] Add support for TPM event log 2.0 on EFI/ARM Date: Mon, 11 Feb 2019 15:30:47 +0100 Message-Id: <20190211143052.3128-1-bsz@semihalf.com> X-Mailer: git-send-email 2.17.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Bartosz Szczepanek These few patches introduce support for retrieving TPM event log in 2.0 format from EFI structures. Since 2.0 format involves dynamically-sized records, some more computation is needed. Function responsible for this has already been in kernel (calc_tpm2_event_size) - it was moved to library, so it can be used from both EFI stub and device drivers. Signature is slightly altered, as explained in one of the commits. EFI stub was enhanced to call EFI GetEventLog function asking for 2.0 event log. If found, it's installed in configuration table similarily to TPM 1.2 log. In case 2.0 log is not available, it falls back to 1.2 log. Call to efi_retrieve_tpm2_eventlog() is added at ARM efi_entry to enable TPM functionality on ARM / ARM64 platforms. It was tested on two platforms - ARM64 and x86_64, both EFI-based and equipped with TPM 2.0 module. Bartosz Szczepanek (5): tpm: Copy calc_tpm2_event_size() to TPM library tpm: Change calc_tpm2_event_size signature tpm: Use library version of calc_tpm2_event_size in sysfs code efi/libstub/tpm: Retrieve TPM event log in 2.0 format efi/arm: Retrieve TPM event log at efi_entry drivers/char/tpm/eventlog/tpm2.c | 89 +++++--------------------- drivers/firmware/efi/libstub/Makefile | 3 +- drivers/firmware/efi/libstub/arm-stub.c | 1 + drivers/firmware/efi/libstub/tpm.c | 107 +++++++++++++++++++++++++++++++- include/linux/tpm_eventlog.h | 3 + lib/Makefile | 2 + lib/tpm.c | 78 +++++++++++++++++++++++ 7 files changed, 208 insertions(+), 75 deletions(-) create mode 100644 lib/tpm.c -- 2.14.4