Subject: [PATCH] gnu: mbedtls-apache: Update to 2.26.0.
From: Matthew James Kraai <[email-masked]>
To: [email-masked]
Cc: Matthew James Kraai <[email-masked]>
Date: Sat, 3 Jul 2021 17:16:57 -0700
List-Id: <debbugs-submit.debbugs.gnu.org>

* gnu/packages/patches/mbedtls-apache-reduce-level-of-Wformat-truncation.patch:
New file.
* gnu/local.mk (dist_patch_DATA): Adjust accordingly.
* gnu/packages/tls.scm (mbedtls-apache): Update to 2.26.0.
---
 gnu/local.mk                                  |  1 +
 ...e-reduce-level-of-Wformat-truncation.patch | 29 +++++++++++++++++++
 gnu/packages/tls.scm                          |  5 ++--
 3 files changed, 33 insertions(+), 2 deletions(-)
 create mode 100644 gnu/packages/patches/mbedtls-apache-reduce-level-of-Wformat-truncation.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index b197ec55f9..6a44438918 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1422,6 +1422,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/maven-enforcer-api-fix-old-dependencies.patch	\
   %D%/packages/patches/maven-generate-component-xml.patch		\
   %D%/packages/patches/maven-generate-javax-inject-named.patch		\
+  %D%/packages/patches/mbedtls-apache-reduce-level-of-Wformat-truncation.patch	\
   %D%/packages/patches/mcrypt-CVE-2012-4409.patch			\
   %D%/packages/patches/mcrypt-CVE-2012-4426.patch			\
   %D%/packages/patches/mcrypt-CVE-2012-4527.patch			\
diff --git a/gnu/packages/patches/mbedtls-apache-reduce-level-of-Wformat-truncation.patch b/gnu/packages/patches/mbedtls-apache-reduce-level-of-Wformat-truncation.patch
new file mode 100644
index 0000000000..7f3c2d8c05
--- /dev/null
+++ b/gnu/packages/patches/mbedtls-apache-reduce-level-of-Wformat-truncation.patch
@@ -0,0 +1,29 @@
+From 2065a8d8af27c6cb1e40c9462b5933336dca7434 Mon Sep 17 00:00:00 2001
+From: Paul Elliott <[email-masked]>
+Date: Wed, 17 Mar 2021 13:12:22 +0000
+Subject: [PATCH] Reduce level of -Wformat-truncation
+
+Reduce level of format truncation warnings due to issues with false
+positives (an unknown size buffer is always treated as size 1)
+
+Signed-off-by: Paul Elliott <[email-masked]>
+---
+ CMakeLists.txt | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 2ab2e01eb..14ca7b696 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -198,7 +198,7 @@ if(CMAKE_COMPILER_IS_GNU)
+         endif()
+     endif()
+     if (GCC_VERSION VERSION_GREATER 7.0 OR GCC_VERSION VERSION_EQUAL 7.0)
+-      set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wformat-overflow=2 -Wformat-truncation=2")
++      set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wformat-overflow=2 -Wformat-truncation")
+     endif()
+     set(CMAKE_C_FLAGS_RELEASE     "-O2")
+     set(CMAKE_C_FLAGS_DEBUG       "-O0 -g3")
+-- 
+2.32.0
+
diff --git a/gnu/packages/tls.scm b/gnu/packages/tls.scm
index 60005cf339..bb669859b9 100644
--- a/gnu/packages/tls.scm
+++ b/gnu/packages/tls.scm
@@ -946,7 +946,7 @@ then ported to the GNU / Linux environment.")
     (name "mbedtls-apache")
     ;; XXX Check whether ‘-Wformat-signedness’ still breaks mbedtls-for-hiawatha
     ;; when updating.
-    (version "2.23.0")
+    (version "2.26.0")
     (source
      (origin
        (method git-fetch)
@@ -954,7 +954,8 @@ then ported to the GNU / Linux environment.")
              (url "https://github.com/ARMmbed/mbedtls")
              (commit (string-append "mbedtls-" version))))
        (sha256
-        (base32 "13fa9h2i989cbf8n8c0j019mshv6wg213va18my1s787lhcq2d62"))
+        (base32 "0scwpmrgvg6q7rvqkc352d2fqlsx0aylcbyibcp1f1rsn8iiif2m"))
+       (patches (search-patches "mbedtls-apache-reduce-level-of-Wformat-truncation.patch"))
        (file-name (git-file-name name version))))
     (build-system cmake-build-system)
     (arguments
-- 
2.32.0