Folder refactor

This commit is contained in:
Andrew 2023-06-01 23:09:44 +03:00
parent cc009d0ad4
commit e437cc548a
8 changed files with 23 additions and 17 deletions

View File

@ -1,31 +1,31 @@
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.11)
CMAKE_MINIMUM_REQUIRED(VERSION 3.9)
PROJECT(WindowsXPKg)
SET(CMAKE_CXX_STANDARD 17)
set(OPENSSL_USE_STATIC_LIBS TRUE)
find_package(PkgConfig REQUIRED)
pkg_search_module(OPENSSL REQUIRED openssl)
SET(OPENSSL_USE_STATIC_LIBS TRUE)
FIND_PACKAGE(PkgConfig REQUIRED)
PKG_SEARCH_MODULE(OPENSSL REQUIRED openssl)
if (!OPENSSL_FOUND)
message(FATAL_ERROR "OpenSSL Development Libraries Not Found")
endif()
IF(!OPENSSL_FOUND)
MESSAGE(FATAL_ERROR "OpenSSL Development Libraries Not Found")
ENDIF()
include(cmake/CPM.cmake)
INCLUDE(cmake/CPM.cmake)
# include json runtime library
# Include JSON runtime library
CPMAddPackage(
NAME nlohmann_json
GITHUB_REPOSITORY nlohmann/json
VERSION 3.11.2)
configure_file(keys.json keys.json COPYONLY)
CONFIGURE_FILE(keys.json keys.json COPYONLY)
set(BUILD_SHARED_LIBS OFF)
set(CMAKE_EXE_LINKER_FLAGS "-static")
ADD_EXECUTABLE(xpkey main.cpp xp.cpp key.cpp util.cpp cli.cpp)
SET(BUILD_SHARED_LIBS OFF)
SET(CMAKE_EXE_LINKER_FLAGS "-static")
ADD_EXECUTABLE(xpkey src/main.cpp src/xp.cpp src/key.cpp src/util.cpp src/cli.cpp)
TARGET_INCLUDE_DIRECTORIES(xpkey PUBLIC crypto)
TARGET_LINK_LIBRARIES(xpkey PUBLIC crypto nlohmann_json::nlohmann_json)
ADD_EXECUTABLE(srv2003key server.cpp key.cpp util.cpp cli.cpp)
ADD_EXECUTABLE(srv2003key src/server.cpp src/key.cpp src/util.cpp src/cli.cpp)
TARGET_INCLUDE_DIRECTORIES(srv2003key PUBLIC crypto)
TARGET_LINK_LIBRARIES(srv2003key PUBLIC crypto nlohmann_json::nlohmann_json)

View File

@ -10,6 +10,7 @@
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <random>
#include <fstream>
#include <string>
#include <vector>
@ -31,7 +32,7 @@
#define FIELD_BYTES_2003 64
typedef unsigned char byte;
typedef uint32_t ul32;
typedef unsigned int ul32;
extern char charset[];

View File

@ -80,7 +80,7 @@ int main() {
ul32 nRaw = 640 * 1000000 ; /* <- change */
//nRaw += rand() & 999999;
printf("> PID: %lu\n", nRaw);
printf("> PID: %u\n", nRaw);
// generate a key
BN_sub(privateKey, genOrder, privateKey);

View File

@ -4,6 +4,11 @@
#include "header.h"
int randomRange() {
}
/* Convert data between endianness types. */
void endian(byte *data, int length) {
for (int i = 0; i < length / 2; i++) {

View File

@ -231,7 +231,7 @@ void generateXPKey(char *pKey, EC_GROUP *eCurve, EC_POINT *generator, BIGNUM *or
// Pack product key.
packXP(bKey, pRaw, &hash, sig);
printf("PID: %.8lX\nHash: %.8lX\nSig: %.8lX %.8lX\n", pRaw[0], hash, sig[1], sig[0]);
printf("PID: %.8X\nHash: %.8X\nSig: %.8X %.8X\n", pRaw[0], hash, sig[1], sig[0]);
} while (bKey[3] >= 0x40000);
// ↑ ↑ ↑
// bKey[3] can't be longer than 18 bits, else the signature part will make