public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Sam James" <sam@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-libs/botan/, dev-libs/botan/files/
Date: Thu,  6 Jul 2023 02:11:41 +0000 (UTC)	[thread overview]
Message-ID: <1688609440.3eb7e3258d4fd7584fae543d779d9fdea666e721.sam@gentoo> (raw)

commit:     3eb7e3258d4fd7584fae543d779d9fdea666e721
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Thu Jul  6 02:07:48 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Thu Jul  6 02:10:40 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3eb7e325

dev-libs/botan: fix musl build

Couldn't reproduce it but seems straightforward wrt the issue.

Closes: https://bugs.gentoo.org/909422
Signed-off-by: Sam James <sam <AT> gentoo.org>

 dev-libs/botan/botan-3.0.0-r2.ebuild               |  3 +
 .../files/botan-3.0.0-getentropy-includes.patch    | 68 ++++++++++++++++++++++
 2 files changed, 71 insertions(+)

diff --git a/dev-libs/botan/botan-3.0.0-r2.ebuild b/dev-libs/botan/botan-3.0.0-r2.ebuild
index 866ca3ab1f23..fb1e9384a2cc 100644
--- a/dev-libs/botan/botan-3.0.0-r2.ebuild
+++ b/dev-libs/botan/botan-3.0.0-r2.ebuild
@@ -55,6 +55,9 @@ BDEPEND="
 # NOTE: Considering patching Botan?
 # Please see upstream's guidance:
 # https://botan.randombit.net/handbook/packaging.html#minimize-distribution-patches
+PATCHES=(
+	"${FILESDIR}"/${P}-getentropy-includes.patch
+)
 
 python_check_deps() {
 	use doc || return 0

diff --git a/dev-libs/botan/files/botan-3.0.0-getentropy-includes.patch b/dev-libs/botan/files/botan-3.0.0-getentropy-includes.patch
new file mode 100644
index 000000000000..d8b99ba0f4c5
--- /dev/null
+++ b/dev-libs/botan/files/botan-3.0.0-getentropy-includes.patch
@@ -0,0 +1,68 @@
+https://bugs.gentoo.org/909422
+https://github.com/randombit/botan/commit/3f87e1eef7dbfe231d833ffbf06f7a85b070b600 (cherry-picked getentropy.cpp bit)
+https://github.com/randombit/botan/commit/562ea8da8ab34985b4b3dfefc1bea57829213ace
+
+--- a/src/lib/entropy/getentropy/getentropy.cpp
++++ b/src/lib/entropy/getentropy/getentropy.cpp
+@@ -10,8 +10,8 @@
+ #if defined(BOTAN_TARGET_OS_IS_OPENBSD) || defined(BOTAN_TARGET_OS_IS_FREEBSD) || defined(BOTAN_TARGET_OS_IS_SOLARIS)
+    #include <unistd.h>
+ #else
+-   #include <sys/types.h> // older macOS needs this before sys/random.h
+    #include <sys/random.h>
++   #include <sys/types.h>  // older macOS needs this before sys/random.h
+ #endif
+ 
+ namespace Botan {
+@@ -21,16 +21,14 @@ namespace Botan {
+ * buffer size is limited to 256 bytes.  On OpenBSD this does neither
+ * block nor fail.
+ */
+-size_t Getentropy::poll(RandomNumberGenerator& rng)
+-   {
++size_t Getentropy::poll(RandomNumberGenerator& rng) {
+    secure_vector<uint8_t> buf(256);
+ 
+-   if(::getentropy(buf.data(), buf.size()) == 0)
+-      {
++   if(::getentropy(buf.data(), buf.size()) == 0) {
+       rng.add_entropy(buf.data(), buf.size());
+       return buf.size() * 8;
+-      }
++   }
+ 
+    return 0;
+-   }
+ }
++}  // namespace Botan
+
+From 562ea8da8ab34985b4b3dfefc1bea57829213ace Mon Sep 17 00:00:00 2001
+From: Jack Lloyd <jack@randombit.net>
+Date: Mon, 29 May 2023 10:10:54 -0400
+Subject: [PATCH] Clean up getentropy includes
+
+--- a/src/lib/entropy/getentropy/getentropy.cpp
++++ b/src/lib/entropy/getentropy/getentropy.cpp
+@@ -6,12 +6,11 @@
+ */
+ 
+ #include <botan/internal/getentropy.h>
++#include <unistd.h>
+ 
+-#if defined(BOTAN_TARGET_OS_IS_OPENBSD) || defined(BOTAN_TARGET_OS_IS_FREEBSD) || defined(BOTAN_TARGET_OS_IS_SOLARIS)
+-   #include <unistd.h>
+-#else
++// macOS and Android include it in sys/random.h instead
++#if __has_include(<sys/random.h>)
+    #include <sys/random.h>
+-   #include <sys/types.h>  // older macOS needs this before sys/random.h
+ #endif
+ 
+ namespace Botan {
+@@ -31,4 +30,5 @@ size_t Getentropy::poll(RandomNumberGenerator& rng) {
+ 
+    return 0;
+ }
++
+ }  // namespace Botan
+


             reply	other threads:[~2023-07-06  2:11 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-06  2:11 Sam James [this message]
  -- strict thread matches above, loose matches on Subject: below --
2025-03-31 23:39 [gentoo-commits] repo/gentoo:master commit in: dev-libs/botan/, dev-libs/botan/files/ Sam James
2024-12-23  2:48 Sam James
2024-12-22  0:22 Sam James
2023-10-12  8:12 Sam James
2019-05-08  9:35 Alon Bar-Lev
2018-04-08 19:21 Alon Bar-Lev
2017-10-04 18:57 Alon Bar-Lev
2017-03-21 10:01 Alon Bar-Lev
2017-01-22 20:45 Alon Bar-Lev
2017-01-18 14:52 Alon Bar-Lev
2016-12-01 20:13 Alon Bar-Lev
2016-12-01 19:09 Alon Bar-Lev
2016-10-28  8:26 Alon Bar-Lev
2016-10-22 19:58 Alon Bar-Lev

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=1688609440.3eb7e3258d4fd7584fae543d779d9fdea666e721.sam@gentoo \
    --to=sam@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.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