Skip to content

Commit

Permalink
Merge branch 'gditeck-crypto' into ai_cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
nitrocaster committed Nov 6, 2015
2 parents d9e6913 + 0928ad8 commit 51772ff
Show file tree
Hide file tree
Showing 27 changed files with 436 additions and 69 deletions.
4 changes: 0 additions & 4 deletions src/Layers/xrRenderPC_R4/xrRender_R4.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -565,10 +565,6 @@
<ClCompile Include="xrRender_R4.cpp" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="$(SolutionDir)3rd party\crypto\crypto.vcxproj">
<Project>{fa169092-ea3e-40c1-8e5a-a2b575700fe8}</Project>
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
</ProjectReference>
<ProjectReference Include="$(SolutionDir)xrCore\xrCore.vcxproj">
<Project>{a0f7d1fb-59a7-4717-a7e4-96f37e91998e}</Project>
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
Expand Down
30 changes: 3 additions & 27 deletions src/engine.sln
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
VisualStudioVersion = 12.0.40629.0
# Visual Studio 14
VisualStudioVersion = 14.0.23107.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "utils", "utils", "{89F6A7EE-3BBE-45D3-A8A8-5D9366CD987B}"
EndProject
Expand Down Expand Up @@ -109,15 +109,13 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Maya_Export_2009", "plugins
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Maya_Material_2009", "plugins\Maya\Maya_Material2009.vcxproj", "{FFDF27A8-C198-49ED-BA13-4DA9054266C6}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "crypto", "3rd party\crypto\crypto.vcxproj", "{FA169092-EA3E-40C1-8E5A-A2B575700FE8}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "xrRender_R4", "Layers\xrRenderPC_R4\xrRender_R4.vcxproj", "{AC9B12ED-A2D7-4337-A981-5BD8430E96D8}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mp_screenshots_info", "utils\mp_screenshots_info\mp_screenshots_info.vcxproj", "{032A10AB-E44C-4751-A290-001EF99E664A}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mp_configs_verifyer", "utils\mp_configs_verifyer\mp_configs_verifyer.vcxproj", "{1924EF23-A05E-40E5-93F2-6CCD64BE1F8B}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CxImage", "3rd party\CxImage\cximage.vcxproj", "{880CD250-BA77-4DAF-A8D4-552F12DD3AE4}"
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CxImage", "3rd party\cximage\cximage.vcxproj", "{880CD250-BA77-4DAF-A8D4-552F12DD3AE4}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "NVTT", "3rd party\NVTT\NVTT.vcxproj", "{0EB257DC-5CFC-44B0-82C9-CE6B158BE473}"
EndProject
Expand Down Expand Up @@ -1040,27 +1038,6 @@ Global
{FFDF27A8-C198-49ED-BA13-4DA9054266C6}.Release|Mixed Platforms.Build.0 = Release|Win32
{FFDF27A8-C198-49ED-BA13-4DA9054266C6}.Release|Win32.ActiveCfg = Release|Win32
{FFDF27A8-C198-49ED-BA13-4DA9054266C6}.Release|Win32.Build.0 = Release|Win32
{FA169092-EA3E-40C1-8E5A-A2B575700FE8}.Debug_Dedicated|Mixed Platforms.ActiveCfg = Debug|Win32
{FA169092-EA3E-40C1-8E5A-A2B575700FE8}.Debug_Dedicated|Mixed Platforms.Build.0 = Debug|Win32
{FA169092-EA3E-40C1-8E5A-A2B575700FE8}.Debug_Dedicated|Win32.ActiveCfg = Debug|Win32
{FA169092-EA3E-40C1-8E5A-A2B575700FE8}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32
{FA169092-EA3E-40C1-8E5A-A2B575700FE8}.Debug|Mixed Platforms.Build.0 = Debug|Win32
{FA169092-EA3E-40C1-8E5A-A2B575700FE8}.Debug|Win32.ActiveCfg = Debug|Win32
{FA169092-EA3E-40C1-8E5A-A2B575700FE8}.Debug|Win32.Build.0 = Debug|Win32
{FA169092-EA3E-40C1-8E5A-A2B575700FE8}.Mixed_Dedicated|Mixed Platforms.ActiveCfg = Release|Win32
{FA169092-EA3E-40C1-8E5A-A2B575700FE8}.Mixed_Dedicated|Mixed Platforms.Build.0 = Release|Win32
{FA169092-EA3E-40C1-8E5A-A2B575700FE8}.Mixed_Dedicated|Win32.ActiveCfg = Debug|Win32
{FA169092-EA3E-40C1-8E5A-A2B575700FE8}.Mixed|Mixed Platforms.ActiveCfg = Release|Win32
{FA169092-EA3E-40C1-8E5A-A2B575700FE8}.Mixed|Mixed Platforms.Build.0 = Release|Win32
{FA169092-EA3E-40C1-8E5A-A2B575700FE8}.Mixed|Win32.ActiveCfg = Debug|Win32
{FA169092-EA3E-40C1-8E5A-A2B575700FE8}.Mixed|Win32.Build.0 = Debug|Win32
{FA169092-EA3E-40C1-8E5A-A2B575700FE8}.Release_Dedicated|Mixed Platforms.ActiveCfg = Release|Win32
{FA169092-EA3E-40C1-8E5A-A2B575700FE8}.Release_Dedicated|Mixed Platforms.Build.0 = Release|Win32
{FA169092-EA3E-40C1-8E5A-A2B575700FE8}.Release_Dedicated|Win32.ActiveCfg = Release|Win32
{FA169092-EA3E-40C1-8E5A-A2B575700FE8}.Release|Mixed Platforms.ActiveCfg = Release|Win32
{FA169092-EA3E-40C1-8E5A-A2B575700FE8}.Release|Mixed Platforms.Build.0 = Release|Win32
{FA169092-EA3E-40C1-8E5A-A2B575700FE8}.Release|Win32.ActiveCfg = Release|Win32
{FA169092-EA3E-40C1-8E5A-A2B575700FE8}.Release|Win32.Build.0 = Release|Win32
{AC9B12ED-A2D7-4337-A981-5BD8430E96D8}.Debug_Dedicated|Mixed Platforms.ActiveCfg = Debug|Win32
{AC9B12ED-A2D7-4337-A981-5BD8430E96D8}.Debug_Dedicated|Mixed Platforms.Build.0 = Debug|Win32
{AC9B12ED-A2D7-4337-A981-5BD8430E96D8}.Debug_Dedicated|Win32.ActiveCfg = Debug|Win32
Expand Down Expand Up @@ -1375,7 +1352,6 @@ Global
{EC924B9B-4991-4931-8623-E1DB9AE005CA} = {89F6A7EE-3BBE-45D3-A8A8-5D9366CD987B}
{E5F40F9E-C01B-4B97-9BD5-FC24308D8022} = {68CB7CEC-F907-47AD-B624-B8432F53AAE3}
{FFDF27A8-C198-49ED-BA13-4DA9054266C6} = {68CB7CEC-F907-47AD-B624-B8432F53AAE3}
{FA169092-EA3E-40C1-8E5A-A2B575700FE8} = {2BFC806B-CE92-4EA4-8FE8-5F2EA54BA348}
{032A10AB-E44C-4751-A290-001EF99E664A} = {89F6A7EE-3BBE-45D3-A8A8-5D9366CD987B}
{1924EF23-A05E-40E5-93F2-6CCD64BE1F8B} = {89F6A7EE-3BBE-45D3-A8A8-5D9366CD987B}
{880CD250-BA77-4DAF-A8D4-552F12DD3AE4} = {2BFC806B-CE92-4EA4-8FE8-5F2EA54BA348}
Expand Down
2 changes: 1 addition & 1 deletion src/utils/mp_configs_verifyer/configs_common.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef CONFIGS_COMMON_INCLUDED
#define CONFIGS_COMMON_INCLUDED

