[openssl-commits] [openssl] master update

Dr. Stephen Henson steve at openssl.org
Thu May 14 01:07:27 UTC 2015


The branch master has been updated
       via  1c7b2c0ed5d02d0d60179e0df0c49ef3f659fa77 (commit)
       via  c1a623c55ad4b9e184438653d55f7853ee48ba29 (commit)
      from  98cd49db1df8091ac10459f75d07f7eb53e82d6c (commit)


- Log -----------------------------------------------------------------
commit 1c7b2c0ed5d02d0d60179e0df0c49ef3f659fa77
Author: Dr. Stephen Henson <steve at openssl.org>
Date:   Wed May 13 17:47:13 2015 +0100

    use unit64_t for CPUID and timestamp code
    
    Reviewed-by: Matt Caswell <matt at openssl.org>

commit c1a623c55ad4b9e184438653d55f7853ee48ba29
Author: Dr. Stephen Henson <steve at openssl.org>
Date:   Wed May 13 17:34:53 2015 +0100

    Allow use of standard integer types.
    
    Include appropriate headers for standard integer types in e_os2.h
    
    This should use stdint.h, inttypes.h or a workaround for systems which
    have neither.
    
    Reviewed-by: Matt Caswell <matt at openssl.org>

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

Summary of changes:
 crypto/cryptlib.c       |  6 +-----
 crypto/x509v3/v3_scts.c | 28 ++++++++++------------------
 include/openssl/e_os2.h | 39 +++++++++++++++++++++++++++++++++++++++
 3 files changed, 50 insertions(+), 23 deletions(-)

diff --git a/crypto/cryptlib.c b/crypto/cryptlib.c
index 3742ff2..69883ab 100644
--- a/crypto/cryptlib.c
+++ b/crypto/cryptlib.c
@@ -134,11 +134,7 @@ unsigned int *OPENSSL_ia32cap_loc(void)
 
 # if defined(OPENSSL_CPUID_OBJ) && !defined(OPENSSL_NO_ASM) && !defined(I386_ONLY)
 #  define OPENSSL_CPUID_SETUP
-#  if defined(_WIN32)
-typedef unsigned __int64 IA32CAP;
-#  else
-typedef unsigned long long IA32CAP;
-#  endif
+typedef uint64_t IA32CAP;
 void OPENSSL_cpuid_setup(void)
 {
     static int trigger = 0;
diff --git a/crypto/x509v3/v3_scts.c b/crypto/x509v3/v3_scts.c
index a9e1a97..e9ee668 100644
--- a/crypto/x509v3/v3_scts.c
+++ b/crypto/x509v3/v3_scts.c
@@ -71,22 +71,14 @@
 #define n2s(c,s)        ((s=(((unsigned int)(c[0]))<< 8)| \
                             (((unsigned int)(c[1]))    )),c+=2)
 
-#if (defined(_WIN32) || defined(_WIN64)) && !defined(__MINGW32__)
-# define SCT_TIMESTAMP unsigned __int64
-#elif defined(__arch64__)
-# define SCT_TIMESTAMP unsigned long
-#else
-# define SCT_TIMESTAMP unsigned long long
-#endif
-
-#define n2l8(c,l)       (l =((SCT_TIMESTAMP)(*((c)++)))<<56, \
-                         l|=((SCT_TIMESTAMP)(*((c)++)))<<48, \
-                         l|=((SCT_TIMESTAMP)(*((c)++)))<<40, \
-                         l|=((SCT_TIMESTAMP)(*((c)++)))<<32, \
-                         l|=((SCT_TIMESTAMP)(*((c)++)))<<24, \
-                         l|=((SCT_TIMESTAMP)(*((c)++)))<<16, \
-                         l|=((SCT_TIMESTAMP)(*((c)++)))<< 8, \
-                         l|=((SCT_TIMESTAMP)(*((c)++))))
+#define n2l8(c,l)       (l =((uint64_t)(*((c)++)))<<56, \
+                         l|=((uint64_t)(*((c)++)))<<48, \
+                         l|=((uint64_t)(*((c)++)))<<40, \
+                         l|=((uint64_t)(*((c)++)))<<32, \
+                         l|=((uint64_t)(*((c)++)))<<24, \
+                         l|=((uint64_t)(*((c)++)))<<16, \
+                         l|=((uint64_t)(*((c)++)))<< 8, \
+                         l|=((uint64_t)(*((c)++))))
 
 typedef struct SCT_st {
     /* The encoded SCT */
@@ -99,7 +91,7 @@ typedef struct SCT_st {
     unsigned char version;
     unsigned char *logid;
     unsigned short logidlen;
-    SCT_TIMESTAMP timestamp;
+    uint64_t timestamp;
     unsigned char *ext;
     unsigned short extlen;
     unsigned char hash_alg;
@@ -149,7 +141,7 @@ static void tls12_signature_print(BIO *out, const unsigned char hash_alg,
         BIO_printf(out, "%s", OBJ_nid2ln(nid));
 }
 
-static void timestamp_print(BIO *out, SCT_TIMESTAMP timestamp)
+static void timestamp_print(BIO *out, uint64_t timestamp)
 {
     ASN1_GENERALIZEDTIME *gen;
     char genstr[20];
diff --git a/include/openssl/e_os2.h b/include/openssl/e_os2.h
index 12bad8a..9df7d53 100644
--- a/include/openssl/e_os2.h
+++ b/include/openssl/e_os2.h
@@ -268,6 +268,45 @@ extern "C" {
 #  define __owur
 # endif
 
+/* Standard integer types */
+# if defined(__osf__) || defined(__sgi) || defined(__hpux) || defined(OPENSSL_SYS_VMS)
+#  include <inttypes.h>
+# elif defined(_MSC_VER) && _MSC_VER<=1500
+/*
+ * minimally required typdefs for systems not supporting inttypes.h or
+ * stdint.h: currently just older VC++
+ */
+typedef signed char int8_t;
+typedef unsigned char uint8_t;
+typedef short int16_t;
+typedef unsigned short uint16_t;
+typedef int int32_t;
+typedef unsigned int uint32_t;
+typedef __int64 int64_t;
+typedef unsigned __int64 uint64_t;
+
+#  include <limits.h>
+
+#  define INT8_MAX    SCHAR_MAX
+#  define INT8_MIN    SCHAR_MIN
+#  define UINT8_MAX   UCHAR_MAX
+
+#  define INT16_MAX   SHRT_MAX
+#  define INT16_MIN   SHRT_MIN
+#  define UINT16_MAX  USHRT_MAX
+
+#  define INT32_MAX   INT_MAX
+#  define INT32_MIN   INT_MIN
+#  define UINT32_MAX  UINT_MAX
+
+#  define INT64_MAX   _I64_MAX
+#  define INT64_MIN   _I64_MIN
+#  define UINT64_MAX  _UI64_MAX
+
+# else
+#  include <stdint.h>
+# endif
+
 #ifdef  __cplusplus
 }
 #endif


More information about the openssl-commits mailing list