[{"id":3684046,"web_url":"http://patchwork.ozlabs.org/comment/3684046/","msgid":"<afID0vZKncqbc8aY@fedora>","list_archive_url":null,"date":"2026-04-29T13:12:50","subject":"Re: [PATCH v2 3/6] tests: Convert string arrays to byte arrays","submitter":{"id":91136,"url":"http://patchwork.ozlabs.org/api/people/91136/","name":"Arun Menon","email":"armenon@redhat.com"},"content":"Hi,\n\nOn Wed, Apr 29, 2026 at 12:17:40PM +0000, Stefan Berger wrote:\n> Convert the TPM command and response string arrays to byte arrays.\n> \n> Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>\n> ---\n>  tests/qtest/tpm-tests.c | 30 ++++++++++++++++++---------\n>  tests/qtest/tpm-util.c  | 45 ++++++++++++++++++++++++++---------------\n>  2 files changed, 49 insertions(+), 26 deletions(-)\n> \n> diff --git a/tests/qtest/tpm-tests.c b/tests/qtest/tpm-tests.c\n> index 197714f8d9..8bd3288f80 100644\n> --- a/tests/qtest/tpm-tests.c\n> +++ b/tests/qtest/tpm-tests.c\n> @@ -59,11 +59,16 @@ void tpm_test_swtpm_test(const char *src_tpm_path, tx_func *tx,\n>      tpm_util_startup(s, tx);\n>      tpm_util_pcrextend(s, tx);\n>  \n> -    static const unsigned char tpm_pcrread_resp[] =\n> -        \"\\x80\\x01\\x00\\x00\\x00\\x3e\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x16\\x00\\x00\"\n> -        \"\\x00\\x01\\x00\\x0b\\x03\\x00\\x04\\x00\\x00\\x00\\x00\\x01\\x00\\x20\\xf6\\x85\"\n> -        \"\\x98\\xe5\\x86\\x8d\\xe6\\x8b\\x97\\x29\\x99\\x60\\xf2\\x71\\x7d\\x17\\x67\\x89\"\n> -        \"\\xa4\\x2f\\x9a\\xae\\xa8\\xc7\\xb7\\xaa\\x79\\xa8\\x62\\x56\\xc1\\xde\";\n> +    static const unsigned char tpm_pcrread_resp[] = {\n> +        0x80, 0x01, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00,\n> +        0x00, 0x00, 0x00, 0x00, 0x00, 0x16, 0x00, 0x00,\n> +        0x00, 0x01, 0x00, 0x0b, 0x03, 0x00, 0x04, 0x00,\n> +        0x00, 0x00, 0x00, 0x01, 0x00, 0x20, 0xf6, 0x85,\n> +        0x98, 0xe5, 0x86, 0x8d, 0xe6, 0x8b, 0x97, 0x29,\n> +        0x99, 0x60, 0xf2, 0x71, 0x7d, 0x17, 0x67, 0x89,\n> +        0xa4, 0x2f, 0x9a, 0xae, 0xa8, 0xc7, 0xb7, 0xaa,\n> +        0x79, 0xa8, 0x62, 0x56, 0xc1, 0xde\n> +    };\n>      tpm_util_pcrread(s, tx, tpm_pcrread_resp,\n>                       sizeof(tpm_pcrread_resp));\n>  \n> @@ -105,11 +110,16 @@ void tpm_test_swtpm_migration_test(const char *src_tpm_path,\n>      tpm_util_startup(src_qemu, tx);\n>      tpm_util_pcrextend(src_qemu, tx);\n>  \n> -    static const unsigned char tpm_pcrread_resp[] =\n> -        \"\\x80\\x01\\x00\\x00\\x00\\x3e\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x16\\x00\\x00\"\n> -        \"\\x00\\x01\\x00\\x0b\\x03\\x00\\x04\\x00\\x00\\x00\\x00\\x01\\x00\\x20\\xf6\\x85\"\n> -        \"\\x98\\xe5\\x86\\x8d\\xe6\\x8b\\x97\\x29\\x99\\x60\\xf2\\x71\\x7d\\x17\\x67\\x89\"\n> -        \"\\xa4\\x2f\\x9a\\xae\\xa8\\xc7\\xb7\\xaa\\x79\\xa8\\x62\\x56\\xc1\\xde\";\n> +    static const unsigned char tpm_pcrread_resp[] = {\n> +        0x80, 0x01, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00,\n> +        0x00, 0x00, 0x00, 0x00, 0x00, 0x16, 0x00, 0x00,\n> +        0x00, 0x01, 0x00, 0x0b, 0x03, 0x00, 0x04, 0x00,\n> +        0x00, 0x00, 0x00, 0x01, 0x00, 0x20, 0xf6, 0x85,\n> +        0x98, 0xe5, 0x86, 0x8d, 0xe6, 0x8b, 0x97, 0x29,\n> +        0x99, 0x60, 0xf2, 0x71, 0x7d, 0x17, 0x67, 0x89,\n> +        0xa4, 0x2f, 0x9a, 0xae, 0xa8, 0xc7, 0xb7, 0xaa,\n> +        0x79, 0xa8, 0x62, 0x56, 0xc1, 0xde,\n> +    };\n>      tpm_util_pcrread(src_qemu, tx, tpm_pcrread_resp,\n>                       sizeof(tpm_pcrread_resp));\n>  \n> diff --git a/tests/qtest/tpm-util.c b/tests/qtest/tpm-util.c\n> index 2cb2dd4796..63cd5b69db 100644\n> --- a/tests/qtest/tpm-util.c\n> +++ b/tests/qtest/tpm-util.c\n> @@ -54,10 +54,14 @@ void tpm_util_crb_transfer(QTestState *s,\n>  void tpm_util_startup(QTestState *s, tx_func *tx)\n>  {\n>      unsigned char buffer[1024];\n> -    static const unsigned char tpm_startup[] =\n> -        \"\\x80\\x01\\x00\\x00\\x00\\x0c\\x00\\x00\\x01\\x44\\x00\\x00\";\n> -    static const unsigned char tpm_startup_resp[] =\n> -        \"\\x80\\x01\\x00\\x00\\x00\\x0a\\x00\\x00\\x00\\x00\";\n> +    static const unsigned char tpm_startup[] = {\n> +        0x80, 0x01, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00,\n> +        0x01, 0x44, 0x00, 0x00\n> +    };\n> +    static const unsigned char tpm_startup_resp[] = {\n> +        0x80, 0x01, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00,\n> +        0x00, 0x00\n> +    };\n>  \n>      tx(s, tpm_startup, sizeof(tpm_startup), buffer, sizeof(buffer));\n>  \n> @@ -68,16 +72,23 @@ void tpm_util_startup(QTestState *s, tx_func *tx)\n>  void tpm_util_pcrextend(QTestState *s, tx_func *tx)\n>  {\n>      unsigned char buffer[1024];\n> -    static const unsigned char tpm_pcrextend[] =\n> -        \"\\x80\\x02\\x00\\x00\\x00\\x41\\x00\\x00\\x01\\x82\\x00\\x00\\x00\\x0a\\x00\\x00\"\n> -        \"\\x00\\x09\\x40\\x00\\x00\\x09\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x01\\x00\"\n> -        \"\\x0b\\x74\\x65\\x73\\x74\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\"\n> -        \"\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\"\n> -        \"\\x00\";\n> +    static const unsigned char tpm_pcrextend[] = {\n> +        0x80, 0x02, 0x00, 0x00, 0x00, 0x41, 0x00, 0x00,\n> +        0x01, 0x82, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00,\n> +        0x00, 0x09, 0x40, 0x00, 0x00, 0x09, 0x00, 0x00,\n> +        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00,\n> +        0x0b, 0x74, 0x65, 0x73, 0x74, 0x00, 0x00, 0x00,\n> +        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n> +        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n> +        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n> +        0x00\n> +    };\n>  \n> -    static const unsigned char tpm_pcrextend_resp[] =\n> -        \"\\x80\\x02\\x00\\x00\\x00\\x13\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\"\n> -        \"\\x01\\x00\\x00\";\n> +    static const unsigned char tpm_pcrextend_resp[] = {\n> +        0x80, 0x02, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00,\n> +        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n> +        0x01, 0x00, 0x00\n> +    };\n>  \n>      tx(s, tpm_pcrextend, sizeof(tpm_pcrextend), buffer, sizeof(buffer));\n>  \n> @@ -89,9 +100,11 @@ void tpm_util_pcrread(QTestState *s, tx_func *tx,\n>                        const unsigned char *exp_resp, size_t exp_resp_size)\n>  {\n>      unsigned char buffer[1024];\n> -    static const unsigned char tpm_pcrread[] =\n> -        \"\\x80\\x01\\x00\\x00\\x00\\x14\\x00\\x00\\x01\\x7e\\x00\\x00\\x00\\x01\\x00\\x0b\"\n> -        \"\\x03\\x00\\x04\\x00\";\n> +    static const unsigned char tpm_pcrread[] = {\n> +        0x80, 0x01, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00,\n> +        0x01, 0x7e, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0b,\n> +        0x03, 0x00, 0x04, 0x00\n> +    };\n>  \n>      tx(s, tpm_pcrread, sizeof(tpm_pcrread), buffer, sizeof(buffer));\n>  \n> -- \n> 2.43.0\n>\n\nReviewed-by: Arun Menon <armenon@redhat.com>\n\n\nRegards,\nArun Menon","headers":{"Return-Path":"<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@legolas.ozlabs.org","Authentication-Results":["legolas.ozlabs.org;\n\tdkim=pass (1024-bit key;\n unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256\n header.s=mimecast20190719 header.b=JMhTVbFY;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256\n header.s=google header.b=HbUt/VZN;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org\n (client-ip=209.51.188.17; helo=lists1p.gnu.org;\n envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n receiver=patchwork.ozlabs.org)"],"Received":["from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17])\n\t(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4g5HnG0MCWz1yHX\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 29 Apr 2026 23:13:52 +1000 (AEST)","from localhost ([::1] helo=lists1p.gnu.org)\n\tby lists1p.gnu.org with esmtp (Exim 4.90_1)\n\t(envelope-from <qemu-devel-bounces@nongnu.org>)\n\tid 1wI4ix-0000os-4s; Wed, 29 Apr 2026 09:13:07 -0400","from eggs.gnu.org ([2001:470:142:3::10])\n by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)\n (Exim 4.90_1) (envelope-from <armenon@redhat.com>)\n id 1wI4iu-0000oi-6H\n for qemu-devel@nongnu.org; Wed, 29 Apr 2026 09:13:05 -0400","from us-smtp-delivery-124.mimecast.com ([170.10.133.124])\n by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)\n (Exim 4.90_1) (envelope-from <armenon@redhat.com>)\n id 1wI4ir-0003Qx-4E\n for qemu-devel@nongnu.org; Wed, 29 Apr 2026 09:13:02 -0400","from mail-pl1-f198.google.com (mail-pl1-f198.google.com\n [209.85.214.198]) by relay.mimecast.com with ESMTP with STARTTLS\n (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id\n us-mta-588-290ilFsPNTKmOYvQCPlZiA-1; Wed, 29 Apr 2026 09:12:58 -0400","by mail-pl1-f198.google.com with SMTP id\n d9443c01a7336-2b249975139so223873245ad.0\n for <qemu-devel@nongnu.org>; Wed, 29 Apr 2026 06:12:58 -0700 (PDT)","from fedora ([49.36.110.142]) by smtp.gmail.com with ESMTPSA id\n d9443c01a7336-2b98897edefsm21723485ad.74.2026.04.29.06.12.54\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Wed, 29 Apr 2026 06:12:56 -0700 (PDT)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n s=mimecast20190719; t=1777468379;\n h=from:from:reply-to:subject:subject:date:date:message-id:message-id:\n to:to:cc:cc:mime-version:mime-version:content-type:content-type:\n in-reply-to:in-reply-to:references:references;\n bh=uqQHFwRr6DroiTCNpDUucbHknCMRsLsW+16aQL/i05Y=;\n b=JMhTVbFYm/K4k+EtN3pdzbvjkz6hh/fcucs8QhvZRVUe6S7gUcOZSyZ4PqPooDhKSkOALc\n GJjW71sJyHfqEQ8sBIgiEUQsku/1EX8hkb6eFYCfq2S9r76TvL/udIDnB4k9Z0KiN2TOab\n K9TQSrrdAhxR4pEfDumesHn/YVVwj6E=","v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=redhat.com; s=google; t=1777468377; x=1778073177; darn=nongnu.org;\n h=in-reply-to:content-disposition:mime-version:references:message-id\n :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to;\n bh=uqQHFwRr6DroiTCNpDUucbHknCMRsLsW+16aQL/i05Y=;\n b=HbUt/VZNNU0q++gAXkcnKFqEGQlnL3ugqBz2NbygxQJujvmfGDuiv5XOEV06v0Q6rT\n +eQAYLmVmK3FJdk/jbAKkN/Nj/mdrcVggUdN8XugtER8Ur4OjM2Vh9Aqu/XIoAWGgZg3\n hSn3sqDZP79WjJQLfZVKZQNw5DMkoNClyX/xBeyfvfWWU6mqmhepFDFEUCUR0XBciHNY\n hMVFe056bbleqnCTdhY2w77kMkVHbd4RYciZqSYcsJU4M/k2l9y+kzQw5l83pfKHnoET\n 1i+rVgTFqpe5IGE2F+WVmooEj3/vdFYvbyfYytUCIaAYd/AD1dUQ18xhsJ46Ei6D7ka7\n 0fKA=="],"X-MC-Unique":"290ilFsPNTKmOYvQCPlZiA-1","X-Mimecast-MFC-AGG-ID":"290ilFsPNTKmOYvQCPlZiA_1777468377","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1777468377; x=1778073177;\n h=in-reply-to:content-disposition:mime-version:references:message-id\n :subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc\n :subject:date:message-id:reply-to;\n bh=uqQHFwRr6DroiTCNpDUucbHknCMRsLsW+16aQL/i05Y=;\n b=su9jse6XT84LPsDskUE6uB194tn63jqccvFJbn/dsM4YVtbsxF1A+MdJfIuqdHQXCo\n uiYUt5PYexn5Ysk6l5vKiCSlKki6PsRIL7vhHt3BiyYQDAtjr8weB/uTB2i2itjC/PHn\n nW3FlHtz/UPI/FQObdbCbnwxO+7QvJBTNK6Z67ppZb8FnyUAhkUY9wvEItGOLTIPjARU\n VwmVL4YozgusBNslNvQKfIhj1E2SZYjX4MVdBXxyREBSEk8NxHVyHp/g1Dx1C1TK0VAW\n lM8Hk7DcKGPGXhVadRGbWQymL9+zfpP2hVu1TDPJDr0/WhCzDDvGUSW73o3lQBXKbOjX\n biOw==","X-Gm-Message-State":"AOJu0Yyry2QaggS7ls8ZNvDfx9fCyViGiJFa+RFN6L5qldOZAFBaUtV/\n mD8dCoKd0xiaDvWN6jqBwxAMaUG9U2hNJiJEt0N/sDRX3JWroXRuhK+v/ruDqQBwZNhx43Hpf3X\n YVLWsSnQhroxi+n0KYqAl8JVUQWZgYvyXCefAaDgq2tFlO+L2atrAN7bK","X-Gm-Gg":"AeBDiesjpkxKEDb/bF4RzFx5m0X98HzMoUeUsudh63oDjk75BZY7NoLs5HbjHcgFWHj\n Wk5Xlreo47ZK5w7GqQIbvHg+rtN9MZVyzfsfrmbxOQlJR91lhX7PsQh4Pvy7jwfwqox3amJVRii\n 87DZGPnVUOz7J52lbfrRDIr/eaf2xz+5YxVlUoDIzqntqBsZRU3xZK9DE7PjnHItPPXB15nl9a4\n 3gXepF3BM0vBuJsjjo4IKmdLP007TFnPX71ttVn8lyxPlr2SxaFMJBNZOkUXjjEBwRwoq1A/vT2\n npqfxzwGxCoZ9h/K4MU7EAh9OzwnrGMeijOrQJlX8W5Fy0XfJ2YMMoJ6Xm88xoSBiwzelVDarZn\n mswyy2NvatWhzr+bicjvap+M=","X-Received":["by 2002:a17:902:7598:b0:2b2:5840:80c5 with SMTP id\n d9443c01a7336-2b9874d9572mr25190805ad.37.1777468377352;\n Wed, 29 Apr 2026 06:12:57 -0700 (PDT)","by 2002:a17:902:7598:b0:2b2:5840:80c5 with SMTP id\n d9443c01a7336-2b9874d9572mr25190525ad.37.1777468376787;\n Wed, 29 Apr 2026 06:12:56 -0700 (PDT)"],"Date":"Wed, 29 Apr 2026 18:42:50 +0530","From":"Arun Menon <armenon@redhat.com>","To":"Stefan Berger <stefanb@linux.ibm.com>","Cc":"qemu-devel@nongnu.org, marcandre.lureau@redhat.com","Subject":"Re: [PATCH v2 3/6] tests: Convert string arrays to byte arrays","Message-ID":"<afID0vZKncqbc8aY@fedora>","References":"<20260429121743.1346635-1-stefanb@linux.ibm.com>\n <20260429121743.1346635-4-stefanb@linux.ibm.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=us-ascii","Content-Disposition":"inline","In-Reply-To":"<20260429121743.1346635-4-stefanb@linux.ibm.com>","Received-SPF":"pass client-ip=170.10.133.124; envelope-from=armenon@redhat.com;\n helo=us-smtp-delivery-124.mimecast.com","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,\n DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,\n RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001,\n SPF_HELO_PASS=-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":"qemu development <qemu-devel.nongnu.org>","List-Unsubscribe":"<https://lists.nongnu.org/mailman/options/qemu-devel>,\n <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>","List-Archive":"<https://lists.nongnu.org/archive/html/qemu-devel>","List-Post":"<mailto:qemu-devel@nongnu.org>","List-Help":"<mailto:qemu-devel-request@nongnu.org?subject=help>","List-Subscribe":"<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n <mailto:qemu-devel-request@nongnu.org?subject=subscribe>","Errors-To":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org","Sender":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org"}}]