From 978f80cac5bbaab340017a306ec505410fcf2cb5 Mon Sep 17 00:00:00 2001
From: magnum <magnum>
Date: Wed, 16 Nov 2011 01:38:48 +0100
Subject: [PATCH] j8: Correct Cygwin align bug workaround

---
 src/mssql-old_fmt_plug.c |    6 +++---
 src/mssql05_fmt_plug.c   |    6 +++---
 src/mysqlSHA1_fmt_plug.c |    8 ++++----
 src/nsldap_fmt_plug.c    |    6 +++---
 src/rawMD4_fmt_plug.c    |    8 ++++----
 src/rawSHA1_fmt_plug.c   |    2 +-
 6 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/src/mssql-old_fmt_plug.c b/src/mssql-old_fmt_plug.c
index 927c1e9..bf4bab5 100644
--- a/src/mssql-old_fmt_plug.c
+++ b/src/mssql-old_fmt_plug.c
@@ -86,15 +86,15 @@ static struct fmt_tests tests[] = {
 static unsigned char cursalt[SALT_SIZE];
 
 #ifdef MMX_COEF
-#ifdef _MSC_VER
 /* Cygwin would not guarantee the alignment if these were declared static */
 #define saved_key mssql_saved_key
 #define crypt_key mssql_crypt_key
+#ifdef _MSC_VER
 __declspec(align(16)) char saved_key[80*4*NBKEYS];
 __declspec(align(16)) char crypt_key[BINARY_SIZE*NBKEYS];
 #else
-static char saved_key[80*4*NBKEYS] __attribute__ ((aligned(16)));
-static char crypt_key[BINARY_SIZE*NBKEYS] __attribute__ ((aligned(16)));
+char saved_key[80*4*NBKEYS] __attribute__ ((aligned(16)));
+char crypt_key[BINARY_SIZE*NBKEYS] __attribute__ ((aligned(16)));
 #endif
 #ifndef SHA1_SSE_PARA
 static unsigned long total_len;
diff --git a/src/mssql05_fmt_plug.c b/src/mssql05_fmt_plug.c
index 3f86330..18fe3b8 100644
--- a/src/mssql05_fmt_plug.c
+++ b/src/mssql05_fmt_plug.c
@@ -89,15 +89,15 @@ static struct fmt_tests tests[] = {
 static unsigned char cursalt[SALT_SIZE];
 
 #ifdef MMX_COEF
-#ifdef _MSC_VER
 /* Cygwin would not guarantee the alignment if these were declared static */
 #define saved_key mssql05_saved_key
 #define crypt_key mssql05_crypt_key
+#ifdef _MSC_VER
 __declspec(align(16)) char saved_key[80*4*NBKEYS];
 __declspec(align(16)) char crypt_key[BINARY_SIZE*NBKEYS];
 #else
-static char saved_key[80*4*NBKEYS] __attribute__ ((aligned(16)));
-static char crypt_key[BINARY_SIZE*NBKEYS] __attribute__ ((aligned(16)));
+char saved_key[80*4*NBKEYS] __attribute__ ((aligned(16)));
+char crypt_key[BINARY_SIZE*NBKEYS] __attribute__ ((aligned(16)));
 #endif
 #ifndef SHA1_SSE_PARA
 static unsigned long total_len;
diff --git a/src/mysqlSHA1_fmt_plug.c b/src/mysqlSHA1_fmt_plug.c
index 4025703..8c82593 100644
--- a/src/mysqlSHA1_fmt_plug.c
+++ b/src/mysqlSHA1_fmt_plug.c
@@ -89,18 +89,18 @@ static struct fmt_tests tests[] = {
 };
 
 #ifdef MMX_COEF
-#ifdef _MSC_VER
 /* Cygwin would not guarantee the alignment if these were declared static */
 #define saved_key mysqlSHA1_saved_key
 #define crypt_key mysqlSHA1_crypt_key
 #define interm_key mysqlSHA1_interm_key
+#ifdef _MSC_VER
 __declspec(align(16)) char saved_key[80*4*NBKEYS];
 __declspec(align(16)) char crypt_key[BINARY_SIZE*NBKEYS];
 __declspec(align(16)) char interm_key[80*4*NBKEYS];
 #else
-static char saved_key[80*4*NBKEYS] __attribute__ ((aligned(16)));
-static char crypt_key[BINARY_SIZE*NBKEYS] __attribute__ ((aligned(16)));
-static char interm_key[80*4*NBKEYS] __attribute__ ((aligned(16)));
+char saved_key[80*4*NBKEYS] __attribute__ ((aligned(16)));
+char crypt_key[BINARY_SIZE*NBKEYS] __attribute__ ((aligned(16)));
+char interm_key[80*4*NBKEYS] __attribute__ ((aligned(16)));
 #endif
 #ifndef SHA1_SSE_PARA
 static unsigned long total_len;
diff --git a/src/nsldap_fmt_plug.c b/src/nsldap_fmt_plug.c
index 5247c42..d6cd756 100644
--- a/src/nsldap_fmt_plug.c
+++ b/src/nsldap_fmt_plug.c
@@ -69,15 +69,15 @@ static struct fmt_tests tests[] = {
 };
 
 #ifdef MMX_COEF
-#if defined (_MSC_VER)
 /* Cygwin would not guarantee the alignment if these were declared static */
 #define saved_key nsldap_saved_key
 #define crypt_key nsldap_crypt_key
+#if defined (_MSC_VER)
 __declspec(align(16)) unsigned char saved_key[80*4*NBKEYS];
 __declspec(align(16)) unsigned char crypt_key[BINARY_SIZE*NBKEYS];
 #else
-static unsigned char saved_key[80*4*NBKEYS] __attribute__ ((aligned(16)));
-static unsigned char crypt_key[BINARY_SIZE*NBKEYS] __attribute__ ((aligned(16)));
+unsigned char saved_key[80*4*NBKEYS] __attribute__ ((aligned(16)));
+unsigned char crypt_key[BINARY_SIZE*NBKEYS] __attribute__ ((aligned(16)));
 #endif
 #ifndef SHA1_SSE_PARA
 static unsigned long total_len;
diff --git a/src/rawMD4_fmt_plug.c b/src/rawMD4_fmt_plug.c
index c998f92..d14e489 100644
--- a/src/rawMD4_fmt_plug.c
+++ b/src/rawMD4_fmt_plug.c
@@ -48,15 +48,15 @@ static struct fmt_tests tests[] = {
 };
 
 #ifdef MD4_SSE_PARA
-#if defined (_MSC_VER)
+/* Cygwin would not guarantee the alignment if these were declared static */
 #define saved_key rawmd4_saved_key
 #define crypt_key rawmd4_crypt_key
-/* Cygwin would not guarantee the alignment if these were declared static */
+#if defined (_MSC_VER)
 __declspec(align(16)) char saved_key[64*MAX_KEYS_PER_CRYPT];
 __declspec(align(16)) char crypt_key[BINARY_SIZE*MAX_KEYS_PER_CRYPT];
 #else
-static char saved_key[64*MAX_KEYS_PER_CRYPT] __attribute__ ((aligned(16)));
-static char crypt_key[BINARY_SIZE*MAX_KEYS_PER_CRYPT] __attribute__ ((aligned(16)));
+char saved_key[64*MAX_KEYS_PER_CRYPT] __attribute__ ((aligned(16)));
+char crypt_key[BINARY_SIZE*MAX_KEYS_PER_CRYPT] __attribute__ ((aligned(16)));
 #endif
 static unsigned char out[PLAINTEXT_LENGTH + 1];
 #else
diff --git a/src/rawSHA1_fmt_plug.c b/src/rawSHA1_fmt_plug.c
index 2d71793..950f2ba 100644
--- a/src/rawSHA1_fmt_plug.c
+++ b/src/rawSHA1_fmt_plug.c
@@ -72,10 +72,10 @@ static struct fmt_tests rawsha1_tests[] = {
 	{NULL}
 };
 
-#ifdef MMX_COEF
 /* Cygwin would not guarantee the alignment if these were declared static */
 #define saved_key rawSHA1_saved_key
 #define crypt_key rawSHA1_crypt_key
+#ifdef MMX_COEF
 #if defined (_MSC_VER)
 __declspec(align(16)) char saved_key[80*4*NBKEYS];
 __declspec(align(16)) char crypt_key[BINARY_SIZE*NBKEYS];
-- 
1.7.5.4

