Bitcoin Forum
December 16, 2017, 11:31:06 PM *
News: Latest stable version of Bitcoin Core: 0.15.1  [Torrent].
 
   Home   Help Search Donate Login Register  
Pages: [1]
  Print  
Author Topic: secp256k1 as a library on Windows  (Read 1791 times)
amaclin
Legendary
*
Offline Offline

Activity: 1260


View Profile
January 16, 2015, 10:44:08 AM
 #1

Is there a simple way to use https://github.com/bitcoin/secp256k1 with rfc6979 support in Windows/Qt environment?
I do not have enough experience with boost, gmp and many other mubmo-jumbo packages
I feel myself lost reading the words "sudo", "apt-get", "autotools", "make" etc.
I had big troubles with installing/compiling OpenSSL (but I've solved them)

I want to have just a way to include header file with two methods something like

Code:
void sign ( const char* privkey, const char* digest, char* r, char* s ); // every pointer to 32-byte memory buffer
bool verify ( const char* digest, const char* pub, const int pubLen, const char* sig, const int sigLen );

Let us say that I have fresh
1) Windows installation
2) Qt/mingw installation
1513467066
Hero Member
*
Offline Offline

Posts: 1513467066

View Profile Personal Message (Offline)

Ignore
1513467066
Reply with quote  #2

1513467066
Report to moderator
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction. Advertise here.
gmaxwell
Moderator
Legendary
*
qt
Offline Offline

Activity: 2366



View Profile
January 16, 2015, 02:56:42 PM
 #2

You should probably not be using the library right now, especially not if you're having problems using what is a very basic C library.  It is preproduction experimental software, as it says so quite explicitly on the website.

I probably will never stop being horrified at people's capacity for rushing head long into using software that even its authors tell them not to use. It makes it much harder to work in the open, because you now have to worry about what harm inadequately tested software is causing people (and their users) who ignore warnings.

Bitcoin will not be compromised
CIYAM
Legendary
*
Offline Offline

Activity: 1862


Ian Knowles - CIYAM Lead Developer


View Profile WWW
January 16, 2015, 03:00:17 PM
 #3

As an aside has the OpenSSL project planned to change to the RFC sig implementation?

(if not then I might work on getting a MSVC Windows build of this library as I have developed a Wallet package that I would prefer uses deterministic sigs)

With CIYAM anyone can create 100% generated C++ web applications in literally minutes.

GPG Public Key | 1ciyam3htJit1feGa26p2wQ4aw6KFTejU
amaclin
Legendary
*
Offline Offline

Activity: 1260


View Profile
January 16, 2015, 03:11:37 PM
 #4

You should probably not be using the library right now, especially not if you're having problems using what is a very basic C library.  It is preproduction experimental software.
I want use it after understanding how it works.
But I can not even compile a very basic example, something like

Code:
#include "secp256k1.h"
void main ( )
{
  QByteArray privkey ( "Hello, world!                              " );
  privkey.resize ( 32 );
  QByteArray digest ( "This is a digest                           " );
  digest.resize ( 32 );
  qDebug ( ) << QString ( sign ( privkey, digest ).toHex ( ) );
}
CIYAM
Legendary
*
Offline Offline

Activity: 1862


Ian Knowles - CIYAM Lead Developer


View Profile WWW
January 16, 2015, 03:17:14 PM
 #5

You do release that your snippet doesn't have any #include's for Qt?

And that "void main" is non-standard C++ (are their still books teaching people to code "void main" these days?).


With CIYAM anyone can create 100% generated C++ web applications in literally minutes.

GPG Public Key | 1ciyam3htJit1feGa26p2wQ4aw6KFTejU
amaclin
Legendary
*
Offline Offline

Activity: 1260


View Profile
January 16, 2015, 03:25:26 PM
 #6

You do release that your snippet doesn't have any #include's for Qt?
And that "void main" is non-standard C++ (are their still books teaching people to code "void main" these days?).
This code was written in browser, not in C++ editor.
This is only an example how do I see the usage of library.
Do you think that this snippet would be better with #include <QString> #include <QByteArray>  Grin
CIYAM
Legendary
*
Offline Offline

Activity: 1862


Ian Knowles - CIYAM Lead Developer


View Profile WWW
January 16, 2015, 03:27:02 PM
 #7

