vanitygen: update to 1.53.

change to vanitygen-plus fork,
vanitygen wasn't compatible with OpenSSL-1.1+
This commit is contained in:
John 2021-02-13 23:53:54 +01:00
parent b536bd0af5
commit a065fc5156
3 changed files with 1276 additions and 8 deletions

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,98 @@
From 5f163e6fff7da52c4aecbd898d9df2e60a56f134 Mon Sep 17 00:00:00 2001
From: DesWurstes <DesWurstes@users.noreply.github.com>
Date: Sun, 3 Jun 2018 17:46:16 +0300
Subject: [PATCH] Privkey prefix OpenSSL 1.1 compatibility (#116)
Fixes #114
---
oclengine.c | 18 +++++++++++++-----
vanitygen.c | 12 ++++++++++--
2 files changed, 23 insertions(+), 7 deletions(-)
diff --git a/oclengine.c b/oclengine.c
index 6585fc6..c69bd4b 100644
--- oclengine.c
+++ oclengine.c
@@ -5,7 +5,7 @@
* Vanitygen is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
- * any later version.
+ * any later version.
*
* Vanitygen is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -1058,7 +1058,7 @@ vg_ocl_kernel_arg_alloc(vg_ocl_context_t *vocp, int slot,
karg,
sizeof(clbuf),
&clbuf);
-
+
if (ret) {
fprintf(stderr,
"clSetKernelArg(%d,%d): ", knum, karg);
@@ -1090,7 +1090,7 @@ vg_ocl_copyout_arg(vg_ocl_context_t *vocp, int wslot, int arg,
buffer,
0, NULL,
NULL);
-
+
if (ret) {
fprintf(stderr, "clEnqueueWriteBuffer(%d): ", arg);
vg_ocl_error(vocp, ret, NULL);
@@ -2079,7 +2079,15 @@ vg_opencl_loop(vg_exec_context_t *arg)
npoints = 0;
if (vcp->vc_privkey_prefix_length > 0) {
BIGNUM *pkbn = BN_dup(EC_KEY_get0_private_key(pkey));
- memcpy((char *)pkbn->d + 32 - vcp->vc_privkey_prefix_length, vcp->vc_privkey_prefix, vcp->vc_privkey_prefix_length);
+ unsigned char pkey_arr[32];
+ assert(BN_bn2bin(pkbn, pkey_arr) < 33);
+ memcpy((char *) pkey_arr, vcp->vc_privkey_prefix, vcp->vc_privkey_prefix_length);
+ for (int i = 0; i < vcp->vc_privkey_prefix_length / 2; i++) {
+ int k = pkey_arr[i];
+ pkey_arr[i] = pkey_arr[vcp->vc_privkey_prefix_length - 1 - i];
+ pkey_arr[vcp->vc_privkey_prefix_length - 1 - i] = k;
+ }
+ BN_bin2bn(pkey_arr, 32, pkbn);
EC_KEY_set_private_key(pkey, pkbn);
EC_POINT *origin = EC_POINT_new(pgroup);
@@ -2240,7 +2248,7 @@ vg_opencl_loop(vg_exec_context_t *arg)
slot_busy = 1;
slot = (slot + 1) % nslots;
- } else {
+ } else {
if (slot_busy) {
pthread_mutex_lock(&vocp->voc_lock);
while (vocp->voc_ocl_slot != -1) {
diff --git a/vanitygen.c b/vanitygen.c
index 992e5d7..5e49df7 100644
--- vanitygen.c
+++ vanitygen.c
@@ -129,7 +129,15 @@ vg_thread_loop(void *arg)
EC_KEY_generate_key(pkey);
if (vcp->vc_privkey_prefix_length > 0) {
BIGNUM *pkbn = BN_dup(EC_KEY_get0_private_key(pkey));
- memcpy((char *)pkbn->d + 32 - vcp->vc_privkey_prefix_length, vcp->vc_privkey_prefix, vcp->vc_privkey_prefix_length);
+ unsigned char pkey_arr[32];
+ assert(BN_bn2bin(pkbn, pkey_arr) < 33);
+ memcpy((char *) pkey_arr, vcp->vc_privkey_prefix, vcp->vc_privkey_prefix_length);
+ for (int i = 0; i < vcp->vc_privkey_prefix_length / 2; i++) {
+ int k = pkey_arr[i];
+ pkey_arr[i] = pkey_arr[vcp->vc_privkey_prefix_length - 1 - i];
+ pkey_arr[vcp->vc_privkey_prefix_length - 1 - i] = k;
+ }
+ BN_bin2bn(pkey_arr, 32, pkbn);
EC_KEY_set_private_key(pkey, pkbn);
EC_POINT *origin = EC_POINT_new(pgroup);
@@ -1395,7 +1403,7 @@ main(int argc, char **argv)
addrtype = 60;
privtype = 128;
break;
- }
+ }
break;
/*END ALTCOIN GENERATOR*/

View file

@ -1,17 +1,16 @@
# Template file for 'vanitygen'
pkgname=vanitygen
version=0.22
revision=3
_commit=9e04497a127aa6413463ccf4a4aee75f0d581d92
wrksrc="vanitygen-${_commit}"
version=1.53
revision=1
wrksrc="vanitygen-plus-PLUS${version}"
makedepends="pcre-devel libressl-devel"
short_desc="Bitcoin vanity address generator"
maintainer="Orphaned <orphan@voidlinux.org>"
license="AGPL-3.0-or-later"
homepage="https://github.com/samr7/vanitygen"
changelog="https://raw.githubusercontent.com/samr7/vanitygen/master/CHANGELOG"
distfiles="https://github.com/samr7/vanitygen/archive/${_commit}.tar.gz"
checksum=cf81e1eb4c81a3dcf86ab681ef1ad9229702ad8b00d1367462f396718b13d1fc
homepage="https://github.com/exploitagency/vanitygen-plus"
changelog="https://raw.githubusercontent.com/exploitagency/vanitygen-plus/master/CHANGELOG"
distfiles="https://github.com/exploitagency/vanitygen-plus/archive/PLUS${version}.tar.gz"
checksum=976a9afe2a4470551a8b6b0da97101a3a2e6c54c5a26dc870ae755bb2d8c7041
do_build() {
make CC=$CC CFLAGS="$CFLAGS $LDFLAGS" ${makejobs}