rbsecp256k1 3.0.0 → 3.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +147 -0
- data/ext/rbsecp256k1/extconf.rb +50 -2
- data/lib/rbsecp256k1/version.rb +1 -1
- metadata +16 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 529c72afdaa5cd79bc685fd28661d367be89a019366e9b9d46bb9db7dd99e499
|
4
|
+
data.tar.gz: 21d2af92f7c0c696f2a36b6a6de4c330f0dac30078a1d61327e3e22bb80bd4ef
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2d32348b294c9e75ac950f1be1ae2dc0de0c1a31a3038da397426dc56f5cde637a453037f0e5dab0c6bb7bc1761f9afc6934c2f804d328bb4f31279754ec1584
|
7
|
+
data.tar.gz: '03028eee4ffcf8d8df75488444a8fc963ffa2e10fceb0ac4ac9fb8762f5c403594d74eafedf110ff2c955091fb2d9f76257a5517c7f80fdd2bccc6e2274d6882'
|
data/README.md
ADDED
@@ -0,0 +1,147 @@
|
|
1
|
+
# rbsecp256k1
|
2
|
+
|
3
|
+
[![Build Status](https://travis-ci.com/etscrivner/rbsecp256k1.svg?branch=master)](https://travis-ci.com/etscrivner/rbsecp256k1) [![Gem Version](https://badge.fury.io/rb/rbsecp256k1.svg)](https://badge.fury.io/rb/rbsecp256k1)
|
4
|
+
|
5
|
+
Compiled Ruby extension gem for [libsecp256k1](https://github.com/bitcoin-core/secp256k1). In rbsecp256k1 3.0.0
|
6
|
+
and later libsecp256k1 is bundled with the gem.
|
7
|
+
|
8
|
+
[Documentation](documentation/index.md)
|
9
|
+
|
10
|
+
### Why wrap libsecp256k1?
|
11
|
+
|
12
|
+
[libsecp256k1](https://github.com/bitcoin-core/secp256k1) is an extremely optimized implementation of public key derivation,
|
13
|
+
signing, and verification with the secp256k1 elliptic curve. It comes with its
|
14
|
+
own set of benchmarks, but from [benchmarking done by Peter Wuille](https://www.reddit.com/r/Bitcoin/comments/2weymr/experiment_bitcoin_core_0100_initial_sync_time/coqghm2) it is ~4.9x
|
15
|
+
faster than the OpenSSL implementation of the same curve. It is the only library
|
16
|
+
that provides constant time signing of this curve and has been deployed as part
|
17
|
+
of Bitcoin since [v0.10.0](https://bitcoin.org/en/release/v0.10.0#improved-signing-security)
|
18
|
+
|
19
|
+
## Installation
|
20
|
+
|
21
|
+
The simplest installation:
|
22
|
+
|
23
|
+
```
|
24
|
+
gem install rbsecp256k1
|
25
|
+
```
|
26
|
+
|
27
|
+
## Requirements
|
28
|
+
|
29
|
+
If you want to use your system version of libsecp256k1 rather than the bundled
|
30
|
+
version use the `--with-system-libraries` flag:
|
31
|
+
|
32
|
+
```
|
33
|
+
gem install rbsecp256k1 -- --with-system-libraries
|
34
|
+
```
|
35
|
+
|
36
|
+
#### Linux
|
37
|
+
|
38
|
+
Install the dependencies for building libsecp256k1 and this library:
|
39
|
+
|
40
|
+
```
|
41
|
+
sudo apt-get install build-essential automake pkg-config libtool \
|
42
|
+
libffi-dev libssl-dev libgmp-dev python-dev
|
43
|
+
```
|
44
|
+
|
45
|
+
**NOTE:** If you have installed libsecp256k1 but the gem cannot find it. Ensure
|
46
|
+
you have run `ldconfig` so that your library load paths have been updated.
|
47
|
+
|
48
|
+
#### macOS
|
49
|
+
|
50
|
+
Dependencies for building libsecp256k1 and this library:
|
51
|
+
|
52
|
+
```
|
53
|
+
brew install openssl libtool pkg-config gmp libffi
|
54
|
+
```
|
55
|
+
|
56
|
+
## Features
|
57
|
+
|
58
|
+
See [rbsecp256k1 documentation](documentation/index.md) for examples and complete list of supported functionality.
|
59
|
+
|
60
|
+
## Development
|
61
|
+
|
62
|
+
### Cloning
|
63
|
+
|
64
|
+
To clone the repository and its submodules you'll need to the following:
|
65
|
+
|
66
|
+
```
|
67
|
+
git clone git@github.com:etscrivner/rbsecp256k1.git
|
68
|
+
```
|
69
|
+
|
70
|
+
### Setup
|
71
|
+
|
72
|
+
Development is largely facilitated by a makefile. After download you should run
|
73
|
+
the following command to set up your local environment:
|
74
|
+
|
75
|
+
```
|
76
|
+
make setup
|
77
|
+
```
|
78
|
+
|
79
|
+
### Compiling Extension
|
80
|
+
|
81
|
+
To compile the extension gem run the following (this is required to run tests):
|
82
|
+
|
83
|
+
```
|
84
|
+
make build
|
85
|
+
```
|
86
|
+
|
87
|
+
### Running Tests
|
88
|
+
|
89
|
+
```
|
90
|
+
make test
|
91
|
+
```
|
92
|
+
|
93
|
+
To test with recovery functionality disabled run:
|
94
|
+
|
95
|
+
```
|
96
|
+
make test WITH_RECOVERY=0
|
97
|
+
```
|
98
|
+
|
99
|
+
To test with ECDH functionality disabled run:
|
100
|
+
|
101
|
+
```
|
102
|
+
make test WITH_ECDH=0
|
103
|
+
```
|
104
|
+
|
105
|
+
To test with both disabled run:
|
106
|
+
|
107
|
+
```
|
108
|
+
make test WITH_RECOVERY=0 WITH_ECDH=0
|
109
|
+
```
|
110
|
+
|
111
|
+
### Building Gem
|
112
|
+
|
113
|
+
```
|
114
|
+
make gem
|
115
|
+
```
|
116
|
+
|
117
|
+
### Installing Gem Locally
|
118
|
+
|
119
|
+
To install the gem locally and verify builds you can run:
|
120
|
+
|
121
|
+
```
|
122
|
+
make install
|
123
|
+
```
|
124
|
+
|
125
|
+
### Uninstall Gem Locally
|
126
|
+
|
127
|
+
You can similarly uninstall the local gem by running the following:
|
128
|
+
|
129
|
+
```
|
130
|
+
make uninstall
|
131
|
+
```
|
132
|
+
|
133
|
+
### Cleaning Up
|
134
|
+
|
135
|
+
To clean up and do a fresh build:
|
136
|
+
|
137
|
+
```
|
138
|
+
make clean
|
139
|
+
```
|
140
|
+
|
141
|
+
### Running YARD Documentation Server
|
142
|
+
|
143
|
+
To run the [YARD](https://yardoc.org/) documentation server:
|
144
|
+
|
145
|
+
```
|
146
|
+
make docserver
|
147
|
+
```
|
data/ext/rbsecp256k1/extconf.rb
CHANGED
@@ -2,6 +2,19 @@ require 'mini_portile2'
|
|
2
2
|
require 'mkmf'
|
3
3
|
require 'zip'
|
4
4
|
|
5
|
+
# Indicates the platform on which the package is being installed
|
6
|
+
INSTALLING_OS =
|
7
|
+
if RUBY_PLATFORM =~ /darwin/
|
8
|
+
:macos
|
9
|
+
elsif RUBY_PLATFORM =~ /linux/
|
10
|
+
:linux
|
11
|
+
else
|
12
|
+
:unknown
|
13
|
+
end
|
14
|
+
|
15
|
+
# Fixed path to Homebrew OpenSSL pkgconfig file
|
16
|
+
HOMEBREW_OPENSSL_PKGCONFIG = '/usr/local/opt/openssl/lib/pkgconfig'.freeze
|
17
|
+
|
5
18
|
# Recipe for downloading and building libsecp256k1 as part of installation
|
6
19
|
class Secp256k1Recipe < MiniPortile
|
7
20
|
# Hard-coded URL for libsecp256k1 zipfile (HEAD of master as of 26-11-2018)
|
@@ -70,13 +83,48 @@ class Secp256k1Recipe < MiniPortile
|
|
70
83
|
end
|
71
84
|
|
72
85
|
# OpenSSL flags
|
73
|
-
|
86
|
+
message("checking for OpenSSL\n")
|
74
87
|
results = pkg_config('openssl')
|
88
|
+
|
89
|
+
# Failed to find package OpenSSL
|
90
|
+
unless results && results[1]
|
91
|
+
# Check if the user happens to have OpenSSL installed via Homebrew on a path
|
92
|
+
# we know about.
|
93
|
+
# rubocop:disable Style/GlobalVars
|
94
|
+
if INSTALLING_OS == :macos && File.exist?(HOMEBREW_OPENSSL_PKGCONFIG)
|
95
|
+
begin
|
96
|
+
require 'rubygems'
|
97
|
+
gem 'pkg-config', (gem_ver = '~> 1.3')
|
98
|
+
require 'pkg-config'
|
99
|
+
rescue LoadError
|
100
|
+
message(
|
101
|
+
"pkg-config could not be used to find openssl\n" \
|
102
|
+
"Please install either `pkg-config` or the pkg-config gem via\n" \
|
103
|
+
"gem install pkg-config -v #{gem_ver.inspect}\n\n"
|
104
|
+
)
|
105
|
+
else
|
106
|
+
message("Initial check failed. Trying homebrew openssl path...\n")
|
107
|
+
message("Using pkg-config gem version #{PKGConfig::VERSION}\n")
|
108
|
+
PKGConfig.add_path(HOMEBREW_OPENSSL_PKGCONFIG)
|
109
|
+
|
110
|
+
cflags = PKGConfig.cflags('openssl')
|
111
|
+
ldflags = PKGConfig.libs_only_L('openssl')
|
112
|
+
libs = PKGConfig.libs_only_l('openssl')
|
113
|
+
|
114
|
+
$CFLAGS += " " << cflags if cflags
|
115
|
+
$libs += " " << libs if libs
|
116
|
+
$LDFLAGS = [$LDFLAGS, ldflags].join(' ')
|
117
|
+
|
118
|
+
results = [cflags, libs, ldflags]
|
119
|
+
end
|
120
|
+
end
|
121
|
+
# rubocop:enable Style/GlobalVars
|
122
|
+
end
|
75
123
|
abort "missing openssl pkg-config information" unless results && results[1]
|
76
124
|
|
77
125
|
if with_config('system-library')
|
78
126
|
# Require that libsecp256k1 be installed using `make install` or similar.
|
79
|
-
|
127
|
+
message("checking for libsecp256k1\n")
|
80
128
|
results = pkg_config('libsecp256k1')
|
81
129
|
abort "missing libsecp256k1" unless results && results[1]
|
82
130
|
else
|
data/lib/rbsecp256k1/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rbsecp256k1
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
4
|
+
version: 3.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eric Scrivner
|
@@ -24,6 +24,20 @@ dependencies:
|
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '2.4'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: pkg-config
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.3'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.3'
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: rubyzip
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -115,6 +129,7 @@ extensions:
|
|
115
129
|
- ext/rbsecp256k1/extconf.rb
|
116
130
|
extra_rdoc_files: []
|
117
131
|
files:
|
132
|
+
- README.md
|
118
133
|
- Rakefile
|
119
134
|
- ext/rbsecp256k1/extconf.rb
|
120
135
|
- ext/rbsecp256k1/rbsecp256k1.c
|