#include "3rd party/crypto/crypto.h"
#include "xrCore/crypto/crypto.h"

namespace mp_anticheat
{
Expand Down
1 change: 0 additions & 1 deletion src/utils/mp_configs_verifyer/entry_point.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
#include "configs_dump_verifyer.h"

#pragma comment(lib, "xrCore.lib")
#pragma comment(lib, "crypto.lib")

static char const * help_msg =
"Format: mp_configs_verifyer.exe [--file | --unpack | --io_filter | --help] [file name]\n"
Expand Down
4 changes: 0 additions & 4 deletions src/utils/mp_configs_verifyer/mp_configs_verifyer.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,6 @@
<ClInclude Include="xr_dsa_verifyer.h" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="$(SolutionDir)3rd party\crypto\crypto.vcxproj">
<Project>{fa169092-ea3e-40c1-8e5a-a2b575700fe8}</Project>
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
</ProjectReference>
<ProjectReference Include="$(SolutionDir)xrCore\xrCore.vcxproj">
<Project>{a0f7d1fb-59a7-4717-a7e4-96f37e91998e}</Project>
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
Expand Down
2 changes: 1 addition & 1 deletion src/utils/mp_configs_verifyer/pch.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include "xrCore/xrCore.h"
#include "xrCore/LocatorAPI.h"
#include "xrCore/ppmd_compressor.h"
#include "3rd party/crypto/crypto.h"
#include "xrCore/crypto/crypto.h"


#include <stdio.h>
Expand Down
2 changes: 1 addition & 1 deletion src/utils/mp_configs_verifyer/xr_dsa_verifyer.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef XR_DSA_VERIFYER_INCLUDED
#define XR_DSA_VERIFYER_INCLUDED

#include "3rd party/crypto/crypto.h"
#include "xrCore/crypto/crypto.h"

class xr_dsa_verifyer
{
Expand Down
1 change: 0 additions & 1 deletion src/utils/mp_screenshots_info/entry_point.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
#include "screenshots_reader.h"

#pragma comment(lib, "xrCore.lib")
#pragma comment(lib, "crypto.lib")

void print_format()
{
Expand Down
4 changes: 0 additions & 4 deletions src/utils/mp_screenshots_info/mp_screenshots_info.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -127,10 +127,6 @@
<ClInclude Include="xr_dsa_verifyer.h" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="$(SolutionDir)3rd party\crypto\crypto.vcxproj">
<Project>{fa169092-ea3e-40c1-8e5a-a2b575700fe8}</Project>
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
</ProjectReference>
<ProjectReference Include="$(SolutionDir)xrCore\xrCore.vcxproj">
<Project>{a0f7d1fb-59a7-4717-a7e4-96f37e91998e}</Project>
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
Expand Down
2 changes: 1 addition & 1 deletion src/utils/mp_screenshots_info/pch.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

#include "xrCore/xrCore.h"
#include "xrCore/LocatorAPI.h"
#include "3rd party/crypto/crypto.h"
#include "xrCore/crypto/crypto.h"

#include <stdio.h>
#include <conio.h>
Expand Down
2 changes: 1 addition & 1 deletion src/utils/mp_screenshots_info/xr_dsa_signer.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef XR_DSA_SIGNER_INCLUDED
#define XR_DSA_SIGNER_INCLUDED

#include "3rd party/crypto/crypto.h"
#include "xrCore/crypto/crypto.h"

typedef fastdelegate::FastDelegate1< long > sha_process_yielder;

Expand Down
36 changes: 36 additions & 0 deletions src/xrCore/crypto/crypto.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#include "stdafx.h"
#include "crypto.h"
#include <openssl/bn.h>
#include <openssl/rand.h>
#include <openssl/dsa.h>


namespace crypto
{

static void unsafe_xr_free(void* ptr)
{
xr_free(ptr);
};

static unsigned char rnd_seed[] = "S.T.A.L.K.E.R. 4ever Rulezz !!!";

CRYPTO_API void xr_crypto_init ()
{
string256 random_string;
xr_sprintf (random_string, "%I64d_%s", CPU::QPC(), rnd_seed);
//sprintf_s (random_string, "%s", rnd_seed);
CRYPTO_set_mem_functions (xr_malloc, xr_realloc, unsafe_xr_free);
RAND_seed (random_string, xr_strlen(random_string));
//unsigned int siglen;
//tmp_dsa_params->flags |= DSA_FLAG_NO_EXP_CONSTTIME;
//ZeroMemory(sig, sizeof(sig));
//DSA_sign(0, digest, sizeof(digest), sig, &siglen, tmp_dsa_params);
//DSA_verify(0, digest, sizeof(digest), sig, siglen, tmp_dsa_params);
/*#ifdef DEBUG
CRYPTO_dbg_set_options (V_CRYPTO_MDEBUG_ALL);
CRYPTO_mem_ctrl (CRYPTO_MEM_CHECK_ON);
#endif*/
}

} //namespace crypto
15 changes: 15 additions & 0 deletions src/xrCore/crypto/crypto.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#ifndef CRYPTO_INCLUDED
#define CRYPTO_INCLUDED

#include "xrCore/xrCore.h"
#include "xr_dsa.h"
#include "xr_sha.h"

namespace crypto
{

CRYPTO_API void xr_crypto_init ();

} //namespace crypto

#endif
10 changes: 10 additions & 0 deletions src/xrCore/crypto/crypto_api_def.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#ifndef CRYPTO_API_DEF_INCLUDED
#define CRYPTO_API_DEF_INCLUDED

# ifdef CRYPTO_BUILD
# define CRYPTO_API __declspec(dllexport)
# else
# define CRYPTO_API __declspec(dllimport)
# endif //#ifdef CRYPTO_BUILD

#endif //#ifndef CRYPTO_API_DEF_INCLUDED
Loading

0 comments on commit 51772ff

Please sign in to comment.