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
#define WINDOWSXPKG_BINK_H
#include "header.h"
std::unordered_map<std::string, std::unordered_map<int, std::string>> Products;
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() {
''')

View file

@ -19,6 +19,8 @@
#include <openssl/sha.h>
#include <openssl/rand.h>
#include "bink.h"
#define PK_LENGTH 25
#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);
// server.cpp
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;
};
extern std::unordered_map<std::string, std::unordered_map<int, std::string>> Products;
extern std::unordered_map<std::string, ECDLP_Params> BINKData;
void initBink();
int verify2003(EC_GROUP *ec, EC_POINT *generator, EC_POINT *public_key, char *cdkey);
void generate2003(char *pkey, EC_GROUP *ec, EC_POINT *generator, BIGNUM *order, BIGNUM *priv, ul32 *osfamily, ul32 *prefix);
#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)
{

2
xp.cpp
View file

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