total refactor, happy new year, ground level code for automatic DPC selection, code is currently very much a work in progress, and very much broken, we'll work through it

This commit is contained in:
Neo-Desktop
2024-01-04 16:32:18 -08:00
parent c0a4c76b54
commit bf6365916d
41 changed files with 2571 additions and 1448 deletions

View File

@@ -1,7 +1,7 @@
/**
* This file is a part of the UMSKT Project
*
* Copyleft (C) 2019-2023 UMSKT Contributors (et.al.)
* Copyleft (C) 2019-2024 UMSKT Contributors (et.al.)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
@@ -16,7 +16,7 @@
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @FileCreated by Neo on 6/24/2023
* @FileCreated by Neo on 06/24/2023
* @Maintainer Neo
*/
@@ -27,23 +27,65 @@
class PIDGEN3
{
protected:
EC_GROUP *eCurve;
EC_POINT *basePoint, *publicKey, *genPoint, *pubPoint;
BIGNUM *genOrder, *privateKey;
DWORD Serial, AuthInfo, ChannelID, Hash;
QWORD Signature;
BOOL isUpgrade;
public:
class BINK1998;
class BINK2002;
PIDGEN3()
{
}
// util.cpp
static int BN_bn2lebin(const BIGNUM *a, unsigned char *to,
int tolen); // Hello OpenSSL developers, please tell me, where is this function at?
static void endian(BYTE *data, int length);
static EC_GROUP *initializeEllipticCurve(std::string pSel, std::string aSel, std::string bSel,
std::string generatorXSel, std::string generatorYSel,
std::string publicKeyXSel, std::string publicKeyYSel, EC_POINT *&genPoint,
EC_POINT *&pubPoint);
~PIDGEN3()
{
EC_GROUP_free(eCurve);
EC_POINT_free(genPoint);
EC_POINT_free(pubPoint);
EC_POINT_free(basePoint);
EC_POINT_free(publicKey);
BN_free(genOrder);
BN_free(privateKey);
BN_free(privateKey);
BN_free(genOrder);
}
// key.cpp
static constexpr char pKeyCharset[] = "BCDFGHJKMPQRTVWXY2346789";
static void unbase24(BYTE *byteSeq, const char *cdKey);
static void base24(char *cdKey, BYTE *byteSeq);
BOOL LoadEllipticCurve(std::string pSel, std::string aSel, std::string bSel, std::string generatorXSel,
std::string generatorYSel, std::string publicKeyXSel, std::string publicKeyYSel,
std::string genOrderSel, std::string privateKeySel);
virtual BOOL Unpack(QWORD (&pRaw)[2]) = 0;
virtual BOOL Pack(QWORD (&pRaw)[2]) = 0;
virtual BOOL Verify(std::string &pKey) = 0;
virtual BOOL Generate(std::string &pKey) = 0;
// PIDGEN3.cpp
// Hello OpenSSL developers, please tell me, where is this function at?
int BN_bn2lebin(const BIGNUM *a, unsigned char *to, int tolen);
void endian(BYTE *data, int length);
void base24(std::string &cdKey, BYTE *byteSeq);
void unbase24(BYTE *byteSeq, std::string cdKey);
void setSerial(DWORD serialIn)
{
Serial = serialIn;
}
void setAuthInfo(DWORD AuthInfoIn)
{
AuthInfo = AuthInfoIn;
}
void setChannelID(DWORD ChannelIDIn)
{
ChannelID = ChannelIDIn;
}
};
#endif // UMSKT_PIDGEN3_H