From patchwork Mon Jan 9 21:18:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ondrej Mosnacek X-Patchwork-Id: 13094347 X-Patchwork-Delegate: omosnacek@gmail.com Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CFADDC5479D for ; Mon, 9 Jan 2023 21:20:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237619AbjAIVUE (ORCPT ); Mon, 9 Jan 2023 16:20:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56022 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237667AbjAIVT0 (ORCPT ); Mon, 9 Jan 2023 16:19:26 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7C414D47 for ; Mon, 9 Jan 2023 13:18:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1673299119; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=tN/qdHlqeSIhmjrzgJz8ttzucfU8QVSdboeIPwna4uE=; b=JWB3Mo3ILGM6ROZJ2TTABgeaAt4uZcpSOh4mJO0mv/SJfdm85QRiFZlVKmF1wd4wRpqeCJ hzhdqMvRsRGi0LKGaqadhx07EIg+8uz15b5fAjKddEiyIoKbg1C+RLOlRbHzNkxJwELRCj F84jOmTB2ibW39YZdpAUWgM8quKaUq4= Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-584-J0kDNyMuNA6UKYx1y4vlbw-1; Mon, 09 Jan 2023 16:18:38 -0500 X-MC-Unique: J0kDNyMuNA6UKYx1y4vlbw-1 Received: by mail-wm1-f70.google.com with SMTP id m7-20020a05600c4f4700b003d971a5e770so5323189wmq.3 for ; Mon, 09 Jan 2023 13:18:37 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=tN/qdHlqeSIhmjrzgJz8ttzucfU8QVSdboeIPwna4uE=; b=385vYTTn2eXKab81NBU/2TyIc6OrAFoX4DdwUbL1cUewqZtxHYvVrIKvGdaXCKqp+N wxFx6rOLFwvFUoLenUWLdcafPrBRr76nMWaRrNvcWQ/WNlqtE1menbQVlGSisr9H8egF 5/8PfegjiRp2sXRkcLO4YJBHt6GakFSRivXaBMyH+W+ns4zY/iZy6vuqAl1Qk0mSpO8I uByAggtuqBOUL1O/qnQgLI+vpvtBSNxonUFv0pHvzCPQswCYGW8i9MU/MpYKbi/LtdLf HH3yEvL64KOd9fwTZayaspcxggzAU3Jzq9y9OSsg0/8jkxUXYQ1eGDOp2iuQyAQhOyJm KYHQ== X-Gm-Message-State: AFqh2kox5mFxv6xsZ9TqgHmGUBH6hhNhLHRFED8/L+J25oLC3qjnrqiF 1qb/jmuXyylxpWoAzxnoLrqEvonRWB7qVlx7GBLBa65nZvq1Gd/rmWDefD7hWgRXbO4YjnpXhKQ R+jSZy5Hq/gSxivOBn4frMO4IYyxi23V9v8LxSS7qUArBkNs0UTb/bTKOnhPgzm5GKt0CEQ== X-Received: by 2002:a05:600c:3485:b0:3d0:761b:f86 with SMTP id a5-20020a05600c348500b003d0761b0f86mr47116359wmq.28.1673299116546; Mon, 09 Jan 2023 13:18:36 -0800 (PST) X-Google-Smtp-Source: AMrXdXt080mQyw7vhmq+R1wyai1I4wP7oHjQFy2Y5kFfuDJNho8nSTi3ZDAmQOGC+B6IrthSgGsjQQ== X-Received: by 2002:a05:600c:3485:b0:3d0:761b:f86 with SMTP id a5-20020a05600c348500b003d0761b0f86mr47116351wmq.28.1673299116129; Mon, 09 Jan 2023 13:18:36 -0800 (PST) Received: from localhost.localdomain ([2a02:8308:b104:2c00:2e8:ec99:5760:fb52]) by smtp.gmail.com with ESMTPSA id u16-20020a05600c00d000b003cf4eac8e80sm15127179wmm.23.2023.01.09.13.18.35 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Jan 2023 13:18:35 -0800 (PST) From: Ondrej Mosnacek To: selinux@vger.kernel.org Subject: [PATCH testsuite] tests/keys: remove extraneous zero byte from the DH prime Date: Mon, 9 Jan 2023 22:18:34 +0100 Message-Id: <20230109211834.1950163-1-omosnace@redhat.com> X-Mailer: git-send-email 2.39.0 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: selinux@vger.kernel.org The extra zero byte at the beginning is unnecessary and not expected by the kernel. While the generic DH implementation is able to deal with it, at least one hardware driver implementation (intel_qat) rejects it. Since the kernel's test vectors do not include one with zero bytes at the beginning, assume that it's invalid and remove it from our prime byte array. While there also regroup the byte values by 8 instead of 10, so that it is easy to verify that the size of the array is a multiple of 8 as expected. Verified on a machine with the Intel QAT accelerator, where the test was failing before. Fixes: 85832b99b430 ("tests/keys: use a longer prime in DH params") Signed-off-by: Ondrej Mosnacek --- tests/keys/keys_common.h | 58 ++++++++++++++++++++++------------------ 1 file changed, 32 insertions(+), 26 deletions(-) diff --git a/tests/keys/keys_common.h b/tests/keys/keys_common.h index 64385bf..c9a8ec6 100644 --- a/tests/keys/keys_common.h +++ b/tests/keys/keys_common.h @@ -13,32 +13,38 @@ /* dummy values - prime generated by `openssl dhparam -text -2 2048` */ static const unsigned char payload_prime[] = { - 0x00, 0xad, 0xf4, 0x89, 0x34, 0x97, 0x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0x18, 0x3b, - 0xaf, 0x1a, 0x6a, 0xf3, 0x5a, 0xc1, 0x29, 0x47, 0x71, 0xe5, - 0x39, 0x4d, 0x35, 0x31, 0xc6, 0xe9, 0x81, 0xc4, 0x90, 0xd1, - 0x40, 0xf5, 0x08, 0x80, 0x6c, 0x91, 0x05, 0xcc, 0x24, 0x8d, - 0x80, 0xc1, 0x7d, 0x27, 0xa2, 0xfd, 0x51, 0xfd, 0xc6, 0xd7, - 0x11, 0x9d, 0x62, 0x89, 0xc3, 0x57, 0x71, 0xbf, 0x1a, 0x75, - 0xaa, 0x6d, 0x37, 0x3f, 0xb1, 0x53, 0xf6, 0xa4, 0xa6, 0x6d, - 0xd5, 0xbb, 0xc2, 0x9d, 0xb9, 0x31, 0xbf + 0xad, 0xf4, 0x89, 0x34, 0x97, 0xf0, 0x98, 0x83, + 0xb3, 0x99, 0x38, 0xb7, 0x35, 0xed, 0xf6, 0x81, + 0xe8, 0xdd, 0x0f, 0x37, 0x50, 0x81, 0xbf, 0x06, + 0x82, 0xe6, 0x0f, 0x39, 0x90, 0xd2, 0x8e, 0xc6, + 0x69, 0xa4, 0x84, 0x79, 0xc9, 0x6a, 0x16, 0x1d, + 0x6c, 0x5c, 0xf7, 0x5e, 0x74, 0x51, 0xef, 0x94, + 0x33, 0x7c, 0x4a, 0x37, 0x26, 0x76, 0x20, 0x96, + 0xf5, 0x54, 0xb7, 0x22, 0x09, 0xe4, 0xec, 0x35, + 0x4c, 0x58, 0xf2, 0xf7, 0x27, 0x98, 0xb0, 0xc5, + 0x66, 0x59, 0x00, 0x5a, 0xa5, 0x24, 0x2b, 0x5a, + 0x27, 0x9e, 0xce, 0x28, 0x3d, 0x03, 0x97, 0x42, + 0x8f, 0xd7, 0xc1, 0xcd, 0x93, 0x5c, 0xf0, 0x53, + 0x66, 0xbf, 0x72, 0x29, 0xcd, 0xc3, 0xc9, 0x64, + 0x85, 0xd4, 0xf6, 0x86, 0x5d, 0xb1, 0x99, 0xf6, + 0x8c, 0xd7, 0xdf, 0xd0, 0x49, 0x7a, 0xd3, 0x5e, + 0x17, 0xeb, 0xdf, 0xf3, 0xdf, 0xaa, 0x76, 0x2b, + 0xa4, 0x43, 0xc8, 0xc6, 0xfd, 0xab, 0xf9, 0xf7, + 0xb3, 0x21, 0x73, 0x06, 0xe7, 0x1f, 0x51, 0x1a, + 0x51, 0x57, 0x15, 0xbe, 0x52, 0x26, 0xc9, 0x87, + 0x24, 0x15, 0x4b, 0xf2, 0x39, 0x51, 0x92, 0xb9, + 0xbe, 0xcf, 0xd3, 0xc6, 0xca, 0xdc, 0xbb, 0x5b, + 0x1f, 0x60, 0x89, 0x96, 0x08, 0xf5, 0xe6, 0xa4, + 0xb7, 0xf7, 0x72, 0x5d, 0xe2, 0x95, 0x04, 0x1c, + 0x4a, 0xd6, 0x85, 0x18, 0x3b, 0xaf, 0x1a, 0x6a, + 0xf3, 0x5a, 0xc1, 0x29, 0x47, 0x71, 0xe5, 0x39, + 0x4d, 0x35, 0x31, 0xc6, 0xe9, 0x81, 0xc4, 0x90, + 0xd1, 0x40, 0xf5, 0x08, 0x80, 0x6c, 0x91, 0x05, + 0xcc, 0x24, 0x8d, 0x80, 0xc1, 0x7d, 0x27, 0xa2, + 0xfd, 0x51, 0xfd, 0xc6, 0xd7, 0x11, 0x9d, 0x62, + 0x89, 0xc3, 0x57, 0x71, 0xbf, 0x1a, 0x75, 0xaa, + 0x6d, 0x37, 0x3f, 0xb1, 0x53, 0xf6, 0xa4, 0xa6, + 0x6d, 0xd5, 0xbb, 0xc2, 0x9d, 0xb9, 0x31, 0xbf, }; static const unsigned char payload_base[] = { 0x02 }; static const unsigned char payload_private[] = { 42 };