Remove BINK.h dependency on header.h

This commit is contained in:
Andrew 2023-06-01 19:24:07 +03:00
parent 814b8e48fb
commit 62e2e37373
4 changed files with 25 additions and 27 deletions

View File

@ -14,11 +14,28 @@ with open('bink.h', 'w') as out:
#ifndef WINDOWSXPKG_BINK_H #ifndef WINDOWSXPKG_BINK_H
#define WINDOWSXPKG_BINK_H #define WINDOWSXPKG_BINK_H
#include "header.h"
std::unordered_map<std::string, std::unordered_map<int, std::string>> Products; std::unordered_map<std::string, std::unordered_map<int, std::string>> Products;
std::unordered_map<std::string, ECDLP_Params> BINKData; std::unordered_map<std::string, ECDLP_Params> BINKData;
struct ECDLP_Params {
// p, a, b
std::tuple<std::string, std::string, std::string> E;
// x, y
std::tuple<std::string, std::string> K;
// x, y
std::tuple<std::string, std::string> G;
std::string n;
std::string k;
};
struct ProductID {
uint8_t SiteID;
uint16_t Serial;
};
void initBink() { void initBink() {
''') ''')

View File

@ -19,6 +19,8 @@
#include <openssl/sha.h> #include <openssl/sha.h>
#include <openssl/rand.h> #include <openssl/rand.h>
#include "bink.h"
#define PK_LENGTH 25 #define PK_LENGTH 25
#define NULL_TERMINATOR 1 #define NULL_TERMINATOR 1
@ -48,28 +50,7 @@ bool verifyXPKey(EC_GROUP *eCurve, EC_POINT *generator, EC_POINT *publicKey, cha
void generateXPKey(char *pKey, EC_GROUP *eCurve, EC_POINT *generator, BIGNUM *order, BIGNUM *privateKey, ul32 *pRaw); void generateXPKey(char *pKey, EC_GROUP *eCurve, EC_POINT *generator, BIGNUM *order, BIGNUM *privateKey, ul32 *pRaw);
// server.cpp // server.cpp
int verify2003(EC_GROUP *ec, EC_POINT *generator, EC_POINT *public_key, char *cdkey);
struct ECDLP_Params { void generate2003(char *pkey, EC_GROUP *ec, EC_POINT *generator, BIGNUM *order, BIGNUM *priv, ul32 *osfamily, ul32 *prefix);
// p, a, b
std::tuple<std::string, std::string, std::string> E;
// x, y
std::tuple<std::string, std::string> K;
// x, y
std::tuple<std::string, std::string> G;
std::string n;
std::string k;
};
struct ProductID {
uint8_t SiteID;
uint16_t Serial;
};
extern std::unordered_map<std::string, std::unordered_map<int, std::string>> Products;
extern std::unordered_map<std::string, ECDLP_Params> BINKData;
void initBink();
#endif //WINDOWSXPKG_HEADER_H #endif //WINDOWSXPKG_HEADER_H

View File

@ -1,4 +1,4 @@
#include "bink.h" #include "header.h"
void unpack2003(ul32 *osfamily, ul32 *hash, ul32 *sig, ul32 *prefix, ul32 *raw) void unpack2003(ul32 *osfamily, ul32 *hash, ul32 *sig, ul32 *prefix, ul32 *raw)
{ {

2
xp.cpp
View File

@ -15,7 +15,7 @@
*/ */
#include "bink.h" #include "header.h"
/* Unpacks the Windows XP Product Key. */ /* Unpacks the Windows XP Product Key. */
void unpackXP(ul32 *serial, ul32 *hash, ul32 *sig, ul32 *raw) { void unpackXP(ul32 *serial, ul32 *hash, ul32 *sig, ul32 *raw) {