Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
And patch two includes out :-/
  • Loading branch information
StanFromIreland committed Apr 26, 2026
commit c80066ba2ceaef2d6931fa78a16f114c08d159c6
4 changes: 2 additions & 2 deletions Misc/sbom.spdx.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions Modules/expat/refresh.sh
Comment thread
StanFromIreland marked this conversation as resolved.
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,18 @@ This may be due to source changes and will require updating this script" >&2
exit 1
fi

# Step 4: Skip the Windows rand_s entropy path in xmlparse.c when
# XML_POOR_ENTROPY is set.
sed -z -i 's|#if defined(_WIN32)\n# include "random_rand_s\.h"\n#endif /\* defined(_WIN32) \*/|#if defined(_WIN32) \&\& ! defined(XML_POOR_ENTROPY)\n# include "random_rand_s.h"\n#endif /* defined(_WIN32) \&\& ! defined(XML_POOR_ENTROPY) */|' xmlparse.c
sed -z -i 's|# ifdef _WIN32\n if (writeRandomBytes_rand_s|# if defined(_WIN32) \&\& ! defined(XML_POOR_ENTROPY)\n if (writeRandomBytes_rand_s|' xmlparse.c

if ! grep -q '#if defined(_WIN32) && ! defined(XML_POOR_ENTROPY)' xmlparse.c; then
echo "
Error: rand_s gate not patched in xmlparse.c;
This may be due to source changes and will require updating this script" >&2
exit 1
fi

echo '
Updated! next steps:
- Verify all is okay:
Expand Down
6 changes: 3 additions & 3 deletions Modules/expat/xmlparse.c
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,9 @@
# include "random_getrandom.h"
#endif /* defined(HAVE_GETRANDOM) || defined(HAVE_SYSCALL_GETRANDOM) */

#if defined(_WIN32)
#if defined(_WIN32) && ! defined(XML_POOR_ENTROPY)
# include "random_rand_s.h"
#endif /* defined(_WIN32) */
#endif /* defined(_WIN32) && ! defined(XML_POOR_ENTROPY) */

#if ! defined(HAVE_GETRANDOM) && ! defined(HAVE_SYSCALL_GETRANDOM) \
&& ! defined(HAVE_ARC4RANDOM_BUF) && ! defined(HAVE_ARC4RANDOM) \
Expand Down Expand Up @@ -1088,7 +1088,7 @@ generate_hash_secret_salt(void) {
return ENTROPY_DEBUG("arc4random", entropy);
#else
/* Try high quality providers first .. */
# ifdef _WIN32
# if defined(_WIN32) && ! defined(XML_POOR_ENTROPY)
if (writeRandomBytes_rand_s(&entropy, sizeof(entropy))) {
return ENTROPY_DEBUG("rand_s", entropy);
}
Expand Down
Loading