Skip to content

Commit

Permalink
Fix build error in Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
10gic committed Mar 21, 2021
1 parent 055f932 commit ace6227
Show file tree
Hide file tree
Showing 271 changed files with 79,708 additions and 38 deletions.
59 changes: 39 additions & 20 deletions Makefile.Win32
Original file line number Diff line number Diff line change
@@ -1,37 +1,56 @@
CC = cl
OPENSSL_DIR = C:\OpenSSL-Win32
PTHREADS_DIR = C:\pthreads-w32-2-8-0-release
PCRE_DIR = C:\pcre-7.9-src
CURL_DIR = C:\curl-7.26.0-x86\builds\libcurl-release-static-ssl-static-ipv6-sspi
OPENCL_DIR = "C:\Program Files (x86)\AMD APP"
OPENCL_INCLUDE = /I$(OPENCL_DIR)\include
OPENCL_LIBS = $(OPENCL_DIR)\lib\x86\OpenCL.lib
CURL_INCLUDE = /I$(CURL_DIR)\include /DCURL_STATICLIB
CURL_LIBS = $(CURL_DIR)\lib\libcurl_a.lib
CFLAGS_BASE = /D_WIN32 /DPTW32_STATIC_LIB /DPCRE_STATIC /I$(OPENSSL_DIR)\inc32 /I$(PTHREADS_DIR) /I$(PCRE_DIR) /Ox /Zi

#### 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\CL
OPENCL_LIBS = $(OPENCL_DIR)\lib\Win32\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

#### Pthread
#### From: http://sourceware.org/pthreads-win32/
#### ftp://sourceware.org/pub/pthreads-win32/pthreads-w32-2-9-1-release.zip
PTHREADS_INCLUDE = .\third_party\windows\pthread\Pre-built.2\include
PTHREADS_LIBS = .\third_party\windows\pthread\Pre-built.2\lib\x86\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


#CURL_DIR = C:\curl-7.26.0-x86\builds\libcurl-release-static-ssl-static-ipv6-sspi
#CURL_INCLUDE = /I$(CURL_DIR)\include /DCURL_STATICLIB
#CURL_LIBS = $(CURL_DIR)\lib\libcurl_a.lib

CFLAGS_BASE = /D_WIN32 /DPCRE_STATIC /DPTW32_STATIC_LIB /DHAVE_STRUCT_TIMESPEC /I$(PTHREADS_INCLUDE) /I$(PCRE_INCLUDE) /I$(OPENSSL_INCLUDE) /Ox /Zi
CFLAGS = $(CFLAGS_BASE) /GL
LIBS = $(OPENSSL_DIR)\out32\libeay32.lib $(PTHREADS_DIR)\pthreadVC2.lib $(PCRE_DIR)\pcre.lib ws2_32.lib user32.lib advapi32.lib gdi32.lib /LTCG /DEBUG
OBJS = vanitygen.obj oclvanitygen.obj oclengine.obj oclvanityminer.obj keyconv.obj pattern.obj util.obj winglue.obj groestl.obj
LIBS = $(OPENSSL_LIBS) $(PTHREADS_LIBS) $(PCRE_LIBS) ws2_32.lib user32.lib advapi32.lib gdi32.lib /LTCG /DEBUG
OBJS = vanitygen.obj oclvanitygen.obj oclengine.obj oclvanityminer.obj keyconv.obj pattern.obj util.obj winglue.obj groestl.obj sha3.obj ed25519.obj stellar.o base32.o crc16.o

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

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

oclvanitygen.exe: oclvanitygen.obj oclengine.obj pattern.obj util.obj winglue.obj groestl.obj
oclvanitygen++.exe: oclvanitygen.obj oclengine.obj pattern.obj util.obj winglue.obj groestl.obj sha3.obj
link /nologo /out:$@ $** $(LIBS) $(OPENCL_LIBS)

