-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Win32: check for BCryptGenRandom #1813
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
2668021 to
d2393ba
Compare
azat
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, but blocked by #1819
c9a655c to
6fa8ccc
Compare
event-config.h.cmake
Outdated
| #cmakedefine EVENT__HAVE__GMTIME64 1 | ||
|
|
||
| /* Define to 1 if you link with `bcrypt.lib'. */ | ||
| #cmakedefine EVENT__HAVE_BCRYPT_LIB 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, but who will set this define?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know.
How do you link with bcrypt from cmake?
My goal is to solve the build issue referenced in the pull request description. If you know a way, please help. :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is done here -
Line 1052 in 7ef754a
| set(LIB_PLATFORM ws2_32 shell32 advapi32 bcrypt iphlpapi) |
So it is always linked with bcrypt.lib no need to detect it at configure stage.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, somehow that doesn't work for building libevent within Transmission.
The only fix I could find was to revert to the old code. Can we define an option to use bcrypt ON/OFF?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see, then I believe that you need to detect presence of the function not the header file, smth like this
$ git di
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9bcb1597..0cd72061 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -529,6 +529,7 @@ if (WIN32)
list(APPEND SYMBOLS_TO_CHECK
_gmtime64
_gmtime64_s
+ BCryptGenRandom
)
else()
list(APPEND SYMBOLS_TO_CHECK
diff --git a/event-config.h.cmake b/event-config.h.cmake
index a6375141..09bfc06f 100644
--- a/event-config.h.cmake
+++ b/event-config.h.cmake
@@ -282,6 +282,9 @@
/* Define to 1 if you have the `_gmtime64' function. */
#cmakedefine EVENT__HAVE__GMTIME64 1
+/* Define to 1 if you have the `BCryptGenRandom' function. */
+#cmakedefine EVENT__HAVE__BCRYPTGENRANDOM 1
+
/* Define to 1 if the system has the type `struct addrinfo'. */
#cmakedefine EVENT__HAVE_STRUCT_ADDRINFO 1Not tested, but you get the idea
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did try it and it did not work.
You can see it was my code on November 5: d2393ba
6fa8ccc to
97a86bf
Compare
Partial revert of eb7bed0
This is a build fix for https://github.com/transmission/transmission/actions/runs/19074269764/job/54485374550?pr=7765#step:6:2528