From patchwork Sun Sep 13 22:59:02 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stewart Smith X-Patchwork-Id: 1363166 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 4BqQ2M2qfnz9sT6 for ; Mon, 14 Sep 2020 09:00:43 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=flamingspork.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=flamingspork.com header.i=@flamingspork.com header.a=rsa-sha256 header.s=mesmtp header.b=p/ToyFI3; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.a=rsa-sha256 header.s=fm3 header.b=mh7rrZfQ; 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 4BqQ2M190yzDqZm for ; Mon, 14 Sep 2020 09:00:43 +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=flamingspork.com (client-ip=66.111.4.25; helo=out1-smtp.messagingengine.com; envelope-from=stewart@flamingspork.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=flamingspork.com Authentication-Results: lists.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=flamingspork.com header.i=@flamingspork.com header.a=rsa-sha256 header.s=mesmtp header.b=p/ToyFI3; dkim=pass (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.a=rsa-sha256 header.s=fm3 header.b=mh7rrZfQ; dkim-atps=neutral Received: from out1-smtp.messagingengine.com (out1-smtp.messagingengine.com [66.111.4.25]) (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 4BqQ0y3TbKzDqX8 for ; Mon, 14 Sep 2020 08:59:22 +1000 (AEST) Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 1F7525C00EE; Sun, 13 Sep 2020 18:59:19 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Sun, 13 Sep 2020 18:59:19 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= flamingspork.com; h=from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; s=mesmtp; bh=BhFb6txm9v+y4xzJJWPf+YkDlRTYMyCvRP85vibs8kE=; b=p/ ToyFI341kFzaWWEBG9+orIT4UzHAa/EJ16ZZXqvYb767d0nowPn6amZ14l3n4j3d amiJHOlF2EsqTW2BsRaH7CoxjapJeEedsMyWPh8fb4rlyCwR6dHL9/BdpeABAvsM pXtVTED5DkA4lZ0uYaWcEWi3eigCUIlxFkevHmJwk= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; bh=BhFb6txm9v+y4xzJJWPf+YkDlRTYMyCvRP85vibs8kE=; b=mh7rrZfQ b+kpbAZGf+PNI14e1iARLyqCE4IYLU2uTIiehi+Is/ya5+lPjtVvaXKcL7uxups6 hm28T7cvC/wLCPqN18o+C5jofOT9qHCNvsjbb1u23TiQlEl2A6/Tl9ESIFlAi3fB dK6B4gYpgRGpH4Q9cTC5C2Kk2n27rvJ1927n/2ZtQ8bzzFxF6XkOOiW7cRZPUExH ntEIp6ZdMlQxPaokkKPI+rKqnLt96JC7/b0tWjPnm/BajO/hlO9ZP7xtF1wdCfoB K+5ca5N4uKFeM2LTP2QttlMzqTpbwVDlK0uPeWHixPJiKnJgccB+WYm3FT8DB/Ds Zj9VD9XRmlC8+A== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduiedrudeihedgudehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefhvffufffkofgjfhgggfestdekre dtredttdenucfhrhhomhepufhtvgifrghrthcuufhmihhthhcuoehsthgvfigrrhhtsehf lhgrmhhinhhgshhpohhrkhdrtghomheqnecuggftrfgrthhtvghrnhepkeeggeegvdefte eggeegtdfgjeegiedvgeetheefleeujeeffeeiffeuheevueetnecukfhppeeljedruddu fedrkedurddvhedvnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilh hfrhhomhepshhtvgifrghrthesfhhlrghmihhnghhsphhorhhkrdgtohhm X-ME-Proxy: Received: from willster.tuckerbox.house (97-113-81-252.tukw.qwest.net [97.113.81.252]) by mail.messagingengine.com (Postfix) with ESMTPA id 960353064683; Sun, 13 Sep 2020 18:59:18 -0400 (EDT) From: Stewart Smith To: skiboot@lists.ozlabs.org Date: Sun, 13 Sep 2020 15:59:02 -0700 Message-Id: <20200913225904.42537-2-stewart@flamingspork.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200913225904.42537-1-stewart@flamingspork.com> References: <20200913225904.42537-1-stewart@flamingspork.com> MIME-Version: 1.0 Subject: [Skiboot] [PATCH 2/4] libstb/tss/trustedTypes.C: Fix sparse annotations 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: , Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" Lots of sparse warning fixes: warning: incorrect type in assignment (different base types) expected unsigned short [usertype] got restricted leint16_t Signed-off-by: Stewart Smith --- libstb/tss/trustedTypes.C | 42 +++++++++++++++++++-------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/libstb/tss/trustedTypes.C b/libstb/tss/trustedTypes.C index edc0269c..b73ca85c 100644 --- a/libstb/tss/trustedTypes.C +++ b/libstb/tss/trustedTypes.C @@ -490,7 +490,7 @@ namespace TRUSTEDBOOT uint8_t* TPMT_HA_logMarshal(const TPMT_HA* val, uint8_t* i_logBuf) { - uint16_t* field16 = (uint16_t*)i_logBuf; + __le16* field16 = (__le16*)i_logBuf; *field16 = htole16(val->algorithmId); i_logBuf += sizeof(uint16_t); memcpy(i_logBuf, &(val->digest), @@ -503,14 +503,14 @@ namespace TRUSTEDBOOT const uint8_t* i_tpmBuf, bool* o_err) { size_t size = 0; - uint16_t* field16 = NULL; + __le16* field16 = NULL; do { *o_err = false; // algorithmId size = sizeof(val->algorithmId); - field16 = (uint16_t*)i_tpmBuf; + field16 = (__le16*)i_tpmBuf; val->algorithmId = le16toh(*field16); // Ensure a valid count if (val->algorithmId >= TPM_ALG_INVALID_ID) @@ -572,7 +572,7 @@ namespace TRUSTEDBOOT uint8_t* TPML_DIGEST_VALUES_logMarshal(const TPML_DIGEST_VALUES* val, uint8_t* i_logBuf) { - uint32_t* field32 = (uint32_t*)i_logBuf; + __le32* field32 = (__le32*)i_logBuf; if (HASH_COUNT < val->count) { i_logBuf = NULL; @@ -595,13 +595,13 @@ namespace TRUSTEDBOOT bool* o_err) { size_t size = 0; - uint32_t* field32 = NULL; + __le32* field32 = NULL; do { *o_err = false; // count size = sizeof(val->count); - field32 = (uint32_t*)(i_tpmBuf); + field32 = (__le32*)(i_tpmBuf); val->count = le32toh(*field32); // Ensure a valid count if (val->count > HASH_COUNT) @@ -651,7 +651,7 @@ namespace TRUSTEDBOOT bool* o_err) { size_t size = 0; - uint32_t* field32; + __le32* field32; *o_err = false; do { @@ -665,7 +665,7 @@ namespace TRUSTEDBOOT // pcrIndex size = sizeof(val->pcrIndex); - field32 = (uint32_t*)(i_tpmBuf); + field32 = (__le32*)(i_tpmBuf); val->pcrIndex = le32toh(*field32); // Ensure a valid pcr index if (val->pcrIndex >= IMPLEMENTATION_PCR) @@ -681,7 +681,7 @@ namespace TRUSTEDBOOT // eventType size = sizeof(val->eventType); - field32 = (uint32_t*)(i_tpmBuf); + field32 = (__le32*)(i_tpmBuf); val->eventType = le32toh(*field32); // Ensure a valid event type if (val->eventType == 0 || val->eventType >= EV_INVALID) @@ -702,7 +702,7 @@ namespace TRUSTEDBOOT // eventSize size = sizeof(val->eventSize); - field32 = (uint32_t*)(i_tpmBuf); + field32 = (__le32*)(i_tpmBuf); val->eventSize = le32toh(*field32); // Ensure a valid eventSize if (val->eventSize >= MAX_TPM_LOG_MSG) @@ -727,18 +727,18 @@ namespace TRUSTEDBOOT uint8_t* TCG_PCR_EVENT_logMarshal(const TCG_PCR_EVENT* val, uint8_t* i_logBuf) { - uint32_t* field32 = (uint32_t*)(i_logBuf); + __le32* field32 = (__le32*)(i_logBuf); *field32 = htole32(val->pcrIndex); i_logBuf += sizeof(uint32_t); - field32 = (uint32_t*)(i_logBuf); + field32 = (__le32*)(i_logBuf); *field32 = htole32(val->eventType); i_logBuf += sizeof(uint32_t); memcpy(i_logBuf, val->digest, sizeof(val->digest)); i_logBuf += sizeof(val->digest); - field32 = (uint32_t*)(i_logBuf); + field32 = (__le32*)(i_logBuf); *field32 = htole32(val->eventSize); i_logBuf += sizeof(uint32_t); @@ -758,7 +758,7 @@ namespace TRUSTEDBOOT uint8_t* TPM_EVENT_FIELD_logMarshal(const TPM_EVENT_FIELD* val, uint8_t* i_logBuf) { - uint32_t* field32 = (uint32_t*)i_logBuf; + __le32* field32 = (__le32*)i_logBuf; if (MAX_TPM_LOG_MSG < val->eventSize) { i_logBuf = NULL; @@ -779,13 +779,13 @@ namespace TRUSTEDBOOT bool* o_err) { size_t size = 0; - uint32_t* field32 = NULL; + __le32* field32 = NULL; do { *o_err = false; // Event size size = sizeof(val->eventSize); - field32 = (uint32_t*)(i_tpmBuf); + field32 = (__le32*)(i_tpmBuf); val->eventSize = le32toh(*field32); i_tpmBuf += size; @@ -828,10 +828,10 @@ namespace TRUSTEDBOOT uint8_t* TCG_PCR_EVENT2_logMarshal(const TCG_PCR_EVENT2* val, uint8_t* i_logBuf) { - uint32_t* field32 = (uint32_t*)i_logBuf; + __le32* field32 = (__le32*)i_logBuf; *field32 = htole32(val->pcrIndex); i_logBuf += sizeof(uint32_t); - field32 = (uint32_t*)i_logBuf; + field32 = (__le32*)i_logBuf; *field32 = htole32(val->eventType); i_logBuf += sizeof(uint32_t); @@ -849,7 +849,7 @@ namespace TRUSTEDBOOT bool* o_err) { size_t size = 0; - uint32_t* field32 = NULL; + __le32* field32 = NULL; do { *o_err = false; @@ -864,7 +864,7 @@ namespace TRUSTEDBOOT // pcrIndex size = sizeof(val->pcrIndex); - field32 = (uint32_t*)(i_tpmBuf); + field32 = (__le32*)(i_tpmBuf); val->pcrIndex = le32toh(*field32); // Ensure a valid pcr index if (val->pcrIndex > IMPLEMENTATION_PCR) @@ -880,7 +880,7 @@ namespace TRUSTEDBOOT // eventType size = sizeof(val->eventType); - field32 = (uint32_t*)(i_tpmBuf); + field32 = (__le32*)(i_tpmBuf); val->eventType = le32toh(*field32); // Ensure a valid event type if (val->eventType == 0 ||