implglue.h 3.16 KB
Newer Older
1
/*
2 3
 * dlls/rsaenh/implglue.h
 * Glueing the RSAENH specific code to the crypto library
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
 *
 * Copyright (c) 2004 Michael Jung
 *
 * based on code by Mike McCormack and David Hammerton
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * 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
22 23
 */

24 25
#ifndef __WINE_IMPLGLUE_H
#define __WINE_IMPLGLUE_H
26

27
#include "bcrypt.h"
28
#include "tomcrypt.h"
29

30 31
#define RSAENH_MAX_HASH_SIZE        104

32
typedef union tagKEY_CONTEXT {
33 34 35
    rc2_key rc2;
    des_key des;
    des3_key des3;
36
    aes_key aes;
37 38
    prng_state rc4;
    rsa_key rsa;
39 40
} KEY_CONTEXT;

41 42
BOOL init_hash_impl(ALG_ID aiAlgid, BCRYPT_HASH_HANDLE *hash_handle) DECLSPEC_HIDDEN;
BOOL update_hash_impl(BCRYPT_HASH_HANDLE hash_handle, const BYTE *pbData,
43
                      DWORD dwDataLen) DECLSPEC_HIDDEN;
44
BOOL finalize_hash_impl(BCRYPT_HASH_HANDLE hash_handle, BYTE *hash_value, DWORD hash_size) DECLSPEC_HIDDEN;
45 46
BOOL duplicate_hash_impl(BCRYPT_HASH_HANDLE src_hash_handle,
                         BCRYPT_HASH_HANDLE *dest_hash_handle) DECLSPEC_HIDDEN;
47

48 49
BOOL new_key_impl(ALG_ID aiAlgid, KEY_CONTEXT *pKeyContext, DWORD dwKeyLen) DECLSPEC_HIDDEN;
BOOL free_key_impl(ALG_ID aiAlgid, KEY_CONTEXT *pKeyContext) DECLSPEC_HIDDEN;
50
BOOL setup_key_impl(ALG_ID aiAlgid, KEY_CONTEXT *pKeyContext, DWORD dwKeyLen,
51
                    DWORD dwEffectiveKeyLen, DWORD dwSaltLen, BYTE *abKeyValue) DECLSPEC_HIDDEN;
52
BOOL duplicate_key_impl(ALG_ID aiAlgid, const KEY_CONTEXT *pSrcKeyContext,
53
                        KEY_CONTEXT *pDestKeyContext) DECLSPEC_HIDDEN;
54

55
/* dwKeySpec is optional for symmetric key algorithms */
56 57
BOOL encrypt_block_impl(ALG_ID aiAlgid, DWORD dwKeySpec, KEY_CONTEXT *pKeyContext, const BYTE *pbIn,
                        BYTE *pbOut, DWORD enc) DECLSPEC_HIDDEN;
58
BOOL encrypt_stream_impl(ALG_ID aiAlgid, KEY_CONTEXT *pKeyContext, BYTE *pbInOut, DWORD dwLen) DECLSPEC_HIDDEN;
59

60
BOOL export_public_key_impl(BYTE *pbDest, const KEY_CONTEXT *pKeyContext, DWORD dwKeyLen,
61
                            DWORD *pdwPubExp) DECLSPEC_HIDDEN;
62
BOOL import_public_key_impl(const BYTE *pbSrc, KEY_CONTEXT *pKeyContext, DWORD dwKeyLen,
63
                            DWORD dwPubExp) DECLSPEC_HIDDEN;
64
BOOL export_private_key_impl(BYTE *pbDest, const KEY_CONTEXT *pKeyContext, DWORD dwKeyLen,
65
                             DWORD *pdwPubExp) DECLSPEC_HIDDEN;
66
BOOL import_private_key_impl(const BYTE* pbSrc, KEY_CONTEXT *pKeyContext, DWORD dwKeyLen,
67
                             DWORD dwDataLen, DWORD dwPubExp) DECLSPEC_HIDDEN;
68

69
BOOL gen_rand_impl(BYTE *pbBuffer, DWORD dwLen) DECLSPEC_HIDDEN;
70

71
#endif /* __WINE_IMPLGLUE_H */