From nobody Fri Dec 19 19:17:27 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1747297146; cv=none; d=zohomail.com; s=zohoarc; b=VhnpMWcMejyv/VSOCdr5xPWc5RuwXoK0Dw6bWeY2vrN9DV2kzSiVuxHR2LUC9pMCr7855DPEygIDVCkQxqaGyPQ3552wHIHRXdR/2z29CzOjMw1YsUJoN/oaz3dhuYBOs5WLQLuGkCqziA+0HT4LKfXWL4M4QNC9oXTmrcxviek= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1747297146; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Sender:Subject:Subject:To:To:Message-Id; bh=uUzR4MdOftzQh+baIUt+R0ZUu8QTFmzKZL3jfxQ1IXY=; b=l1sK4QA2XUJ8Gm3PYvYKvCICR0159yIOy//CSyh4EL0H+Yr0Rgp3c/RnU+PkeOglIMr/8L4fRzAWt4hBS2hZkrUsVfPXLYsgB7gNFNW+Xmrsak5niERrruoUrY3oho0N4m/R/txjMzmSes5WR4lLt7dCMvoJBTgMLPwbvxLzMto= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1747297146768153.20353944299723; Thu, 15 May 2025 01:19:06 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uFTi6-0003tb-Uo; Thu, 15 May 2025 04:12:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uFTh4-00079t-Nn; Thu, 15 May 2025 04:11:57 -0400 Received: from mail.aspeedtech.com ([211.20.114.72] helo=TWMBX01.aspeed.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uFTgw-00018W-V6; Thu, 15 May 2025 04:11:54 -0400 Received: from TWMBX01.aspeed.com (192.168.0.62) by TWMBX01.aspeed.com (192.168.0.62) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1748.10; Thu, 15 May 2025 16:10:14 +0800 Received: from mail.aspeedtech.com (192.168.10.10) by TWMBX01.aspeed.com (192.168.0.62) with Microsoft SMTP Server id 15.2.1748.10 via Frontend Transport; Thu, 15 May 2025 16:10:14 +0800 To: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Peter Maydell , Steven Lee , Troy Lee , Andrew Jeffery , "Joel Stanley" , Fabiano Rosas , Laurent Vivier , Paolo Bonzini , "open list:ASPEED BMCs" , "open list:All patches CC here" CC: , Subject: [PATCH v3 19/28] test/qtest/hace: Specify explicit array sizes for test vectors and hash results Date: Thu, 15 May 2025 16:09:51 +0800 Message-ID: <20250515081008.583578-20-jamin_lin@aspeedtech.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250515081008.583578-1-jamin_lin@aspeedtech.com> References: <20250515081008.583578-1-jamin_lin@aspeedtech.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=211.20.114.72; envelope-from=jamin_lin@aspeedtech.com; helo=TWMBX01.aspeed.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_FAIL=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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-to: Jamin Lin From: Jamin Lin via Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZM-MESSAGEID: 1747297148335116600 Content-Type: text/plain; charset="utf-8" To enhance code readability and prevent potential buffer overflows or unint= ended size assumptions, this commit updates all fixed-size array declarations to = use explicit array sizes. Signed-off-by: Jamin Lin --- tests/qtest/aspeed-hace-utils.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/tests/qtest/aspeed-hace-utils.c b/tests/qtest/aspeed-hace-util= s.c index 8582847945..777fa5b986 100644 --- a/tests/qtest/aspeed-hace-utils.c +++ b/tests/qtest/aspeed-hace-utils.c @@ -19,9 +19,9 @@ * for hash in sha512sum sha256sum md5sum; do $hash /tmp/test; done * */ -static const uint8_t test_vector[] =3D {0x61, 0x62, 0x63}; +static const uint8_t test_vector[3] =3D {0x61, 0x62, 0x63}; =20 -static const uint8_t test_result_sha512[] =3D { +static const uint8_t test_result_sha512[64] =3D { 0xdd, 0xaf, 0x35, 0xa1, 0x93, 0x61, 0x7a, 0xba, 0xcc, 0x41, 0x73, 0x49, 0xae, 0x20, 0x41, 0x31, 0x12, 0xe6, 0xfa, 0x4e, 0x89, 0xa9, 0x7e, 0xa2, 0x0a, 0x9e, 0xee, 0xe6, 0x4b, 0x55, 0xd3, 0x9a, 0x21, 0x92, 0x99, 0x2a, @@ -29,12 +29,12 @@ static const uint8_t test_result_sha512[] =3D { 0x45, 0x4d, 0x44, 0x23, 0x64, 0x3c, 0xe8, 0x0e, 0x2a, 0x9a, 0xc9, 0x4f, 0xa5, 0x4c, 0xa4, 0x9f}; =20 -static const uint8_t test_result_sha256[] =3D { +static const uint8_t test_result_sha256[32] =3D { 0xba, 0x78, 0x16, 0xbf, 0x8f, 0x01, 0xcf, 0xea, 0x41, 0x41, 0x40, 0xde, 0x5d, 0xae, 0x22, 0x23, 0xb0, 0x03, 0x61, 0xa3, 0x96, 0x17, 0x7a, 0x9c, 0xb4, 0x10, 0xff, 0x61, 0xf2, 0x00, 0x15, 0xad}; =20 -static const uint8_t test_result_md5[] =3D { +static const uint8_t test_result_md5[16] =3D { 0x90, 0x01, 0x50, 0x98, 0x3c, 0xd2, 0x4f, 0xb0, 0xd6, 0x96, 0x3f, 0x7d, 0x28, 0xe1, 0x7f, 0x72}; =20 @@ -48,11 +48,11 @@ static const uint8_t test_result_md5[] =3D { * for hash in sha512sum sha256sum; do $hash /tmp/test; done * */ -static const uint8_t test_vector_sg1[] =3D {0x61, 0x62, 0x63, 0x64, 0x65, = 0x66}; -static const uint8_t test_vector_sg2[] =3D {0x67, 0x68, 0x69}; -static const uint8_t test_vector_sg3[] =3D {0x6a, 0x6b, 0x6c}; +static const uint8_t test_vector_sg1[6] =3D {0x61, 0x62, 0x63, 0x64, 0x65,= 0x66}; +static const uint8_t test_vector_sg2[3] =3D {0x67, 0x68, 0x69}; +static const uint8_t test_vector_sg3[3] =3D {0x6a, 0x6b, 0x6c}; =20 -static const uint8_t test_result_sg_sha512[] =3D { +static const uint8_t test_result_sg_sha512[64] =3D { 0x17, 0x80, 0x7c, 0x72, 0x8e, 0xe3, 0xba, 0x35, 0xe7, 0xcf, 0x7a, 0xf8, 0x23, 0x11, 0x6d, 0x26, 0xe4, 0x1e, 0x5d, 0x4d, 0x6c, 0x2f, 0xf1, 0xf3, 0x72, 0x0d, 0x3d, 0x96, 0xaa, 0xcb, 0x6f, 0x69, 0xde, 0x64, 0x2e, 0x63, @@ -60,7 +60,7 @@ static const uint8_t test_result_sg_sha512[] =3D { 0x84, 0x25, 0x7c, 0x32, 0xc8, 0xf6, 0xd0, 0x85, 0x4a, 0xe6, 0xb5, 0x40, 0xf8, 0x6d, 0xda, 0x2e}; =20 -static const uint8_t test_result_sg_sha256[] =3D { +static const uint8_t test_result_sg_sha256[32] =3D { 0xd6, 0x82, 0xed, 0x4c, 0xa4, 0xd9, 0x89, 0xc1, 0x34, 0xec, 0x94, 0xf1, 0x55, 0x1e, 0x1e, 0xc5, 0x80, 0xdd, 0x6d, 0x5a, 0x6e, 0xcd, 0xe9, 0xf3, 0xd3, 0x5e, 0x6e, 0x4a, 0x71, 0x7f, 0xbd, 0xe4}; @@ -76,7 +76,7 @@ static const uint8_t test_result_sg_sha256[] =3D { * echo -n -e 'abc' | dd of=3D/tmp/test * for hash in sha512sum sha256sum; do $hash /tmp/test; done */ -static const uint8_t test_vector_accum_512[] =3D { +static const uint8_t test_vector_accum_512[128] =3D { 0x61, 0x62, 0x63, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -94,7 +94,7 @@ static const uint8_t test_vector_accum_512[] =3D { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18}; =20 -static const uint8_t test_vector_accum_256[] =3D { +static const uint8_t test_vector_accum_256[64] =3D { 0x61, 0x62, 0x63, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -104,7 +104,7 @@ static const uint8_t test_vector_accum_256[] =3D { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18}; =20 -static const uint8_t test_result_accum_sha512[] =3D { +static const uint8_t test_result_accum_sha512[64] =3D { 0xdd, 0xaf, 0x35, 0xa1, 0x93, 0x61, 0x7a, 0xba, 0xcc, 0x41, 0x73, 0x49, 0xae, 0x20, 0x41, 0x31, 0x12, 0xe6, 0xfa, 0x4e, 0x89, 0xa9, 0x7e, 0xa2, 0x0a, 0x9e, 0xee, 0xe6, 0x4b, 0x55, 0xd3, 0x9a, 0x21, 0x92, 0x99, 0x2a, @@ -112,7 +112,7 @@ static const uint8_t test_result_accum_sha512[] =3D { 0x45, 0x4d, 0x44, 0x23, 0x64, 0x3c, 0xe8, 0x0e, 0x2a, 0x9a, 0xc9, 0x4f, 0xa5, 0x4c, 0xa4, 0x9f}; =20 -static const uint8_t test_result_accum_sha256[] =3D { +static const uint8_t test_result_accum_sha256[32] =3D { 0xba, 0x78, 0x16, 0xbf, 0x8f, 0x01, 0xcf, 0xea, 0x41, 0x41, 0x40, 0xde, 0x5d, 0xae, 0x22, 0x23, 0xb0, 0x03, 0x61, 0xa3, 0x96, 0x17, 0x7a, 0x9c, 0xb4, 0x10, 0xff, 0x61, 0xf2, 0x00, 0x15, 0xad}; --=20 2.43.0