Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ECDSA_SIG_set0 and ECDSA_SIG_get0 undefined #39

Open
mperklin opened this issue Oct 28, 2016 · 3 comments
Open

ECDSA_SIG_set0 and ECDSA_SIG_get0 undefined #39

mperklin opened this issue Oct 28, 2016 · 3 comments

Comments

@mperklin
Copy link

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
Copy link

rbiegel commented Oct 30, 2016

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
Copy link

je4d commented Mar 26, 2017

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
Copy link

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants