rbsecp256k1 6.0.1 → 6.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/LICENSE +24 -24
- data/README.md +134 -129
- data/Rakefile +23 -18
- data/documentation/context.md +125 -98
- data/documentation/index.md +391 -378
- data/documentation/key_pair.md +25 -25
- data/documentation/private_key.md +25 -25
- data/documentation/public_key.md +36 -36
- data/documentation/recoverable_signature.md +30 -30
- data/documentation/schnorr_signature.md +34 -30
- data/documentation/secp256k1.md +24 -24
- data/documentation/shared_secret.md +14 -14
- data/documentation/signature.md +42 -42
- data/documentation/util.md +17 -17
- data/documentation/xonly_public_key.md +29 -29
- data/ext/rbsecp256k1/extconf.rb +62 -121
- data/ext/rbsecp256k1/rbsecp256k1.c +2429 -2244
- data/ext/rbsecp256k1/secp256k1_recipe.rb +76 -0
- data/lib/rbsecp256k1/context.rb +40 -36
- data/lib/rbsecp256k1/util.rb +28 -28
- data/lib/rbsecp256k1/version.rb +5 -5
- data/lib/rbsecp256k1.rb +14 -14
- metadata +16 -1
data/ext/rbsecp256k1/extconf.rb
CHANGED
|
@@ -1,121 +1,62 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require '
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
#
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
#
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
"
|
|
24
|
-
]
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
def extract
|
|
65
|
-
files_hashs.each do |file|
|
|
66
|
-
extract_zip_file(file[:local_path], tmp_path)
|
|
67
|
-
end
|
|
68
|
-
end
|
|
69
|
-
end
|
|
70
|
-
|
|
71
|
-
if with_config('system-library')
|
|
72
|
-
# Require that libsecp256k1 be installed using `make install` or similar.
|
|
73
|
-
message("checking for libsecp256k1\n")
|
|
74
|
-
results = pkg_config('libsecp256k1')
|
|
75
|
-
abort "missing libsecp256k1" unless results && results[1]
|
|
76
|
-
else
|
|
77
|
-
# Build the libsecp256k1 dependency
|
|
78
|
-
recipe = Secp256k1Recipe.new
|
|
79
|
-
recipe.cook
|
|
80
|
-
recipe.activate
|
|
81
|
-
|
|
82
|
-
# Need to add paths to includes and libraries for library for build
|
|
83
|
-
append_cflags(
|
|
84
|
-
[
|
|
85
|
-
"-I#{recipe.path}/include",
|
|
86
|
-
"-fPIC",
|
|
87
|
-
"-Wno-undef",
|
|
88
|
-
"-Wall"
|
|
89
|
-
]
|
|
90
|
-
)
|
|
91
|
-
append_ldflags(
|
|
92
|
-
[
|
|
93
|
-
"-Wl,--no-as-needed"
|
|
94
|
-
]
|
|
95
|
-
)
|
|
96
|
-
# rubocop:disable Style/GlobalVars
|
|
97
|
-
$LIBPATH = ["#{recipe.path}/lib"] | $LIBPATH
|
|
98
|
-
# rubocop:enable Style/GlobalVars
|
|
99
|
-
|
|
100
|
-
# Also need to make sure we add the library as part of the build
|
|
101
|
-
have_library("secp256k1")
|
|
102
|
-
have_library("gmp")
|
|
103
|
-
end
|
|
104
|
-
|
|
105
|
-
# Sanity check for the basic library
|
|
106
|
-
have_header('secp256k1.h')
|
|
107
|
-
|
|
108
|
-
# Check if we have the libsecp256k1 recoverable signature header.
|
|
109
|
-
have_header('secp256k1_recovery.h') if WITH_RECOVERY
|
|
110
|
-
|
|
111
|
-
# Check if we have EC Diffie-Hellman functionality
|
|
112
|
-
have_header('secp256k1_ecdh.h')
|
|
113
|
-
|
|
114
|
-
# Check if we have Schnorr signatures
|
|
115
|
-
have_header('secp256k1_schnorrsig.h')
|
|
116
|
-
|
|
117
|
-
# Check if we have extra keys module
|
|
118
|
-
have_header('secp256k1_extrakeys.h')
|
|
119
|
-
|
|
120
|
-
# See: https://guides.rubygems.org/gems-with-extensions/
|
|
121
|
-
create_makefile('rbsecp256k1/rbsecp256k1')
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'mkmf'
|
|
4
|
+
require_relative 'secp256k1_recipe'
|
|
5
|
+
|
|
6
|
+
if with_config('system-library')
|
|
7
|
+
# Require that libsecp256k1 be installed using `make install` or similar.
|
|
8
|
+
message("checking for libsecp256k1\n")
|
|
9
|
+
results = pkg_config('libsecp256k1')
|
|
10
|
+
abort "missing libsecp256k1" unless results && results[1]
|
|
11
|
+
else
|
|
12
|
+
# Build the libsecp256k1 dependency
|
|
13
|
+
recipe = Secp256k1Recipe.new
|
|
14
|
+
recipe.cook
|
|
15
|
+
recipe.activate
|
|
16
|
+
|
|
17
|
+
# Need to add paths to includes and libraries for library for build
|
|
18
|
+
append_cflags(
|
|
19
|
+
[
|
|
20
|
+
"-I#{recipe.path}/include",
|
|
21
|
+
"-fPIC",
|
|
22
|
+
"-Wno-undef",
|
|
23
|
+
"-Wall"
|
|
24
|
+
]
|
|
25
|
+
)
|
|
26
|
+
# Since libsecp256k1 v0.4.0, consumers of the static library on Windows must
|
|
27
|
+
# define SECP256K1_STATIC before including secp256k1.h.
|
|
28
|
+
append_cflags("-DSECP256K1_STATIC") if RUBY_PLATFORM =~ /mingw|mswin/
|
|
29
|
+
append_ldflags(
|
|
30
|
+
[
|
|
31
|
+
"-Wl,--no-as-needed"
|
|
32
|
+
]
|
|
33
|
+
)
|
|
34
|
+
# rubocop:disable Style/GlobalVars
|
|
35
|
+
$LIBPATH = ["#{recipe.path}/lib"] | $LIBPATH
|
|
36
|
+
# rubocop:enable Style/GlobalVars
|
|
37
|
+
|
|
38
|
+
# Also need to make sure we add the library as part of the build
|
|
39
|
+
have_library("secp256k1")
|
|
40
|
+
have_library("gmp")
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
# Reject ABI-incompatible pointer arguments when the compiler supports it.
|
|
44
|
+
append_cflags('-Werror=incompatible-pointer-types')
|
|
45
|
+
|
|
46
|
+
# Sanity check for the basic library
|
|
47
|
+
have_header('secp256k1.h')
|
|
48
|
+
|
|
49
|
+
# Check if we have the libsecp256k1 recoverable signature header.
|
|
50
|
+
have_header('secp256k1_recovery.h') if WITH_RECOVERY
|
|
51
|
+
|
|
52
|
+
# Check if we have EC Diffie-Hellman functionality
|
|
53
|
+
have_header('secp256k1_ecdh.h')
|
|
54
|
+
|
|
55
|
+
# Check if we have Schnorr signatures
|
|
56
|
+
have_header('secp256k1_schnorrsig.h')
|
|
57
|
+
|
|
58
|
+
# Check if we have extra keys module
|
|
59
|
+
have_header('secp256k1_extrakeys.h')
|
|
60
|
+
|
|
61
|
+
# See: https://guides.rubygems.org/gems-with-extensions/
|
|
62
|
+
create_makefile('rbsecp256k1/rbsecp256k1')
|