fips/fips_[canister|premain].c: make it work with VC6 and add sentinels
authorAndy Polyakov <appro@openssl.org>
Thu, 20 Oct 2011 12:09:13 +0000 (12:09 +0000)
committerAndy Polyakov <appro@openssl.org>
Thu, 20 Oct 2011 12:09:13 +0000 (12:09 +0000)
even to code segments.

fips/fips_canister.c
fips/fips_premain.c
fips/fips_premain.c.sha1
fips/fipssyms.h

index 4f187948a23368aed1e096af9cb5761c5027e81a..9e1b038197c40780c948f44da0d19e5337c6f2bf 100644 (file)
@@ -60,7 +60,13 @@ static void *instruction_pointer_xlc(void);
  * big-endian encoded variable names, just to prevent these arrays
  * from being merged by linker. */
 # if defined(_MSC_VER)
-#  pragma section("fipsro$a",read)
+#  pragma code_seg("fipstx")
+#  pragma code_seg()
+   __declspec(allocate("fipstx"))
+const unsigned int FIPS_text_startX[]=
+       { 0x46495053, 0x5f746578, 0x745f7374, 0x61727458 };
+#  pragma const_seg("fipsro$a")
+#  pragma const_seg()
    __declspec(allocate("fipsro$a"))
 # endif
 const unsigned int FIPS_rodata_start[]=
@@ -71,13 +77,20 @@ const unsigned int FIPS_rodata_start[]=
 #  define instruction_pointer  FIPS_text_endX
 # endif
 # if defined(_MSC_VER)
-#  pragma section("fipsro$c",read)
-   __declspec(allocate("fipsro$c"))
+#  pragma code_seg("fipstx$z")
+#  pragma code_seg()
+   __declspec(allocate("fipstx$z"))
+const unsigned int FIPS_text_endX[]=
+       { 0x46495053, 0x5f746578, 0x745f656e, 0x64585b5d };
+#  pragma const_seg("fipsro$z")
+#  pragma const_seg()
+   __declspec(allocate("fipsro$z"))
 # endif
 const unsigned int FIPS_rodata_end[]=
        { 0x46495053, 0x5f726f64, 0x6174615f, 0x656e645b };
 #endif
 
+#if !defined(_MSC_VER) || !defined(instruction_pointer)
 /*
  * I declare reference function as static in order to avoid certain
  * pitfalls in -dynamic linker behaviour...
@@ -159,6 +172,7 @@ static void *instruction_pointer(void)
 #endif
   return ret;
 }
+#endif
 
 /*
  * This function returns pointer to an instruction in the vicinity of
index fc448d0eaaa1f989a296630fb86e733af055d218..a7c8b78f8f716d7099c52f5a33c902ec41c7f702 100644 (file)
@@ -69,7 +69,8 @@
 #endif
 
 #if defined(_MSC_VER)
-# pragma section("fipsro",read)
+# pragma const_seg("fipsro")
+# pragma const_seg()
   __declspec(allocate("fipsro"))
 #endif
 static const unsigned char FINGERPRINT_ascii_value[41] = HMAC_SHA1_SIG;
index 20fa600a786b31022e483eea3586a1a45754e587..e0332e8afdc4565ef76aa8386d3bbdd2b3a6f11e 100644 (file)
@@ -1 +1 @@
-HMAC-SHA1(fips_premain.c)= 3b8c0f293cb26288698881095a7be2e2fc24ea6b
+HMAC-SHA1(fips_premain.c)= a401afd9c2b57f0f11d2b34b6d0c9815b1fe6a66
index 08c69da77ab3b22159f6fe110385fba50b7fc03b..5b1e18878597bdbc2ce07f897bc4dd8968c07ef5 100644 (file)
 #define bn_gather5 fips_bn_gather5
 
 #if defined(_MSC_VER)
-# pragma section("fipsro$b",read)
+# pragma const_seg("fipsro$b")
+# pragma const_seg()
 # define __fips_constseg __declspec(allocate("fipsro$b"))
 #else
 # define __fips_constseg