From patchwork Thu Oct 1 16:37:42 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Richter X-Patchwork-Id: 1375258 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 4C2JhZ0Sr4z9sSC for ; Fri, 2 Oct 2020 02:38:06 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=linux.ibm.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=ibm.com header.i=@ibm.com header.a=rsa-sha256 header.s=pp1 header.b=oOmwuaDL; dkim-atps=neutral Received: from bilbo.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 4C2JhY74mSzDqYY for ; Fri, 2 Oct 2020 02:38:05 +1000 (AEST) 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=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=ibm.com header.i=@ibm.com header.a=rsa-sha256 header.s=pp1 header.b=oOmwuaDL; dkim-atps=neutral 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 4C2JhL5TkszDqWY for ; Fri, 2 Oct 2020 02:37:54 +1000 (AEST) Received: from pps.filterd (m0098404.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 091GWM3f067433 for ; Thu, 1 Oct 2020 12:37:51 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : mime-version : content-transfer-encoding; s=pp1; bh=HkvlABesGXFGYU02T7ru/oltlARhsuUTYg3E+aj0vWk=; b=oOmwuaDLzYRls2QxQZatFt8I9cLPFiMrprrOBHZ20UqZKP+ng68uuG5HNEMP3Yhkt61x E3CLTFw7lJHPmn95ARbNVKKDYh9rmtXh6ETZdGas997iI2l+g+Ar0eK5RaPEnd4AcQGK DdcW3//62mw6cUpLrx/z1U3k16yztre04nlpIDDXZHl6b0WUoLsvYgK/UIjXEjCL9KiS eNszpYqza2mrmUZomDMRy8L99t1g/g7aWkVEJH5Mu1eZR2XjNrXbkuOF+LvpRiFwJYZo jbiwa4QeYkIb6NTVKv1+IGAGFxlVbgjQh/qrplIzUb7XfgedcwpjwSmiMvT5+AplgNFQ wg== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 33wh47mdyq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 01 Oct 2020 12:37:51 -0400 Received: from m0098404.ppops.net (m0098404.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.36/8.16.0.36) with SMTP id 091GWj2D069661 for ; Thu, 1 Oct 2020 12:37:50 -0400 Received: from ppma04ams.nl.ibm.com (63.31.33a9.ip4.static.sl-reverse.com [169.51.49.99]) by mx0a-001b2d01.pphosted.com with ESMTP id 33wh47mdxq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 01 Oct 2020 12:37:50 -0400 Received: from pps.filterd (ppma04ams.nl.ibm.com [127.0.0.1]) by ppma04ams.nl.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 091GavhE028393; Thu, 1 Oct 2020 16:37:48 GMT Received: from b06avi18626390.portsmouth.uk.ibm.com (b06avi18626390.portsmouth.uk.ibm.com [9.149.26.192]) by ppma04ams.nl.ibm.com with ESMTP id 33sw97wr0w-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 01 Oct 2020 16:37:48 +0000 Received: from d06av25.portsmouth.uk.ibm.com (d06av25.portsmouth.uk.ibm.com [9.149.105.61]) by b06avi18626390.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 091Gbjrd33489318 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 1 Oct 2020 16:37:45 GMT Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 8A4B411C04A; Thu, 1 Oct 2020 16:37:45 +0000 (GMT) Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 95D9311C052; Thu, 1 Oct 2020 16:37:44 +0000 (GMT) Received: from ceres.ibmuc.com (unknown [9.211.127.206]) by d06av25.portsmouth.uk.ibm.com (Postfix) with ESMTP; Thu, 1 Oct 2020 16:37:44 +0000 (GMT) From: Eric Richter To: skiboot@lists.ozlabs.org Date: Thu, 1 Oct 2020 11:37:42 -0500 Message-Id: <20201001163742.26298-1-erichte@linux.ibm.com> X-Mailer: git-send-email 2.21.1 MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.235, 18.0.687 definitions=2020-10-01_05:2020-10-01, 2020-10-01 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 priorityscore=1501 lowpriorityscore=0 phishscore=0 malwarescore=0 impostorscore=0 adultscore=0 spamscore=0 bulkscore=0 clxscore=1015 mlxlogscore=999 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2010010134 Subject: [Skiboot] [PATCH] secvar/test: use vendored mbedtls instead of host 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" Linking against the host mbedtls introduces problems if the host does not have the library, or if the host has a different version installed. This patch changes the tests to instead build mbedtls from the version included in skiboot using the host compiler, removing the dependency on external mbedtls. Signed-off-by: Eric Richter --- NOTE: This patch should be applied on top of the PATCH v6/v6a series[1] for the secvar driver implementation. [1] https://lists.ozlabs.org/pipermail/skiboot/2020-September/017278.html libstb/secvar/test/Makefile.check | 15 ++++++++++----- libstb/secvar/test/secvar-test-secboot-tpm.c | 2 -- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/libstb/secvar/test/Makefile.check b/libstb/secvar/test/Makefile.check index 3a99f8d8..b2cafcf6 100644 --- a/libstb/secvar/test/Makefile.check +++ b/libstb/secvar/test/Makefile.check @@ -32,15 +32,20 @@ $(SECVAR_TEST:%=%-check) : %-check: % $(call QTEST, RUN-TEST ,$(VALGRIND) $<, $<) @$(RM) -f secboot.img -HOSTMBEDFLAGS += -lmbedcrypto -lmbedx509 +HOST_MBEDTLS_OBJS=$(MBEDTLS_OBJS:%.o=$(CRYPTO_DIR)/%.host.o) +HOST_MBEDTLS_CFLAGS=-I$(SRC)/$(LIBSTB_DIR)/crypto -DMBEDTLS_CONFIG_FILE='' +HOST_MBEDTLS_CFLAGS+= -Wno-unused-function -Wno-suggest-attribute=const +%.host.o: %.c + $(call Q, HOSTCC , $(HOSTCC) $(HOSTCFLAGS) $(HOST_MBEDTLS_CFLAGS) -O0 -g -c -o $@ $<, $<) + $(SECVAR_TEST) : core/test/stubs.o -$(SECVAR_TEST) : % : %.c - $(call Q, HOSTCC ,$(HOSTCC) $(HOSTCFLAGS) $(HOSTMBEDFLAGS) -O0 -g -I include -I . -I libfdt -o $@ $< core/test/stubs.o, $<) +$(SECVAR_TEST) : % : %.c $(HOST_MBEDTLS_OBJS) + $(call Q, HOSTCC ,$(HOSTCC) $(HOSTCFLAGS) -O0 -g -I include -I . -I libfdt -o $@ $< $(HOST_MBEDTLS_OBJS) core/test/stubs.o, $<) -$(SECVAR_TEST:%=%-gcov): %-gcov : %.c % - $(call Q, HOSTCC ,$(HOSTCC) $(HOSTCFLAGS) $(HOSTGCOVCFLAGS) $(HOSTMBEDFLAGS) -I include -I . -I libfdt -lgcov -o $@ $< core/test/stubs.o, $<) +$(SECVAR_TEST:%=%-gcov): %-gcov : %.c % $(HOST_MBEDTLS_OBJS) + $(call Q, HOSTCC ,$(HOSTCC) $(HOSTCFLAGS) $(HOSTGCOVCFLAGS) -I include -I . -I libfdt -lgcov -o $@ $< $(HOST_MBEDTLS_OBJS) core/test/stubs.o, $<) -include $(wildcard libstb/secvar/test/*.d) diff --git a/libstb/secvar/test/secvar-test-secboot-tpm.c b/libstb/secvar/test/secvar-test-secboot-tpm.c index e883b884..798ca281 100644 --- a/libstb/secvar/test/secvar-test-secboot-tpm.c +++ b/libstb/secvar/test/secvar-test-secboot-tpm.c @@ -4,8 +4,6 @@ #include "secvar_common_test.c" #include "../storage/secboot_tpm.c" #include "../storage/fakenv_ops.c" -#include "../../crypto/mbedtls/library/sha256.c" -#include "../../crypto/mbedtls/library/platform_util.c" #include "../secvar_util.c" char *secboot_buffer;