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')
131 /* asymmetric encryption */
134 /* secret agreement */
161 enum chain_mode mode
;
167 enum chain_mode mode
;
176 #define KEY_FLAG_LEGACY_DSA_V2 0x00000001
178 struct key_asymmetric
180 ULONG bitlen
; /* ignored for ECC keys */
189 UINT64
private[2]; /* private data for backend */
192 struct key_symmetric s
;
193 struct key_asymmetric a
;
202 struct key_symmetric_set_auth_data_params
209 struct key_symmetric_encrypt_params
218 struct key_symmetric_decrypt_params
227 struct key_symmetric_get_tag_params
234 struct key_asymmetric_decrypt_params
244 struct key_asymmetric_encrypt_params
254 struct key_asymmetric_duplicate_params
256 struct key
*key_orig
;
257 struct key
*key_copy
;
260 struct key_asymmetric_sign_params
272 struct key_asymmetric_verify_params
283 #define KEY_EXPORT_FLAG_PUBLIC 0x00000001
284 #define KEY_EXPORT_FLAG_RSA_FULL 0x00000002
285 struct key_asymmetric_export_params
294 #define KEY_IMPORT_FLAG_PUBLIC 0x00000001
295 struct key_asymmetric_import_params
307 unix_key_symmetric_vector_reset
,
308 unix_key_symmetric_set_auth_data
,
309 unix_key_symmetric_encrypt
,
310 unix_key_symmetric_decrypt
,
311 unix_key_symmetric_get_tag
,
312 unix_key_symmetric_destroy
,
313 unix_key_asymmetric_generate
,
314 unix_key_asymmetric_decrypt
,
315 unix_key_asymmetric_encrypt
,
316 unix_key_asymmetric_duplicate
,
317 unix_key_asymmetric_sign
,
318 unix_key_asymmetric_verify
,
319 unix_key_asymmetric_destroy
,
320 unix_key_asymmetric_export
,
321 unix_key_asymmetric_import
,
324 #endif /* __BCRYPT_INTERNAL_H */