Release 9.12.
[wine.git] / dlls / rsaenh / implglue.h
blob2d490aa345bc0e67e1eb910c87de7d3c08560c76
1 /*
2 * dlls/rsaenh/implglue.h
3 * Glueing the RSAENH specific code to the crypto library
5 * Copyright (c) 2004 Michael Jung
7 * based on code by Mike McCormack and David Hammerton
9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public
11 * License as published by the Free Software Foundation; either
12 * version 2.1 of the License, or (at your option) any later version.
14 * This library is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with this library; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
24 #ifndef __WINE_IMPLGLUE_H
25 #define __WINE_IMPLGLUE_H
27 #include "bcrypt.h"
28 #include "tomcrypt.h"
30 #define RSAENH_MAX_HASH_SIZE 104
32 typedef union tagKEY_CONTEXT {
33 rc2_key rc2;
34 des_key des;
35 des3_key des3;
36 aes_key aes;
37 prng_state rc4;
38 rsa_key rsa;
39 } KEY_CONTEXT;
41 BOOL init_hash_impl(ALG_ID aiAlgid, BCRYPT_HASH_HANDLE *hash_handle);
42 BOOL update_hash_impl(BCRYPT_HASH_HANDLE hash_handle, const BYTE *pbData, DWORD dwDataLen);
43 BOOL finalize_hash_impl(BCRYPT_HASH_HANDLE hash_handle, BYTE *hash_value, DWORD hash_size);
44 BOOL duplicate_hash_impl(BCRYPT_HASH_HANDLE src_hash_handle, BCRYPT_HASH_HANDLE *dest_hash_handle);
46 BOOL new_key_impl(ALG_ID aiAlgid, KEY_CONTEXT *pKeyContext, DWORD dwKeyLen);
47 BOOL free_key_impl(ALG_ID aiAlgid, KEY_CONTEXT *pKeyContext);
48 BOOL setup_key_impl(ALG_ID aiAlgid, KEY_CONTEXT *pKeyContext, DWORD dwKeyLen,
49 DWORD dwEffectiveKeyLen, DWORD dwSaltLen, BYTE *abKeyValue);
50 BOOL duplicate_key_impl(ALG_ID aiAlgid, const KEY_CONTEXT *pSrcKeyContext,
51 KEY_CONTEXT *pDestKeyContext);
53 /* dwKeySpec is optional for symmetric key algorithms */
54 BOOL encrypt_block_impl(ALG_ID aiAlgid, DWORD dwKeySpec, KEY_CONTEXT *pKeyContext, const BYTE *pbIn,
55 BYTE *pbOut, DWORD enc);
56 BOOL encrypt_stream_impl(ALG_ID aiAlgid, KEY_CONTEXT *pKeyContext, BYTE *pbInOut, DWORD dwLen);
58 BOOL export_public_key_impl(BYTE *pbDest, const KEY_CONTEXT *pKeyContext, DWORD dwKeyLen,
59 DWORD *pdwPubExp);
60 BOOL import_public_key_impl(const BYTE *pbSrc, KEY_CONTEXT *pKeyContext, DWORD dwKeyLen,
61 DWORD dwPubExp);
62 BOOL export_private_key_impl(BYTE *pbDest, const KEY_CONTEXT *pKeyContext, DWORD dwKeyLen,
63 DWORD *pdwPubExp);
64 BOOL import_private_key_impl(const BYTE* pbSrc, KEY_CONTEXT *pKeyContext, DWORD dwKeyLen,
65 DWORD dwDataLen, DWORD dwPubExp);
67 BOOL gen_rand_impl(BYTE *pbBuffer, DWORD dwLen);
69 #endif /* __WINE_IMPLGLUE_H */