[21326] | 1 | /*
|
---|
| 2 | * Driver routines
|
---|
| 3 | *
|
---|
| 4 | * Copyright 2001 - Travis Michielsen
|
---|
| 5 | *
|
---|
| 6 | * This library is free software; you can redistribute it and/or
|
---|
| 7 | * modify it under the terms of the GNU Lesser General Public
|
---|
| 8 | * License as published by the Free Software Foundation; either
|
---|
| 9 | * version 2.1 of the License, or (at your option) any later version.
|
---|
| 10 | *
|
---|
| 11 | * This library is distributed in the hope that it will be useful,
|
---|
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
| 14 | * Lesser General Public License for more details.
|
---|
| 15 | *
|
---|
| 16 | * You should have received a copy of the GNU Lesser General Public
|
---|
| 17 | * License along with this library; if not, write to the Free Software
|
---|
| 18 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
---|
| 19 | */
|
---|
| 20 |
|
---|
| 21 | #ifndef __WINE_CRYPT_H
|
---|
| 22 | #define __WINE_CRYPT_H
|
---|
| 23 |
|
---|
| 24 | #include <stdarg.h>
|
---|
| 25 |
|
---|
| 26 | #include "windef.h"
|
---|
| 27 | #include "winbase.h"
|
---|
| 28 | #include "wincrypt.h"
|
---|
| 29 |
|
---|
[21353] | 30 | /*RLW - created typedefs for each function to enable pointers
|
---|
| 31 | to be cast to the appropriate type when loaded using GetProcAddress()
|
---|
| 32 | */
|
---|
| 33 | typedef BOOL (WINAPI fnCPAcquireContext)(HCRYPTPROV *phProv, LPSTR pszContainer, DWORD dwFlags, PVTableProvStruc pVTable);
|
---|
| 34 | typedef BOOL (WINAPI fnCPCreateHash)(HCRYPTPROV hProv, ALG_ID Algid, HCRYPTKEY hKey, DWORD dwFlags, HCRYPTHASH *phHash);
|
---|
| 35 | typedef BOOL (WINAPI fnCPDecrypt)(HCRYPTPROV hProv, HCRYPTKEY hKey, HCRYPTHASH hHash, BOOL Final, DWORD dwFlags, BYTE *pbData, DWORD *pdwDataLen);
|
---|
| 36 | typedef BOOL (WINAPI fnCPDeriveKey)(HCRYPTPROV hProv, ALG_ID Algid, HCRYPTHASH hBaseData, DWORD dwFlags, HCRYPTKEY *phKey);
|
---|
| 37 | typedef BOOL (WINAPI fnCPDestroyHash)(HCRYPTPROV hProv, HCRYPTHASH hHash);
|
---|
| 38 | typedef BOOL (WINAPI fnCPDestroyKey)(HCRYPTPROV hProv, HCRYPTKEY hKey);
|
---|
| 39 | typedef BOOL (WINAPI fnCPDuplicateHash)(HCRYPTPROV hUID, HCRYPTHASH hHash, DWORD *pdwReserved, DWORD dwFlags, HCRYPTHASH *phHash);
|
---|
| 40 | typedef BOOL (WINAPI fnCPDuplicateKey)(HCRYPTPROV hUID, HCRYPTKEY hKey, DWORD *pdwReserved, DWORD dwFlags, HCRYPTKEY *phKey);
|
---|
| 41 | typedef BOOL (WINAPI fnCPEncrypt)(HCRYPTPROV hProv, HCRYPTKEY hKey, HCRYPTHASH hHash, BOOL Final, DWORD dwFlags, BYTE *pbData, DWORD *pdwDataLen, DWORD dwBufLen);
|
---|
| 42 | typedef BOOL (WINAPI fnCPExportKey)(HCRYPTPROV hProv, HCRYPTKEY hKey, HCRYPTKEY hPubKey, DWORD dwBlobType, DWORD dwFlags, BYTE *pbData, DWORD *pdwDataLen);
|
---|
| 43 | typedef BOOL (WINAPI fnCPGenKey)(HCRYPTPROV hProv, ALG_ID Algid, DWORD dwFlags, HCRYPTKEY *phKey);
|
---|
| 44 | typedef BOOL (WINAPI fnCPGenRandom)(HCRYPTPROV hProv, DWORD dwLen, BYTE *pbBuffer);
|
---|
| 45 | typedef BOOL (WINAPI fnCPGetHashParam)(HCRYPTPROV hProv, HCRYPTHASH hHash, DWORD dwParam, BYTE *pbData, DWORD *pdwDataLen, DWORD dwFlags);
|
---|
| 46 | typedef BOOL (WINAPI fnCPGetKeyParam)(HCRYPTPROV hProv, HCRYPTKEY hKey, DWORD dwParam, BYTE *pbData, DWORD *pdwDataLen, DWORD dwFlags);
|
---|
| 47 | typedef BOOL (WINAPI fnCPGetProvParam)(HCRYPTPROV hProv, DWORD dwParam, BYTE *pbData, DWORD *pdwDataLen, DWORD dwFlags);
|
---|
| 48 | typedef BOOL (WINAPI fnCPGetUserKey)(HCRYPTPROV hProv, DWORD dwKeySpec, HCRYPTKEY *phUserKey);
|
---|
| 49 | typedef BOOL (WINAPI fnCPHashData)(HCRYPTPROV hProv, HCRYPTHASH hHash, CONST BYTE *pbData, DWORD dwDataLen, DWORD dwFlags);
|
---|
| 50 | typedef BOOL (WINAPI fnCPHashSessionKey)(HCRYPTPROV hProv, HCRYPTHASH hHash, HCRYPTKEY hKey, DWORD dwFlags);
|
---|
| 51 | typedef BOOL (WINAPI fnCPImportKey)(HCRYPTPROV hProv, CONST BYTE *pbData, DWORD dwDataLen, HCRYPTKEY hPubKey, DWORD dwFlags, HCRYPTKEY *phKey);
|
---|
| 52 | typedef BOOL (WINAPI fnCPReleaseContext)(HCRYPTPROV hProv, DWORD dwFlags);
|
---|
| 53 | typedef BOOL (WINAPI fnCPSetHashParam)(HCRYPTPROV hProv, HCRYPTHASH hHash, DWORD dwParam, CONST BYTE *pbData, DWORD dwFlags);
|
---|
| 54 | typedef BOOL (WINAPI fnCPSetKeyParam)(HCRYPTPROV hProv, HCRYPTKEY hKey, DWORD dwParam, CONST BYTE *pbData, DWORD dwFlags);
|
---|
| 55 | typedef BOOL (WINAPI fnCPSetProvParam)(HCRYPTPROV hProv, DWORD dwParam, CONST BYTE *pbData, DWORD dwFlags);
|
---|
| 56 | typedef BOOL (WINAPI fnCPSignHash)(HCRYPTPROV hProv, HCRYPTHASH hHash, DWORD dwKeySpec, LPCWSTR sDescription, DWORD dwFlags, BYTE *pbSignature, DWORD *pdwSigLen);
|
---|
| 57 | typedef BOOL (WINAPI fnCPVerifySignature)(HCRYPTPROV hProv, HCRYPTHASH hHash, CONST BYTE *pbSignature, DWORD dwSigLen, HCRYPTKEY hPubKey, LPCWSTR sDescription, DWORD dwFlags);
|
---|
| 58 |
|
---|
[21326] | 59 | typedef struct tagPROVFUNCS
|
---|
| 60 | {
|
---|
[21353] | 61 | fnCPAcquireContext* pCPAcquireContext;
|
---|
| 62 | fnCPCreateHash* pCPCreateHash;
|
---|
| 63 | fnCPDecrypt* pCPDecrypt;
|
---|
| 64 | fnCPDeriveKey* pCPDeriveKey;
|
---|
| 65 | fnCPDestroyHash* pCPDestroyHash;
|
---|
| 66 | fnCPDestroyKey* pCPDestroyKey;
|
---|
| 67 | fnCPDuplicateHash* pCPDuplicateHash;
|
---|
| 68 | fnCPDuplicateKey* pCPDuplicateKey;
|
---|
| 69 | fnCPEncrypt* pCPEncrypt;
|
---|
| 70 | fnCPExportKey* pCPExportKey;
|
---|
| 71 | fnCPGenKey* pCPGenKey;
|
---|
| 72 | fnCPGenRandom* pCPGenRandom;
|
---|
| 73 | fnCPGetHashParam* pCPGetHashParam;
|
---|
| 74 | fnCPGetKeyParam* pCPGetKeyParam;
|
---|
| 75 | fnCPGetProvParam* pCPGetProvParam;
|
---|
| 76 | fnCPGetUserKey* pCPGetUserKey;
|
---|
| 77 | fnCPHashData* pCPHashData;
|
---|
| 78 | fnCPHashSessionKey* pCPHashSessionKey;
|
---|
| 79 | fnCPImportKey* pCPImportKey;
|
---|
| 80 | fnCPReleaseContext* pCPReleaseContext;
|
---|
| 81 | fnCPSetHashParam* pCPSetHashParam;
|
---|
| 82 | fnCPSetKeyParam* pCPSetKeyParam;
|
---|
| 83 | fnCPSetProvParam* pCPSetProvParam;
|
---|
| 84 | fnCPSignHash* pCPSignHash;
|
---|
| 85 | fnCPVerifySignature* pCPVerifySignature;
|
---|
[21326] | 86 | } PROVFUNCS, *PPROVFUNCS;
|
---|
| 87 |
|
---|
| 88 | #define MAGIC_CRYPTPROV 0xA39E741F
|
---|
| 89 |
|
---|
| 90 | typedef struct tagCRYPTPROV
|
---|
| 91 | {
|
---|
| 92 | DWORD dwMagic;
|
---|
| 93 | UINT refcount;
|
---|
| 94 | HMODULE hModule;
|
---|
| 95 | PPROVFUNCS pFuncs;
|
---|
| 96 | HCRYPTPROV hPrivate; /*CSP's handle - Should not be given to application under any circumstances!*/
|
---|
| 97 | PVTableProvStruc pVTable;
|
---|
| 98 | } CRYPTPROV, *PCRYPTPROV;
|
---|
| 99 |
|
---|
| 100 | typedef struct tagCRYPTKEY
|
---|
| 101 | {
|
---|
| 102 | PCRYPTPROV pProvider;
|
---|
| 103 | HCRYPTKEY hPrivate; /*CSP's handle - Should not be given to application under any circumstances!*/
|
---|
| 104 | } CRYPTKEY, *PCRYPTKEY;
|
---|
| 105 |
|
---|
| 106 | typedef struct tagCRYPTHASH
|
---|
| 107 | {
|
---|
| 108 | PCRYPTPROV pProvider;
|
---|
| 109 | HCRYPTHASH hPrivate; /*CSP's handle - Should not be given to application under any circumstances!*/
|
---|
| 110 | } CRYPTHASH, *PCRYPTHASH;
|
---|
| 111 |
|
---|
| 112 | #define MAXPROVTYPES 999
|
---|
| 113 |
|
---|
| 114 | extern unsigned char *CRYPT_DESkey8to7( unsigned char *dst, const unsigned char *key );
|
---|
| 115 | extern unsigned char *CRYPT_DEShash( unsigned char *dst, const unsigned char *key,
|
---|
| 116 | const unsigned char *src );
|
---|
| 117 | extern unsigned char *CRYPT_DESunhash( unsigned char *dst, const unsigned char *key,
|
---|
| 118 | const unsigned char *src );
|
---|
| 119 |
|
---|
| 120 | struct ustring {
|
---|
| 121 | DWORD Length;
|
---|
| 122 | DWORD MaximumLength;
|
---|
| 123 | unsigned char *Buffer;
|
---|
| 124 | };
|
---|
| 125 |
|
---|
| 126 | NTSTATUS WINAPI SystemFunction032(struct ustring *data, struct ustring *key);
|
---|
| 127 |
|
---|
| 128 | #endif /* __WINE_CRYPT_H_ */
|
---|