Remove final pieces of encryption code. Warning: This touches some seriously

unstable code. Bugs may follow!


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@2184 4a71c877-e1ca-e34f-864e-861f7616d084
master
Per Inge Mathisen 2007-07-24 18:22:04 +00:00
parent 2e28b1926a
commit 1df2199ce8
4 changed files with 8 additions and 38 deletions

View File

@ -61,10 +61,7 @@ unsigned int masterserver_port = 0, gameserver_port = 0;
#define MSG_PLAYER_LEFT 95
#define MSG_GAME_FLAGS 96
//#define NET_DEBUG
static BOOL allow_joining = FALSE;
static void NETallowJoining(void);
extern BOOL MultiPlayerJoin(UDWORD dpid); /* from src/multijoin.c ! */
extern BOOL MultiPlayerLeave(UDWORD dpid); /* from src/multijoin.c ! */
@ -77,15 +74,7 @@ static GAMESTRUCT game;
static void NETsetMessageSize(NETMSG* pMsg, unsigned int size)
{
unsigned int tmp = 8 - (size % 8);
if (tmp == 8) {
pMsg->size = size;
pMsg->paddedBytes = 0;
} else {
pMsg->size = size + tmp;
pMsg->paddedBytes = tmp;
}
}
// *********** Socket with buffer that read NETMSGs ******************
@ -140,8 +129,6 @@ static BOOL NET_fillBuffer(NETBUFSOCKET* bs, SDLNet_SocketSet socket_set)
return FALSE;
}
size = SDLNet_TCP_Recv(bs->socket, bufstart, bufsize);
if (size > 0) {
@ -164,7 +151,6 @@ static BOOL NET_recvMessage(NETBUFSOCKET* bs, NETMSG* pMsg)
const NETMSG* message = (NETMSG*)(bs->buffer + bs->buffer_start);
const unsigned int headersize = sizeof(message->size)
+ sizeof(message->type)
+ sizeof(message->paddedBytes)
+ sizeof(message->destination);
if (headersize > bs->bytes) {
@ -684,7 +670,7 @@ BOOL NETsend(NETMSG *msg, UDWORD player, BOOL guarantee)
if (player >= MAX_CONNECTED_PLAYERS) return FALSE;
msg->destination = player;
size = msg->size + sizeof(msg->size) + sizeof(msg->type) + sizeof(msg->paddedBytes) + sizeof(msg->destination);
size = msg->size + sizeof(msg->size) + sizeof(msg->type) + sizeof(msg->destination);
NETlogPacket(msg, FALSE);
@ -723,7 +709,7 @@ BOOL NETbcast(NETMSG *msg, BOOL guarantee)
msg->destination = NET_ALL_PLAYERS;
size = msg->size + sizeof(msg->size) + sizeof(msg->type) + sizeof(msg->paddedBytes) + sizeof(msg->destination);
size = msg->size + sizeof(msg->size) + sizeof(msg->type) + sizeof(msg->destination);
NETlogPacket(msg, FALSE);
@ -905,7 +891,7 @@ receive_message:
return FALSE;
} else {
size = pMsg->size + sizeof(pMsg->size) + sizeof(pMsg->type)
+ sizeof(pMsg->paddedBytes) + sizeof(pMsg->destination);
+ sizeof(pMsg->destination);
if (is_server == FALSE) {
} else if (pMsg->destination == NET_ALL_PLAYERS) {
unsigned int j;
@ -1013,7 +999,6 @@ UBYTE NETsendFile(BOOL newFile, const char *fileName, UDWORD player)
memcpy(&(msg.body[msg.size]),&inBuff,bytesRead);
msg.size += bytesRead;
msg.type = FILEMSG;
msg.paddedBytes = 0;
if(player==0)
{
NETbcast(&msg,TRUE); // send it.
@ -1115,7 +1100,8 @@ void NETregisterServer(int state) {
// ////////////////////////////////////////////////////////////////////////
// Host a game with a given name and player name. & 4 user game flags
static void NETallowJoining(void) {
static void NETallowJoining(void)
{
unsigned int i;
UDWORD numgames = SDL_SwapBE32(1); // always 1 on normal server
char buffer[5];
@ -1444,7 +1430,6 @@ BOOL NETjoinGame(UDWORD gameNumber, const char* playername)
} else {
strcpy(NetPlay.games[gameNumber].desc.host, tmpgame->desc.host);
}
//printf("JoinGame: Received info for host %s\n", NetPlay.games[gameNumber].desc.host);
}
bsocket = NET_createBufferedSocket();

View File

@ -64,7 +64,6 @@ typedef struct {
typedef struct {
uint16_t size; // used size of body
uint8_t paddedBytes; // numberofbytes appended for encryption
uint8_t type; // type of packet
uint8_t destination; // player to send to, or NET_ALL_PLAYERS
char body[MaxMsgSize];
@ -101,11 +100,6 @@ typedef struct {
uint32_t bLobbyLaunched; // true if app launched by a lobby
uint32_t bSpectator; // true if just spectating
uint32_t bEncryptAllPackets; // set to true to encrypt all communications.
// Legitimate uint32_t (i.e. a non-bool)
uint32_t cryptKey[4]; // 4*32 bit encryption key
// booleans
uint32_t bCaptureInUse; // true if someone is speaking.
uint32_t bAllowCaptureRecord; // true if speech can be recorded.

View File

@ -3258,7 +3258,8 @@ static void endian_SaveGameV(SAVE_GAME* psSaveGame, UDWORD version) {
UDWORD i,j;
/* SAVE_GAME is GAME_SAVE_V33 */
/* GAME_SAVE_V33 includes GAME_SAVE_V31 */
if(version >= VERSION_33) {
if(version >= VERSION_33)
{
endian_udword(&psSaveGame->sGame.power);
endian_uword(&psSaveGame->sGame.bytesPerSec);
for(i = 0; i < MaxGames; i++) {
@ -3275,8 +3276,6 @@ static void endian_SaveGameV(SAVE_GAME* psSaveGame, UDWORD version) {
endian_udword(&psSaveGame->sNetPlay.players[i].dpid);
endian_udword(&psSaveGame->sNetPlay.playercount);
endian_udword(&psSaveGame->sNetPlay.dpidPlayer);
for(i = 0; i < 4; i++)
endian_udword(&psSaveGame->sNetPlay.cryptKey[i]);
endian_udword(&psSaveGame->savePlayer);
for(i = 0; i < MAX_PLAYERS; i++)
endian_udword(&psSaveGame->sPlayer2dpid[i]);
@ -4277,8 +4276,6 @@ BOOL writeGameFile(char *pFileName, SDWORD saveType)
endian_udword(&psSaveGame->sNetPlay.players[i].dpid);
endian_udword(&psSaveGame->sNetPlay.playercount);
endian_udword(&psSaveGame->sNetPlay.dpidPlayer);
for(i = 0; i < 4; i++)
endian_udword(&psSaveGame->sNetPlay.cryptKey[i]);
endian_udword(&psSaveGame->savePlayer);
for(i = 0; i < MAX_PLAYERS; i++)
endian_udword(&psSaveGame->sPlayer2dpid[i]);

View File

@ -2415,12 +2415,6 @@ BOOL startMultiOptions(BOOL bReenter)
game.skDiff[i] = (DIFF_SLIDER_STOPS / 2);
}
// set the encrypt key.
if(NetPlay.bHost)
{
game.encryptKey = 0;
}
if(!NetPlay.bComms) // firce skirmish if no comms.
{
game.type = SKIRMISH;