From nobody Mon Oct 09 11:57:34 2023 X-Original-To: dev-commits-ports-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4S3yFq0bHxz4wKFK; Mon, 9 Oct 2023 11:57:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4S3yFq03rTz4SSS; Mon, 9 Oct 2023 11:57:35 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696852655; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=aQ4U3IU6uHcjU+4+dX8zl+OeDXlytcMNhmrOa4Vom1Y=; b=KdV7PstJiitOrL8+zvkydweNPu4JMssRbTjn1HIfUY/4ISzE5p52NfBy/Cd3s5uCmBLDU8 PUaaA1qVdnva2gddByk3xMbYfmFVQkqicHZbHxYezZ6Laex4HtyjItlLgbbo8DpIzfQZbq Nwa9BjAuXvrAL7Nt5fMbSgx/lZ21uBbzzz5uKfJJRPTGREOtm3XqXnz5GF6cgBUTEMVscC WTfovYmH9EV7tZ8ldmXbGFrpK19inm4BMbVCcA86u/il+lkusGDCqwJq8ylzno8Xn2owjT PaDKzZeA3qROJvFS3T9Q3kfksRChhdPc99JXFnckGJRMeL90bcYR32VYSCe0nQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696852655; a=rsa-sha256; cv=none; b=F01UDzi6XhnUHn7B5lrtNUqUREwOYUoKloF2+UGqCOpcdk9HprPHW403BtF5DF8KZdHKfC neMRPyOFWW1dGY3HqAMUVwY1vipReA7DKPcR3EU8B8lPBn5F7D4CFQeSZSIfACzXQx0NHy SY5wETiqDv3clFT1VFfxX5Kkc8mOSceB5N+1Z39IAPzPV/GsAqGkkFTgc8Ec0T49TmdS/Y nP2+Jh0uAFIZXWIm/38lP84s+ACiJzJ9+3pFTlHg0c5/t3+rtr9j6CZ8/OwFAcyY7Z59CR f++y9suXchCXtwPbMpRqZgfdWeEFu6OF03sX/Nvhv+J/we8vCe7lxrBa19ptKA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696852655; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=aQ4U3IU6uHcjU+4+dX8zl+OeDXlytcMNhmrOa4Vom1Y=; b=kWuclp7MK4QmDewl0hTZAeFIwk5n2RmxbbkbKLQMpGMiAOkinGiDx0u1k0CuWYjbNuwx6w KWYtpFGaXXizC4QLKYjgn1SY5TclYtrE+PRfA1RSlONO/jYtdpX75g4ckrVCpLWC44r758 5PuxuhQ0z3XuSjMYStGRfFgaBUhXtQUO6DuMF8I22KtnHYswrlcOOBBktj2WwhmaJ+/m0I 2kLuGBpWbExa280Z3EQX8pIiEAjUiN3BUUYTEYzURVX0815BaHeS3mAr6SPUtQIBTD2E9d ftv3xVUWnagv3jAGrO74+fO7miw8VNXaGXFnnuwx18rUtAc6sJ+bQQ/p4x5uKg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4S3yFp6DRMztgW; Mon, 9 Oct 2023 11:57:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 399BvYf1039911; Mon, 9 Oct 2023 11:57:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 399BvYu2039908; Mon, 9 Oct 2023 11:57:34 GMT (envelope-from git) Date: Mon, 9 Oct 2023 11:57:34 GMT Message-Id: <202310091157.399BvYu2039908@gitrepo.freebsd.org> To: ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org From: Pietro Cerutti Subject: git: c97e9a50f399 - main - math/libtommath: update to 1.2.1 List-Id: Commits to the main branch of the FreeBSD ports repository List-Archive: https://lists.freebsd.org/archives/dev-commits-ports-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-ports-main@freebsd.org X-BeenThere: dev-commits-ports-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: gahr X-Git-Repository: ports X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c97e9a50f3996f7c8c6e0065209a43220d97eaef Auto-Submitted: auto-generated The branch main has been updated by gahr: URL: https://cgit.FreeBSD.org/ports/commit/?id=c97e9a50f3996f7c8c6e0065209a43220d97eaef commit c97e9a50f3996f7c8c6e0065209a43220d97eaef Author: Pietro Cerutti AuthorDate: 2023-10-09 10:43:52 +0000 Commit: Pietro Cerutti CommitDate: 2023-10-09 11:57:32 +0000 math/libtommath: update to 1.2.1 PR: 274350 Reported by: dizzy This is a bugfix release because of potential integer overflow. See PR #546 and CVE-2023-36328. --- math/libtommath/Makefile | 10 ++- math/libtommath/distinfo | 6 +- math/libtommath/files/patch-beba89 | 137 ------------------------------------- math/libtommath/files/patch-c1cf80 | 57 --------------- 4 files changed, 10 insertions(+), 200 deletions(-) diff --git a/math/libtommath/Makefile b/math/libtommath/Makefile index 7c35694132c8..1e721627e196 100644 --- a/math/libtommath/Makefile +++ b/math/libtommath/Makefile @@ -1,6 +1,5 @@ PORTNAME= libtommath -DISTVERSION= 1.2.0 -PORTREVISION= 2 +DISTVERSION= 1.2.1 CATEGORIES= math MASTER_SITES= https://github.com/libtom/libtommath/releases/download/v${DISTVERSION}/ DISTNAME= ltm-${DISTVERSION} @@ -12,12 +11,13 @@ WWW= https://libtom.net/ LICENSE= UNLICENSE LICENSE_FILE= ${WRKSRC}/LICENSE -USES= gmake libtool:build tar:xz +USES= gmake libtool:build pathfix tar:xz WRKSRC= ${WRKDIR}/${PORTNAME}-${DISTVERSION} USE_LDCONFIG= yes MAKEFILE= makefile.shared +MAKE_ENV+= IGNORE_SPEED=yes ALL_TARGET= default CFLAGS+= -fPIC PORTDOCS= * @@ -31,6 +31,10 @@ PLIST_FILES= include/tommath.h \ OPTIONS_DEFINE= DOCS +post-patch: + @${REINPLACE_CMD} -e 's|$$(LIBPATH)/pkgconfig|${PREFIX}/libdata/pkgconfig|' \ + ${WRKSRC}/${MAKEFILE} + post-install: @${MKDIR} ${STAGEDIR}${DOCSDIR} ${INSTALL_DATA} ${WRKSRC}/doc/bn.pdf ${STAGEDIR}${DOCSDIR} diff --git a/math/libtommath/distinfo b/math/libtommath/distinfo index c23e3259df3a..6cc0e5e7f56c 100644 --- a/math/libtommath/distinfo +++ b/math/libtommath/distinfo @@ -1,3 +1,3 @@ -TIMESTAMP = 1571744626 -SHA256 (ltm-1.2.0.tar.xz) = b7c75eecf680219484055fcedd686064409254ae44bc31a96c5032843c0e18b1 -SIZE (ltm-1.2.0.tar.xz) = 622120 +TIMESTAMP = 1696845190 +SHA256 (ltm-1.2.1.tar.xz) = 986025d7b374276fee2e30e99f3649e4ac0db8a02257a37ee10eae72abed0d1f +SIZE (ltm-1.2.1.tar.xz) = 635728 diff --git a/math/libtommath/files/patch-beba89 b/math/libtommath/files/patch-beba89 deleted file mode 100644 index c157ec911a48..000000000000 --- a/math/libtommath/files/patch-beba89 +++ /dev/null @@ -1,137 +0,0 @@ -From beba892bc0d4e4ded4d667ab1d2a94f4d75109a9 Mon Sep 17 00:00:00 2001 -From: czurnieden -Date: Tue, 9 May 2023 17:17:12 +0200 -Subject: [PATCH] Fix possible integer overflow - ----.orig - bn_mp_2expt.c | 4 ++++ - bn_mp_grow.c | 4 ++++ - bn_mp_init_size.c | 5 +++++ - bn_mp_mul_2d.c | 4 ++++ - bn_s_mp_mul_digs.c | 4 ++++ - bn_s_mp_mul_digs_fast.c | 4 ++++ - bn_s_mp_mul_high_digs.c | 4 ++++ - bn_s_mp_mul_high_digs_fast.c | 4 ++++ - 8 files changed, 33 insertions(+) - -diff --git bn_mp_2expt.c bn_mp_2expt.c -index 0ae3df1bf..23de0c3c5 100644 ---- bn_mp_2expt.c.orig -+++ bn_mp_2expt.c -@@ -12,6 +12,10 @@ mp_err mp_2expt(mp_int *a, int b) - { - mp_err err; - -+ if (b < 0) { -+ return MP_VAL; -+ } -+ - /* zero a as per default */ - mp_zero(a); - -diff --git bn_mp_grow.c bn_mp_grow.c -index 9e904c547..2b1682651 100644 ---- bn_mp_grow.c.orig -+++ bn_mp_grow.c -@@ -9,6 +9,10 @@ mp_err mp_grow(mp_int *a, int size) - int i; - mp_digit *tmp; - -+ if (size < 0) { -+ return MP_VAL; -+ } -+ - /* if the alloc size is smaller alloc more ram */ - if (a->alloc < size) { - /* reallocate the array a->dp -diff --git bn_mp_init_size.c bn_mp_init_size.c -index d62268721..99573833f 100644 ---- bn_mp_init_size.c.orig -+++ bn_mp_init_size.c -@@ -6,6 +6,11 @@ - /* init an mp_init for a given size */ - mp_err mp_init_size(mp_int *a, int size) - { -+ -+ if (size < 0) { -+ return MP_VAL; -+ } -+ - size = MP_MAX(MP_MIN_PREC, size); - - /* alloc mem */ -diff --git bn_mp_mul_2d.c bn_mp_mul_2d.c -index 87354de20..bfeaf2eb2 100644 ---- bn_mp_mul_2d.c.orig -+++ bn_mp_mul_2d.c -@@ -9,6 +9,10 @@ mp_err mp_mul_2d(const mp_int *a, int b, mp_int *c) - mp_digit d; - mp_err err; - -+ if (b < 0) { -+ return MP_VAL; -+ } -+ - /* copy */ - if (a != c) { - if ((err = mp_copy(a, c)) != MP_OKAY) { -diff --git bn_s_mp_mul_digs.c bn_s_mp_mul_digs.c -index 64509d4cb..3682b4980 100644 ---- bn_s_mp_mul_digs.c.orig -+++ bn_s_mp_mul_digs.c -@@ -16,6 +16,10 @@ mp_err s_mp_mul_digs(const mp_int *a, const mp_int *b, mp_int *c, int digs) - mp_word r; - mp_digit tmpx, *tmpt, *tmpy; - -+ if (digs < 0) { -+ return MP_VAL; -+ } -+ - /* can we use the fast multiplier? */ - if ((digs < MP_WARRAY) && - (MP_MIN(a->used, b->used) < MP_MAXFAST)) { -diff --git bn_s_mp_mul_digs_fast.c bn_s_mp_mul_digs_fast.c -index b2a287b02..3c4176a87 100644 ---- bn_s_mp_mul_digs_fast.c.orig -+++ bn_s_mp_mul_digs_fast.c -@@ -26,6 +26,10 @@ mp_err s_mp_mul_digs_fast(const mp_int *a, const mp_int *b, mp_int *c, int digs) - mp_digit W[MP_WARRAY]; - mp_word _W; - -+ if (digs < 0) { -+ return MP_VAL; -+ } -+ - /* grow the destination as required */ - if (c->alloc < digs) { - if ((err = mp_grow(c, digs)) != MP_OKAY) { -diff --git bn_s_mp_mul_high_digs.c bn_s_mp_mul_high_digs.c -index 2bb2a5098..c9dd355f8 100644 ---- bn_s_mp_mul_high_digs.c.orig -+++ bn_s_mp_mul_high_digs.c -@@ -15,6 +15,10 @@ mp_err s_mp_mul_high_digs(const mp_int *a, const mp_int *b, mp_int *c, int digs) - mp_word r; - mp_digit tmpx, *tmpt, *tmpy; - -+ if (digs < 0) { -+ return MP_VAL; -+ } -+ - /* can we use the fast multiplier? */ - if (MP_HAS(S_MP_MUL_HIGH_DIGS_FAST) - && ((a->used + b->used + 1) < MP_WARRAY) -diff --git bn_s_mp_mul_high_digs_fast.c bn_s_mp_mul_high_digs_fast.c -index a2c4fb692..4ce7f590c 100644 ---- bn_s_mp_mul_high_digs_fast.c.orig -+++ bn_s_mp_mul_high_digs_fast.c -@@ -19,6 +19,10 @@ mp_err s_mp_mul_high_digs_fast(const mp_int *a, const mp_int *b, mp_int *c, int - mp_digit W[MP_WARRAY]; - mp_word _W; - -+ if (digs < 0) { -+ return MP_VAL; -+ } -+ - /* grow the destination as required */ - pa = a->used + b->used; - if (c->alloc < pa) { diff --git a/math/libtommath/files/patch-c1cf80 b/math/libtommath/files/patch-c1cf80 deleted file mode 100644 index a6137942d9f0..000000000000 --- a/math/libtommath/files/patch-c1cf80 +++ /dev/null @@ -1,57 +0,0 @@ -From c1cf80738219dbd70cba0c0c1244698aad842ec7 Mon Sep 17 00:00:00 2001 -From: Steffen Jaeckel -Date: Thu, 5 Mar 2020 13:57:07 +0100 -Subject: [PATCH] introduce MP_HAS_SET_DOUBLE - ---- - demo/test.c | 4 ++-- - mp_set_double.c | 2 +- - tommath_private.h | 7 +++++++ - 3 files changed, 10 insertions(+), 3 deletions(-) - ---- demo/test.c.orig 2019-10-22 09:44:44.000000000 +0000 -+++ demo/test.c 2021-09-20 10:02:00.103699000 +0000 -@@ -625,7 +625,7 @@ - - } - --#if defined(__STDC_IEC_559__) || defined(__GCC_IEC_559) -+#if defined(MP_HAS_SET_DOUBLE) - static int test_mp_set_double(void) - { - int i; -@@ -2461,7 +2461,7 @@ - T1(mp_read_write_sbin, MP_TO_SBIN), - T1(mp_reduce_2k, MP_REDUCE_2K), - T1(mp_reduce_2k_l, MP_REDUCE_2K_L), --#if defined(__STDC_IEC_559__) || defined(__GCC_IEC_559) -+#if defined(MP_HAS_SET_DOUBLE) - T1(mp_set_double, MP_SET_DOUBLE), - #endif - T1(mp_signed_rsh, MP_SIGNED_RSH), ---- bn_mp_set_double.c.orig 2019-10-22 09:44:44.000000000 +0000 -+++ bn_mp_set_double.c 2021-09-20 10:05:36.466235000 +0000 -@@ -3,7 +3,7 @@ - /* LibTomMath, multiple-precision integer library -- Tom St Denis */ - /* SPDX-License-Identifier: Unlicense */ - --#if defined(__STDC_IEC_559__) || defined(__GCC_IEC_559) -+#if defined(MP_HAS_SET_DOUBLE) - mp_err mp_set_double(mp_int *a, double b) - { - uint64_t frac; ---- tommath_private.h.orig -+++ tommath_private.h -@@ -164,6 +164,13 @@ MP_STATIC_ASSERT(prec_geq_min_prec, MP_DEFAULT_DIGIT_COUNT >= MP_MIN_DIGIT_COUNT - */ - #define MP_MAX_DIGIT_COUNT ((INT_MAX - 2) / MP_DIGIT_BIT) - -+#if defined(__STDC_IEC_559__) || defined(__GCC_IEC_559) \ -+ || defined(__x86_64__) || defined(_M_X64) || defined(_M_AMD64) \ -+ || defined(__i386__) || defined(_M_X86) \ -+ || defined(__aarch64__) || defined(__arm__) -+#define MP_HAS_SET_DOUBLE -+#endif -+ - /* random number source */ - extern MP_PRIVATE mp_err(*s_mp_rand_source)(void *out, size_t size);