From patchwork Wed Sep 2 08:09:09 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 1355585 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=Sf0RZVf+; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4BhGrB5M7Dz9sTN for ; Wed, 2 Sep 2020 18:12:10 +1000 (AEST) Received: from localhost ([::1]:51240 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kDNsG-0003ju-MM for incoming@patchwork.ozlabs.org; Wed, 02 Sep 2020 04:12:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42128) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kDNpX-0007wG-Ef for qemu-devel@nongnu.org; Wed, 02 Sep 2020 04:09:19 -0400 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:59743 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kDNpV-0001sm-M9 for qemu-devel@nongnu.org; Wed, 02 Sep 2020 04:09:19 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1599034157; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=8S1is3V+uNMDSCkr5ooDmUvJBA2c6esYl0AjU7GwsP8=; b=Sf0RZVf+PJTUjrd+N6MJj/pORzabfb2JLsDbRfIFEZhHCyD8AXcoyz77jCnNXCVlxrsy8F VRUe6Zndt8Nf8Zm8S8uGbuJZHRocIi3nDUEjhv42wC/2mxst+b9z45u6a6ozWB86zgFH86 3MfD082HbAYbU3NSYWeHRLhFJmotW8A= Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-188-P9kje0oePUiO7Fjw4IoUHg-1; Wed, 02 Sep 2020 04:09:15 -0400 X-MC-Unique: P9kje0oePUiO7Fjw4IoUHg-1 Received: by mail-wr1-f72.google.com with SMTP id g3so1646185wrx.1 for ; Wed, 02 Sep 2020 01:09:15 -0700 (PDT) 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:mime-version :content-transfer-encoding; bh=8S1is3V+uNMDSCkr5ooDmUvJBA2c6esYl0AjU7GwsP8=; b=jeWwWdXclJkYiohFtUH2jb2LLfCQPEX2EZ9uCtiekTI5d1KPQYv0xoF3UA6zgMj/cc 1eT8S/AKjUO6UWLEFeowmEo3Z2rhCrK7eFcx37GB7VcieQzl3Gq1LOL9k2v4QcbVcpVH mWUtfyIDb8Ivft/hi67zjPQJEcB8nkohtFgGHscY3vvWkkojtpdPyuV2MclYYT9kjk9o 6/hH+UoYq8YF3qjQO7ffDo8lDPVd8KM0fqnwGGpz85+W3x3UmgjWdQcL1TXkQdM97KqS egQfdwmcxhynNluUavEyVeOhjPud91l21BoaT7QdGCW9EbbYcZ35EszAyWa9brmIIRhf Kw3w== X-Gm-Message-State: AOAM5315GV0ONsfyiIiozQUK4Tv38vitcfQMACrxYj34id9ebOoO7hQT 1BZE4hl4DjgK4BHQO26geAUIimCuRU1ebv2ajZ2rAJNTgLLl0TzMa+ebus5Sz0XF8D21paYqGvO JtQBtuA0purdkRG8= X-Received: by 2002:a1c:9a8c:: with SMTP id c134mr5311970wme.136.1599034151469; Wed, 02 Sep 2020 01:09:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxdELmA+vA0BeUn53E71O8OpMVJpZEBfRMTyxXaR+ksUAWaLzsPPsi+Zkr1u6d+sRm3xCV+Lw== X-Received: by 2002:a1c:9a8c:: with SMTP id c134mr5311952wme.136.1599034151313; Wed, 02 Sep 2020 01:09:11 -0700 (PDT) Received: from localhost.localdomain (50.red-83-52-54.dynamicip.rima-tde.net. [83.52.54.50]) by smtp.gmail.com with ESMTPSA id d18sm5618291wrm.10.2020.09.02.01.09.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Sep 2020 01:09:10 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH] tests/qtest/tpm: Declare input buffers const and static Date: Wed, 2 Sep 2020 10:09:09 +0200 Message-Id: <20200902080909.161034-1-philmd@redhat.com> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0.002 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=205.139.110.61; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/02 03:24:55 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Laurent Vivier , Paolo Bonzini , Thomas Huth , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Stefan Berger Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" The functions using these arrays expect a "const unsigned char *" argument, it is safe to declare these as 'static const'. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Darren Kenny Reviewed-by: Thomas Huth Reviewed-by: Stefan Berger --- tests/qtest/tpm-tests.c | 4 ++-- tests/qtest/tpm-util.c | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/tests/qtest/tpm-tests.c b/tests/qtest/tpm-tests.c index a2f2838e15b..70c80f8379a 100644 --- a/tests/qtest/tpm-tests.c +++ b/tests/qtest/tpm-tests.c @@ -59,7 +59,7 @@ void tpm_test_swtpm_test(const char *src_tpm_path, tx_func *tx, tpm_util_startup(s, tx); tpm_util_pcrextend(s, tx); - unsigned char tpm_pcrread_resp[] = + static const unsigned char tpm_pcrread_resp[] = "\x80\x01\x00\x00\x00\x3e\x00\x00\x00\x00\x00\x00\x00\x16\x00\x00" "\x00\x01\x00\x0b\x03\x00\x04\x00\x00\x00\x00\x01\x00\x20\xf6\x85" "\x98\xe5\x86\x8d\xe6\x8b\x97\x29\x99\x60\xf2\x71\x7d\x17\x67\x89" @@ -107,7 +107,7 @@ void tpm_test_swtpm_migration_test(const char *src_tpm_path, tpm_util_startup(src_qemu, tx); tpm_util_pcrextend(src_qemu, tx); - unsigned char tpm_pcrread_resp[] = + static const unsigned char tpm_pcrread_resp[] = "\x80\x01\x00\x00\x00\x3e\x00\x00\x00\x00\x00\x00\x00\x16\x00\x00" "\x00\x01\x00\x0b\x03\x00\x04\x00\x00\x00\x00\x01\x00\x20\xf6\x85" "\x98\xe5\x86\x8d\xe6\x8b\x97\x29\x99\x60\xf2\x71\x7d\x17\x67\x89" diff --git a/tests/qtest/tpm-util.c b/tests/qtest/tpm-util.c index e2b29ef0f8c..3ed6c8548a6 100644 --- a/tests/qtest/tpm-util.c +++ b/tests/qtest/tpm-util.c @@ -98,9 +98,9 @@ void tpm_util_tis_transfer(QTestState *s, void tpm_util_startup(QTestState *s, tx_func *tx) { unsigned char buffer[1024]; - unsigned char tpm_startup[] = + static const unsigned char tpm_startup[] = "\x80\x01\x00\x00\x00\x0c\x00\x00\x01\x44\x00\x00"; - unsigned char tpm_startup_resp[] = + static const unsigned char tpm_startup_resp[] = "\x80\x01\x00\x00\x00\x0a\x00\x00\x00\x00"; tx(s, tpm_startup, sizeof(tpm_startup), buffer, sizeof(buffer)); @@ -112,14 +112,14 @@ void tpm_util_startup(QTestState *s, tx_func *tx) void tpm_util_pcrextend(QTestState *s, tx_func *tx) { unsigned char buffer[1024]; - unsigned char tpm_pcrextend[] = + static const unsigned char tpm_pcrextend[] = "\x80\x02\x00\x00\x00\x41\x00\x00\x01\x82\x00\x00\x00\x0a\x00\x00" "\x00\x09\x40\x00\x00\x09\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00" "\x0b\x74\x65\x73\x74\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00"; - unsigned char tpm_pcrextend_resp[] = + static const unsigned char tpm_pcrextend_resp[] = "\x80\x02\x00\x00\x00\x13\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x01\x00\x00"; @@ -133,7 +133,7 @@ void tpm_util_pcrread(QTestState *s, tx_func *tx, const unsigned char *exp_resp, size_t exp_resp_size) { unsigned char buffer[1024]; - unsigned char tpm_pcrread[] = + static const unsigned char tpm_pcrread[] = "\x80\x01\x00\x00\x00\x14\x00\x00\x01\x7e\x00\x00\x00\x01\x00\x0b" "\x03\x00\x04\x00";