[openssl-commits] [openssl] OpenSSL_1_1_0-stable update

Richard Levitte levitte at openssl.org
Wed Mar 1 10:53:06 UTC 2017


The branch OpenSSL_1_1_0-stable has been updated
       via  1c78765f2dcc0d30bcc1ac279cc03cb388808c95 (commit)
      from  1bc45dd2cc8b4e18d8fc530f68c8949fab335643 (commit)


- Log -----------------------------------------------------------------
commit 1c78765f2dcc0d30bcc1ac279cc03cb388808c95
Author: Richard Levitte <levitte at openssl.org>
Date:   Wed Mar 1 10:33:20 2017 +0100

    VMS: compensate for gmtime_r() parameter pointer size
    
    With VMS C, the second parameter takes a 32-bit pointer.  When
    building with 64-bit pointer size default, we must compensate.
    
    Reviewed-by: Andy Polyakov <appro at openssl.org>
    (Merged from https://github.com/openssl/openssl/pull/2811)
    (cherry picked from commit 48ce800aa5a2ccee204ad3960a20c4ca14acb3a1)

-----------------------------------------------------------------------

Summary of changes:
 crypto/o_time.c | 24 +++++++++++++++++++++++-
 1 file changed, 23 insertions(+), 1 deletion(-)

diff --git a/crypto/o_time.c b/crypto/o_time.c
index aa74340..3690232 100755
--- a/crypto/o_time.c
+++ b/crypto/o_time.c
@@ -15,7 +15,29 @@ struct tm *OPENSSL_gmtime(const time_t *timer, struct tm *result)
 {
     struct tm *ts = NULL;
 
-#if defined(OPENSSL_THREADS) && !defined(OPENSSL_SYS_WIN32) && !defined(OPENSSL_SYS_MACOSX)
+#if defined(OPENSSL_THREADS) && defined(OPENSSL_SYS_VMS)
+    {
+        /*
+         * On VMS, gmtime_r() takes a 32-bit pointer as second argument.
+         * Since we can't know that |result| is in a space that can easily
+         * translate to a 32-bit pointer, we must store temporarly on stack
+         * and copy the result.  The stack is always reachable with 32-bit
+         * pointers.
+         */
+#if defined(OPENSSL_SYS_VMS) && __INITIAL_POINTER_SIZE
+# pragma pointer_size save
+# pragma pointer_size 32
+#endif
+        struct tm data, *ts2 = &data;
+#if defined OPENSSL_SYS_VMS && __INITIAL_POINTER_SIZE
+# pragma pointer_size restore
+#endif
+        if (gmtime_r(timer, ts2) == NULL)
+            return NULL;
+        memcpy(result, ts2, sizeof(struct tm));
+        ts = result;
+    }
+#elif defined(OPENSSL_THREADS) && !defined(OPENSSL_SYS_WIN32) && !defined(OPENSSL_SYS_MACOSX)
     if (gmtime_r(timer, result) == NULL)
         return NULL;
     ts = result;


More information about the openssl-commits mailing list