From patchwork Wed May 15 16:26:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Fabrice Fontaine X-Patchwork-Id: 1935673 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=buildroot.org (client-ip=140.211.166.138; helo=smtp1.osuosl.org; envelope-from=buildroot-bounces@buildroot.org; receiver=patchwork.ozlabs.org) Received: from smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4VfdsB0b7wz1ymf for ; Thu, 16 May 2024 02:26:38 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 7F98C820EE; Wed, 15 May 2024 16:26:36 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id 4cX3T8Xehg0D; Wed, 15 May 2024 16:26:35 +0000 (UTC) X-Comment: SPF check N/A for local connections - client-ip=140.211.166.34; helo=ash.osuosl.org; envelope-from=buildroot-bounces@buildroot.org; receiver= DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 7F1E582133 Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by smtp1.osuosl.org (Postfix) with ESMTP id 7F1E582133; Wed, 15 May 2024 16:26:35 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from smtp2.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by ash.osuosl.org (Postfix) with ESMTP id 7488E1BF396 for ; Wed, 15 May 2024 16:26:33 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 6EE52414F1 for ; Wed, 15 May 2024 16:26:33 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id gG_iCtU48LAi for ; Wed, 15 May 2024 16:26:32 +0000 (UTC) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=2a00:1450:4864:20::330; helo=mail-wm1-x330.google.com; envelope-from=fontaine.fabrice@gmail.com; receiver= DMARC-Filter: OpenDMARC Filter v1.4.2 smtp2.osuosl.org 14D5F4064D DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org 14D5F4064D Received: from mail-wm1-x330.google.com (mail-wm1-x330.google.com [IPv6:2a00:1450:4864:20::330]) by smtp2.osuosl.org (Postfix) with ESMTPS id 14D5F4064D for ; Wed, 15 May 2024 16:26:31 +0000 (UTC) Received: by mail-wm1-x330.google.com with SMTP id 5b1f17b1804b1-41fd5dc0508so47815095e9.0 for ; Wed, 15 May 2024 09:26:31 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715790390; x=1716395190; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=IhBILBDEAqpXRWcUKGZlQGJzR/jXoCqRcmg8WxCQ5Xw=; b=GJo/oFPNn0AdjUj1l6X8UIAiA5SCRLjhMC60UQLDtZGnYjXbSNFZ8si4FeDDIZBRZV tE89RNhiJrpmaS4aIbjZarCEAPb3vRAoBDz+7jBo1RZChYSzOK1Dpx5k5vkft0cTsjxi mYfHl18it8AdcNnUFVFfE+Iob5swD+uXoTZCoL7nKYoIFN+wpLGLs3RsmIsa3vEJg23O KX5UHv8MDf8BE8U9G6WillZwA8C/rxksrwXC/qSEeLA54pHRCrELvArgLe2/bM05dh3t NwUC9SFn1SMBNk3Ig+5UBCw7d17UNuLoCAXAx1SSSWg0Quj2pmMwb208MVLWprfeNQHA Qw4g== X-Gm-Message-State: AOJu0YwZkhMqzsWplLtyhxr25NlFrOAVzFDWZrfOQbcNIX6+U+F2FzxL ydNlSDKhmA0XDxzaqMEhB0ccNuW+00tFk/fkcV6xVm650MtXAxuWJ4TgUw== X-Google-Smtp-Source: AGHT+IGg+5ETPdKuZP3+stqmedoIIsVKhQRG05Wb8Qy0Oe+2+0jve2ylYiQ7b1efMsYjfb4hwbZyvA== X-Received: by 2002:a05:600c:19c8:b0:41f:e7e6:7f4d with SMTP id 5b1f17b1804b1-41feac55f65mr121898985e9.27.1715790389648; Wed, 15 May 2024 09:26:29 -0700 (PDT) Received: from kali.home (lfbn-ren-1-785-215.w83-197.abo.wanadoo.fr. [83.197.112.215]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-41fccce24efsm237625215e9.19.2024.05.15.09.26.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 May 2024 09:26:29 -0700 (PDT) From: Fabrice Fontaine To: buildroot@buildroot.org Date: Wed, 15 May 2024 18:26:26 +0200 Message-ID: <20240515162627.1087686-1-fontaine.fabrice@gmail.com> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1715790390; x=1716395190; darn=buildroot.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=IhBILBDEAqpXRWcUKGZlQGJzR/jXoCqRcmg8WxCQ5Xw=; b=AI2r94Am2PaT/qF71u5Hu1o26yGafENV7dVRIrLrHZ9rN1plO3vb7OMKoNHFVWEwLe 6hnCGCCZyphf+v/HdKKaetezR28js5/AEypa3W0pzmgvd7djc3RzmSWHkFBPdnikps1d MuxS6fRtwi4MQTQVa5Dm6XFbL46VaDtx5RrQ//TbdgYG0H6oCkhS67I6645Db9AyNy4C ctxvmb0ajt0NIzmqYAnDFzELtWfZnOSdqoFBozr/16q7PzqIc9yddfgoiq4HQOxPnScN JlgUqQMlsPhZvZmZbahzmjMx2p8KHghGcb3TZiKSYxuHkapu02YiIgfUXUFfjqB4gCzG wlDA== X-Mailman-Original-Authentication-Results: smtp2.osuosl.org; dmarc=pass (p=none dis=none) header.from=gmail.com X-Mailman-Original-Authentication-Results: smtp2.osuosl.org; dkim=pass (2048-bit key, unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=AI2r94Am Subject: [Buildroot] [PATCH 1/1] package/p11-kit: fix build with gcc 14 X-BeenThere: buildroot@buildroot.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fabrice Fontaine Errors-To: buildroot-bounces@buildroot.org Sender: "buildroot" Fix the following build failure with gcc 14: p11-kit/import-object.c: In function 'add_attrs_pubkey_rsa': p11-kit/import-object.c:223:62: error: passing argument 3 of 'p11_asn1_read' from incompatible pointer type [-Wincompatible-pointer-types] 223 | attr_modulus.pValue = p11_asn1_read (asn, "modulus", &attr_modulus.ulValueLen); | ^~~~~~~~~~~~~~~~~~~~~~~~ | | | long unsigned int * Fixes: - http://autobuild.buildroot.org/results/41508a057568ad715e9e00a67adfc3867445d6c1 Signed-off-by: Fabrice Fontaine --- ...teger-truncation-on-32-bit-platforms.patch | 109 ++++++++++++++++++ 1 file changed, 109 insertions(+) create mode 100644 package/p11-kit/0001-import-object-Avoid-integer-truncation-on-32-bit-platforms.patch diff --git a/package/p11-kit/0001-import-object-Avoid-integer-truncation-on-32-bit-platforms.patch b/package/p11-kit/0001-import-object-Avoid-integer-truncation-on-32-bit-platforms.patch new file mode 100644 index 0000000000..03f54b4408 --- /dev/null +++ b/package/p11-kit/0001-import-object-Avoid-integer-truncation-on-32-bit-platforms.patch @@ -0,0 +1,109 @@ +From d49c92c8420db6ee4c88515bdb014f68f4d471d9 Mon Sep 17 00:00:00 2001 +From: Daiki Ueno +Date: Sat, 2 Dec 2023 09:24:01 +0900 +Subject: [PATCH] import-object: Avoid integer truncation on 32-bit platforms +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +The build fails when compiling for 32-bit platforms with +-Werror=incompatible-pointer-types: + + CFLAGS="-m32 -march=i686 -Werror=incompatible-pointer-types -Werror=implicit -Werror=int-conversion" setarch i686 -- meson setup _build + setarch i686 -- meson compile -C _build -v + ... + + ../p11-kit/import-object.c: In function ‘add_attrs_pubkey_rsa’: + ../p11-kit/import-object.c:223:62: error: passing argument 3 of ‘p11_asn1_read’ from incompatible pointer type [-Werror=incompatible-pointer-types] + 223 | attr_modulus.pValue = p11_asn1_read (asn, "modulus", &attr_modulus.ulValueLen); + | ^~~~~~~~~~~~~~~~~~~~~~~~ + | | + | long unsigned int * + +Reported by Sam James in: +https://github.com/p11-glue/p11-kit/issues/608 + +Signed-off-by: Daiki Ueno + +Upstream: https://github.com/p11-glue/p11-kit/commit/d49c92c8420db6ee4c88515bdb014f68f4d471d9 +Signed-off-by: Fabrice Fontaine +--- + p11-kit/import-object.c | 30 +++++++++++++++++++++++++++--- + 1 file changed, 27 insertions(+), 3 deletions(-) + +diff --git a/p11-kit/import-object.c b/p11-kit/import-object.c +index feee0765..fb47b964 100644 +--- a/p11-kit/import-object.c ++++ b/p11-kit/import-object.c +@@ -55,6 +55,7 @@ + #endif + + #include ++#include + #include + #include + #include +@@ -201,6 +202,7 @@ add_attrs_pubkey_rsa (CK_ATTRIBUTE *attrs, + CK_ATTRIBUTE attr_encrypt = { CKA_ENCRYPT, &tval, sizeof (tval) }; + CK_ATTRIBUTE attr_modulus = { CKA_MODULUS, }; + CK_ATTRIBUTE attr_exponent = { CKA_PUBLIC_EXPONENT, }; ++ size_t len = 0; + + pubkey = p11_asn1_read (info, "subjectPublicKey", &pubkey_len); + if (pubkey == NULL) { +@@ -220,17 +222,31 @@ add_attrs_pubkey_rsa (CK_ATTRIBUTE *attrs, + goto cleanup; + } + +- attr_modulus.pValue = p11_asn1_read (asn, "modulus", &attr_modulus.ulValueLen); ++ attr_modulus.pValue = p11_asn1_read (asn, "modulus", &len); + if (attr_modulus.pValue == NULL) { + p11_message (_("failed to obtain modulus")); + goto cleanup; + } ++#if ULONG_MAX < SIZE_MAX ++ if (len > ULONG_MAX) { ++ p11_message (_("failed to obtain modulus")); ++ goto cleanup; ++ } ++#endif ++ attr_modulus.ulValueLen = len; + +- attr_exponent.pValue = p11_asn1_read (asn, "publicExponent", &attr_exponent.ulValueLen); ++ attr_exponent.pValue = p11_asn1_read (asn, "publicExponent", &len); + if (attr_exponent.pValue == NULL) { + p11_message (_("failed to obtain exponent")); + goto cleanup; + } ++#if ULONG_MAX < SIZE_MAX ++ if (len > ULONG_MAX) { ++ p11_message (_("failed to obtain exponent")); ++ goto cleanup; ++ } ++#endif ++ attr_exponent.ulValueLen = len; + + result = p11_attrs_build (attrs, &attr_key_type, &attr_encrypt, &attr_modulus, &attr_exponent, NULL); + if (result == NULL) { +@@ -260,12 +276,20 @@ add_attrs_pubkey_ec (CK_ATTRIBUTE *attrs, + CK_ATTRIBUTE attr_key_type = { CKA_KEY_TYPE, &key_type, sizeof (key_type) }; + CK_ATTRIBUTE attr_ec_params = { CKA_EC_PARAMS, }; + CK_ATTRIBUTE attr_ec_point = { CKA_EC_POINT, }; ++ size_t len = 0; + +- attr_ec_params.pValue = p11_asn1_read (info, "algorithm.parameters", &attr_ec_params.ulValueLen); ++ attr_ec_params.pValue = p11_asn1_read (info, "algorithm.parameters", &len); + if (attr_ec_params.pValue == NULL) { + p11_message (_("failed to obtain EC parameters")); + goto cleanup; + } ++#if ULONG_MAX < SIZE_MAX ++ if (len > ULONG_MAX) { ++ p11_message (_("failed to obtain EC parameters")); ++ goto cleanup; ++ } ++#endif ++ attr_ec_params.ulValueLen = len; + + /* subjectPublicKey is read as BIT STRING value which contains + * EC point data. We need to DER encode this data as OCTET STRING.