-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathlibmbedtls.c
More file actions
56 lines (45 loc) · 1.05 KB
/
libmbedtls.c
File metadata and controls
56 lines (45 loc) · 1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#include <mbedtls/mbedtls_config.h>
#include <ntifs.h>
#include <windef.h>
#include <ntstrsafe.h>
#include <ntimage.h>
#include <intrin.h>
int libmbedtls_printf(const char *format, ...)
{
return 0;
}
int libmbedtls_snprintf(char *s, size_t n, const char *format, ...)
{
va_list ArgList;
int Result;
va_start(ArgList, format);
Result = _vsnprintf(s, n, format, ArgList);
va_end(ArgList);
return Result;
}
void* libmbedtls_calloc(size_t num, size_t size)
{
void* Pointer;
size_t NumberOfBytes;
Pointer = NULL;
NumberOfBytes = num * size;
if (0 != NumberOfBytes) {
Pointer = ExAllocatePoolWithTag(NonPagedPool, NumberOfBytes, 'mbed');
if (NULL != Pointer) {
memset(Pointer, 0, NumberOfBytes);
}
}
return Pointer;
}
void libmbedtls_free(void *ptr)
{
if (NULL != ptr) {
ExFreePoolWithTag(ptr, 'mbed');
}
}
int64_t mbedtls_ms_time(void)
{
LARGE_INTEGER SystemTime = { 0 };
KeQuerySystemTime(&SystemTime);
return SystemTime.QuadPart / 10000;
}