forked from focus-creative-games/il2cpp_plus
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCryptography.cpp
More file actions
38 lines (30 loc) · 944 Bytes
/
Cryptography.cpp
File metadata and controls
38 lines (30 loc) · 944 Bytes
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
#include "il2cpp-config.h"
#if IL2CPP_TARGET_WINRT || IL2CPP_TARGET_XBOXONE
#include "os/Win32/WindowsHeaders.h"
#include "os/Cryptography.h"
namespace il2cpp
{
namespace os
{
// This has to be non-null value because the return value of NULL from GetCryptographyProvider means it failed
void* const kCryptographyProvider = reinterpret_cast<void*>(0x12345678);
void* Cryptography::GetCryptographyProvider()
{
return kCryptographyProvider;
}
bool Cryptography::OpenCryptographyProvider()
{
return true;
}
void Cryptography::ReleaseCryptographyProvider(void* provider)
{
// Do nothing, since we never allocated it
}
bool Cryptography::FillBufferWithRandomBytes(void* provider, uint32_t length, unsigned char* data)
{
NO_UNUSED_WARNING(provider);
return SUCCEEDED(BCryptGenRandom(NULL, data, length, BCRYPT_USE_SYSTEM_PREFERRED_RNG));
}
}
}
#endif