Skip to content

Commit c960625

Browse files
committed
Reverted access to Raknet RSA functions
1 parent eaebdc1 commit c960625

File tree

3 files changed

+1
-86
lines changed

3 files changed

+1
-86
lines changed

MTA10_Server/sdk/net/CNetServer.h

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -147,37 +147,6 @@ class CNetServer
147147
virtual bool GetPlayerPacketUsageStats ( uchar* packetIdList, uint uiNumPacketIds, SPlayerPacketUsage* pOutStats, uint uiTopCount ) { return false; }
148148
virtual const char* GetLogOutput ( void ) { return NULL; }
149149
virtual bool IsValidSocket ( const NetServerPlayerID& playerID ) { assert( 0 ); return false; }
150-
151-
//
152-
// RSA structures:
153-
//
154-
// private key (64 bytes):
155-
// 32 bytes p (prime1)
156-
// 32 bytes q (prime2)
157-
//
158-
// public key (68 bytes):
159-
// 4 bytes e (public exponent)
160-
// 64 bytes n (modulus)
161-
//
162-
// encrypted data:
163-
// 4 bytes original size
164-
// 64+ bytes data
165-
//
166-
167-
// RSAGenerateKeys
168-
// PrivateKeySize must be set to 64, PublicKeySize must be set to 68.
169-
// Returns false on failure.
170-
virtual bool RSAGenerateKeys ( char* pOutPrivateKey, uint uiPrivateKeySize, char* pOutPublicKey, uint uiPublicKeySize ) { assert( 0 ); return false; }
171-
172-
// RSAEncryptData
173-
// MaxOutputDataSize should be slightly larger than the input size.
174-
// Returns actual size of encrypted data, or zero on failure.
175-
virtual uint RSAEncryptData ( const char* pInputData, uint uiInputDataSize, const char* pKey, uint uiKeySize, char* pOutputData, uint uiMaxOutputDataSize ) { assert( 0 ); return 0; }
176-
177-
// RSADecryptData
178-
// MaxOutputDataSize can be the same size as the input size.
179-
// Returns actual size of decrypted data, or zero on failure.
180-
virtual uint RSADecryptData ( const char* pInputData, uint uiInputDataSize, const char* pKey, uint uiKeySize, char* pOutputData, uint uiMaxOutputDataSize ) { assert( 0 ); return 0; }
181150
};
182151

183152
#endif

MTA10_Server/version.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@
7878

7979
#define _ASE_VERSION QUOTE_DEFINE(MTASA_VERSION_MAJOR) "." QUOTE_DEFINE(MTASA_VERSION_MINOR)
8080
#define _NETCODE_VERSION_BRANCH_ID 0x4 // Use 0x1 - 0xF to indicate an incompatible branch is being used (0x0 is reserved, 0x4 is trunk)
81-
#define _SERVER_NET_MODULE_VERSION 0x097 // (0x000 - 0xfff) Lvl9 wizards only
81+
#define _SERVER_NET_MODULE_VERSION 0x099 // (0x000 - 0xfff) Lvl9 wizards only
8282
#define _NETCODE_VERSION 0x1DA // (0x000 - 0xfff) Increment when net messages change (pre-release)
8383
#define MTA_DM_BITSTREAM_VERSION 0x064 // (0x000 - 0xfff) Increment when net messages change (post-release). (Changing will also require additional backward compatibility code).
8484

Shared/sdk/SharedUtil.Tests.hpp

Lines changed: 0 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,6 @@ void SharedUtil_WildcardMatch_Tests ( void );
2121
void SharedUtil_Collection_Tests ( void );
2222
void SharedUtil_String_Tests ( void );
2323
void SharedUtil_Hash_Tests ( void );
24-
void SharedUtil_RSA_Tests ( void );
25-
void RSATestCrypt ( const SString& input, const SString& keyEncrypt, const SString& keyDecrypt );
26-
2724

2825
///////////////////////////////////////////////////////////////
2926
//
@@ -41,9 +38,6 @@ void SharedUtil_Tests ( void )
4138
SharedUtil_Collection_Tests ();
4239
SharedUtil_String_Tests ();
4340
SharedUtil_Hash_Tests ();
44-
#ifndef MTA_CLIENT
45-
SharedUtil_RSA_Tests ();
46-
#endif
4741
}
4842

4943

@@ -905,51 +899,3 @@ void SharedUtil_Hash_Tests ( void )
905899

906900
FileDelete( szTempFilename );
907901
}
908-
909-
910-
#ifndef MTA_CLIENT
911-
///////////////////////////////////////////////////////////////
912-
//
913-
// SharedUtil_RSA_Tests
914-
//
915-
// Test behaviour of Raknet RSA code
916-
//
917-
///////////////////////////////////////////////////////////////
918-
void SharedUtil_RSA_Tests( void )
919-
{
920-
// Generate keys
921-
char privateKeyTemp[64];
922-
char publicKeyTemp[68];
923-
g_pRealNetServer->RSAGenerateKeys( privateKeyTemp, sizeof( privateKeyTemp ), publicKeyTemp, sizeof( publicKeyTemp ) );
924-
SStringX privateKey( privateKeyTemp, sizeof( privateKeyTemp ) );
925-
SStringX publicKey( publicKeyTemp, sizeof( publicKeyTemp ) );
926-
927-
// Short data length
928-
SString input = "hello";
929-
RSATestCrypt( input, publicKey, privateKey );
930-
RSATestCrypt( input, privateKey, publicKey );
931-
932-
// Long data length
933-
while( input.size() < 3000 )
934-
input += input + "goodbye";
935-
RSATestCrypt( input, publicKey, privateKey );
936-
RSATestCrypt( input, privateKey, publicKey );
937-
}
938-
939-
void RSATestCrypt( const SString& input, const SString& keyEncrypt, const SString& keyDecrypt )
940-
{
941-
// Encrypt
942-
std::vector < char > encryptedBuffer;
943-
encryptedBuffer.resize( input.size() + 100 );
944-
uint uiEncryptedSize = g_pRealNetServer->RSAEncryptData( &input[0], input.size(), &keyEncrypt[0], keyEncrypt.size(), &encryptedBuffer[0], encryptedBuffer.size() );
945-
946-
// Decrypt
947-
std::vector < char > decryptedBuffer;
948-
decryptedBuffer.resize( uiEncryptedSize );
949-
uint uiDecryptedSize = g_pRealNetServer->RSADecryptData( &encryptedBuffer[0], uiEncryptedSize, &keyDecrypt[0], keyDecrypt.size(), &decryptedBuffer[0], decryptedBuffer.size() );
950-
951-
// Check decrypted is the same as original
952-
assert( input.size() == uiDecryptedSize );
953-
assert( memcmp( &input[0], &decryptedBuffer[0], uiDecryptedSize ) == 0 );
954-
}
955-
#endif

0 commit comments

Comments
 (0)