summaryrefslogtreecommitdiff
path: root/libexslt/crypto.c
diff options
context:
space:
mode:
Diffstat (limited to 'libexslt/crypto.c')
-rw-r--r--libexslt/crypto.c24
1 files changed, 13 insertions, 11 deletions
diff --git a/libexslt/crypto.c b/libexslt/crypto.c
index e13db8b1..ac390387 100644
--- a/libexslt/crypto.c
+++ b/libexslt/crypto.c
@@ -1,7 +1,7 @@
#define IN_LIBEXSLT
#include "libexslt/libexslt.h"
-#if defined(WIN32) && !defined (__CYGWIN__) && (!__MINGW32__)
+#if defined(_WIN32) && !defined (__CYGWIN__) && (!__MINGW32__)
#include <win32config.h>
#else
#include "config.h"
@@ -109,7 +109,7 @@ exsltCryptoHex2Bin (const unsigned char *hex, int hexlen,
return j;
}
-#if defined(WIN32)
+#if defined(_WIN32) && !defined(__CYGWIN__)
#define HAVE_CRYPTO
#define PLATFORM_HASH exsltCryptoCryptoApiHash
@@ -121,12 +121,14 @@ exsltCryptoHex2Bin (const unsigned char *hex, int hexlen,
#include <windows.h>
#include <wincrypt.h>
+#ifdef _MSC_VER
#pragma comment(lib, "advapi32.lib")
+#endif
static void
exsltCryptoCryptoApiReportError (xmlXPathParserContextPtr ctxt,
int line) {
- LPVOID lpMsgBuf;
+ char *lpMsgBuf;
DWORD dw = GetLastError ();
FormatMessage (FORMAT_MESSAGE_ALLOCATE_BUFFER |
@@ -143,7 +145,7 @@ exsltCryptoCryptoApiReportError (xmlXPathParserContextPtr ctxt,
static HCRYPTHASH
exsltCryptoCryptoApiCreateHash (xmlXPathParserContextPtr ctxt,
HCRYPTPROV hCryptProv, ALG_ID algorithm,
- const char *msg, unsigned int msglen,
+ const unsigned char *msg, unsigned int msglen,
char *dest, unsigned int destlen)
{
HCRYPTHASH hHash = 0;
@@ -154,12 +156,12 @@ exsltCryptoCryptoApiCreateHash (xmlXPathParserContextPtr ctxt,
return 0;
}
- if (!CryptHashData (hHash, (const BYTE *) msg, msglen, 0)) {
+ if (!CryptHashData (hHash, msg, msglen, 0)) {
exsltCryptoCryptoApiReportError (ctxt, __LINE__);
goto fail;
}
- if (!CryptGetHashParam (hHash, HP_HASHVAL, dest, &dwHashLen, 0)) {
+ if (!CryptGetHashParam (hHash, HP_HASHVAL, (BYTE *) dest, &dwHashLen, 0)) {
exsltCryptoCryptoApiReportError (ctxt, __LINE__);
goto fail;
}
@@ -194,8 +196,8 @@ exsltCryptoCryptoApiHash (xmlXPathParserContextPtr ctxt,
}
hHash = exsltCryptoCryptoApiCreateHash (ctxt, hCryptProv,
- algorithm, msg, msglen,
- dest, HASH_DIGEST_LENGTH);
+ algorithm, (unsigned char *) msg,
+ msglen, dest, HASH_DIGEST_LENGTH);
if (0 != hHash) {
CryptDestroyHash (hHash);
}
@@ -212,7 +214,7 @@ exsltCryptoCryptoApiRc4Encrypt (xmlXPathParserContextPtr ctxt,
HCRYPTKEY hKey;
HCRYPTHASH hHash;
DWORD dwDataLen;
- unsigned char hash[HASH_DIGEST_LENGTH];
+ char hash[HASH_DIGEST_LENGTH];
if (msglen > destlen) {
xsltTransformError (xsltXPathGetTransformContext (ctxt), NULL,
@@ -263,7 +265,7 @@ exsltCryptoCryptoApiRc4Decrypt (xmlXPathParserContextPtr ctxt,
HCRYPTKEY hKey;
HCRYPTHASH hHash;
DWORD dwDataLen;
- unsigned char hash[HASH_DIGEST_LENGTH];
+ char hash[HASH_DIGEST_LENGTH];
if (msglen > destlen) {
xsltTransformError (xsltXPathGetTransformContext (ctxt), NULL,
@@ -305,7 +307,7 @@ exsltCryptoCryptoApiRc4Decrypt (xmlXPathParserContextPtr ctxt,
CryptReleaseContext (hCryptProv, 0);
}
-#endif /* defined(WIN32) */
+#endif /* defined(_WIN32) */
#if defined(HAVE_GCRYPT)