This commit is contained in:
Andrew 2023-06-09 21:07:29 +03:00
parent eed869981b
commit f11552509a
6 changed files with 71 additions and 24 deletions

View File

@ -8,12 +8,34 @@
#include "header.h" #include "header.h"
class BINK1998 { class BINK1998 {
static void Unpack (QWORD (&pRaw)[2], DWORD &pSerial, DWORD &pHash, QWORD &pSignature); static void Unpack(
static void Pack (QWORD (&pRaw)[2], DWORD pSerial, DWORD pHash, QWORD pSignature); QWORD (&pRaw)[2],
DWORD &pSerial,
DWORD &pHash,
QWORD &pSignature
);
static void Pack(
QWORD (&pRaw)[2],
DWORD pSerial,
DWORD pHash,
QWORD pSignature
);
public: public:
static bool Verify (EC_GROUP *eCurve, EC_POINT *basePoint, EC_POINT *publicKey, char (&pKey)[25]); static bool Verify(
static void Generate (EC_GROUP *eCurve, EC_POINT *basePoint, BIGNUM *genOrder, BIGNUM *privateKey, DWORD pSerial, char (&pKey)[25]); EC_GROUP *eCurve,
EC_POINT *basePoint,
EC_POINT *publicKey,
char (&pKey)[25]
);
static void Generate(
EC_GROUP *eCurve,
EC_POINT *basePoint,
BIGNUM *genOrder,
BIGNUM *privateKey,
DWORD pSerial,
char (&pKey)[25]
);
}; };
#endif //WINDOWSXPKG_BINK1998_H #endif //WINDOWSXPKG_BINK1998_H

View File

@ -35,7 +35,7 @@ void BINK2002::Pack(
QWORD (&pRaw)[2], QWORD (&pRaw)[2],
DWORD pChannelID, DWORD pChannelID,
DWORD pHash, DWORD pHash,
QWORD &pSignature, QWORD pSignature,
DWORD pAuthInfo DWORD pAuthInfo
) { ) {
// AuthInfo [113..104] <- Signature [103..42] <- Hash [41..11] <- Channel ID [10..1] <- Upgrade [0] // AuthInfo [113..104] <- Signature [103..42] <- Hash [41..11] <- Channel ID [10..1] <- Upgrade [0]

View File

@ -8,12 +8,37 @@
#include "header.h" #include "header.h"
class BINK2002 { class BINK2002 {
static void Unpack (QWORD (&pRaw)[2], DWORD &pChannelID, DWORD &pHash, QWORD &pSignature, DWORD &pAuthInfo); static void Unpack(
static void Pack (QWORD (&pRaw)[2], DWORD pChannelID, DWORD pHash, QWORD &pSignature, DWORD pAuthInfo); QWORD (&pRaw)[2],
DWORD &pChannelID,
DWORD &pHash,
QWORD &pSignature,
DWORD &pAuthInfo
);
static void Pack(
QWORD (&pRaw)[2],
DWORD pChannelID,
DWORD pHash,
QWORD pSignature,
DWORD pAuthInfo
);
public: public:
static bool Verify (EC_GROUP *eCurve, EC_POINT *basePoint, EC_POINT *publicKey, char (&cdKey)[25]); static bool Verify(
static void Generate (EC_GROUP *eCurve, EC_POINT *basePoint, BIGNUM *genOrder, BIGNUM *privateKey, DWORD pChannelID, DWORD pAuthInfo, char (&pKey)[25]); EC_GROUP *eCurve,
EC_POINT *basePoint,
EC_POINT *publicKey,
char (&cdKey)[25]
);
static void Generate(
EC_GROUP *eCurve,
EC_POINT *basePoint,
BIGNUM *genOrder,
BIGNUM *privateKey,
DWORD pChannelID,
DWORD pAuthInfo,
char (&pKey)[25]
);
}; };
#endif //WINDOWSXPKG_BINK2002_H #endif //WINDOWSXPKG_BINK2002_H

View File

@ -30,7 +30,7 @@ QWORD ConfirmationID::residue_sub(QWORD x, QWORD y)
#ifdef __GNUC__ #ifdef __GNUC__
inline QWORD ConfirmationID::__umul128(QWORD a, QWORD b, QWORD* hi) inline QWORD ConfirmationID::__umul128(QWORD a, QWORD b, QWORD* hi)
{ {
DQWORD r = (DQWORD)a * (DQWORD)b; OWORD r = (OWORD)a * (OWORD)b;
*hi = r >> 64; *hi = r >> 64;
return (QWORD) r; return (QWORD) r;
} }

View File

@ -87,7 +87,7 @@ typedef uint32_t DWORD;
typedef uint64_t QWORD; typedef uint64_t QWORD;
#ifdef __SIZEOF_INT128__ #ifdef __SIZEOF_INT128__
typedef unsigned __int128 DQWORD; typedef unsigned __int128 OWORD;
#endif #endif
// Global variables // Global variables