forked from OpenXRay/xray-16
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'gditeck-crypto' into ai_cleanup
- Loading branch information
Showing
27 changed files
with
436 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Oops, something went wrong.