From patchwork Wed Apr 1 00:34:14 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Richter X-Patchwork-Id: 1264977 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 48sS206rzDz9sT9 for ; Wed, 1 Apr 2020 11:36:56 +1100 (AEDT) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.ibm.com Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 48sS203T3FzDqRh for ; Wed, 1 Apr 2020 11:36:56 +1100 (AEDT) X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=linux.ibm.com (client-ip=148.163.156.1; helo=mx0a-001b2d01.pphosted.com; envelope-from=erichte@linux.ibm.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.ibm.com Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 48sRzM4xGtzDqnM for ; Wed, 1 Apr 2020 11:34:39 +1100 (AEDT) Received: from pps.filterd (m0098409.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 0310Xhow086236 for ; Tue, 31 Mar 2020 20:34:37 -0400 Received: from e06smtp07.uk.ibm.com (e06smtp07.uk.ibm.com [195.75.94.103]) by mx0a-001b2d01.pphosted.com with ESMTP id 303wrwrjgp-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 31 Mar 2020 20:34:37 -0400 Received: from localhost by e06smtp07.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 1 Apr 2020 01:34:33 +0100 Received: from b06cxnps4075.portsmouth.uk.ibm.com (9.149.109.197) by e06smtp07.uk.ibm.com (192.168.101.137) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Wed, 1 Apr 2020 01:34:31 +0100 Received: from d06av26.portsmouth.uk.ibm.com (d06av26.portsmouth.uk.ibm.com [9.149.105.62]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 0310YVql59375648 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 1 Apr 2020 00:34:32 GMT Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D62BCAE051; Wed, 1 Apr 2020 00:34:31 +0000 (GMT) Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 30A71AE045; Wed, 1 Apr 2020 00:34:31 +0000 (GMT) Received: from ceres.ibmuc.com (unknown [9.80.234.145]) by d06av26.portsmouth.uk.ibm.com (Postfix) with ESMTP; Wed, 1 Apr 2020 00:34:31 +0000 (GMT) From: Eric Richter To: skiboot@lists.ozlabs.org Date: Tue, 31 Mar 2020 19:34:14 -0500 X-Mailer: git-send-email 2.21.1 In-Reply-To: <20200401003426.7198-1-erichte@linux.ibm.com> References: <20200401003426.7198-1-erichte@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 x-cbid: 20040100-0028-0000-0000-000003EFB0D6 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 20040100-0029-0000-0000-000024B534F8 Message-Id: <20200401003426.7198-4-erichte@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.138, 18.0.676 definitions=2020-03-31_07:2020-03-31, 2020-03-31 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 lowpriorityscore=0 mlxlogscore=963 clxscore=1015 bulkscore=0 malwarescore=0 suspectscore=1 phishscore=0 priorityscore=1501 spamscore=0 adultscore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2003020000 definitions=main-2004010003 Subject: [Skiboot] [PATCH v3 03/15] secvar_devtree: add physical presence mode helper X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Mailing list for skiboot development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: nayna@linux.ibm.com Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" This patch adds a simple function to detect whether or not physical presence has been asserted. In the current implementation, all physical presence assertion modes are treated the same. Signed-off-by: Eric Richter --- libstb/secvar/secvar_devtree.c | 15 +++++++++++++++ libstb/secvar/secvar_devtree.h | 2 ++ 2 files changed, 17 insertions(+) diff --git a/libstb/secvar/secvar_devtree.c b/libstb/secvar/secvar_devtree.c index 4bff1392..5dbd872e 100644 --- a/libstb/secvar/secvar_devtree.c +++ b/libstb/secvar/secvar_devtree.c @@ -64,3 +64,18 @@ void secvar_set_update_status(uint64_t val) dt_add_property_u64(secvar_node, "update-status", val); } +bool secvar_check_physical_presence(void) +{ + struct dt_node *secureboot; + + secureboot = dt_find_by_path(dt_root, "ibm,secureboot"); + if (!secureboot) + return false; + + if (dt_find_property(secureboot, "clear-os-keys") + || dt_find_property(secureboot, "clear-all-keys") + || dt_find_property(secureboot, "clear-mfg-keys")) + return true; + + return false; +} diff --git a/libstb/secvar/secvar_devtree.h b/libstb/secvar/secvar_devtree.h index d3838849..b88162bf 100644 --- a/libstb/secvar/secvar_devtree.h +++ b/libstb/secvar/secvar_devtree.h @@ -10,4 +10,6 @@ void secvar_init_devnode(const char *compatible); void secvar_set_status(const char *status); void secvar_set_update_status(uint64_t val); +bool secvar_check_physical_presence(void); + #endif