public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
From: Michal Schorm <mschorm@redhat.com>
To: git-commits@fedoraproject.org
Subject: [rpms/freetds] rawhide: [bugfix] Fix FTBFS with nettle 4.0: 'sha1_digest()' also lost length parameter
Date: Wed, 29 Jul 2026 16:05:15 GMT	[thread overview]
Message-ID: <178534111558.1.13104822357512683721.rpms-freetds-e1705a147ff8@fedoraproject.org> (raw)

            A new commit has been pushed.

            Repo   : rpms/freetds
            Branch : rawhide
            Commit : e1705a147ff8ea8a26afe612df347cf9109b6008
            Author : Michal Schorm <mschorm@redhat.com>
            Date   : 2026-07-29T14:18:33+02:00
            Stats  : +52/-5 in 2 file(s)
            URL    : https://src.fedoraproject.org/rpms/freetds/c/e1705a147ff8ea8a26afe612df347cf9109b6008?branch=rawhide

            Log:
            [bugfix] Fix FTBFS with nettle 4.0: 'sha1_digest()' also lost length parameter

The existing nettle 4.0 patch fixed 'nettle_md4_digest()' and
'nettle_md5_digest()' but missed 'sha1_digest()' in
'sec_negotiate_gnutls.h', which also dropped the length parameter
in nettle 4.0.

Replace the unconditional patch with version-guarded '#ifdef' blocks
matching upstream commit 67663a0 ("Fix compatibility with Nettle 4
library"), covering all three digest functions with backwards
compatibility for nettle < 4.

Co-Authored-By: Claude AI <noreply@anthropic.com>

---
diff --git a/freetds-1.4.23-nettle4.patch b/freetds-1.4.23-nettle4.patch
index a7b7a78..770ff34 100644
--- a/freetds-1.4.23-nettle4.patch
+++ b/freetds-1.4.23-nettle4.patch
@@ -1,22 +1,66 @@
 --- a/include/freetds/utils/md4.h
 +++ b/include/freetds/utils/md4.h
-@@ -38,7 +38,7 @@ static inline void MD4Update(MD4_CTX *ctx, const uint8_t *buf, size_t len)
+@@ -23,6 +23,7 @@ typedef struct MD4Context MD4_CTX;
+ #else
+
+ #include <nettle/md4.h>
++#include <nettle/version.h>
+
+ typedef struct md4_ctx MD4_CTX;
+
+@@ -38,7 +39,11 @@ static inline void MD4Update(MD4_CTX *ctx, const uint8_t *buf, size_t len)
 
  static inline void MD4Final(MD4_CTX *ctx, uint8_t *digest)
  {
--	nettle_md4_digest(ctx, 16, digest);
++#if defined(NETTLE_VERSION_MAJOR) && NETTLE_VERSION_MAJOR >= 4
 +	nettle_md4_digest(ctx, digest);
++#else
+ 	nettle_md4_digest(ctx, 16, digest);
++#endif
  }
 
 
 --- a/include/freetds/utils/md5.h
 +++ b/include/freetds/utils/md5.h
-@@ -40,7 +40,7 @@ static inline void MD5Update(MD5_CTX *ctx, const uint8_t *buf, size_t len)
+@@ -25,6 +25,7 @@ typedef struct md5_ctx MD5_CTX;
+ #else
+
+ #include <nettle/md5.h>
++#include <nettle/version.h>
+
+ typedef struct md5_ctx MD5_CTX;
+
+@@ -40,7 +41,11 @@ static inline void MD5Update(MD5_CTX *ctx, const uint8_t *buf, size_t len)
 
  static inline void MD5Final(MD5_CTX *ctx, uint8_t *digest)
  {
--	nettle_md5_digest(ctx, 16, digest);
++#if defined(NETTLE_VERSION_MAJOR) && NETTLE_VERSION_MAJOR >= 4
 +	nettle_md5_digest(ctx, digest);
++#else
+ 	nettle_md5_digest(ctx, 16, digest);
++#endif
  }
 
  #endif
+--- a/src/tds/sec_negotiate_gnutls.h
++++ b/src/tds/sec_negotiate_gnutls.h
+@@ -35,6 +35,7 @@
+ #  include <nettle/asn1.h>
+ #  include <nettle/rsa.h>
+ #  include <nettle/bignum.h>
++#  include <nettle/version.h>
+ #endif
+
+ /**
+@@ -186,7 +187,11 @@ sha1(uint8_t *hash, const void *data, size_t len)
+ 	struct sha1_ctx ctx;
+ 	sha1_init(&ctx);
+ 	sha1_update(&ctx, len, (const uint8_t *) data);
++#if defined(NETTLE_VERSION_MAJOR) && NETTLE_VERSION_MAJOR >= 4
++	sha1_digest(&ctx, hash);
++#else
+ 	sha1_digest(&ctx, 20, hash);
++#endif
+ }
+ #endif
+

diff --git a/freetds.spec b/freetds.spec
index eccb6b7..a2a3013 100644
--- a/freetds.spec
+++ b/freetds.spec
@@ -3,7 +3,7 @@
 Name: freetds
 Summary: Implementation of the TDS (Tabular DataStream) protocol
 Version: 1.4.23
-Release: 7%{?dist}
+Release: 8%{?dist}
 # Automatically converted from old format: LGPLv2+ and GPLv2+ - review is highly recommended.
 License: LGPL-2.0-or-later AND GPL-2.0-or-later
 URL: http://www.freetds.org/
@@ -169,6 +169,9 @@ find docdir -type f -print0 | xargs -0 chmod -x
  
 
 %changelog
+* Wed Jul 29 2026 Michal Schorm <mschorm@redhat.com> - 1.4.23-8
+- Fix FTBFS with nettle 4.0: 'sha1_digest()' also lost length parameter
+
 * Mon Jul 20 2026 Michal Schorm <mschorm@redhat.com> - 1.4.23-7
 - Ship drop-in snippet for ODBC driver self-registration
 

                 reply	other threads:[~2026-07-29 16:05 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=178534111558.1.13104822357512683721.rpms-freetds-e1705a147ff8@fedoraproject.org \
    --to=mschorm@redhat.com \
    --cc=git-commits@fedoraproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox