VMS: only use the high precision on VMS v8.4 and up
authorRichard Levitte <richard@levitte.org>
Sat, 15 Sep 2018 12:59:06 +0000 (14:59 +0200)
committerRichard Levitte <levitte@openssl.org>
Sat, 15 Sep 2018 13:44:45 +0000 (15:44 +0200)
It simply isn't available on older versions.

Issue submitted by Mark Daniels

Fixes #7229

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com>
(Merged from https://github.com/openssl/openssl/pull/7230)

(cherry picked from commit d6d6aa3521e207c2727bbd1e5c97772502d15739)

crypto/rand/rand_vms.c

index 43dddf3c93d101218f4fd1bf7d4cea4e4bec64f7..bfcf6f0a86c508e9b0c23411f67c6ae2ac2d77d4 100644 (file)
@@ -478,13 +478,18 @@ int rand_pool_add_nonce_data(RAND_POOL *pool)
     } data = { 0 };
 
     /*
-     * Add process id, thread id, and a high resolution timestamp to
-     * ensure that the nonce is unique whith high probability for
-     * different process instances.
+     * Add process id, thread id, and a high resolution timestamp
+     * (where available, which is OpenVMS v8.4 and up) to ensure that
+     * the nonce is unique whith high probability for different process
+     * instances.
      */
     data.pid = getpid();
     data.tid = CRYPTO_THREAD_get_current_id();
+#if __CRTL_VER >= 80400000
     sys$gettim_prec(&data.time);
+#else
+    sys$gettim((void*)&data.time);
+#endif
 
     return rand_pool_add(pool, (unsigned char *)&data, sizeof(data), 0);
 }