oclvanityminer.exe: oclvanityminer.obj oclengine.obj pattern.obj util.obj winglue.obj groestl.obj
oclvanityminer.exe: oclvanityminer.obj oclengine.obj pattern.obj util.obj winglue.obj groestl.obj sha3.obj
link /nologo /out:$@ $** $(LIBS) $(OPENCL_LIBS) $(CURL_LIBS)

keyconv.exe: keyconv.obj util.obj winglue.obj groestl.obj
link /nologo /out:$@ $** $(LIBS)
keyconv.exe: keyconv.obj util.obj winglue.obj groestl.obj sha3.obj
link /nologo /out:$@ $** $(LIBS) $(OPENCL_LIBS)

.c.obj:
@$(CC) /nologo $(CFLAGS) /c /Tp$< /Fo$@

oclengine.obj: oclengine.c
@$(CC) /nologo $(CFLAGS_BASE) $(OPENCL_INCLUDE) /c /Tpoclengine.c /Fo$@
@$(CC) /nologo $(CFLAGS_BASE) /c /Tpoclengine.c /Fo$@

oclvanitygen.obj: oclvanitygen.c
@$(CC) /nologo $(CFLAGS_BASE) /c /Tpoclvanitygen.c /Fo$@
Expand All @@ -40,4 +59,4 @@ oclvanityminer.obj: oclvanityminer.c
@$(CC) /nologo $(CFLAGS_BASE) $(CURL_INCLUDE) /c /Tpoclvanityminer.c /Fo

clean:
del vanitygen.exe oclvanitygen.exe oclvanityminer.exe keyconv.exe $(OBJS)
del vanitygen++.exe oclvanitygen++.exe oclvanityminer.exe keyconv.exe $(OBJS)
10 changes: 7 additions & 3 deletions oclengine.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@
#include <openssl/rand.h>
#include <openssl/evp.h>

#if defined(_WIN32)
#include "winglue.h"
#endif

#define CL_USE_DEPRECATED_OPENCL_1_2_APIS

