Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions Makefile.unix.amd
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
LIBS=-lpcre -lcrypto -lm -lpthread -L/opt/AMDAPP/lib -L/opt/AMDAPP/lib/x86_64
CFLAGS=-ggdb -O3 -Wall -I/opt/AMDAPP/include
OBJS=vanitygen.o oclvanitygen.o oclvanityminer.o oclengine.o keyconv.o pattern.o util.o
PROGS=vanitygen keyconv oclvanitygen oclvanityminer

PLATFORM=$(shell uname -s)
ifeq ($(PLATFORM),Darwin)
OPENCL_LIBS=-framework OpenCL
else
OPENCL_LIBS=-lOpenCL
endif


most: vanitygen keyconv

all: $(PROGS)

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

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

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

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

clean:
rm -f $(OBJS) $(PROGS) $(TESTS)
2 changes: 2 additions & 0 deletions oclengine.c
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,8 @@ vg_ocl_get_quirks(vg_ocl_context_t *vocp)

dvn = vg_ocl_device_getstr(vocp->voc_ocldid,
CL_DEVICE_NAME);
if (!strcmp(dvn, "Tahiti") || !strcmp(dvn, "Barts") || !strcmp(dvn, "Pitcairn"))
quirks &= ~VG_OCL_AMD_BFI_INT;
if (!strcmp(dvn, "ATI RV710")) {
quirks &= ~VG_OCL_OPTIMIZATIONS;
quirks |= VG_OCL_NO_BINARIES;
Expand Down
35 changes: 27 additions & 8 deletions oclvanitygen.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,12 @@
* along with Vanitygen. If not, see <http://www.gnu.org/licenses/>.
*/

#include <assert.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <assert.h>
#include <sys/types.h>
#include <unistd.h>

#include <openssl/ec.h>
#include <openssl/bn.h>
Expand Down Expand Up @@ -76,7 +78,8 @@ usage(const char *name)
"-f <file> File containing list of patterns, one per line\n"
" (Use \"-\" as the file name for stdin)\n"
"-o <file> Write pattern matches to <file>\n"
"-s <file> Seed random number generator from <file>\n",
"-s <file> Seed random number generator from <file>\n"
"-O <file> Save PID in <file>\n",
version, name);
}

Expand Down Expand Up @@ -107,10 +110,11 @@ main(int argc, char **argv)
int verify_mode = 0;
int safe_mode = 0;
vg_context_t *vcp = NULL;
vg_ocl_context_t *vocp = NULL;
EC_POINT *pubkey_base = NULL;
const char *result_file = NULL;
vg_ocl_context_t *vocp = NULL;
EC_POINT *pubkey_base = NULL;
const char *result_file = NULL;
const char *key_password = NULL;
const char *pidfile = NULL;
char *devstrs[MAX_DEVS];
int ndevstrs = 0;
int opened = 0;
Expand All @@ -123,7 +127,7 @@ main(int argc, char **argv)
int i;

while ((opt = getopt(argc, argv,
"vqik1NTX:eE:p:P:d:w:t:g:b:VSh?f:o:s:D:")) != -1) {
"vqik1NTX:eE:p:P:d:w:t:g:b:VSh?f:o:O:s:D:")) != -1) {
switch (opt) {
case 'v':
verbose = 2;
Expand Down Expand Up @@ -282,7 +286,10 @@ main(int argc, char **argv)
}
seedfile = optarg;
break;
default:
case 'O':
pidfile = optarg;
break;
case 'h': case '?': default:
usage(argv[0]);
return 1;
}
Expand Down Expand Up @@ -322,6 +329,18 @@ main(int argc, char **argv)
}
}

if (pidfile) {
FILE *fd = fopen(pidfile, "wb");
if (!fd) {
fprintf(stderr, "Could not write pid, open file failure: %s\n", pidfile);
return 1;
}
char buf[8];
snprintf(buf, sizeof(buf), "%d", getpid());
fwrite(buf, strlen(buf), 1, fd);
fclose(fd);
}

if (regex) {
vcp = vg_regex_context_new(addrtype, privtype);

Expand Down