This code was written in browser, not in C++ editor.
This is only an example how do I see the usage of library.

Okay - but it's hard to help out if you don't post the actual code you are trying compile.

Do you think that this snippet would be better with #include <QString> #include <QByteArray>

It would make it somewhat easier to know for sure what your problem is considering in the OP indicated you were not that well versed in C++.

You should post the compile errors for a start.

With CIYAM anyone can create 100% generated C++ web applications in literally minutes.

GPG Public Key | 1ciyam3htJit1feGa26p2wQ4aw6KFTejU
amaclin
Legendary
*
Offline Offline

Activity: 1260


View Profile
January 16, 2015, 03:41:26 PM
 #8

Quote
You should post the compile errors for a start.

Code:
num_gmp.h:10: Error: gmp.h: No such file or directory
 #include <gmp.h>
                 ^
fsb4000
Legendary
*
Offline Offline

Activity: 1400



View Profile
January 16, 2015, 03:55:43 PM
 #9

Quote
You should post the compile errors for a start.

Code:
num_gmp.h:10: Error: gmp.h: No such file or directory
 #include <gmp.h>
                 ^
http://habrahabr.ru/sandbox/53707/
CIYAM
Legendary
*
Offline Offline

Activity: 1862


Ian Knowles - CIYAM Lead Developer


View Profile WWW
January 16, 2015, 04:37:56 PM
 #10

Code:
num_gmp.h:10: Error: gmp.h: No such file or directory
 #include <gmp.h>
                 ^

So you are missing GMP - is there a windows version of that library?


With CIYAM anyone can create 100% generated C++ web applications in literally minutes.

GPG Public Key | 1ciyam3htJit1feGa26p2wQ4aw6KFTejU
amaclin
Legendary
*
Offline Offline

Activity: 1260


View Profile
January 16, 2015, 04:47:21 PM
 #11

Quote
So you are missing GMP - is there a windows version of that library?
I've missed everything.
No boost, stl, std, c++11, generics, templates, namespaces, packages...
Only Windows + Qt from the box.

I've never used gmp, I even do not know what is it and can I trust it.
I know that ECDSA sign is a function of three arguments: key, digest and k
where key is my secret key,
k is temporary secret value (random of derived from secret)
and digest is public known hash of some data
CIYAM
Legendary
*
Offline Offline

Activity: 1862


Ian Knowles - CIYAM Lead Developer


View Profile WWW
January 16, 2015, 04:50:53 PM
 #12

I think you are going to have problems - if it uses GMP then you need GMP (unless there is some macro that makes that not necessary).

I doubt it uses high level stuff (like STL) as it is basically a C library (I haven't looked at the source code yet - just took a quick look at the README).

With CIYAM anyone can create 100% generated C++ web applications in literally minutes.

GPG Public Key | 1ciyam3htJit1feGa26p2wQ4aw6KFTejU
CIYAM
Legendary
*
Offline Offline

Activity: 1862


Ian Knowles - CIYAM Lead Developer


View Profile WWW
January 16, 2015, 04:56:24 PM
 #13

As I want to upgrade my Wallet package to use deterministic sigs I will probably be using this library myself soon.

If you aren't in a huge hurry then perhaps just wait for me to fork it (as CIYAM can be compiled with MSVC so I'll work out how it can be done using MSVC rather than a Linux to Windows environment).

With CIYAM anyone can create 100% generated C++ web applications in literally minutes.

GPG Public Key | 1ciyam3htJit1feGa26p2wQ4aw6KFTejU
amaclin
Legendary
*
Offline Offline

Activity: 1260


View Profile
January 16, 2015, 05:01:39 PM
 #14

Quote
I think you are going to have problems

What else can we do on Sunday? {*}
samson
Legendary
*
Offline Offline

Activity: 1274


View Profile
January 18, 2015, 12:37:13 AM
 #15

The PolarSSL C library does all that you want and it's easy to use.

If you want to write programs which do raw transactions, sha256 / ripemd160 hashing, signature creation and verification, etc it's all there.

There's a library called picocoin which I think someone in this thread created and someone else has converted it to work with polarssl instead of openssl. I believe that work was completed.
Pages: [1]
  Print  
 
Jump to:  

Sponsored by , a Bitcoin-accepting VPN.
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!