git: d43d863bc832 - stable/12 - libarchive: import changes from upstream

From: Martin Matuska <mm_at_FreeBSD.org>
Date: Wed, 28 Dec 2022 22:11:48 UTC
The branch stable/12 has been updated by mm:

URL: https://cgit.FreeBSD.org/src/commit/?id=d43d863bc832239bd29efa81467808b8a90398ce

commit d43d863bc832239bd29efa81467808b8a90398ce
Author:     Martin Matuska <mm@FreeBSD.org>
AuthorDate: 2022-04-12 18:12:34 +0000
Commit:     Martin Matuska <mm@FreeBSD.org>
CommitDate: 2022-12-28 21:57:11 +0000

    libarchive: import changes from upstream
    
    Libarchive 3.6.1
    
    Bug fixes:
      PR #1549: archive_digest: check return value of EVP_DigestInit()
    
    Relnotes:       yes
    
    (cherry picked from commit 7ec51a3e2b91caaea5c1de1a4c7b362b20d35a62)
---
 contrib/libarchive/NEWS                        |  2 ++
 contrib/libarchive/libarchive/archive.h        |  4 ++--
 contrib/libarchive/libarchive/archive_digest.c | 18 ++++++++++++------
 contrib/libarchive/libarchive/archive_entry.h  |  2 +-
 4 files changed, 17 insertions(+), 9 deletions(-)

diff --git a/contrib/libarchive/NEWS b/contrib/libarchive/NEWS
index 0ccdb5d61b04..bf0515f34d8c 100644
--- a/contrib/libarchive/NEWS
+++ b/contrib/libarchive/NEWS
@@ -1,3 +1,5 @@
+Apr 08, 2022: libarchive 3.6.1 released
+
 Feb 09, 2022: libarchive 3.6.0 released
 
 Feb 08, 2022: libarchive 3.5.3 released
diff --git a/contrib/libarchive/libarchive/archive.h b/contrib/libarchive/libarchive/archive.h
index 67381bf24be0..ee1a02f4de01 100644
--- a/contrib/libarchive/libarchive/archive.h
+++ b/contrib/libarchive/libarchive/archive.h
@@ -36,7 +36,7 @@
  * assert that ARCHIVE_VERSION_NUMBER >= 2012108.
  */
 /* Note: Compiler will complain if this does not match archive_entry.h! */
-#define	ARCHIVE_VERSION_NUMBER 3006000
+#define	ARCHIVE_VERSION_NUMBER 3006001
 
 #include <sys/stat.h>
 #include <stddef.h>  /* for wchar_t */
@@ -155,7 +155,7 @@ __LA_DECL int		archive_version_number(void);
 /*
  * Textual name/version of the library, useful for version displays.
  */
-#define	ARCHIVE_VERSION_ONLY_STRING "3.6.0"
+#define	ARCHIVE_VERSION_ONLY_STRING "3.6.1"
 #define	ARCHIVE_VERSION_STRING "libarchive " ARCHIVE_VERSION_ONLY_STRING
 __LA_DECL const char *	archive_version_string(void);
 
diff --git a/contrib/libarchive/libarchive/archive_digest.c b/contrib/libarchive/libarchive/archive_digest.c
index 410df01563df..a7bd5f0286a4 100644
--- a/contrib/libarchive/libarchive/archive_digest.c
+++ b/contrib/libarchive/libarchive/archive_digest.c
@@ -243,7 +243,8 @@ __archive_md5init(archive_md5_ctx *ctx)
 {
   if ((*ctx = EVP_MD_CTX_new()) == NULL)
 	return (ARCHIVE_FAILED);
-  EVP_DigestInit(*ctx, EVP_md5());
+  if (!EVP_DigestInit(*ctx, EVP_md5()))
+	return (ARCHIVE_FAILED);
   return (ARCHIVE_OK);
 }
 
@@ -434,7 +435,8 @@ __archive_ripemd160init(archive_rmd160_ctx *ctx)
 {
   if ((*ctx = EVP_MD_CTX_new()) == NULL)
 	return (ARCHIVE_FAILED);
-  EVP_DigestInit(*ctx, EVP_ripemd160());
+  if (!EVP_DigestInit(*ctx, EVP_ripemd160()))
+	return (ARCHIVE_FAILED);
   return (ARCHIVE_OK);
 }
 
@@ -624,7 +626,8 @@ __archive_sha1init(archive_sha1_ctx *ctx)
 {
   if ((*ctx = EVP_MD_CTX_new()) == NULL)
 	return (ARCHIVE_FAILED);
-  EVP_DigestInit(*ctx, EVP_sha1());
+  if (!EVP_DigestInit(*ctx, EVP_sha1()))
+	return (ARCHIVE_FAILED);
   return (ARCHIVE_OK);
 }
 
@@ -887,7 +890,8 @@ __archive_sha256init(archive_sha256_ctx *ctx)
 {
   if ((*ctx = EVP_MD_CTX_new()) == NULL)
 	return (ARCHIVE_FAILED);
-  EVP_DigestInit(*ctx, EVP_sha256());
+  if (!EVP_DigestInit(*ctx, EVP_sha256()))
+	return (ARCHIVE_FAILED);
   return (ARCHIVE_OK);
 }
 
@@ -1122,7 +1126,8 @@ __archive_sha384init(archive_sha384_ctx *ctx)
 {
   if ((*ctx = EVP_MD_CTX_new()) == NULL)
 	return (ARCHIVE_FAILED);
-  EVP_DigestInit(*ctx, EVP_sha384());
+  if (!EVP_DigestInit(*ctx, EVP_sha384()))
+	return (ARCHIVE_FAILED);
   return (ARCHIVE_OK);
 }
 
@@ -1381,7 +1386,8 @@ __archive_sha512init(archive_sha512_ctx *ctx)
 {
   if ((*ctx = EVP_MD_CTX_new()) == NULL)
 	return (ARCHIVE_FAILED);
-  EVP_DigestInit(*ctx, EVP_sha512());
+  if (!EVP_DigestInit(*ctx, EVP_sha512()))
+	return (ARCHIVE_FAILED);
   return (ARCHIVE_OK);
 }
 
diff --git a/contrib/libarchive/libarchive/archive_entry.h b/contrib/libarchive/libarchive/archive_entry.h
index 8b76360a777f..461866a5a6a2 100644
--- a/contrib/libarchive/libarchive/archive_entry.h
+++ b/contrib/libarchive/libarchive/archive_entry.h
@@ -30,7 +30,7 @@
 #define	ARCHIVE_ENTRY_H_INCLUDED
 
 /* Note: Compiler will complain if this does not match archive.h! */
-#define	ARCHIVE_VERSION_NUMBER 3006000
+#define	ARCHIVE_VERSION_NUMBER 3006001
 
 /*
  * Note: archive_entry.h is for use outside of libarchive; the