diff --git a/convert_keys_to_cpp.py b/convert_keys_to_cpp.py index 6067bf2..2edf32c 100644 --- a/convert_keys_to_cpp.py +++ b/convert_keys_to_cpp.py @@ -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> Products; std::unordered_map BINKData; +struct ECDLP_Params { + // p, a, b + std::tuple E; + + // x, y + std::tuple K; + + // x, y + std::tuple G; + + std::string n; + std::string k; +}; + +struct ProductID { + uint8_t SiteID; + uint16_t Serial; +}; + void initBink() { ''') diff --git a/header.h b/header.h index 6bdbccb..31020c4 100644 --- a/header.h +++ b/header.h @@ -19,6 +19,8 @@ #include #include +#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 E; - - // x, y - std::tuple K; - - // x, y - std::tuple G; - - std::string n; - std::string k; -}; - -struct ProductID { - uint8_t SiteID; - uint16_t Serial; -}; - -extern std::unordered_map> Products; -extern std::unordered_map 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 diff --git a/server.cpp b/server.cpp index bf763e9..295320a 100644 --- a/server.cpp +++ b/server.cpp @@ -1,4 +1,4 @@ -#include "bink.h" +#include "header.h" void unpack2003(ul32 *osfamily, ul32 *hash, ul32 *sig, ul32 *prefix, ul32 *raw) { diff --git a/xp.cpp b/xp.cpp index 7e2fb37..ca92e12 100644 --- a/xp.cpp +++ b/xp.cpp @@ -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) {