Commit dc679c9e06 for perl
commit dc679c9e06eec60b29dde3e0d874a5874e70dfde
Author: Craig A. Berry <craigberry@mac.com>
Date: Sun Oct 18 07:02:27 2026 -0500
VMS: use native entropy in Perl_seed if available
There is a relatively new system service that is very much like the
POSIX getentropy() except that it provides VMS-style rather than
Unix-style return values. Use it when we have it.
diff --git a/pod/perldelta.pod b/pod/perldelta.pod
index 3ab61fc894..f0f60c5c03 100644
--- a/pod/perldelta.pod
+++ b/pod/perldelta.pod
@@ -349,9 +349,10 @@ L</Modules and Pragmata> section.
=over 4
-=item XXX-some-platform
+=item VMS
-XXX
+The C<Perl_seed> function will now use the native entropy source
+C<sys$get_entropy> when available (OpenVMS 9.2 and later).
=back
diff --git a/util.c b/util.c
index 9347ccfacb..50194acf61 100644
--- a/util.c
+++ b/util.c
@@ -4795,6 +4795,14 @@ Perl_seed(pTHX)
}
#endif
+#if defined(__VMS) && __VMS_VER >= 90200000
+ /* Use the native entropy if available. Can supply up to 256 bytes
+ * in one call. */
+ if ($VMS_STATUS_SUCCESS(sys$get_entropy(&seed, sizeof(seed)))) {
+ return seed;
+ }
+#endif
+
/* We only get this far if /dev/urandom is not available or the read fails.
* Grab several state variables and hash those for randomness instead. */