[KSECDD]
[reactos.git] / reactos / drivers / crypto / ksecdd / ksecdd.h
1 /*
2 * PROJECT: ReactOS Drivers
3 * COPYRIGHT: See COPYING in the top level directory
4 * PURPOSE: Kernel Security Support Provider Interface Driver
5 *
6 * PROGRAMMERS: Timo Kreuzer (timo.kreuzer@reactos.org)
7 */
8
9 #define _NO_KSECDD_IMPORT_
10 #include <ntifs.h>
11 #include <ndk/exfuncs.h>
12 #include <pseh/pseh2.h>
13 #include <ntstrsafe.h>
14
15 #include <md4.h>
16 #include <md5.h>
17 #include <tomcrypt.h>
18 typedef aes_key AES_KEY, *PAES_KEY;
19 typedef des3_key DES3_KEY, *PDES3_KEY;
20
21 #define STATUS_KSEC_INTERNAL_ERROR ((NTSTATUS)0x80090304)
22
23 /* FIXME: this should be in some shared header */
24 #define RTL_ENCRYPT_OPTION_SAME_PROCESS 0
25 #define RTL_ENCRYPT_OPTION_CROSS_PROCESS 1
26 #define RTL_ENCRYPT_OPTION_SAME_LOGON 2
27
28 typedef struct _KSEC_CONNECTION_INFO
29 {
30 ULONG Unknown0;
31 NTSTATUS Status;
32 ULONG_PTR Information;
33 CHAR ConnectionString[128];
34 ULONG Flags;
35 } KSEC_CONNECTION_INFO;
36
37 #if defined(_M_IX86) || defined(_M_AMD64)
38 typedef struct _KSEC_MACHINE_SPECIFIC_COUNTERS
39 {
40 ULONG64 Tsc;
41 ULONG64 Pmc0;
42 ULONG64 Pmc1;
43 ULONG64 Ctr0;
44 ULONG64 Ctr1;
45 } KSEC_MACHINE_SPECIFIC_COUNTERS, *PKSEC_MACHINE_SPECIFIC_COUNTERS;
46 #else
47 typedef ULONG KSEC_MACHINE_SPECIFIC_COUNTERS;
48 #endif
49
50 typedef struct _KSEC_ENTROPY_DATA
51 {
52 HANDLE CurrentProcessId;
53 HANDLE CurrentThreadId;
54 LARGE_INTEGER TickCount;
55 LARGE_INTEGER SystemTime;
56 LARGE_INTEGER PerformanceCounter;
57 LARGE_INTEGER PerformanceFrequency;
58 UCHAR EnvironmentHash[16];
59 KSEC_MACHINE_SPECIFIC_COUNTERS MachineSpecificCounters;
60 SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION SystemProcessorPerformanceInformation;
61 SYSTEM_PERFORMANCE_INFORMATION SystemPerformanceInformation;
62 SYSTEM_EXCEPTION_INFORMATION SystemExceptionInformation;
63 SYSTEM_LOOKASIDE_INFORMATION SystemLookasideInformation;
64 SYSTEM_INTERRUPT_INFORMATION SystemInterruptInformation;
65 SYSTEM_PROCESS_INFORMATION SystemProcessInformation;
66 } KSEC_ENTROPY_DATA, *PKSEC_ENTROPY_DATA;
67
68 extern PEPROCESS KsecLsaProcess;;
69 extern HANDLE KsecLsaProcessHandle;
70
71 NTSTATUS
72 NTAPI
73 KsecDdDispatch(
74 PDEVICE_OBJECT DeviceObject,
75 PIRP Irp);
76
77 NTSTATUS
78 NTAPI
79 KsecGatherEntropyData(
80 PKSEC_ENTROPY_DATA EntropyData);
81
82 NTSTATUS
83 NTAPI
84 KsecGenRandom(
85 PVOID Buffer,
86 SIZE_T Length);
87
88 VOID
89 NTAPI
90 KsecInitializeEncryptionSupport (
91 VOID);
92
93 NTSTATUS
94 NTAPI
95 KsecEncryptMemory (
96 _Inout_ PVOID Buffer,
97 _In_ ULONG Length,
98 _In_ ULONG OptionFlags);
99
100 NTSTATUS
101 NTAPI
102 KsecDecryptMemory (
103 _Inout_ PVOID Buffer,
104 _In_ ULONG Length,
105 _In_ ULONG OptionFlags);
106