Selaa lähdekoodia

Merge pull request #8013 from ghalliday/issue14662

HPCC-14662 Disable strict aliasing for jencrypt

Reviewed-By: Richard Chapman <rchapman@hpccsystems.com>
Richard Chapman 9 vuotta sitten
vanhempi
commit
6485b916a1
2 muutettua tiedostoa jossa 15 lisäystä ja 14 poistoa
  1. 1 0
      system/jlib/CMakeLists.txt
  2. 14 14
      system/jlib/jencrypt.cpp

+ 1 - 0
system/jlib/CMakeLists.txt

@@ -151,6 +151,7 @@ set (    INCLUDES
 
 if (CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_CLANG)
     set_source_files_properties (jmalloc.cpp PROPERTIES COMPILE_FLAGS -fno-strict-aliasing)
+    set_source_files_properties (jencrypt.cpp PROPERTIES COMPILE_FLAGS -fno-strict-aliasing)
 endif ()
 
 include_directories ( 

+ 14 - 14
system/jlib/jencrypt.cpp

@@ -171,7 +171,7 @@ protected:
 
 
 
-static UINT8 S[256]=
+static const UINT8 S[256]=
 {
      99, 124, 119, 123, 242, 107, 111, 197,  48,   1, 103,  43, 254, 215, 171, 118, 
     202, 130, 201, 125, 250,  89,  71, 240, 173, 212, 162, 175, 156, 164, 114, 192, 
@@ -192,7 +192,7 @@ static UINT8 S[256]=
 };
 
 
-static UINT8 T1[256][4]=
+static const UINT8 T1[256][4]=
 {
     0xc6,0x63,0x63,0xa5, 0xf8,0x7c,0x7c,0x84, 0xee,0x77,0x77,0x99, 0xf6,0x7b,0x7b,0x8d, 
     0xff,0xf2,0xf2,0x0d, 0xd6,0x6b,0x6b,0xbd, 0xde,0x6f,0x6f,0xb1, 0x91,0xc5,0xc5,0x54, 
@@ -260,7 +260,7 @@ static UINT8 T1[256][4]=
     0x7b,0xb0,0xb0,0xcb, 0xa8,0x54,0x54,0xfc, 0x6d,0xbb,0xbb,0xd6, 0x2c,0x16,0x16,0x3a
 };
     
-static UINT8 T2[256][4]=
+static const UINT8 T2[256][4]=
 {
     0xa5,0xc6,0x63,0x63, 0x84,0xf8,0x7c,0x7c, 0x99,0xee,0x77,0x77, 0x8d,0xf6,0x7b,0x7b, 
     0x0d,0xff,0xf2,0xf2, 0xbd,0xd6,0x6b,0x6b, 0xb1,0xde,0x6f,0x6f, 0x54,0x91,0xc5,0xc5, 
@@ -328,7 +328,7 @@ static UINT8 T2[256][4]=
     0xcb,0x7b,0xb0,0xb0, 0xfc,0xa8,0x54,0x54, 0xd6,0x6d,0xbb,0xbb, 0x3a,0x2c,0x16,0x16
 };
 
-static UINT8 T3[256][4]=
+static const UINT8 T3[256][4]=
 {
     0x63,0xa5,0xc6,0x63, 0x7c,0x84,0xf8,0x7c, 0x77,0x99,0xee,0x77, 0x7b,0x8d,0xf6,0x7b, 
     0xf2,0x0d,0xff,0xf2, 0x6b,0xbd,0xd6,0x6b, 0x6f,0xb1,0xde,0x6f, 0xc5,0x54,0x91,0xc5, 
@@ -396,7 +396,7 @@ static UINT8 T3[256][4]=
     0xb0,0xcb,0x7b,0xb0, 0x54,0xfc,0xa8,0x54, 0xbb,0xd6,0x6d,0xbb, 0x16,0x3a,0x2c,0x16
 };
 
-static UINT8 T4[256][4]=
+static const UINT8 T4[256][4]=
 {
     0x63,0x63,0xa5,0xc6, 0x7c,0x7c,0x84,0xf8, 0x77,0x77,0x99,0xee, 0x7b,0x7b,0x8d,0xf6, 
     0xf2,0xf2,0x0d,0xff, 0x6b,0x6b,0xbd,0xd6, 0x6f,0x6f,0xb1,0xde, 0xc5,0xc5,0x54,0x91, 
@@ -464,7 +464,7 @@ static UINT8 T4[256][4]=
     0xb0,0xb0,0xcb,0x7b, 0x54,0x54,0xfc,0xa8, 0xbb,0xbb,0xd6,0x6d, 0x16,0x16,0x3a,0x2c
 };
 
-static UINT8 T5[256][4]=
+static const UINT8 T5[256][4]=
 {
     0x51,0xf4,0xa7,0x50, 0x7e,0x41,0x65,0x53, 0x1a,0x17,0xa4,0xc3, 0x3a,0x27,0x5e,0x96, 
     0x3b,0xab,0x6b,0xcb, 0x1f,0x9d,0x45,0xf1, 0xac,0xfa,0x58,0xab, 0x4b,0xe3,0x03,0x93, 
@@ -532,7 +532,7 @@ static UINT8 T5[256][4]=
     0x7b,0xcb,0x84,0x61, 0xd5,0x32,0xb6,0x70, 0x48,0x6c,0x5c,0x74, 0xd0,0xb8,0x57,0x42
 };
 
-static UINT8 T6[256][4]=
+static const UINT8 T6[256][4]=
 {
     0x50,0x51,0xf4,0xa7, 0x53,0x7e,0x41,0x65, 0xc3,0x1a,0x17,0xa4, 0x96,0x3a,0x27,0x5e, 
     0xcb,0x3b,0xab,0x6b, 0xf1,0x1f,0x9d,0x45, 0xab,0xac,0xfa,0x58, 0x93,0x4b,0xe3,0x03, 
@@ -600,7 +600,7 @@ static UINT8 T6[256][4]=
     0x61,0x7b,0xcb,0x84, 0x70,0xd5,0x32,0xb6, 0x74,0x48,0x6c,0x5c, 0x42,0xd0,0xb8,0x57
 };
 
-static UINT8 T7[256][4]=
+static const UINT8 T7[256][4]=
 {
     0xa7,0x50,0x51,0xf4, 0x65,0x53,0x7e,0x41, 0xa4,0xc3,0x1a,0x17, 0x5e,0x96,0x3a,0x27, 
     0x6b,0xcb,0x3b,0xab, 0x45,0xf1,0x1f,0x9d, 0x58,0xab,0xac,0xfa, 0x03,0x93,0x4b,0xe3, 
@@ -668,7 +668,7 @@ static UINT8 T7[256][4]=
     0x84,0x61,0x7b,0xcb, 0xb6,0x70,0xd5,0x32, 0x5c,0x74,0x48,0x6c, 0x57,0x42,0xd0,0xb8
 };
 
-static UINT8 T8[256][4]=
+static const UINT8 T8[256][4]=
 {
     0xf4,0xa7,0x50,0x51, 0x41,0x65,0x53,0x7e, 0x17,0xa4,0xc3,0x1a, 0x27,0x5e,0x96,0x3a, 
     0xab,0x6b,0xcb,0x3b, 0x9d,0x45,0xf1,0x1f, 0xfa,0x58,0xab,0xac, 0xe3,0x03,0x93,0x4b, 
@@ -736,7 +736,7 @@ static UINT8 T8[256][4]=
     0xcb,0x84,0x61,0x7b, 0x32,0xb6,0x70,0xd5, 0x6c,0x5c,0x74,0x48, 0xb8,0x57,0x42,0xd0
 };
 
-static UINT8 S5[256]=
+static const UINT8 S5[256]=
 {
     0x52,0x09,0x6a,0xd5,
     0x30,0x36,0xa5,0x38,
@@ -804,7 +804,7 @@ static UINT8 S5[256]=
     0x55,0x21,0x0c,0x7d
 };
 
-static UINT8 U1[256][4]=
+static const UINT8 U1[256][4]=
 {
     0x00,0x00,0x00,0x00, 0x0e,0x09,0x0d,0x0b, 0x1c,0x12,0x1a,0x16, 0x12,0x1b,0x17,0x1d, 
     0x38,0x24,0x34,0x2c, 0x36,0x2d,0x39,0x27, 0x24,0x36,0x2e,0x3a, 0x2a,0x3f,0x23,0x31, 
@@ -872,7 +872,7 @@ static UINT8 U1[256][4]=
     0x9f,0x5d,0x80,0xbe, 0x91,0x54,0x8d,0xb5, 0x83,0x4f,0x9a,0xa8, 0x8d,0x46,0x97,0xa3
 };
     
-static UINT8 U2[256][4]=
+static const UINT8 U2[256][4]=
 {
     0x00,0x00,0x00,0x00, 0x0b,0x0e,0x09,0x0d, 0x16,0x1c,0x12,0x1a, 0x1d,0x12,0x1b,0x17, 
     0x2c,0x38,0x24,0x34, 0x27,0x36,0x2d,0x39, 0x3a,0x24,0x36,0x2e, 0x31,0x2a,0x3f,0x23, 
@@ -940,7 +940,7 @@ static UINT8 U2[256][4]=
     0xbe,0x9f,0x5d,0x80, 0xb5,0x91,0x54,0x8d, 0xa8,0x83,0x4f,0x9a, 0xa3,0x8d,0x46,0x97
 };
 
-static UINT8 U3[256][4]=
+static const UINT8 U3[256][4]=
 {
     0x00,0x00,0x00,0x00, 0x0d,0x0b,0x0e,0x09, 0x1a,0x16,0x1c,0x12, 0x17,0x1d,0x12,0x1b, 
     0x34,0x2c,0x38,0x24, 0x39,0x27,0x36,0x2d, 0x2e,0x3a,0x24,0x36, 0x23,0x31,0x2a,0x3f, 
@@ -1008,7 +1008,7 @@ static UINT8 U3[256][4]=
     0x80,0xbe,0x9f,0x5d, 0x8d,0xb5,0x91,0x54, 0x9a,0xa8,0x83,0x4f, 0x97,0xa3,0x8d,0x46
 };
 
-static UINT8 U4[256][4]=
+static const UINT8 U4[256][4]=
 {
     0x00,0x00,0x00,0x00, 0x09,0x0d,0x0b,0x0e, 0x12,0x1a,0x16,0x1c, 0x1b,0x17,0x1d,0x12, 
     0x24,0x34,0x2c,0x38, 0x2d,0x39,0x27,0x36, 0x36,0x2e,0x3a,0x24, 0x3f,0x23,0x31,0x2a,