Skip to content

Commit

Permalink
Add oclvanityminer. Move OpenCL engine code to oclengine.c.
Browse files Browse the repository at this point in the history
  • Loading branch information
samr7 committed Jul 1, 2012
1 parent 9ac1c5e commit 4700be0
Show file tree
Hide file tree
Showing 11 changed files with 3,634 additions and 2,582 deletions.
11 changes: 8 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,16 +1,21 @@
LIBS=-lpcre -lcrypto -lm -lpthread
CFLAGS=-ggdb -O3 -Wall
OBJS=vanitygen.o oclvanitygen.o keyconv.o pattern.o util.o
PROGS=vanitygen keyconv
OBJS=vanitygen.o oclvanitygen.o oclvanityminer.o oclengine.o keyconv.o pattern.o util.o
PROGS=vanitygen oclvanitygen oclvanityminer keyconv

most: vanitygen keyconv

all: $(PROGS)

vanitygen: vanitygen.o pattern.o util.o
$(CC) $^ -o $@ $(CFLAGS) $(LIBS)

oclvanitygen: oclvanitygen.o pattern.o util.o
oclvanitygen: oclvanitygen.o oclengine.o pattern.o util.o
$(CC) $^ -o $@ $(CFLAGS) $(LIBS) -lOpenCL

oclvanityminer: oclvanityminer.o oclengine.o pattern.o util.o
$(CC) $^ -o $@ $(CFLAGS) $(LIBS) -lOpenCL -lcurl

keyconv: keyconv.o util.o
$(CC) $^ -o $@ $(CFLAGS) $(LIBS)

Expand Down
31 changes: 22 additions & 9 deletions Makefile.Win32
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,42 @@ 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
CFLAGS = /D_WIN32 /DPTW32_STATIC_LIB /DPCRE_STATIC /I$(OPENSSL_DIR)\include /I$(PTHREADS_DIR) /I$(PCRE_DIR)
LIBS = $(OPENSSL_DIR)\lib\libeay32.lib $(PTHREADS_DIR)\pthreadVC2.lib $(PCRE_DIR)\pcre.lib ws2_32.lib
OBJS = vanitygen.obj oclvanitygen.obj keyconv.obj pattern.obj util.obj winglue.obj
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
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

all: vanitygen.exe
all: vanitygen.exe keyconv.exe

vanitygen.exe: vanitygen.obj pattern.obj util.obj winglue.obj
link /nologo /out:$@ $** $(LIBS)

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

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

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

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

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

oclvanitygen.obj: oclvanitygen.c
@$(CC) /nologo $(CFLAGS) $(OPENCL_INCLUDE) /c /Tpoclvanitygen.c /Fo$@
@$(CC) /nologo $(CFLAGS_BASE) /c /Tpoclvanitygen.c /Fo$@

oclvanityminer.obj: oclvanityminer.c
@$(CC) /nologo $(CFLAGS_BASE) $(CURL_INCLUDE) /c /Tpoclvanityminer.c /Fo$@

clean:
del vanitygen.exe $(OBJS)
del vanitygen.exe oclvanitygen.exe oclvanityminer.exe keyconv.exe $(OBJS)
18 changes: 16 additions & 2 deletions keyconv.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ usage(const char *progname)
"-8 Output key in PKCS#8 form\n"
"-e Encrypt output key, prompt for password\n"
"-E <password> Encrypt output key with <password> (UNSAFE)\n"
"-c <key> Combine private key parts to make complete private key",
"-c <key> Combine private key parts to make complete private key\n"
"-v Verbose output\n",
version, progname);
}

Expand All @@ -47,10 +48,11 @@ main(int argc, char **argv)
int privtype, addrtype;
int pkcs8 = 0;
int pass_prompt = 0;
int verbose = 0;
int opt;
int res;

while ((opt = getopt(argc, argv, "8E:ec:")) != -1) {
while ((opt = getopt(argc, argv, "8E:ec:v")) != -1) {
switch (opt) {
case '8':
pkcs8 = 1;
Expand All @@ -75,6 +77,9 @@ main(int argc, char **argv)
case 'c':
key2_in = optarg;
break;
case 'v':
verbose = 1;
break;
default:
usage(argv[0]);
return 1;
Expand Down Expand Up @@ -149,6 +154,15 @@ main(int argc, char **argv)
default: addrtype = 0; break;
}

if (verbose) {
unsigned char *pend = (unsigned char *) pbuf;
res = i2o_ECPublicKey(pkey, &pend);
fprintf(stderr, "Pubkey (hex): ");
dumphex((unsigned char *)pbuf, res);
fprintf(stderr, "Privkey (hex): ");
dumpbn(EC_KEY_get0_private_key(pkey));
}

if (pkcs8) {
res = vg_pkcs8_encode_privkey(pbuf, sizeof(pbuf),
pkey, pass_in);
Expand Down
Loading

0 comments on commit 4700be0

Please sign in to comment.