--- tool_metalink.c.orig	2012-10-01 13:03:07.000000000 -0700
+++ tool_metalink.c	2012-11-17 21:15:02.850392800 -0800
@@ -33,7 +33,26 @@
 #  include <fcntl.h>
 #endif
 
-#ifdef USE_SSLEAY
+#ifdef _WIN32
+/* For Windows: If no other crypto library is provided, we fallback
+   to the hash functions provided within the Microsoft Windows CryptoAPI */
+#  include <wincrypt.h>
+/* Custom structure in order to store the required provider and hash handle */
+struct win32_crypto_hash {
+  HCRYPTPROV hCryptProv;
+  HCRYPTHASH hHash;
+};
+/* Custom Microsoft AES Cryptographic Provider defines required for MinGW */
+#  ifndef ALG_SID_SHA_256
+#    define ALG_SID_SHA_256  12
+#  endif
+#  ifndef CALG_SHA_256
+#    define CALG_SHA_256 (ALG_CLASS_HASH | ALG_TYPE_ANY | ALG_SID_SHA_256)
+#  endif
+#  define MD5_CTX    struct win32_crypto_hash
+#  define SHA_CTX    struct win32_crypto_hash
+#  define SHA256_CTX struct win32_crypto_hash
+#elif defined(USE_SSLEAY)
 #  ifdef USE_OPENSSL
 #    include <openssl/md5.h>
 #    include <openssl/sha.h>
@@ -61,25 +80,6 @@
    and later. If you're building for an older cat, well, sorry. */
 #  define COMMON_DIGEST_FOR_OPENSSL
 #  include <CommonCrypto/CommonDigest.h>
-#elif defined(_WIN32)
-/* For Windows: If no other crypto library is provided, we fallback
-   to the hash functions provided within the Microsoft Windows CryptoAPI */
-#  include <wincrypt.h>
-/* Custom structure in order to store the required provider and hash handle */
-struct win32_crypto_hash {
-  HCRYPTPROV hCryptProv;
-  HCRYPTHASH hHash;
-};
-/* Custom Microsoft AES Cryptographic Provider defines required for MinGW */
-#  ifndef ALG_SID_SHA_256
-#    define ALG_SID_SHA_256  12
-#  endif
-#  ifndef CALG_SHA_256
-#    define CALG_SHA_256 (ALG_CLASS_HASH | ALG_TYPE_ANY | ALG_SID_SHA_256)
-#  endif
-#  define MD5_CTX    struct win32_crypto_hash
-#  define SHA_CTX    struct win32_crypto_hash
-#  define SHA256_CTX struct win32_crypto_hash
 #else
 #  error "Can't compile METALINK support without a crypto library."
 #endif
