Skip to content

Commit

Permalink
Fix build issue in Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
10gic committed May 4, 2024
1 parent 6a036c9 commit 4fa43bd
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 22 deletions.
28 changes: 14 additions & 14 deletions Makefile.Win32
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
#### Build command: nmake -f Makefile.Win32

CC = cl

#### CUDA
#### From: https://developer.nvidia.com/cuda-10.0-download-archive
OPENCL_DIR = "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.0"
OPENCL_INCLUDE = $(OPENCL_DIR)\include
OPENCL_LIBS = $(OPENCL_DIR)\lib\Win32\OpenCL.lib
#### OpenCL
#### From: https://github.com/KhronosGroup/OpenCL-SDK/releases/download/v2023.12.14/OpenCL-SDK-v2023.12.14-Win-x64.zip
OPENCL_INCLUDE = .\third_party\windows\OpenCL-SDK-v2023.12.14-Win-x64\include
OPENCL_LIBS =.\third_party\windows\OpenCL-SDK-v2023.12.14-Win-x64\lib\OpenCL.lib

#### OpenSSL
#### From: https://kb.firedaemon.com/support/solutions/articles/4000121705
OPENSSL_INCLUDE = .\third_party\windows\openssl-1.1\x86\include
OPENSSL_LIBS = .\third_party\windows\openssl-1.1\x86\lib\libcrypto.lib
OPENSSL_INCLUDE = .\third_party\windows\openssl-3.0\x64\include
OPENSSL_LIBS = .\third_party\windows\openssl-3.0\x64\lib\libcrypto.lib

#### Pthread
#### From: http://sourceware.org/pthreads-win32/
#### ftp://sourceware.org/pub/pthreads-win32/pthreads-w32-2-9-1-release.zip
#### From: https://sourceforge.net/projects/pthreads4w/files/
PTHREADS_INCLUDE = .\third_party\windows\pthread\Pre-built.2\include
PTHREADS_LIBS = .\third_party\windows\pthread\Pre-built.2\lib\x86\pthreadVC2.lib
PTHREADS_LIBS = .\third_party\windows\pthread\Pre-built.2\lib\x64\pthreadVC2.lib

#### PCRE
#### From: http://gnuwin32.sourceforge.net/packages/pcre.htm
PCRE_INCLUDE = .\third_party\windows\pcre-7.0-lib\include
PCRE_LIBS = .\third_party\windows\pcre-7.0-lib\lib\pcre.lib
#### From: https://freeswitch.org/bamboo/browse/SP-PW-1/artifact/shared/pcre-windows-binaries-zip/
PCRE_INCLUDE = .\third_party\windows\pcre-8.34\include
PCRE_LIBS = .\third_party\windows\pcre-8.34\binaries\x64\Release\lib\pcre.lib


#CURL_DIR = C:\curl-7.26.0-x86\builds\libcurl-release-static-ssl-static-ipv6-sspi
Expand All @@ -34,7 +34,7 @@ OBJS = vanitygen.obj oclvanitygen.obj oclengine.obj oclvanityminer.obj keyconv.o

all: vanitygen++.exe oclvanitygen++.exe

vanitygen++.exe: vanitygen.obj pattern.obj util.obj winglue.obj groestl.obj sha3.obj ed25519.obj stellar.obj base32.obj crc16.obj
vanitygen++.exe: vanitygen.obj pattern.obj util.obj winglue.obj groestl.obj sha3.obj ed25519.obj stellar.obj base32.obj crc16.obj simplevanitygen.obj bech32.obj segwit_addr.obj
link /nologo /out:$@ $** $(LIBS)

oclvanitygen++.exe: oclvanitygen.obj oclengine.obj pattern.obj util.obj winglue.obj groestl.obj sha3.obj
Expand Down
16 changes: 8 additions & 8 deletions simplevanitygen.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ output_check_info(vg_context_simplevanitygen_t *vcp) {
fflush(stdout);
}

void *
void
get_public_key(EVP_PKEY *pkey, unsigned char *pub_buf, size_t buf_len, int form, size_t *output_len) {
// There are two methods to get public key from EVP_PKEY
// Method 1: use EVP_PKEY_get_octet_string_param(pkey, OSSL_PKEY_PARAM_PUB_KEY, ...)
Expand All @@ -85,22 +85,22 @@ get_public_key(EVP_PKEY *pkey, unsigned char *pub_buf, size_t buf_len, int form,
} else { // Method 2
// See https://stackoverflow.com/questions/18155559/how-does-one-access-the-raw-ecdh-public-key-private-key-and-params-inside-opens
EC_KEY *ec_key = EVP_PKEY_get1_EC_KEY(pkey);
EC_POINT *ppoint = EC_KEY_get0_public_key(ec_key);
EC_GROUP *pgroup = EC_KEY_get0_group(ec_key);
const EC_POINT *ppoint = EC_KEY_get0_public_key(ec_key);
const EC_GROUP *pgroup = EC_KEY_get0_group(ec_key);
*output_len = EC_POINT_point2oct(pgroup,
ppoint,
form,
(point_conversion_form_t)form,
pub_buf,
buf_len,
NULL);
EC_KEY_free(ec_key);
}
}

void *
void
get_private_key(EVP_PKEY *pkey, unsigned char *pub_buf, size_t buf_len, size_t *output_len) {
EC_KEY *ec_key = EVP_PKEY_get1_EC_KEY(pkey);
BIGNUM *pkbn = EC_KEY_get0_private_key(ec_key);
const BIGNUM *pkbn = EC_KEY_get0_private_key(ec_key);
*output_len = BN_bn2bin(pkbn, pub_buf);
EC_KEY_free(ec_key);
}
Expand Down Expand Up @@ -224,14 +224,14 @@ thread_loop_simplevanitygen(void *arg) {
BN_bin2bn(tagged_hash, 32, t);

EC_KEY *ec_key = EVP_PKEY_get1_EC_KEY(pkey);
EC_GROUP *pgroup = EC_KEY_get0_group(ec_key);
const EC_GROUP *pgroup = EC_KEY_get0_group(ec_key);

// Compute T = t * G
EC_POINT *T = EC_POINT_new(pgroup);
EC_POINT_mul(pgroup, T, t, NULL, NULL, NULL);

// P = public key, if Y of public key is even
EC_POINT *P = EC_KEY_get0_public_key(ec_key);
const EC_POINT *P = EC_KEY_get0_public_key(ec_key);

EC_KEY_free(ec_key);

Expand Down

0 comments on commit 4fa43bd

Please sign in to comment.