nginnever / zogminer

an OpenCL Zcash GPU miner
MIT License
151 stars 64 forks source link

ECDSA_SIG_set0 and ECDSA_SIG_get0 undefined #39

Open mperklin opened 7 years ago

mperklin commented 7 years ago

Can't compile zogminer due to these undefined symbols.

They seem related to the openssl library, however I can't find which openssl header defines them.

rbiegel commented 7 years ago

Are you using libressl instead of openssl? Had the same issue when compiling vanilla zcashd and fixed it by manually adding the missing definitions (borrowed from openssl source). An include statement has to be adapted too:

diff --git a/src/ecwrapper.cpp b/src/ecwrapper.cpp
index ae27488..66750c2 100644
--- a/src/ecwrapper.cpp
+++ b/src/ecwrapper.cpp
@@ -10,6 +10,26 @@
 #include <openssl/bn.h>
 #include <openssl/obj_mac.h>

+
+void ECDSA_SIG_get0(const ECDSA_SIG *sig, const BIGNUM **pr, const BIGNUM **ps)
+{
+    if (pr != NULL)
+        *pr = sig->r;
+    if (ps != NULL)
+        *ps = sig->s;
+}
+
+int ECDSA_SIG_set0(ECDSA_SIG *sig, BIGNUM *r, BIGNUM *s)
+{
+    if (r == NULL || s == NULL)
+        return 0;
+    BN_clear_free(sig->r);
+    BN_clear_free(sig->s);
+    sig->r = r;
+    sig->s = s;
+    return 1;
+}
+
 namespace {

 class ecgroup_order
diff --git a/src/ecwrapper.h b/src/ecwrapper.h
index efb6cd1..9af6d5d 100644
--- a/src/ecwrapper.h
+++ b/src/ecwrapper.h
@@ -8,7 +8,7 @@
 #include <cstddef>
 #include <vector>

-#include <openssl/ec.h>
+#include <openssl/ecdsa.h>

 class uint256;
je4d commented 7 years ago

I just ran into this. Those functions are new in openssl1.1, which your OS may not have. e.g. latest Ubuntu (yakkety) is on 1.0.x.

nuaa-wwbin commented 2 years ago

I just ran into this. Those functions are new in openssl1.1, which your OS may not have. e.g. latest Ubuntu (yakkety) is on 1.0.x.

How to fix it?