Browse Source

Swap DH key bytes to maintain compatability with PC's server.ini format

Michael Hansen 14 years ago
parent
commit
7eac0222e6
  1. 16
      Sources/Plasma/FeatureLib/pfConsole/pfConsoleCommandsNet.cpp

16
Sources/Plasma/FeatureLib/pfConsole/pfConsoleCommandsNet.cpp

@ -1062,6 +1062,14 @@ PF_CONSOLE_CMD(
*
***/
//TODO: Fix Plasma to use OpenSSL's byte order (or better yet, to use OpenSSL),
// so this hack isn't needed
static void swap_key_bytes(byte keyData[])
{
for (size_t i = 0; i < (kNetDiffieHellmanKeyBits / 16); ++i)
std::swap(keyData[i], keyData[ (kNetDiffieHellmanKeyBits / 8) - i - 1 ]);
}
//============================================================================
// Server group
PF_CONSOLE_GROUP(Server)
@ -1140,6 +1148,7 @@ PF_CONSOLE_CMD(
Base64Decode(hsStrlen((const char *)params[0]), (const char *)params[0],
kNetDiffieHellmanKeyBits / 8, kAuthDhNData);
swap_key_bytes(kAuthDhNData);
}
//============================================================================
@ -1158,6 +1167,7 @@ PF_CONSOLE_CMD(
Base64Decode(hsStrlen((const char *)params[0]), (const char *)params[0],
kNetDiffieHellmanKeyBits / 8, kAuthDhXData);
swap_key_bytes(kAuthDhXData);
}
@ -1193,6 +1203,7 @@ PF_CONSOLE_CMD(
Base64Decode(hsStrlen((const char *)params[0]), (const char *)params[0],
kNetDiffieHellmanKeyBits / 8, kCsrDhNData);
swap_key_bytes(kCsrDhNData);
}
//============================================================================
@ -1211,6 +1222,7 @@ PF_CONSOLE_CMD(
Base64Decode(hsStrlen((const char *)params[0]), (const char *)params[0],
kNetDiffieHellmanKeyBits / 8, kCsrDhXData);
swap_key_bytes(kCsrDhXData);
}
@ -1234,6 +1246,7 @@ PF_CONSOLE_CMD(
Base64Decode(hsStrlen((const char *)params[0]), (const char *)params[0],
kNetDiffieHellmanKeyBits / 8, kGameDhNData);
swap_key_bytes(kGameDhNData);
}
//============================================================================
@ -1252,6 +1265,7 @@ PF_CONSOLE_CMD(
Base64Decode(hsStrlen((const char *)params[0]), (const char *)params[0],
kNetDiffieHellmanKeyBits / 8, kGameDhXData);
swap_key_bytes(kGameDhXData);
}
@ -1287,6 +1301,7 @@ PF_CONSOLE_CMD(
Base64Decode(hsStrlen((const char *)params[0]), (const char *)params[0],
kNetDiffieHellmanKeyBits / 8, kGateKeeperDhNData);
swap_key_bytes(kGateKeeperDhNData);
}
//============================================================================
@ -1305,4 +1320,5 @@ PF_CONSOLE_CMD(
Base64Decode(hsStrlen((const char *)params[0]), (const char *)params[0],
kNetDiffieHellmanKeyBits / 8, kGateKeeperDhXData);
swap_key_bytes(kGateKeeperDhXData);
}

Loading…
Cancel
Save