32 #include "webdav.h" |
32 #include "webdav.h" |
33 #include <ucx/string.h> |
33 #include <ucx/string.h> |
34 |
34 |
35 #ifdef __APPLE__ |
35 #ifdef __APPLE__ |
36 /* macos */ |
36 /* macos */ |
|
37 |
|
38 #define DAV_CRYPTO_COMMON_CRYPTO |
|
39 |
37 #define DAV_AES_CTX CCCryptorRef |
40 #define DAV_AES_CTX CCCryptorRef |
38 #define DAV_SHA_CTX CC_SHA256_CTX |
41 #define DAV_SHA_CTX CC_SHA256_CTX |
39 #define DAV_SHA256_DIGEST_LENGTH 32 |
42 #define DAV_SHA256_DIGEST_LENGTH 32 |
40 |
43 |
41 #include <CommonCrypto/CommonCrypto.h> |
44 #include <CommonCrypto/CommonCrypto.h> |
42 #include <CommonCrypto/CommonDigest.h> |
45 #include <CommonCrypto/CommonDigest.h> |
43 |
46 |
|
47 #elif defined(_WIN32) |
|
48 |
|
49 #define DAV_CRYPTO_CNG |
|
50 |
|
51 #include <windows.h> |
|
52 #include <bcrypt.h> |
|
53 |
|
54 typedef struct WinBCryptCTX { |
|
55 BCRYPT_ALG_HANDLE hAlg; |
|
56 BCRYPT_KEY_HANDLE hKey; |
|
57 void *pbKeyObject; |
|
58 unsigned char pbIV[16]; |
|
59 |
|
60 char buf[16]; |
|
61 size_t buflen; |
|
62 } WinBCryptCTX; |
|
63 |
|
64 typedef struct WinBCryptSHACTX { |
|
65 BCRYPT_ALG_HANDLE hAlg; |
|
66 BCRYPT_HASH_HANDLE hHash; |
|
67 void *pbHashObject; |
|
68 } WinBCryptSHACTX; |
|
69 |
|
70 #define DAV_AES_CTX WinBCryptCTX |
|
71 #define DAV_SHA_CTX WinBCryptSHACTX |
|
72 #define DAV_SHA256_DIGEST_LENGTH 32 |
|
73 |
44 #else |
74 #else |
45 /* unix/linux and still windows */ |
75 /* unix/linux */ |
|
76 |
|
77 #define DAV_USE_OPENSSL |
|
78 |
46 #define DAV_AES_CTX EVP_CIPHER_CTX* |
79 #define DAV_AES_CTX EVP_CIPHER_CTX* |
47 #define DAV_SHA_CTX SHA256_CTX |
80 #define DAV_SHA_CTX SHA256_CTX |
48 #define DAV_SHA256_DIGEST_LENGTH 32 |
81 #define DAV_SHA256_DIGEST_LENGTH 32 |
49 |
|
50 #define DAV_USE_OPENSSL |
|
51 |
82 |
52 #include <openssl/evp.h> |
83 #include <openssl/evp.h> |
53 #include <openssl/rand.h> |
84 #include <openssl/rand.h> |
54 |
85 |
55 #if defined(__sun) && defined(__SunOS_5_10) |
86 #if defined(__sun) && defined(__SunOS_5_10) |