libidav/crypto.h

Sat, 25 Jul 2020 12:08:15 +0200

author
Olaf Wintermann <olaf.wintermann@gmail.com>
date
Sat, 25 Jul 2020 12:08:15 +0200
changeset 724
9c2f0072abed
parent 689
b1f7d83f6e69
child 747
efbd59642577
permissions
-rw-r--r--

sort files in outgoing cmd

40
a95ee94b9204 supports whitespace in paths
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1 /*
a95ee94b9204 supports whitespace in paths
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
2 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
a95ee94b9204 supports whitespace in paths
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
3 *
404
5c08b8e14df8 updates copyright notice
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 367
diff changeset
4 * Copyright 2018 Olaf Wintermann. All rights reserved.
40
a95ee94b9204 supports whitespace in paths
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
5 *
a95ee94b9204 supports whitespace in paths
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
6 * Redistribution and use in source and binary forms, with or without
a95ee94b9204 supports whitespace in paths
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
7 * modification, are permitted provided that the following conditions are met:
a95ee94b9204 supports whitespace in paths
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
8 *
a95ee94b9204 supports whitespace in paths
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
9 * 1. Redistributions of source code must retain the above copyright
a95ee94b9204 supports whitespace in paths
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
10 * notice, this list of conditions and the following disclaimer.
a95ee94b9204 supports whitespace in paths
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
11 *
a95ee94b9204 supports whitespace in paths
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
12 * 2. Redistributions in binary form must reproduce the above copyright
a95ee94b9204 supports whitespace in paths
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
13 * notice, this list of conditions and the following disclaimer in the
a95ee94b9204 supports whitespace in paths
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
14 * documentation and/or other materials provided with the distribution.
a95ee94b9204 supports whitespace in paths
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
15 *
a95ee94b9204 supports whitespace in paths
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
a95ee94b9204 supports whitespace in paths
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
17 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
a95ee94b9204 supports whitespace in paths
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
18 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
a95ee94b9204 supports whitespace in paths
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
19 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
a95ee94b9204 supports whitespace in paths
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
20 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
a95ee94b9204 supports whitespace in paths
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
21 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
a95ee94b9204 supports whitespace in paths
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
22 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
a95ee94b9204 supports whitespace in paths
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
23 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
a95ee94b9204 supports whitespace in paths
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
24 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
a95ee94b9204 supports whitespace in paths
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
25 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
a95ee94b9204 supports whitespace in paths
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
26 * POSSIBILITY OF SUCH DAMAGE.
a95ee94b9204 supports whitespace in paths
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
27 */
a95ee94b9204 supports whitespace in paths
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
28
a95ee94b9204 supports whitespace in paths
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
29 #ifndef DAV_CRYPTO_H
a95ee94b9204 supports whitespace in paths
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
30 #define DAV_CRYPTO_H
a95ee94b9204 supports whitespace in paths
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
31
a95ee94b9204 supports whitespace in paths
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
32 #include "webdav.h"
349
0b4ecadaf3f9 ports openssl code to commoncrypto (macos)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 260
diff changeset
33 #include <ucx/string.h>
0b4ecadaf3f9 ports openssl code to commoncrypto (macos)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 260
diff changeset
34
0b4ecadaf3f9 ports openssl code to commoncrypto (macos)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 260
diff changeset
35 #ifdef __APPLE__
0b4ecadaf3f9 ports openssl code to commoncrypto (macos)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 260
diff changeset
36 /* macos */
688
d405d2ac78e6 replace openssl on windows with cng/bcrypt
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 520
diff changeset
37
d405d2ac78e6 replace openssl on windows with cng/bcrypt
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 520
diff changeset
38 #define DAV_CRYPTO_COMMON_CRYPTO
d405d2ac78e6 replace openssl on windows with cng/bcrypt
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 520
diff changeset
39
349
0b4ecadaf3f9 ports openssl code to commoncrypto (macos)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 260
diff changeset
40 #define DAV_AES_CTX CCCryptorRef
0b4ecadaf3f9 ports openssl code to commoncrypto (macos)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 260
diff changeset
41 #define DAV_SHA_CTX CC_SHA256_CTX
0b4ecadaf3f9 ports openssl code to commoncrypto (macos)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 260
diff changeset
42 #define DAV_SHA256_DIGEST_LENGTH 32
0b4ecadaf3f9 ports openssl code to commoncrypto (macos)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 260
diff changeset
43
0b4ecadaf3f9 ports openssl code to commoncrypto (macos)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 260
diff changeset
44 #include <CommonCrypto/CommonCrypto.h>
0b4ecadaf3f9 ports openssl code to commoncrypto (macos)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 260
diff changeset
45 #include <CommonCrypto/CommonDigest.h>
0b4ecadaf3f9 ports openssl code to commoncrypto (macos)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 260
diff changeset
46
688
d405d2ac78e6 replace openssl on windows with cng/bcrypt
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 520
diff changeset
47 #elif defined(_WIN32)
d405d2ac78e6 replace openssl on windows with cng/bcrypt
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 520
diff changeset
48
d405d2ac78e6 replace openssl on windows with cng/bcrypt
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 520
diff changeset
49 #define DAV_CRYPTO_CNG
d405d2ac78e6 replace openssl on windows with cng/bcrypt
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 520
diff changeset
50
d405d2ac78e6 replace openssl on windows with cng/bcrypt
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 520
diff changeset
51 #include <windows.h>
d405d2ac78e6 replace openssl on windows with cng/bcrypt
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 520
diff changeset
52 #include <bcrypt.h>
d405d2ac78e6 replace openssl on windows with cng/bcrypt
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 520
diff changeset
53
d405d2ac78e6 replace openssl on windows with cng/bcrypt
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 520
diff changeset
54 typedef struct WinBCryptCTX {
d405d2ac78e6 replace openssl on windows with cng/bcrypt
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 520
diff changeset
55 BCRYPT_ALG_HANDLE hAlg;
d405d2ac78e6 replace openssl on windows with cng/bcrypt
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 520
diff changeset
56 BCRYPT_KEY_HANDLE hKey;
d405d2ac78e6 replace openssl on windows with cng/bcrypt
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 520
diff changeset
57 void *pbKeyObject;
d405d2ac78e6 replace openssl on windows with cng/bcrypt
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 520
diff changeset
58 unsigned char pbIV[16];
d405d2ac78e6 replace openssl on windows with cng/bcrypt
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 520
diff changeset
59
689
b1f7d83f6e69 fix aes decrypter stream
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 688
diff changeset
60 unsigned char buf[16];
b1f7d83f6e69 fix aes decrypter stream
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 688
diff changeset
61 ULONG buflen;
688
d405d2ac78e6 replace openssl on windows with cng/bcrypt
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 520
diff changeset
62 } WinBCryptCTX;
d405d2ac78e6 replace openssl on windows with cng/bcrypt
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 520
diff changeset
63
d405d2ac78e6 replace openssl on windows with cng/bcrypt
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 520
diff changeset
64 typedef struct WinBCryptSHACTX {
d405d2ac78e6 replace openssl on windows with cng/bcrypt
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 520
diff changeset
65 BCRYPT_ALG_HANDLE hAlg;
d405d2ac78e6 replace openssl on windows with cng/bcrypt
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 520
diff changeset
66 BCRYPT_HASH_HANDLE hHash;
d405d2ac78e6 replace openssl on windows with cng/bcrypt
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 520
diff changeset
67 void *pbHashObject;
d405d2ac78e6 replace openssl on windows with cng/bcrypt
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 520
diff changeset
68 } WinBCryptSHACTX;
d405d2ac78e6 replace openssl on windows with cng/bcrypt
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 520
diff changeset
69
d405d2ac78e6 replace openssl on windows with cng/bcrypt
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 520
diff changeset
70 #define DAV_AES_CTX WinBCryptCTX
d405d2ac78e6 replace openssl on windows with cng/bcrypt
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 520
diff changeset
71 #define DAV_SHA_CTX WinBCryptSHACTX
d405d2ac78e6 replace openssl on windows with cng/bcrypt
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 520
diff changeset
72 #define DAV_SHA256_DIGEST_LENGTH 32
d405d2ac78e6 replace openssl on windows with cng/bcrypt
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 520
diff changeset
73
349
0b4ecadaf3f9 ports openssl code to commoncrypto (macos)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 260
diff changeset
74 #else
688
d405d2ac78e6 replace openssl on windows with cng/bcrypt
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 520
diff changeset
75 /* unix/linux */
d405d2ac78e6 replace openssl on windows with cng/bcrypt
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 520
diff changeset
76
d405d2ac78e6 replace openssl on windows with cng/bcrypt
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 520
diff changeset
77 #define DAV_USE_OPENSSL
d405d2ac78e6 replace openssl on windows with cng/bcrypt
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 520
diff changeset
78
349
0b4ecadaf3f9 ports openssl code to commoncrypto (macos)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 260
diff changeset
79 #define DAV_AES_CTX EVP_CIPHER_CTX*
0b4ecadaf3f9 ports openssl code to commoncrypto (macos)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 260
diff changeset
80 #define DAV_SHA_CTX SHA256_CTX
0b4ecadaf3f9 ports openssl code to commoncrypto (macos)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 260
diff changeset
81 #define DAV_SHA256_DIGEST_LENGTH 32
0b4ecadaf3f9 ports openssl code to commoncrypto (macos)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 260
diff changeset
82
40
a95ee94b9204 supports whitespace in paths
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
83 #include <openssl/evp.h>
349
0b4ecadaf3f9 ports openssl code to commoncrypto (macos)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 260
diff changeset
84 #include <openssl/rand.h>
40
a95ee94b9204 supports whitespace in paths
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
85
234
33f373b28c8c added support for compiling with gcc on Solaris
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 207
diff changeset
86 #if defined(__sun) && defined(__SunOS_5_10)
150
37fb12574acd added checksums for encrypted resources
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 75
diff changeset
87 #include <sha2.h>
183
c238e0017257 fixed Solaris build
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 150
diff changeset
88 #define SHA256_Init SHA256Init
c238e0017257 fixed Solaris build
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 150
diff changeset
89 #define SHA256_Update SHA256Update
c238e0017257 fixed Solaris build
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 150
diff changeset
90 #define SHA256_Final SHA256Final
150
37fb12574acd added checksums for encrypted resources
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 75
diff changeset
91 #else
37fb12574acd added checksums for encrypted resources
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 75
diff changeset
92 #include <openssl/sha.h>
37fb12574acd added checksums for encrypted resources
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 75
diff changeset
93 #endif
37fb12574acd added checksums for encrypted resources
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 75
diff changeset
94
349
0b4ecadaf3f9 ports openssl code to commoncrypto (macos)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 260
diff changeset
95 #endif
0b4ecadaf3f9 ports openssl code to commoncrypto (macos)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 260
diff changeset
96
40
a95ee94b9204 supports whitespace in paths
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
97 #ifdef __cplusplus
a95ee94b9204 supports whitespace in paths
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
98 extern "C" {
a95ee94b9204 supports whitespace in paths
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
99 #endif
a95ee94b9204 supports whitespace in paths
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
100
470
6bf798ad3aec adds encrypted password store
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 404
diff changeset
101 #define DAV_PWFUNC_PBKDF2_SHA256 0
6bf798ad3aec adds encrypted password store
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 404
diff changeset
102 #define DAV_PWFUNC_PBKDF2_SHA512 1
6bf798ad3aec adds encrypted password store
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 404
diff changeset
103
6bf798ad3aec adds encrypted password store
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 404
diff changeset
104 #define DAV_CRYPTO_ITERATION_COUNT 4000
6bf798ad3aec adds encrypted password store
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 404
diff changeset
105
40
a95ee94b9204 supports whitespace in paths
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
106 typedef struct {
349
0b4ecadaf3f9 ports openssl code to commoncrypto (macos)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 260
diff changeset
107 DAV_AES_CTX ctx;
0b4ecadaf3f9 ports openssl code to commoncrypto (macos)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 260
diff changeset
108 DAV_SHA_CTX sha256;
40
a95ee94b9204 supports whitespace in paths
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
109 void *stream;
a95ee94b9204 supports whitespace in paths
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
110 dav_write_func write;
a95ee94b9204 supports whitespace in paths
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
111 DavKey *key;
a95ee94b9204 supports whitespace in paths
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
112 int init;
a95ee94b9204 supports whitespace in paths
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
113 unsigned char ivtmp[16];
a95ee94b9204 supports whitespace in paths
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
114 size_t ivpos;
a95ee94b9204 supports whitespace in paths
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
115 } AESDecrypter;
a95ee94b9204 supports whitespace in paths
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
116
a95ee94b9204 supports whitespace in paths
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
117 typedef struct {
349
0b4ecadaf3f9 ports openssl code to commoncrypto (macos)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 260
diff changeset
118 DAV_AES_CTX ctx;
0b4ecadaf3f9 ports openssl code to commoncrypto (macos)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 260
diff changeset
119 DAV_SHA_CTX sha256;
40
a95ee94b9204 supports whitespace in paths
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
120 void *iv;
a95ee94b9204 supports whitespace in paths
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
121 size_t ivlen;
a95ee94b9204 supports whitespace in paths
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
122 void *stream;
a95ee94b9204 supports whitespace in paths
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
123 dav_read_func read;
478
baa63fef5c5c fixes redirects
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 470
diff changeset
124 dav_seek_func seek;
40
a95ee94b9204 supports whitespace in paths
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
125 char *tmp;
a95ee94b9204 supports whitespace in paths
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
126 size_t tmplen;
a95ee94b9204 supports whitespace in paths
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
127 size_t tmpoff;
a95ee94b9204 supports whitespace in paths
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
128 int end;
a95ee94b9204 supports whitespace in paths
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
129 } AESEncrypter;
a95ee94b9204 supports whitespace in paths
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
130
520
da2b0cc44e4f adds xml attribute support and xattr property
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 515
diff changeset
131 typedef struct DavHashContext DavHashContext;
da2b0cc44e4f adds xml attribute support and xattr property
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 515
diff changeset
132
349
0b4ecadaf3f9 ports openssl code to commoncrypto (macos)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 260
diff changeset
133 int dav_rand_bytes(unsigned char *buf, size_t len);
0b4ecadaf3f9 ports openssl code to commoncrypto (macos)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 260
diff changeset
134
40
a95ee94b9204 supports whitespace in paths
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
135 AESDecrypter* aes_decrypter_new(DavKey *key, void *stream, dav_write_func write_func);
a95ee94b9204 supports whitespace in paths
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
136 size_t aes_write(const void *buf, size_t s, size_t n, AESDecrypter *dec);
207
de23f8881e9f fixed hash verification and head requests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 185
diff changeset
137 void aes_decrypter_shutdown(AESDecrypter *dec);
40
a95ee94b9204 supports whitespace in paths
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
138 void aes_decrypter_close(AESDecrypter *dec);
a95ee94b9204 supports whitespace in paths
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
139
478
baa63fef5c5c fixes redirects
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 470
diff changeset
140 AESEncrypter* aes_encrypter_new(DavKey *key, void *stream, dav_read_func read_func, dav_seek_func seek_func);
40
a95ee94b9204 supports whitespace in paths
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
141 size_t aes_read(void *buf, size_t s, size_t n, AESEncrypter *enc);
a95ee94b9204 supports whitespace in paths
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
142 void aes_encrypter_close(AESEncrypter *enc);
478
baa63fef5c5c fixes redirects
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 470
diff changeset
143 int aes_encrypter_reset(AESEncrypter *enc, curl_off_t offset, int origin);
40
a95ee94b9204 supports whitespace in paths
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
144
505
481802342fdf ucx update
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 478
diff changeset
145 char* aes_encrypt(const char *in, size_t len, DavKey *key);
481802342fdf ucx update
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 478
diff changeset
146 char* aes_decrypt(const char *in, size_t *len, DavKey *key);
150
37fb12574acd added checksums for encrypted resources
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 75
diff changeset
147
349
0b4ecadaf3f9 ports openssl code to commoncrypto (macos)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 260
diff changeset
148 void dav_get_hash(DAV_SHA_CTX *sha256, unsigned char *buf);
40
a95ee94b9204 supports whitespace in paths
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
149
367
4a6a59f89f9f adds dav-sync config for autodetecting tag changes
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 349
diff changeset
150 char* dav_create_hash(const char *data, size_t len);
4a6a59f89f9f adds dav-sync config for autodetecting tag changes
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 349
diff changeset
151
520
da2b0cc44e4f adds xml attribute support and xattr property
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 515
diff changeset
152 DAV_SHA_CTX* dav_hash_init(void);
da2b0cc44e4f adds xml attribute support and xattr property
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 515
diff changeset
153 void dav_hash_update(DAV_SHA_CTX *ctx, const char *data, size_t len);
da2b0cc44e4f adds xml attribute support and xattr property
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 515
diff changeset
154 void dav_hash_final(DAV_SHA_CTX *ctx, unsigned char *buf);
da2b0cc44e4f adds xml attribute support and xattr property
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 515
diff changeset
155
515
2465dd550bb5 fixes signedness of salt in dav_pw2key()
Mike Becker <universe@uap-core.de>
parents: 505
diff changeset
156 DavKey* dav_pw2key(const char *password, const unsigned char *salt, int saltlen, int pwfunc, int enc);
470
6bf798ad3aec adds encrypted password store
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 404
diff changeset
157
6bf798ad3aec adds encrypted password store
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 404
diff changeset
158 UcxBuffer* aes_encrypt_buffer(UcxBuffer *buf, DavKey *key);
6bf798ad3aec adds encrypted password store
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 404
diff changeset
159 UcxBuffer* aes_decrypt_buffer(UcxBuffer *buf, DavKey *key);
6bf798ad3aec adds encrypted password store
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 404
diff changeset
160
40
a95ee94b9204 supports whitespace in paths
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
161 #ifdef __cplusplus
a95ee94b9204 supports whitespace in paths
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
162 }
a95ee94b9204 supports whitespace in paths
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
163 #endif
a95ee94b9204 supports whitespace in paths
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
164
a95ee94b9204 supports whitespace in paths
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
165 #endif /* DAV_CRYPTO_H */
a95ee94b9204 supports whitespace in paths
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
166

mercurial