#ifdef __APPLE__
Expand Down Expand Up @@ -339,9 +343,9 @@ vg_ocl_dump_info(vg_ocl_context_t *vocp)
vg_ocl_device_getsizet(did, CL_DEVICE_MAX_COMPUTE_UNITS));
fprintf(stderr, "Max workgroup size: %" PRSIZET "d\n",
vg_ocl_device_getsizet(did, CL_DEVICE_MAX_WORK_GROUP_SIZE));
fprintf(stderr, "Global memory: %ld\n",
fprintf(stderr, "Global memory: %llu\n",
vg_ocl_device_getulong(did, CL_DEVICE_GLOBAL_MEM_SIZE));
fprintf(stderr, "Max allocation: %ld\n",
fprintf(stderr, "Max allocation: %llu\n",
vg_ocl_device_getulong(did, CL_DEVICE_MAX_MEM_ALLOC_SIZE));
vocp->voc_dump_done = 1;
}
Expand Down Expand Up @@ -1238,7 +1242,7 @@ vg_ocl_kernel_start(vg_ocl_context_t *vocp, int slot, int ncol, int nrow,
{
cl_int val, ret;
cl_event ev;
size_t globalws[2] = { ncol, nrow };
size_t globalws[2] = { (size_t)ncol, (size_t)nrow };
size_t invws = (ncol * nrow) / invsize;

assert(!vocp->voc_oclkrnwait[slot]);
Expand Down
3 changes: 1 addition & 2 deletions pattern.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
#include "pattern.h"
#include "util.h"
#include "avl.h"
#include "sha3.h"

/*
* Common code for execution helper
Expand Down Expand Up @@ -1623,7 +1622,7 @@ vg_prefix_test(vg_exec_context_t *vxcp)
plen -= 2;
}
// perform case-sensitive comparing
if (memcmp(checksum_addr, pattern, plen)) {
if (memcmp(checksum_addr, pattern, plen) != 0) {
if (vxcp->vxc_vc->vc_verbose > 1) {
fprintf(stderr, "case-sensitive comparing fail, pattern %s\n", vp->vp_pattern);
}
Expand Down
8 changes: 4 additions & 4 deletions sha3.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ static const uint64_t RC[24] = {1ULL,
REPEAT5(e; v += s;)

/*** Keccak-f[1600] ***/
__attribute__((always_inline)) static inline
static inline
void keccakf(void *state) {
uint64_t *a = (uint64_t *)state;
uint64_t b[5] = {0};
Expand Down Expand Up @@ -90,12 +90,12 @@ void keccakf(void *state) {
} while (0)
#define FOR(i, ST, L, S) _(size_t i; for (i = 0; i < L; i += ST) { S; })
#define mkapply_ds(NAME, S) \
__attribute__((always_inline)) static inline void NAME( \
static inline void NAME( \
uint8_t *dst, const uint8_t *src, size_t len) { \
FOR(i, 1, len, S); \
}
#define mkapply_sd(NAME, S) \
__attribute__((always_inline)) static inline void NAME( \
static inline void NAME( \
const uint8_t *src, uint8_t *dst, size_t len) { \
FOR(i, 1, len, S); \
}
Expand All @@ -116,7 +116,7 @@ mkapply_sd(setout, dst[i] = src[i]) // setout
}

/** The sponge-based hash construction. **/
__attribute__((always_inline)) static inline
static inline
int hash(uint8_t *out, size_t outlen, const uint8_t *in, size_t inlen,
size_t rate, uint8_t delim) {
if ((out == NULL) || ((in == NULL) && inlen != 0) || (rate >= Plen)) {
Expand Down
4 changes: 2 additions & 2 deletions sha3.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@
decsha3(256)
decsha3(512)

__attribute__((always_inline)) static inline
static inline
void SHA3_256(uint8_t const *ret, uint8_t const *data, size_t const size) {
sha3_256((uint8_t *)ret, 32, data, size);
}

__attribute__((always_inline)) static inline
static inline
void SHA3_512(uint8_t *ret, uint8_t const *data, size_t const size) {
sha3_512(ret, 64, data, size);
}
Expand Down
125 changes: 125 additions & 0 deletions third_party/windows/openssl-1.1/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@

LICENSE ISSUES
==============

The OpenSSL toolkit stays under a double license, i.e. both the conditions of
the OpenSSL License and the original SSLeay license apply to the toolkit.
See below for the actual license texts.

OpenSSL License
---------------

/* ====================================================================
* Copyright (c) 1998-2019 The OpenSSL Project. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. All advertising materials mentioning features or use of this
* software must display the following acknowledgment:
* "This product includes software developed by the OpenSSL Project
* for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
*
* 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
* endorse or promote products derived from this software without
* prior written permission. For written permission, please contact
* [email protected].
*
* 5. Products derived from this software may not be called "OpenSSL"
* nor may "OpenSSL" appear in their names without prior written
* permission of the OpenSSL Project.
*
* 6. Redistributions of any form whatsoever must retain the following
* acknowledgment:
* "This product includes software developed by the OpenSSL Project
* for use in the OpenSSL Toolkit (http://www.openssl.org/)"
*
* THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
* ====================================================================
*
* This product includes cryptographic software written by Eric Young
* ([email protected]). This product includes software written by Tim
* Hudson ([email protected]).
*
*/

Original SSLeay License
-----------------------

/* Copyright (C) 1995-1998 Eric Young ([email protected])
* All rights reserved.
*
* This package is an SSL implementation written
* by Eric Young ([email protected]).
* The implementation was written so as to conform with Netscapes SSL.
*
* This library is free for commercial and non-commercial use as long as
* the following conditions are aheared to. The following conditions
* apply to all code found in this distribution, be it the RC4, RSA,
* lhash, DES, etc., code; not just the SSL code. The SSL documentation
* included with this distribution is covered by the same copyright terms
* except that the holder is Tim Hudson ([email protected]).
*
* Copyright remains Eric Young's, and as such any Copyright notices in
* the code are not to be removed.
* If this package is used in a product, Eric Young should be given attribution
* as the author of the parts of the library used.
* This can be in the form of a textual message at program startup or
* in documentation (online or textual) provided with the package.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* "This product includes cryptographic software written by
* Eric Young ([email protected])"
* The word 'cryptographic' can be left out if the rouines from the library
* being used are not cryptographic related :-).
* 4. If you include any Windows specific code (or a derivative thereof) from
* the apps directory (application code) you must include an acknowledgement:
* "This product includes software written by Tim Hudson ([email protected])"
*
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* The licence and distribution terms for any publically available version or
* derivative of this code cannot be changed. i.e. this code cannot simply be
* copied and put under another distribution licence
* [including the GNU Public Licence.]
*/

1 change: 1 addition & 0 deletions third_party/windows/openssl-1.1/version.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
OpenSSL_1_1_1j-2-g01cf4f868e
92 changes: 92 additions & 0 deletions third_party/windows/openssl-1.1/x64/include/openssl/aes.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
/*
* Copyright 2002-2016 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the OpenSSL license (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
* in the file LICENSE in the source distribution or at
* https://www.openssl.org/source/license.html
*/

#ifndef HEADER_AES_H
# define HEADER_AES_H

# include <openssl/opensslconf.h>

# include <stddef.h>
# ifdef __cplusplus
extern "C" {
# endif

# define AES_ENCRYPT 1
# define AES_DECRYPT 0

/*
* Because array size can't be a const in C, the following two are macros.
* Both sizes are in bytes.
*/
# define AES_MAXNR 14
# define AES_BLOCK_SIZE 16

/* This should be a hidden type, but EVP requires that the size be known */
struct aes_key_st {
# ifdef AES_LONG
unsigned long rd_key[4 * (AES_MAXNR + 1)];
# else
unsigned int rd_key[4 * (AES_MAXNR + 1)];
# endif
int rounds;
};
typedef struct aes_key_st AES_KEY;

const char *AES_options(void);

int AES_set_encrypt_key(const unsigned char *userKey, const int bits,
AES_KEY *key);
int AES_set_decrypt_key(const unsigned char *userKey, const int bits,
AES_KEY *key);

void AES_encrypt(const unsigned char *in, unsigned char *out,
const AES_KEY *key);
void AES_decrypt(const unsigned char *in, unsigned char *out,
const AES_KEY *key);

void AES_ecb_encrypt(const unsigned char *in, unsigned char *out,
const AES_KEY *key, const int enc);
void AES_cbc_encrypt(const unsigned char *in, unsigned char *out,
size_t length, const AES_KEY *key,
unsigned char *ivec, const int enc);
void AES_cfb128_encrypt(const unsigned char *in, unsigned char *out,
size_t length, const AES_KEY *key,
unsigned char *ivec, int *num, const int enc);
void AES_cfb1_encrypt(const unsigned char *in, unsigned char *out,
size_t length, const AES_KEY *key,
unsigned char *ivec, int *num, const int enc);
void AES_cfb8_encrypt(const unsigned char *in, unsigned char *out,
size_t length, const AES_KEY *key,
unsigned char *ivec, int *num, const int enc);
void AES_ofb128_encrypt(const unsigned char *in, unsigned char *out,
size_t length, const AES_KEY *key,
unsigned char *ivec, int *num);
/* NB: the IV is _two_ blocks long */
void AES_ige_encrypt(const unsigned char *in, unsigned char *out,
size_t length, const AES_KEY *key,
unsigned char *ivec, const int enc);
/* NB: the IV is _four_ blocks long */
void AES_bi_ige_encrypt(const unsigned char *in, unsigned char *out,
size_t length, const AES_KEY *key,
const AES_KEY *key2, const unsigned char *ivec,
const int enc);

int AES_wrap_key(AES_KEY *key, const unsigned char *iv,
unsigned char *out,
const unsigned char *in, unsigned int inlen);
int AES_unwrap_key(AES_KEY *key, const unsigned char *iv,
unsigned char *out,
const unsigned char *in, unsigned int inlen);


# ifdef __cplusplus
}
# endif

#endif
Loading

0 comments on commit ace6227

Please sign in to comment.