2 * Copyright 2016 Michael Müller
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
20 #ifndef __BCRYPT_INTERNAL_H
21 #define __BCRYPT_INTERNAL_H
30 #include "wine/unixlib.h"
32 #define MAGIC_DSS1 ('D' | ('S' << 8) | ('S' << 16) | ('1' << 24))
33 #define MAGIC_DSS2 ('D' | ('S' << 8) | ('S' << 16) | ('2' << 24))
42 void sha256_init(SHA256_CTX
*ctx
) DECLSPEC_HIDDEN
;
43 void sha256_update(SHA256_CTX
*ctx
, const UCHAR
*buffer
, ULONG len
) DECLSPEC_HIDDEN
;
44 void sha256_finalize(SHA256_CTX
*ctx
, UCHAR
*buffer
) DECLSPEC_HIDDEN
;
53 void sha512_init(SHA512_CTX
*ctx
) DECLSPEC_HIDDEN
;
54 void sha512_update(SHA512_CTX
*ctx
, const UCHAR
*buffer
, ULONG len
) DECLSPEC_HIDDEN
;
55 void sha512_finalize(SHA512_CTX
*ctx
, UCHAR
*buffer
) DECLSPEC_HIDDEN
;
57 void sha384_init(SHA512_CTX
*ctx
) DECLSPEC_HIDDEN
;
58 #define sha384_update sha512_update
59 void sha384_finalize(SHA512_CTX
*ctx
, UCHAR
*buffer
) DECLSPEC_HIDDEN
;
62 unsigned char chksum
[16], X
[48], buf
[16];
66 void md2_init(MD2_CTX
*ctx
) DECLSPEC_HIDDEN
;
67 void md2_update(MD2_CTX
*ctx
, const unsigned char *buf
, ULONG len
) DECLSPEC_HIDDEN
;
68 void md2_finalize(MD2_CTX
*ctx
, unsigned char *hash
) DECLSPEC_HIDDEN
;
70 /* Definitions from advapi32 */
71 typedef struct tagMD4_CTX
{
75 unsigned char digest
[16];
78 VOID WINAPI
MD4Init(MD4_CTX
*ctx
);
79 VOID WINAPI
MD4Update(MD4_CTX
*ctx
, const unsigned char *buf
, unsigned int len
);
80 VOID WINAPI
MD4Final(MD4_CTX
*ctx
);
87 unsigned char digest
[16];
90 VOID WINAPI
MD5Init(MD5_CTX
*ctx
);
91 VOID WINAPI
MD5Update(MD5_CTX
*ctx
, const unsigned char *buf
, unsigned int len
);
92 VOID WINAPI
MD5Final(MD5_CTX
*ctx
);
102 VOID WINAPI
A_SHAInit(SHA_CTX
*ctx
);
103 VOID WINAPI
A_SHAUpdate(SHA_CTX
*ctx
, const UCHAR
*buffer
, UINT size
);
104 VOID WINAPI
A_SHAFinal(SHA_CTX
*ctx
, PULONG result
);
106 #define MAGIC_ALG (('A' << 24) | ('L' << 16) | ('G' << 8) | '0')
107 #define MAGIC_HASH (('H' << 24) | ('A' << 16) | ('S' << 8) | 'H')
108 #define MAGIC_KEY (('K' << 24) | ('E' << 16) | ('Y' << 8) | '0')
109 #define MAGIC_SECRET (('S' << 24) | ('C' << 16) | ('R' << 8) | 'T')
130 /* asymmetric encryption */
133 /* secret agreement */
160 enum chain_mode mode
;
166 enum chain_mode mode
;
175 #define KEY_FLAG_LEGACY_DSA_V2 0x00000001
177 struct key_asymmetric
179 ULONG bitlen
; /* ignored for ECC keys */
188 UINT64
private[2]; /* private data for backend */
191 struct key_symmetric s
;
192 struct key_asymmetric a
;
201 struct key_symmetric_set_auth_data_params
208 struct key_symmetric_encrypt_params
217 struct key_symmetric_decrypt_params
226 struct key_symmetric_get_tag_params
233 struct key_asymmetric_decrypt_params
243 struct key_asymmetric_encrypt_params
253 struct key_asymmetric_duplicate_params
255 struct key
*key_orig
;
256 struct key
*key_copy
;
259 struct key_asymmetric_sign_params
271 struct key_asymmetric_verify_params
282 #define KEY_EXPORT_FLAG_PUBLIC 0x00000001
283 #define KEY_EXPORT_FLAG_RSA_FULL 0x00000002
284 struct key_asymmetric_export_params
293 #define KEY_IMPORT_FLAG_PUBLIC 0x00000001
294 struct key_asymmetric_import_params
306 unix_key_symmetric_vector_reset
,
307 unix_key_symmetric_set_auth_data
,
308 unix_key_symmetric_encrypt
,
309 unix_key_symmetric_decrypt
,
310 unix_key_symmetric_get_tag
,
311 unix_key_symmetric_destroy
,
312 unix_key_asymmetric_generate
,
313 unix_key_asymmetric_decrypt
,
314 unix_key_asymmetric_encrypt
,
315 unix_key_asymmetric_duplicate
,
316 unix_key_asymmetric_sign
,
317 unix_key_asymmetric_verify
,
318 unix_key_asymmetric_destroy
,
319 unix_key_asymmetric_export
,
320 unix_key_asymmetric_import
,
323 #endif /* __BCRYPT_INTERNAL_H */