gpgme 2.1.0 → 2.1.1
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/dependencies.yml +10 -0
- data/ext/gpgme/extconf.rb +77 -83
- data/ext/gpgme/gpgme_n.c +69 -19
- data/lib/gpgme/ctx.rb +39 -0
- data/lib/gpgme/version.rb +1 -1
- data/test/ctx_test.rb +31 -0
- data/test/native_ext_test.rb +20 -0
- metadata +159 -144
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ac4227fc251abc8c293d87c00af3099ef923f391c7e60f403427e8e2f13d0ec8
|
|
4
|
+
data.tar.gz: fb6055a3144a9234c277e2b74bcd1f3bb9268b746c378390d03a009a3558da2c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 17af9a04f9e7c5061e1e08917ac4bf7d19b94cf2b64ed85999b94f7a81343838b65bad1e984a806e67c3705790ec60fa8a41c57f41bcccccc7bcaa6f9e722890
|
|
7
|
+
data.tar.gz: 8387650ac961e375d857e532c6abb3928c168495a87ab5da965db10749b8a93e88463640178215c391db32f8251649ae6569710545ce59b56b77ec9dc51360d7
|
data/dependencies.yml
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
---
|
|
2
|
+
libgpg-error:
|
|
3
|
+
version: '1.55'
|
|
4
|
+
sha256: 95b178148863f07d45df0cea67e880a79b9ef71f5d230baddc0071128516ef78
|
|
5
|
+
libassuan:
|
|
6
|
+
version: '3.0.2'
|
|
7
|
+
sha256: d2931cdad266e633510f9970e1a2f346055e351bb19f9b78912475b8074c36f6
|
|
8
|
+
gpgme:
|
|
9
|
+
version: '2.3.1'
|
|
10
|
+
sha256: 2bf94e0e677e5a8fc31f79dd323f91c5416b36fb851058bc1e8bce39f2642434
|
data/ext/gpgme/extconf.rb
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
require 'mkmf'
|
|
2
|
+
require 'yaml'
|
|
2
3
|
|
|
3
4
|
# Available options:
|
|
4
5
|
#
|
|
@@ -9,6 +10,78 @@ require 'mkmf'
|
|
|
9
10
|
|
|
10
11
|
ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..', '..'))
|
|
11
12
|
|
|
13
|
+
def load_recipes
|
|
14
|
+
require 'rubygems'
|
|
15
|
+
require 'mini_portile2'
|
|
16
|
+
|
|
17
|
+
dependencies = YAML.load_file(File.join(ROOT, 'dependencies.yml'))
|
|
18
|
+
|
|
19
|
+
cook = lambda do |name, configure_options|
|
|
20
|
+
MiniPortile.new(name, dependencies[name]['version']).tap do |recipe|
|
|
21
|
+
recipe.target = File.join(ROOT, "ports")
|
|
22
|
+
recipe.files = [{
|
|
23
|
+
:url => "https://www.gnupg.org/ftp/gcrypt/#{recipe.name}/#{recipe.name}-#{recipe.version}.tar.bz2",
|
|
24
|
+
:sha256 => dependencies[name]['sha256']
|
|
25
|
+
}]
|
|
26
|
+
recipe.configure_options = configure_options
|
|
27
|
+
checkpoint = "#{recipe.target}/#{recipe.name}-#{recipe.version}-#{recipe.host}.installed"
|
|
28
|
+
unless File.exist?(checkpoint)
|
|
29
|
+
recipe.cook
|
|
30
|
+
FileUtils.touch checkpoint
|
|
31
|
+
end
|
|
32
|
+
recipe.activate
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
libgpg_error_recipe = cook.call('libgpg-error', [
|
|
37
|
+
'--enable-install-gpg-error-config',
|
|
38
|
+
'--disable-shared',
|
|
39
|
+
'--enable-static',
|
|
40
|
+
'--disable-nls',
|
|
41
|
+
"CFLAGS=-fPIC #{ENV["CFLAGS"]}",
|
|
42
|
+
])
|
|
43
|
+
|
|
44
|
+
libassuan_recipe = cook.call('libassuan', [
|
|
45
|
+
'--disable-shared',
|
|
46
|
+
'--enable-static',
|
|
47
|
+
"--with-gpg-error-prefix=#{libgpg_error_recipe.path}",
|
|
48
|
+
"CFLAGS=-fPIC #{ENV["CFLAGS"]}",
|
|
49
|
+
])
|
|
50
|
+
|
|
51
|
+
pkg_config_paths = [
|
|
52
|
+
File.join(libgpg_error_recipe.lib_path, 'pkgconfig'),
|
|
53
|
+
File.join(libassuan_recipe.lib_path, 'pkgconfig'),
|
|
54
|
+
]
|
|
55
|
+
|
|
56
|
+
# Ensure that the locally-built libraries take precedence. gpgme runs
|
|
57
|
+
# `gpgrt-config libassuan` and could pull in the system libassuan
|
|
58
|
+
# if PKG_CONFIG_PATH is not set properly.
|
|
59
|
+
ENV["PKG_CONFIG_PATH"] = [*pkg_config_paths, ENV["PKG_CONFIG_PATH"]].compact.join(File::PATH_SEPARATOR)
|
|
60
|
+
|
|
61
|
+
gpgme_recipe = cook.call('gpgme', [
|
|
62
|
+
'--disable-shared',
|
|
63
|
+
'--enable-static',
|
|
64
|
+
"--with-gpg-error-prefix=#{libgpg_error_recipe.path}",
|
|
65
|
+
"--with-libassuan-prefix=#{libassuan_recipe.path}",
|
|
66
|
+
# GPGME 1.5.0 assumes gpgsm is present if gpgconf is found.
|
|
67
|
+
# However, on some systems (e.g. Debian), they are splitted into
|
|
68
|
+
# separate packages.
|
|
69
|
+
'--disable-gpgconf-test',
|
|
70
|
+
'--disable-gpg-test',
|
|
71
|
+
'--disable-gpgsm-test',
|
|
72
|
+
'--disable-g13-test',
|
|
73
|
+
# We only need the C API.
|
|
74
|
+
'--disable-languages',
|
|
75
|
+
"CFLAGS=-D_LARGEFILE64_SOURCE -fPIC #{ENV["CFLAGS"]}",
|
|
76
|
+
])
|
|
77
|
+
|
|
78
|
+
{
|
|
79
|
+
'libgpg-error' => libgpg_error_recipe,
|
|
80
|
+
'libassuan' => libassuan_recipe,
|
|
81
|
+
'gpgme' => gpgme_recipe,
|
|
82
|
+
}
|
|
83
|
+
end
|
|
84
|
+
|
|
12
85
|
if arg_config('--clean')
|
|
13
86
|
require 'pathname'
|
|
14
87
|
require 'fileutils'
|
|
@@ -62,89 +135,10 @@ follows:
|
|
|
62
135
|
************************************************************************
|
|
63
136
|
EOS
|
|
64
137
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
recipe.target = File.join(ROOT, "ports")
|
|
70
|
-
recipe.files = [{
|
|
71
|
-
:url => "https://www.gnupg.org/ftp/gcrypt/#{recipe.name}/#{recipe.name}-#{recipe.version}.tar.bz2",
|
|
72
|
-
:sha256 => '95b178148863f07d45df0cea67e880a79b9ef71f5d230baddc0071128516ef78'
|
|
73
|
-
}]
|
|
74
|
-
recipe.configure_options = [
|
|
75
|
-
'--enable-install-gpg-error-config',
|
|
76
|
-
'--disable-shared',
|
|
77
|
-
'--enable-static',
|
|
78
|
-
'--disable-nls',
|
|
79
|
-
"CFLAGS=-fPIC #{ENV["CFLAGS"]}",
|
|
80
|
-
]
|
|
81
|
-
checkpoint = "#{recipe.target}/#{recipe.name}-#{recipe.version}-#{recipe.host}.installed"
|
|
82
|
-
unless File.exist?(checkpoint)
|
|
83
|
-
recipe.cook
|
|
84
|
-
FileUtils.touch checkpoint
|
|
85
|
-
end
|
|
86
|
-
recipe.activate
|
|
87
|
-
end
|
|
88
|
-
|
|
89
|
-
libassuan_recipe = MiniPortile.new('libassuan', '3.0.2').tap do |recipe|
|
|
90
|
-
recipe.target = File.join(ROOT, "ports")
|
|
91
|
-
recipe.files = [{
|
|
92
|
-
:url => "https://www.gnupg.org/ftp/gcrypt/#{recipe.name}/#{recipe.name}-#{recipe.version}.tar.bz2",
|
|
93
|
-
:sha256 => 'd2931cdad266e633510f9970e1a2f346055e351bb19f9b78912475b8074c36f6'
|
|
94
|
-
}]
|
|
95
|
-
recipe.configure_options = [
|
|
96
|
-
'--disable-shared',
|
|
97
|
-
'--enable-static',
|
|
98
|
-
"--with-gpg-error-prefix=#{libgpg_error_recipe.path}",
|
|
99
|
-
"CFLAGS=-fPIC #{ENV["CFLAGS"]}",
|
|
100
|
-
]
|
|
101
|
-
checkpoint = "#{recipe.target}/#{recipe.name}-#{recipe.version}-#{recipe.host}.installed"
|
|
102
|
-
unless File.exist?(checkpoint)
|
|
103
|
-
recipe.cook
|
|
104
|
-
FileUtils.touch checkpoint
|
|
105
|
-
end
|
|
106
|
-
recipe.activate
|
|
107
|
-
end
|
|
108
|
-
|
|
109
|
-
pkg_config_paths = [
|
|
110
|
-
File.join(libgpg_error_recipe.lib_path, 'pkgconfig'),
|
|
111
|
-
File.join(libassuan_recipe.lib_path, 'pkgconfig'),
|
|
112
|
-
]
|
|
113
|
-
|
|
114
|
-
# Ensure that the locally-built libraries take precedence. gpgme runs
|
|
115
|
-
# `gpgrt-config libassuan` and could pull in the system libassuan
|
|
116
|
-
# if PKG_CONFIG_PATH is not set properly.
|
|
117
|
-
ENV["PKG_CONFIG_PATH"] = [*pkg_config_paths, ENV["PKG_CONFIG_PATH"]].compact.join(File::PATH_SEPARATOR)
|
|
118
|
-
|
|
119
|
-
gpgme_recipe = MiniPortile.new('gpgme', '2.3.1').tap do |recipe|
|
|
120
|
-
recipe.target = File.join(ROOT, "ports")
|
|
121
|
-
recipe.files = [{
|
|
122
|
-
:url => "https://www.gnupg.org/ftp/gcrypt/#{recipe.name}/#{recipe.name}-#{recipe.version}.tar.bz2",
|
|
123
|
-
:sha256 => '2bf94e0e677e5a8fc31f79dd323f91c5416b36fb851058bc1e8bce39f2642434'
|
|
124
|
-
}]
|
|
125
|
-
recipe.configure_options = [
|
|
126
|
-
'--disable-shared',
|
|
127
|
-
'--enable-static',
|
|
128
|
-
"--with-gpg-error-prefix=#{libgpg_error_recipe.path}",
|
|
129
|
-
"--with-libassuan-prefix=#{libassuan_recipe.path}",
|
|
130
|
-
# GPGME 1.5.0 assumes gpgsm is present if gpgconf is found.
|
|
131
|
-
# However, on some systems (e.g. Debian), they are splitted into
|
|
132
|
-
# separate packages.
|
|
133
|
-
'--disable-gpgconf-test',
|
|
134
|
-
'--disable-gpg-test',
|
|
135
|
-
'--disable-gpgsm-test',
|
|
136
|
-
'--disable-g13-test',
|
|
137
|
-
# We only need the C API.
|
|
138
|
-
'--disable-languages',
|
|
139
|
-
"CFLAGS=-D_LARGEFILE64_SOURCE -fPIC #{ENV["CFLAGS"]}",
|
|
140
|
-
]
|
|
141
|
-
checkpoint = "#{recipe.target}/#{recipe.name}-#{recipe.version}-#{recipe.host}.installed"
|
|
142
|
-
unless File.exist?(checkpoint)
|
|
143
|
-
recipe.cook
|
|
144
|
-
FileUtils.touch checkpoint
|
|
145
|
-
end
|
|
146
|
-
recipe.activate
|
|
147
|
-
end
|
|
138
|
+
recipes = load_recipes
|
|
139
|
+
libgpg_error_recipe = recipes['libgpg-error']
|
|
140
|
+
libassuan_recipe = recipes['libassuan']
|
|
141
|
+
gpgme_recipe = recipes['gpgme']
|
|
148
142
|
|
|
149
143
|
# special treatment to link with static libraries
|
|
150
144
|
$libs = $libs.shellsplit.tap {|libs|
|
data/ext/gpgme/gpgme_n.c
CHANGED
|
@@ -149,12 +149,21 @@ owner_refs_delete (void *owner)
|
|
|
149
149
|
st_delete (owner_refs, &key, NULL);
|
|
150
150
|
}
|
|
151
151
|
|
|
152
|
-
/* Maps each
|
|
153
|
-
gpgme_wait can return the existing object instead of wrapping
|
|
154
|
-
context a second time. The entries are weak: they are removed
|
|
155
|
-
the object is freed and updated when GC.compact moves it. */
|
|
152
|
+
/* Maps each libgpgme context to the GPGME::Ctx object that owns it, so
|
|
153
|
+
that gpgme_wait can return the existing object instead of wrapping
|
|
154
|
+
the context a second time. The entries are weak: they are removed
|
|
155
|
+
when the object is freed and updated when GC.compact moves it. */
|
|
156
156
|
static st_table *ctx_objects;
|
|
157
157
|
|
|
158
|
+
/* What ctx_objects stores for each libgpgme context. It is allocated
|
|
159
|
+
separately, so GC.compact can update OBJECT without changing the
|
|
160
|
+
table. Changing the table would allocate, which is not allowed
|
|
161
|
+
during GC. */
|
|
162
|
+
struct ctx_entry
|
|
163
|
+
{
|
|
164
|
+
VALUE object; /* The GPGME::Ctx object. */
|
|
165
|
+
};
|
|
166
|
+
|
|
158
167
|
static void
|
|
159
168
|
owner_ref_clear (void *owner, long slot)
|
|
160
169
|
{
|
|
@@ -191,9 +200,10 @@ gpgme_ctx_free(void *ptr)
|
|
|
191
200
|
{
|
|
192
201
|
if (ptr)
|
|
193
202
|
{
|
|
194
|
-
st_data_t key = (st_data_t)ptr;
|
|
203
|
+
st_data_t key = (st_data_t)ptr, value;
|
|
195
204
|
|
|
196
|
-
st_delete (ctx_objects, &key,
|
|
205
|
+
if (st_delete (ctx_objects, &key, &value))
|
|
206
|
+
xfree ((struct ctx_entry *)value);
|
|
197
207
|
owner_refs_delete (ptr);
|
|
198
208
|
gpgme_release((gpgme_ctx_t)ptr);
|
|
199
209
|
}
|
|
@@ -202,11 +212,14 @@ gpgme_ctx_free(void *ptr)
|
|
|
202
212
|
static void
|
|
203
213
|
gpgme_ctx_compact(void *ptr)
|
|
204
214
|
{
|
|
205
|
-
st_data_t
|
|
215
|
+
st_data_t value;
|
|
206
216
|
|
|
207
|
-
if (ptr && st_lookup (ctx_objects, (st_data_t)ptr, &
|
|
208
|
-
|
|
209
|
-
|
|
217
|
+
if (ptr && st_lookup (ctx_objects, (st_data_t)ptr, &value))
|
|
218
|
+
{
|
|
219
|
+
struct ctx_entry *entry = (struct ctx_entry *)value;
|
|
220
|
+
|
|
221
|
+
entry->object = rb_gc_location (entry->object);
|
|
222
|
+
}
|
|
210
223
|
}
|
|
211
224
|
|
|
212
225
|
static const rb_data_type_t gpgme_ctx_type = {
|
|
@@ -688,18 +701,55 @@ rb_s_gpgme_data_set_file_name (VALUE dummy, VALUE vdh, VALUE vfile_name)
|
|
|
688
701
|
return LONG2NUM(err);
|
|
689
702
|
}
|
|
690
703
|
|
|
704
|
+
struct ctx_objects_insert_args
|
|
705
|
+
{
|
|
706
|
+
gpgme_ctx_t ctx;
|
|
707
|
+
struct ctx_entry *entry;
|
|
708
|
+
};
|
|
709
|
+
|
|
710
|
+
static VALUE
|
|
711
|
+
ctx_objects_insert (VALUE arg)
|
|
712
|
+
{
|
|
713
|
+
struct ctx_objects_insert_args *args = (struct ctx_objects_insert_args *)arg;
|
|
714
|
+
|
|
715
|
+
st_insert (ctx_objects, (st_data_t)args->ctx, (st_data_t)args->entry);
|
|
716
|
+
return Qnil;
|
|
717
|
+
}
|
|
718
|
+
|
|
691
719
|
static VALUE
|
|
692
720
|
rb_s_gpgme_new (VALUE dummy, VALUE rctx)
|
|
693
721
|
{
|
|
722
|
+
struct ctx_objects_insert_args args;
|
|
694
723
|
gpgme_ctx_t ctx;
|
|
695
|
-
gpgme_error_t err
|
|
696
|
-
|
|
697
|
-
|
|
724
|
+
gpgme_error_t err;
|
|
725
|
+
VALUE vctx;
|
|
726
|
+
int state;
|
|
727
|
+
|
|
728
|
+
/* Allocate the wrapper and the entry before the context exists, so
|
|
729
|
+
an exception from either leaks nothing. The wrapper holds NULL
|
|
730
|
+
until it owns the context. */
|
|
731
|
+
vctx = WRAP_GPGME_CTX(NULL);
|
|
732
|
+
args.entry = ALLOC(struct ctx_entry);
|
|
733
|
+
err = gpgme_new (&ctx);
|
|
734
|
+
if (gpgme_err_code(err) != GPG_ERR_NO_ERROR)
|
|
735
|
+
{
|
|
736
|
+
xfree (args.entry);
|
|
737
|
+
return LONG2NUM(err);
|
|
738
|
+
}
|
|
739
|
+
RTYPEDDATA_DATA(vctx) = ctx;
|
|
740
|
+
args.entry->object = vctx;
|
|
741
|
+
|
|
742
|
+
/* st_insert raises NoMemoryError if it can't grow the table. The
|
|
743
|
+
wrapper already owns the context and frees it, but the entry is
|
|
744
|
+
not in the table yet, so free it here. */
|
|
745
|
+
args.ctx = ctx;
|
|
746
|
+
rb_protect (ctx_objects_insert, (VALUE)&args, &state);
|
|
747
|
+
if (state)
|
|
698
748
|
{
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
rb_ary_store (rctx, 0, vctx);
|
|
749
|
+
xfree (args.entry);
|
|
750
|
+
rb_jump_tag (state);
|
|
702
751
|
}
|
|
752
|
+
rb_ary_store (rctx, 0, vctx);
|
|
703
753
|
return LONG2NUM(err);
|
|
704
754
|
}
|
|
705
755
|
|
|
@@ -2957,13 +3007,13 @@ rb_s_gpgme_wait (VALUE dummy, VALUE vctx, VALUE rstatus, VALUE vhang)
|
|
|
2957
3007
|
owner_ref_clear (ret, CTX_REF_OP_ARGS);
|
|
2958
3008
|
if (ret != ctx)
|
|
2959
3009
|
{
|
|
2960
|
-
st_data_t
|
|
3010
|
+
st_data_t value;
|
|
2961
3011
|
|
|
2962
3012
|
/* Return the object that already owns RET. Wrapping it again
|
|
2963
3013
|
would make two objects free the same context. */
|
|
2964
|
-
if (!st_lookup (ctx_objects, (st_data_t)ret, &
|
|
3014
|
+
if (!st_lookup (ctx_objects, (st_data_t)ret, &value))
|
|
2965
3015
|
rb_raise (rb_eRuntimeError, "gpgme_wait returned an unknown ctx");
|
|
2966
|
-
vctx = (
|
|
3016
|
+
vctx = ((struct ctx_entry *)value)->object;
|
|
2967
3017
|
}
|
|
2968
3018
|
return vctx;
|
|
2969
3019
|
}
|
data/lib/gpgme/ctx.rb
CHANGED
|
@@ -537,6 +537,45 @@ module GPGME
|
|
|
537
537
|
end
|
|
538
538
|
end
|
|
539
539
|
|
|
540
|
+
##
|
|
541
|
+
# Return the engine configuration of this context as an array of
|
|
542
|
+
# {GPGME::EngineInfo}.
|
|
543
|
+
#
|
|
544
|
+
# @example
|
|
545
|
+
# ctx.engine_info.first.home_dir
|
|
546
|
+
#
|
|
547
|
+
def engine_info
|
|
548
|
+
rinfo = []
|
|
549
|
+
GPGME::gpgme_ctx_get_engine_info(self, rinfo)
|
|
550
|
+
rinfo
|
|
551
|
+
end
|
|
552
|
+
|
|
553
|
+
##
|
|
554
|
+
# Change the configuration of the crypto engine implementing protocol
|
|
555
|
+
# +proto+ for this context only. Unlike {GPGME::Engine.set_info}, this
|
|
556
|
+
# does not change the global configuration, so other contexts are not
|
|
557
|
+
# affected.
|
|
558
|
+
#
|
|
559
|
+
# @param proto
|
|
560
|
+
# Can be one of +PROTOCOL_OpenPGP+ or +PROTOCOL_CMS+.
|
|
561
|
+
#
|
|
562
|
+
# @param file_name
|
|
563
|
+
# The file name of the executable program implementing the protocol,
|
|
564
|
+
# or +nil+ to use the default.
|
|
565
|
+
#
|
|
566
|
+
# @param home_dir
|
|
567
|
+
# The directory name of the configuration directory, or +nil+ to use
|
|
568
|
+
# the default.
|
|
569
|
+
#
|
|
570
|
+
# @example
|
|
571
|
+
# ctx.set_engine_info(GPGME::PROTOCOL_OpenPGP, nil, '/tmp/gnupg')
|
|
572
|
+
#
|
|
573
|
+
def set_engine_info(proto, file_name, home_dir)
|
|
574
|
+
err = GPGME::gpgme_ctx_set_engine_info(self, proto, file_name, home_dir)
|
|
575
|
+
exc = GPGME::error_to_exception(err)
|
|
576
|
+
raise exc if exc
|
|
577
|
+
end
|
|
578
|
+
|
|
540
579
|
# Create a signature for the text.
|
|
541
580
|
# +plain+ is a data object which contains the text.
|
|
542
581
|
# +sig+ is a data object where the generated signature is stored.
|
data/lib/gpgme/version.rb
CHANGED
data/test/ctx_test.rb
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
|
2
2
|
require 'test_helper'
|
|
3
|
+
require 'tmpdir'
|
|
3
4
|
|
|
4
5
|
describe GPGME::Ctx do
|
|
5
6
|
before do
|
|
@@ -192,6 +193,36 @@ describe GPGME::Ctx do
|
|
|
192
193
|
end
|
|
193
194
|
end
|
|
194
195
|
|
|
196
|
+
describe :set_engine_info do
|
|
197
|
+
it "changes the home dir for this context only" do
|
|
198
|
+
global_home_dir = GPGME::Engine.info.find { |i| i.protocol == GPGME::PROTOCOL_OpenPGP }.home_dir
|
|
199
|
+
|
|
200
|
+
Dir.mktmpdir do |dir|
|
|
201
|
+
GPGME::Ctx.new do |ctx|
|
|
202
|
+
ctx.set_engine_info(GPGME::PROTOCOL_OpenPGP, nil, dir)
|
|
203
|
+
|
|
204
|
+
info = ctx.engine_info.find { |i| i.protocol == GPGME::PROTOCOL_OpenPGP }
|
|
205
|
+
assert_equal dir, info.home_dir
|
|
206
|
+
end
|
|
207
|
+
|
|
208
|
+
GPGME::Ctx.new do |ctx|
|
|
209
|
+
info = ctx.engine_info.find { |i| i.protocol == GPGME::PROTOCOL_OpenPGP }
|
|
210
|
+
assert_equal global_home_dir, info.home_dir
|
|
211
|
+
end
|
|
212
|
+
end
|
|
213
|
+
|
|
214
|
+
assert_equal global_home_dir, GPGME::Engine.info.find { |i| i.protocol == GPGME::PROTOCOL_OpenPGP }.home_dir
|
|
215
|
+
end
|
|
216
|
+
|
|
217
|
+
it "raises an error for an invalid protocol" do
|
|
218
|
+
GPGME::Ctx.new do |ctx|
|
|
219
|
+
assert_raises(GPGME::Error::InvalidValue) do
|
|
220
|
+
ctx.set_engine_info(-1, nil, nil)
|
|
221
|
+
end
|
|
222
|
+
end
|
|
223
|
+
end
|
|
224
|
+
end
|
|
225
|
+
|
|
195
226
|
describe :protocol do
|
|
196
227
|
it "sets 0 by default" do
|
|
197
228
|
ctx = GPGME::Ctx.new
|
data/test/native_ext_test.rb
CHANGED
|
@@ -120,6 +120,26 @@ describe "GPGME native extension" do
|
|
|
120
120
|
output.seek(0)
|
|
121
121
|
assert_match(/Hello, compaction/, output.read)
|
|
122
122
|
end
|
|
123
|
+
|
|
124
|
+
it "does not allocate while updating the context table" do
|
|
125
|
+
skip "GC compaction not supported" unless GC.respond_to?(:compact)
|
|
126
|
+
# Creating and releasing contexts fills the table with deleted
|
|
127
|
+
# entries, so the next insert would rebuild it. Compaction used
|
|
128
|
+
# to insert into the table and crash with "Cannot malloc during
|
|
129
|
+
# GC".
|
|
130
|
+
live = []
|
|
131
|
+
begin
|
|
132
|
+
300.times do |i|
|
|
133
|
+
live << GPGME::Ctx.new
|
|
134
|
+
live.shift.release if live.size > 5
|
|
135
|
+
GC.compact if i % 3 == 0
|
|
136
|
+
end
|
|
137
|
+
rescue NotImplementedError
|
|
138
|
+
skip "GC compaction not supported"
|
|
139
|
+
ensure
|
|
140
|
+
live.each(&:release)
|
|
141
|
+
end
|
|
142
|
+
end
|
|
123
143
|
end
|
|
124
144
|
|
|
125
145
|
describe "asynchronous operations" do
|
metadata
CHANGED
|
@@ -1,99 +1,111 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: gpgme
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.1.
|
|
4
|
+
version: 2.1.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
|
-
- Daiki Ueno
|
|
8
|
-
- Albert Llop
|
|
7
|
+
- Daiki Ueno
|
|
8
|
+
- Albert Llop
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
11
|
date: 2026-11-26 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
|
-
- !ruby/object:Gem::Dependency
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
- !ruby/object:Gem::
|
|
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
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
- !ruby/object:Gem::
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
14
|
+
name: mini_portile2
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
-
|
|
18
|
+
- ~>
|
|
19
|
+
- !ruby/object:Gem::Version
|
|
20
|
+
version: "2.7"
|
|
21
|
+
type: :runtime
|
|
22
|
+
prerelease: false
|
|
23
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
24
|
+
requirements:
|
|
25
|
+
-
|
|
26
|
+
- ~>
|
|
27
|
+
- !ruby/object:Gem::Version
|
|
28
|
+
version: "2.7"
|
|
29
|
+
- !ruby/object:Gem::Dependency
|
|
30
|
+
name: mocha
|
|
31
|
+
requirement: !ruby/object:Gem::Requirement
|
|
32
|
+
requirements:
|
|
33
|
+
-
|
|
34
|
+
- ~>
|
|
35
|
+
- !ruby/object:Gem::Version
|
|
36
|
+
version: 0.9.12
|
|
37
|
+
type: :development
|
|
38
|
+
prerelease: false
|
|
39
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
40
|
+
requirements:
|
|
41
|
+
-
|
|
42
|
+
- ~>
|
|
43
|
+
- !ruby/object:Gem::Version
|
|
44
|
+
version: 0.9.12
|
|
45
|
+
- !ruby/object:Gem::Dependency
|
|
46
|
+
name: minitest
|
|
47
|
+
requirement: !ruby/object:Gem::Requirement
|
|
48
|
+
requirements:
|
|
49
|
+
-
|
|
50
|
+
- ~>
|
|
51
|
+
- !ruby/object:Gem::Version
|
|
52
|
+
version: 2.1.0
|
|
53
|
+
type: :development
|
|
54
|
+
prerelease: false
|
|
55
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
56
|
+
requirements:
|
|
57
|
+
-
|
|
58
|
+
- ~>
|
|
59
|
+
- !ruby/object:Gem::Version
|
|
60
|
+
version: 2.1.0
|
|
61
|
+
- !ruby/object:Gem::Dependency
|
|
62
|
+
name: yard
|
|
63
|
+
requirement: !ruby/object:Gem::Requirement
|
|
64
|
+
requirements:
|
|
65
|
+
-
|
|
66
|
+
- ~>
|
|
67
|
+
- !ruby/object:Gem::Version
|
|
68
|
+
version: 0.9.11
|
|
69
|
+
type: :development
|
|
70
|
+
prerelease: false
|
|
71
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
72
|
+
requirements:
|
|
73
|
+
-
|
|
74
|
+
- ~>
|
|
75
|
+
- !ruby/object:Gem::Version
|
|
76
|
+
version: 0.9.11
|
|
77
|
+
- !ruby/object:Gem::Dependency
|
|
78
|
+
name: coveralls_reborn
|
|
79
|
+
requirement: !ruby/object:Gem::Requirement
|
|
80
|
+
requirements:
|
|
81
|
+
-
|
|
82
|
+
- ">="
|
|
83
|
+
- !ruby/object:Gem::Version
|
|
84
|
+
version: "0"
|
|
85
|
+
type: :development
|
|
86
|
+
prerelease: false
|
|
87
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
88
|
+
requirements:
|
|
89
|
+
-
|
|
90
|
+
- ">="
|
|
91
|
+
- !ruby/object:Gem::Version
|
|
92
|
+
version: "0"
|
|
93
|
+
- !ruby/object:Gem::Dependency
|
|
94
|
+
name: byebug
|
|
95
|
+
requirement: !ruby/object:Gem::Requirement
|
|
96
|
+
requirements:
|
|
97
|
+
-
|
|
98
|
+
- ">="
|
|
99
|
+
- !ruby/object:Gem::Version
|
|
100
|
+
version: "0"
|
|
101
|
+
type: :development
|
|
102
|
+
prerelease: false
|
|
103
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
104
|
+
requirements:
|
|
105
|
+
-
|
|
106
|
+
- ">="
|
|
107
|
+
- !ruby/object:Gem::Version
|
|
108
|
+
version: "0"
|
|
97
109
|
description: |-
|
|
98
110
|
Ruby-GPGME is a Ruby language binding of GPGME (GnuPG
|
|
99
111
|
Made Easy). GnuPG Made Easy (GPGME) is a library designed to make access to
|
|
@@ -102,74 +114,77 @@ description: |-
|
|
|
102
114
|
email: ueno@gnu.org
|
|
103
115
|
executables: []
|
|
104
116
|
extensions:
|
|
105
|
-
- ext/gpgme/extconf.rb
|
|
117
|
+
- ext/gpgme/extconf.rb
|
|
106
118
|
extra_rdoc_files: []
|
|
107
119
|
files:
|
|
108
|
-
-
|
|
109
|
-
- examples/
|
|
110
|
-
- examples/
|
|
111
|
-
- examples/
|
|
112
|
-
- examples/
|
|
113
|
-
- examples/
|
|
114
|
-
-
|
|
115
|
-
- ext/gpgme/
|
|
116
|
-
-
|
|
117
|
-
- lib/gpgme
|
|
118
|
-
- lib/gpgme/
|
|
119
|
-
- lib/gpgme/
|
|
120
|
-
- lib/gpgme/
|
|
121
|
-
- lib/gpgme/
|
|
122
|
-
- lib/gpgme/
|
|
123
|
-
- lib/gpgme/
|
|
124
|
-
- lib/gpgme/
|
|
125
|
-
- lib/gpgme/
|
|
126
|
-
- lib/gpgme/
|
|
127
|
-
- lib/gpgme/
|
|
128
|
-
- lib/gpgme/
|
|
129
|
-
- lib/gpgme/
|
|
130
|
-
- lib/gpgme/
|
|
131
|
-
- lib/gpgme/
|
|
132
|
-
- lib/gpgme/
|
|
133
|
-
-
|
|
134
|
-
- ports/archives/
|
|
135
|
-
- ports/archives/
|
|
136
|
-
-
|
|
137
|
-
- test/
|
|
138
|
-
- test/
|
|
139
|
-
- test/
|
|
140
|
-
- test/
|
|
141
|
-
- test/files/
|
|
142
|
-
- test/files/
|
|
143
|
-
- test/
|
|
144
|
-
- test/
|
|
145
|
-
- test/
|
|
146
|
-
- test/
|
|
147
|
-
- test/
|
|
148
|
-
- test/
|
|
149
|
-
- test/
|
|
150
|
-
- test/
|
|
151
|
-
- test/
|
|
152
|
-
- test/
|
|
153
|
-
|
|
120
|
+
- dependencies.yml
|
|
121
|
+
- examples/edit.rb
|
|
122
|
+
- examples/genkey.rb
|
|
123
|
+
- examples/keylist.rb
|
|
124
|
+
- examples/roundtrip.rb
|
|
125
|
+
- examples/sign.rb
|
|
126
|
+
- examples/verify.rb
|
|
127
|
+
- ext/gpgme/extconf.rb
|
|
128
|
+
- ext/gpgme/gpgme_n.c
|
|
129
|
+
- lib/gpgme.rb
|
|
130
|
+
- lib/gpgme/compat.rb
|
|
131
|
+
- lib/gpgme/constants.rb
|
|
132
|
+
- lib/gpgme/crypto.rb
|
|
133
|
+
- lib/gpgme/ctx.rb
|
|
134
|
+
- lib/gpgme/data.rb
|
|
135
|
+
- lib/gpgme/engine.rb
|
|
136
|
+
- lib/gpgme/error.rb
|
|
137
|
+
- lib/gpgme/io_callbacks.rb
|
|
138
|
+
- lib/gpgme/key.rb
|
|
139
|
+
- lib/gpgme/key_common.rb
|
|
140
|
+
- lib/gpgme/key_sig.rb
|
|
141
|
+
- lib/gpgme/misc.rb
|
|
142
|
+
- lib/gpgme/signature.rb
|
|
143
|
+
- lib/gpgme/sub_key.rb
|
|
144
|
+
- lib/gpgme/user_id.rb
|
|
145
|
+
- lib/gpgme/version.rb
|
|
146
|
+
- ports/archives/gpgme-2.3.1.tar.bz2
|
|
147
|
+
- ports/archives/libassuan-3.0.2.tar.bz2
|
|
148
|
+
- ports/archives/libgpg-error-1.55.tar.bz2
|
|
149
|
+
- test/crypto_test.rb
|
|
150
|
+
- test/ctx_test.rb
|
|
151
|
+
- test/data_test.rb
|
|
152
|
+
- test/encryption_flags_test.rb
|
|
153
|
+
- test/files/testkey_pub.gpg
|
|
154
|
+
- test/files/testkey_pub_invalid.gpg
|
|
155
|
+
- test/files/testkey_sec.gpg
|
|
156
|
+
- test/gpgme_test.rb
|
|
157
|
+
- test/io_callbacks_test.rb
|
|
158
|
+
- test/key_test.rb
|
|
159
|
+
- test/low_level_test.rb
|
|
160
|
+
- test/native_ext_test.rb
|
|
161
|
+
- test/pinentry
|
|
162
|
+
- test/signature_test.rb
|
|
163
|
+
- test/sub_key_test.rb
|
|
164
|
+
- test/support/resources.rb
|
|
165
|
+
- test/test_helper.rb
|
|
166
|
+
homepage: "http://github.com/ueno/ruby-gpgme"
|
|
154
167
|
licenses:
|
|
155
|
-
- LGPL-2.1+
|
|
168
|
+
- LGPL-2.1+
|
|
156
169
|
metadata: {}
|
|
157
170
|
rdoc_options: []
|
|
158
171
|
require_paths:
|
|
159
|
-
- lib
|
|
160
|
-
- ext
|
|
172
|
+
- lib
|
|
173
|
+
- ext
|
|
161
174
|
required_ruby_version: !ruby/object:Gem::Requirement
|
|
162
175
|
requirements:
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
176
|
+
-
|
|
177
|
+
- ">="
|
|
178
|
+
- !ruby/object:Gem::Version
|
|
179
|
+
version: "3.1"
|
|
166
180
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
167
181
|
requirements:
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
182
|
+
-
|
|
183
|
+
- ">="
|
|
184
|
+
- !ruby/object:Gem::Version
|
|
185
|
+
version: "0"
|
|
171
186
|
requirements: []
|
|
172
|
-
rubygems_version:
|
|
187
|
+
rubygems_version: 4.1.1
|
|
173
188
|
specification_version: 4
|
|
174
189
|
summary: Ruby binding of GPGME.
|
|
175
190
|
test_files: []
|