|
@@ -1,238 +0,0 @@
|
|
|
-From 26ba5ee5d560d62ad05aa6819608fd21cbb962f9 Mon Sep 17 00:00:00 2001
|
|
|
-From: James Hilliard <james.hilliard1@gmail.com>
|
|
|
-Date: Thu, 15 May 2025 04:56:59 -0600
|
|
|
-Subject: [PATCH] Fix mbedtls version 3 compatibility (#2602)
|
|
|
-
|
|
|
-We need to use the new API for mbedtls 3 compatibility
|
|
|
-
|
|
|
-Fixes #2025
|
|
|
-
|
|
|
-Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
|
|
|
-Upstream: https://github.com/libarchive/libarchive/commit/63d7c24eeaa108ecc2ef258c0505eefdadaaaf35
|
|
|
----
|
|
|
- libarchive/archive_digest.c | 72 +++++++++++++++++++++++++++++++++++++
|
|
|
- 1 file changed, 72 insertions(+)
|
|
|
-
|
|
|
-diff --git a/libarchive/archive_digest.c b/libarchive/archive_digest.c
|
|
|
-index 33518740..03f0edd6 100644
|
|
|
---- a/libarchive/archive_digest.c
|
|
|
-+++ b/libarchive/archive_digest.c
|
|
|
-@@ -235,7 +235,11 @@ static int
|
|
|
- __archive_md5init(archive_md5_ctx *ctx)
|
|
|
- {
|
|
|
- mbedtls_md5_init(ctx);
|
|
|
-+#if MBEDTLS_VERSION_NUMBER > 0x03000000
|
|
|
-+ if (mbedtls_md5_starts(ctx) == 0)
|
|
|
-+#else
|
|
|
- if (mbedtls_md5_starts_ret(ctx) == 0)
|
|
|
-+#endif
|
|
|
- return (ARCHIVE_OK);
|
|
|
- else
|
|
|
- return (ARCHIVE_FATAL);
|
|
|
-@@ -245,7 +249,11 @@ static int
|
|
|
- __archive_md5update(archive_md5_ctx *ctx, const void *indata,
|
|
|
- size_t insize)
|
|
|
- {
|
|
|
-+#if MBEDTLS_VERSION_NUMBER > 0x03000000
|
|
|
-+ if (mbedtls_md5_update(ctx, indata, insize) == 0)
|
|
|
-+#else
|
|
|
- if (mbedtls_md5_update_ret(ctx, indata, insize) == 0)
|
|
|
-+#endif
|
|
|
- return (ARCHIVE_OK);
|
|
|
- else
|
|
|
- return (ARCHIVE_FATAL);
|
|
|
-@@ -254,7 +262,11 @@ __archive_md5update(archive_md5_ctx *ctx, const void *indata,
|
|
|
- static int
|
|
|
- __archive_md5final(archive_md5_ctx *ctx, void *md)
|
|
|
- {
|
|
|
-+#if MBEDTLS_VERSION_NUMBER > 0x03000000
|
|
|
-+ if (mbedtls_md5_finish(ctx, md) == 0) {
|
|
|
-+#else
|
|
|
- if (mbedtls_md5_finish_ret(ctx, md) == 0) {
|
|
|
-+#endif
|
|
|
- mbedtls_md5_free(ctx);
|
|
|
- return (ARCHIVE_OK);
|
|
|
- } else {
|
|
|
-@@ -431,7 +443,11 @@ static int
|
|
|
- __archive_ripemd160init(archive_rmd160_ctx *ctx)
|
|
|
- {
|
|
|
- mbedtls_ripemd160_init(ctx);
|
|
|
-+#if MBEDTLS_VERSION_NUMBER > 0x03000000
|
|
|
-+ if (mbedtls_ripemd160_starts(ctx) == 0)
|
|
|
-+#else
|
|
|
- if (mbedtls_ripemd160_starts_ret(ctx) == 0)
|
|
|
-+#endif
|
|
|
- return (ARCHIVE_OK);
|
|
|
- else
|
|
|
- return (ARCHIVE_FATAL);
|
|
|
-@@ -441,7 +457,11 @@ static int
|
|
|
- __archive_ripemd160update(archive_rmd160_ctx *ctx, const void *indata,
|
|
|
- size_t insize)
|
|
|
- {
|
|
|
-+#if MBEDTLS_VERSION_NUMBER > 0x03000000
|
|
|
-+ if (mbedtls_ripemd160_update(ctx, indata, insize) == 0)
|
|
|
-+#else
|
|
|
- if (mbedtls_ripemd160_update_ret(ctx, indata, insize) == 0)
|
|
|
-+#endif
|
|
|
- return (ARCHIVE_OK);
|
|
|
- else
|
|
|
- return (ARCHIVE_FATAL);
|
|
|
-@@ -450,7 +470,11 @@ __archive_ripemd160update(archive_rmd160_ctx *ctx, const void *indata,
|
|
|
- static int
|
|
|
- __archive_ripemd160final(archive_rmd160_ctx *ctx, void *md)
|
|
|
- {
|
|
|
-+#if MBEDTLS_VERSION_NUMBER > 0x03000000
|
|
|
-+ if (mbedtls_ripemd160_finish(ctx, md) == 0) {
|
|
|
-+#else
|
|
|
- if (mbedtls_ripemd160_finish_ret(ctx, md) == 0) {
|
|
|
-+#endif
|
|
|
- mbedtls_ripemd160_free(ctx);
|
|
|
- return (ARCHIVE_OK);
|
|
|
- } else {
|
|
|
-@@ -622,7 +646,11 @@ static int
|
|
|
- __archive_sha1init(archive_sha1_ctx *ctx)
|
|
|
- {
|
|
|
- mbedtls_sha1_init(ctx);
|
|
|
-+#if MBEDTLS_VERSION_NUMBER > 0x03000000
|
|
|
-+ if (mbedtls_sha1_starts(ctx) == 0)
|
|
|
-+#else
|
|
|
- if (mbedtls_sha1_starts_ret(ctx) == 0)
|
|
|
-+#endif
|
|
|
- return (ARCHIVE_OK);
|
|
|
- else
|
|
|
- return (ARCHIVE_FATAL);
|
|
|
-@@ -632,7 +660,11 @@ static int
|
|
|
- __archive_sha1update(archive_sha1_ctx *ctx, const void *indata,
|
|
|
- size_t insize)
|
|
|
- {
|
|
|
-+#if MBEDTLS_VERSION_NUMBER > 0x03000000
|
|
|
-+ if (mbedtls_sha1_update(ctx, indata, insize) == 0)
|
|
|
-+#else
|
|
|
- if (mbedtls_sha1_update_ret(ctx, indata, insize) == 0)
|
|
|
-+#endif
|
|
|
- return (ARCHIVE_OK);
|
|
|
- else
|
|
|
- return (ARCHIVE_FATAL);
|
|
|
-@@ -641,7 +673,11 @@ __archive_sha1update(archive_sha1_ctx *ctx, const void *indata,
|
|
|
- static int
|
|
|
- __archive_sha1final(archive_sha1_ctx *ctx, void *md)
|
|
|
- {
|
|
|
-+#if MBEDTLS_VERSION_NUMBER > 0x03000000
|
|
|
-+ if (mbedtls_sha1_finish(ctx, md) == 0) {
|
|
|
-+#else
|
|
|
- if (mbedtls_sha1_finish_ret(ctx, md) == 0) {
|
|
|
-+#endif
|
|
|
- mbedtls_sha1_free(ctx);
|
|
|
- return (ARCHIVE_OK);
|
|
|
- } else {
|
|
|
-@@ -890,7 +926,11 @@ static int
|
|
|
- __archive_sha256init(archive_sha256_ctx *ctx)
|
|
|
- {
|
|
|
- mbedtls_sha256_init(ctx);
|
|
|
-+#if MBEDTLS_VERSION_NUMBER > 0x03000000
|
|
|
-+ if (mbedtls_sha256_starts(ctx, 0) == 0)
|
|
|
-+#else
|
|
|
- if (mbedtls_sha256_starts_ret(ctx, 0) == 0)
|
|
|
-+#endif
|
|
|
- return (ARCHIVE_OK);
|
|
|
- else
|
|
|
- return (ARCHIVE_FATAL);
|
|
|
-@@ -900,7 +940,11 @@ static int
|
|
|
- __archive_sha256update(archive_sha256_ctx *ctx, const void *indata,
|
|
|
- size_t insize)
|
|
|
- {
|
|
|
-+#if MBEDTLS_VERSION_NUMBER > 0x03000000
|
|
|
-+ if (mbedtls_sha256_update(ctx, indata, insize) == 0)
|
|
|
-+#else
|
|
|
- if (mbedtls_sha256_update_ret(ctx, indata, insize) == 0)
|
|
|
-+#endif
|
|
|
- return (ARCHIVE_OK);
|
|
|
- else
|
|
|
- return (ARCHIVE_FATAL);
|
|
|
-@@ -909,7 +953,11 @@ __archive_sha256update(archive_sha256_ctx *ctx, const void *indata,
|
|
|
- static int
|
|
|
- __archive_sha256final(archive_sha256_ctx *ctx, void *md)
|
|
|
- {
|
|
|
-+#if MBEDTLS_VERSION_NUMBER > 0x03000000
|
|
|
-+ if (mbedtls_sha256_finish(ctx, md) == 0) {
|
|
|
-+#else
|
|
|
- if (mbedtls_sha256_finish_ret(ctx, md) == 0) {
|
|
|
-+#endif
|
|
|
- mbedtls_sha256_free(ctx);
|
|
|
- return (ARCHIVE_OK);
|
|
|
- } else {
|
|
|
-@@ -1130,7 +1178,11 @@ static int
|
|
|
- __archive_sha384init(archive_sha384_ctx *ctx)
|
|
|
- {
|
|
|
- mbedtls_sha512_init(ctx);
|
|
|
-+#if MBEDTLS_VERSION_NUMBER > 0x03000000
|
|
|
-+ if (mbedtls_sha512_starts(ctx, 1) == 0)
|
|
|
-+#else
|
|
|
- if (mbedtls_sha512_starts_ret(ctx, 1) == 0)
|
|
|
-+#endif
|
|
|
- return (ARCHIVE_OK);
|
|
|
- else
|
|
|
- return (ARCHIVE_FATAL);
|
|
|
-@@ -1140,7 +1192,11 @@ static int
|
|
|
- __archive_sha384update(archive_sha384_ctx *ctx, const void *indata,
|
|
|
- size_t insize)
|
|
|
- {
|
|
|
-+#if MBEDTLS_VERSION_NUMBER > 0x03000000
|
|
|
-+ if (mbedtls_sha512_update(ctx, indata, insize) == 0)
|
|
|
-+#else
|
|
|
- if (mbedtls_sha512_update_ret(ctx, indata, insize) == 0)
|
|
|
-+#endif
|
|
|
- return (ARCHIVE_OK);
|
|
|
- else
|
|
|
- return (ARCHIVE_FATAL);
|
|
|
-@@ -1149,7 +1205,11 @@ __archive_sha384update(archive_sha384_ctx *ctx, const void *indata,
|
|
|
- static int
|
|
|
- __archive_sha384final(archive_sha384_ctx *ctx, void *md)
|
|
|
- {
|
|
|
-+#if MBEDTLS_VERSION_NUMBER > 0x03000000
|
|
|
-+ if (mbedtls_sha512_finish(ctx, md) == 0) {
|
|
|
-+#else
|
|
|
- if (mbedtls_sha512_finish_ret(ctx, md) == 0) {
|
|
|
-+#endif
|
|
|
- mbedtls_sha512_free(ctx);
|
|
|
- return (ARCHIVE_OK);
|
|
|
- } else {
|
|
|
-@@ -1394,7 +1454,11 @@ static int
|
|
|
- __archive_sha512init(archive_sha512_ctx *ctx)
|
|
|
- {
|
|
|
- mbedtls_sha512_init(ctx);
|
|
|
-+#if MBEDTLS_VERSION_NUMBER > 0x03000000
|
|
|
-+ if (mbedtls_sha512_starts(ctx, 0) == 0)
|
|
|
-+#else
|
|
|
- if (mbedtls_sha512_starts_ret(ctx, 0) == 0)
|
|
|
-+#endif
|
|
|
- return (ARCHIVE_OK);
|
|
|
- else
|
|
|
- return (ARCHIVE_FATAL);
|
|
|
-@@ -1404,7 +1468,11 @@ static int
|
|
|
- __archive_sha512update(archive_sha512_ctx *ctx, const void *indata,
|
|
|
- size_t insize)
|
|
|
- {
|
|
|
-+#if MBEDTLS_VERSION_NUMBER > 0x03000000
|
|
|
-+ if (mbedtls_sha512_update(ctx, indata, insize) == 0)
|
|
|
-+#else
|
|
|
- if (mbedtls_sha512_update_ret(ctx, indata, insize) == 0)
|
|
|
-+#endif
|
|
|
- return (ARCHIVE_OK);
|
|
|
- else
|
|
|
- return (ARCHIVE_FATAL);
|
|
|
-@@ -1413,7 +1481,11 @@ __archive_sha512update(archive_sha512_ctx *ctx, const void *indata,
|
|
|
- static int
|
|
|
- __archive_sha512final(archive_sha512_ctx *ctx, void *md)
|
|
|
- {
|
|
|
-+#if MBEDTLS_VERSION_NUMBER > 0x03000000
|
|
|
-+ if (mbedtls_sha512_finish(ctx, md) == 0) {
|
|
|
-+#else
|
|
|
- if (mbedtls_sha512_finish_ret(ctx, md) == 0) {
|
|
|
-+#endif
|
|
|
- mbedtls_sha512_free(ctx);
|
|
|
- return (ARCHIVE_OK);
|
|
|
- } else {
|
|
|
---
|
|
|
-2.34.1
|
|
|
-
|