pkcs11 0.2.4-x64-mingw32
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.
- data.tar.gz.sig +0 -0
- data/.autotest +23 -0
- data/.gemtest +0 -0
- data/.yardopts +1 -0
- data/History.txt +57 -0
- data/MIT-LICENSE +22 -0
- data/Manifest.txt +57 -0
- data/README.rdoc +205 -0
- data/Rakefile +111 -0
- data/ext/extconf.rb +7 -0
- data/ext/generate_constants.rb +57 -0
- data/ext/generate_structs.rb +206 -0
- data/ext/generate_thread_funcs.rb +72 -0
- data/ext/include/cryptoki.h +66 -0
- data/ext/include/ct-kip.h +50 -0
- data/ext/include/otp-pkcs11.h +125 -0
- data/ext/include/pkcs-11v2-20a3.h +124 -0
- data/ext/include/pkcs11.h +299 -0
- data/ext/include/pkcs11f.h +912 -0
- data/ext/include/pkcs11t.h +1885 -0
- data/ext/pk11.c +1675 -0
- data/ext/pk11.h +81 -0
- data/ext/pk11_const.c +205 -0
- data/ext/pk11_const_def.inc +452 -0
- data/ext/pk11_const_macros.h +38 -0
- data/ext/pk11_struct.doc +792 -0
- data/ext/pk11_struct_def.inc +302 -0
- data/ext/pk11_struct_impl.inc +302 -0
- data/ext/pk11_struct_macros.h +435 -0
- data/ext/pk11_thread_funcs.c +411 -0
- data/ext/pk11_thread_funcs.h +482 -0
- data/ext/pk11_version.h +6 -0
- data/lib/2.0/pkcs11_ext.so +0 -0
- data/lib/pkcs11.rb +9 -0
- data/lib/pkcs11/extensions.rb +68 -0
- data/lib/pkcs11/helper.rb +144 -0
- data/lib/pkcs11/library.rb +140 -0
- data/lib/pkcs11/object.rb +171 -0
- data/lib/pkcs11/session.rb +765 -0
- data/lib/pkcs11/slot.rb +102 -0
- data/pkcs11_protect_server/Manifest.txt +14 -0
- data/pkcs11_protect_server/README_PROTECT_SERVER.rdoc +89 -0
- data/test/fixtures/softokn/cert8.db +0 -0
- data/test/fixtures/softokn/key3.db +0 -0
- data/test/fixtures/softokn/secmod.db +0 -0
- data/test/helper.rb +58 -0
- data/test/test_pkcs11.rb +71 -0
- data/test/test_pkcs11_crypt.rb +220 -0
- data/test/test_pkcs11_object.rb +122 -0
- data/test/test_pkcs11_session.rb +123 -0
- data/test/test_pkcs11_slot.rb +78 -0
- data/test/test_pkcs11_structs.rb +166 -0
- data/test/test_pkcs11_thread.rb +44 -0
- metadata +213 -0
- metadata.gz.sig +0 -0
@@ -0,0 +1,435 @@
|
|
1
|
+
#ifndef PK11_STRUCT_MACROS_INCLUDED
|
2
|
+
#define PK11_STRUCT_MACROS_INCLUDED
|
3
|
+
|
4
|
+
/**************************************************/
|
5
|
+
/* struct/attribute implementation */
|
6
|
+
/**************************************************/
|
7
|
+
|
8
|
+
#define HANDLE2NUM(n) ULONG2NUM(n)
|
9
|
+
#define NUM2HANDLE(n) PKNUM2ULONG(n)
|
10
|
+
#define PKNUM2ULONG(n) pkcs11_num2ulong(n)
|
11
|
+
|
12
|
+
static VALUE
|
13
|
+
pkcs11_num2ulong(VALUE val)
|
14
|
+
{
|
15
|
+
if (TYPE(val) == T_BIGNUM || TYPE(val) == T_FIXNUM) {
|
16
|
+
return NUM2ULONG(val);
|
17
|
+
}
|
18
|
+
return NUM2ULONG(rb_to_int(val));
|
19
|
+
}
|
20
|
+
|
21
|
+
static VALUE
|
22
|
+
get_string(VALUE obj, off_t offset, size_t size)
|
23
|
+
{
|
24
|
+
char *ptr = (char*)DATA_PTR(obj);
|
25
|
+
return rb_str_new(ptr+offset, size);
|
26
|
+
}
|
27
|
+
|
28
|
+
static VALUE
|
29
|
+
set_string(VALUE obj, VALUE value, off_t offset, size_t size)
|
30
|
+
{
|
31
|
+
char *ptr = (char*)DATA_PTR(obj);
|
32
|
+
int len = size;
|
33
|
+
StringValue(value);
|
34
|
+
if (RSTRING_LEN(value) < len) len = RSTRING_LEN(value);
|
35
|
+
memset(ptr+offset, 0, size);
|
36
|
+
memcpy(ptr+offset, RSTRING_PTR(value), len);
|
37
|
+
return value;
|
38
|
+
}
|
39
|
+
|
40
|
+
static VALUE
|
41
|
+
get_ulong(VALUE obj, off_t offset)
|
42
|
+
{
|
43
|
+
char *ptr = (char*)DATA_PTR(obj);
|
44
|
+
return ULONG2NUM(*(CK_ULONG_PTR)(ptr+offset));
|
45
|
+
}
|
46
|
+
|
47
|
+
static VALUE
|
48
|
+
set_ulong(VALUE obj, VALUE value, off_t offset)
|
49
|
+
{
|
50
|
+
char *ptr = (char*)DATA_PTR(obj);
|
51
|
+
*(CK_ULONG_PTR)(ptr+offset) = NUM2ULONG(value);
|
52
|
+
return value;
|
53
|
+
}
|
54
|
+
|
55
|
+
static VALUE
|
56
|
+
get_byte(VALUE obj, off_t offset)
|
57
|
+
{
|
58
|
+
char *ptr = (char*)DATA_PTR(obj);
|
59
|
+
return ULONG2NUM(*(CK_BYTE_PTR)(ptr+offset));
|
60
|
+
}
|
61
|
+
|
62
|
+
static VALUE
|
63
|
+
set_byte(VALUE obj, VALUE value, off_t offset)
|
64
|
+
{
|
65
|
+
char *ptr = (char*)DATA_PTR(obj);
|
66
|
+
*(CK_BYTE_PTR)(ptr+offset) = NUM2ULONG(value);
|
67
|
+
return value;
|
68
|
+
}
|
69
|
+
|
70
|
+
static VALUE
|
71
|
+
get_ulong_ptr(VALUE obj, off_t offset)
|
72
|
+
{
|
73
|
+
char *ptr = (char*)DATA_PTR(obj);
|
74
|
+
CK_ULONG_PTR p = *(CK_ULONG_PTR *)(ptr+offset);
|
75
|
+
if (!p) return Qnil;
|
76
|
+
return ULONG2NUM(*p);
|
77
|
+
}
|
78
|
+
|
79
|
+
static VALUE
|
80
|
+
set_ulong_ptr(VALUE obj, VALUE value, const char *name, off_t offset)
|
81
|
+
{
|
82
|
+
VALUE new_obj;
|
83
|
+
CK_ULONG_PTR *ptr = (CK_ULONG_PTR *)((char*)DATA_PTR(obj) + offset);
|
84
|
+
if (NIL_P(value)){
|
85
|
+
rb_iv_set(obj, name, value);
|
86
|
+
*ptr = NULL_PTR;
|
87
|
+
return value;
|
88
|
+
}
|
89
|
+
new_obj = Data_Make_Struct(rb_cInteger, CK_ULONG, 0, free, *ptr);
|
90
|
+
rb_iv_set(obj, name, new_obj);
|
91
|
+
**ptr = NUM2ULONG(value);
|
92
|
+
return value;
|
93
|
+
}
|
94
|
+
|
95
|
+
static VALUE
|
96
|
+
get_handle(VALUE obj, off_t offset)
|
97
|
+
{
|
98
|
+
char *ptr = (char*)DATA_PTR(obj);
|
99
|
+
return HANDLE2NUM(*(CK_OBJECT_HANDLE_PTR)(ptr+offset));
|
100
|
+
}
|
101
|
+
|
102
|
+
static VALUE
|
103
|
+
set_handle(VALUE obj, VALUE value, off_t offset)
|
104
|
+
{
|
105
|
+
char *ptr = (char*)DATA_PTR(obj);
|
106
|
+
*(CK_OBJECT_HANDLE_PTR)(ptr+offset) = NUM2HANDLE(value);
|
107
|
+
return value;
|
108
|
+
}
|
109
|
+
|
110
|
+
static VALUE
|
111
|
+
get_bool(VALUE obj, off_t offset)
|
112
|
+
{
|
113
|
+
char *ptr = (char*)DATA_PTR(obj);
|
114
|
+
if(*(CK_BBOOL*)(ptr+offset)) return Qtrue;
|
115
|
+
else return Qfalse;
|
116
|
+
}
|
117
|
+
|
118
|
+
static VALUE
|
119
|
+
set_bool(VALUE obj, VALUE value, off_t offset)
|
120
|
+
{
|
121
|
+
char *ptr = (char*)DATA_PTR(obj);
|
122
|
+
if(value == Qfalse) *(CK_BBOOL*)(ptr+offset) = 0;
|
123
|
+
else if(value == Qtrue) *(CK_BBOOL*)(ptr+offset) = 1;
|
124
|
+
else rb_raise(rb_eArgError, "arg must be true or false");
|
125
|
+
return value;
|
126
|
+
}
|
127
|
+
|
128
|
+
static VALUE
|
129
|
+
get_string_ptr(VALUE obj, const char *name, off_t offset)
|
130
|
+
{
|
131
|
+
char *ptr = (char*)DATA_PTR(obj);
|
132
|
+
char *p = *(char**)(ptr+offset);
|
133
|
+
if (!p) return Qnil;
|
134
|
+
return rb_str_new2(p);
|
135
|
+
}
|
136
|
+
|
137
|
+
static VALUE
|
138
|
+
set_string_ptr(VALUE obj, VALUE value, const char *name, off_t offset)
|
139
|
+
{
|
140
|
+
char *ptr = (char*)DATA_PTR(obj);
|
141
|
+
if (NIL_P(value)){
|
142
|
+
rb_iv_set(obj, name, value);
|
143
|
+
*(CK_VOID_PTR*)(ptr+offset) = NULL_PTR;
|
144
|
+
return value;
|
145
|
+
}
|
146
|
+
StringValue(value);
|
147
|
+
value = rb_obj_freeze(rb_str_dup(value));
|
148
|
+
rb_iv_set(obj, name, value);
|
149
|
+
*(CK_VOID_PTR*)(ptr+offset) = RSTRING_PTR(value);
|
150
|
+
return value;
|
151
|
+
}
|
152
|
+
|
153
|
+
static VALUE
|
154
|
+
get_string_ptr_len(VALUE obj, const char *name, off_t offset, off_t offset_len)
|
155
|
+
{
|
156
|
+
unsigned long l;
|
157
|
+
char *ptr = (char*)DATA_PTR(obj);
|
158
|
+
char *p = *(char**)(ptr+offset);
|
159
|
+
if (!p) return Qnil;
|
160
|
+
l = *(unsigned long*)(ptr+offset_len);
|
161
|
+
return rb_str_new(p, l);
|
162
|
+
}
|
163
|
+
|
164
|
+
static VALUE
|
165
|
+
set_string_ptr_len(VALUE obj, VALUE value, const char *name, off_t offset, off_t offset_len)
|
166
|
+
{
|
167
|
+
char *ptr = (char*)DATA_PTR(obj);
|
168
|
+
if (NIL_P(value)){
|
169
|
+
rb_iv_set(obj, name, value);
|
170
|
+
*(CK_VOID_PTR*)(ptr+offset) = NULL_PTR;
|
171
|
+
*(unsigned long*)(ptr+offset_len) = 0;
|
172
|
+
return value;
|
173
|
+
}
|
174
|
+
StringValue(value);
|
175
|
+
value = rb_obj_freeze(rb_str_dup(value));
|
176
|
+
rb_iv_set(obj, name, value);
|
177
|
+
*(CK_VOID_PTR*)(ptr+offset) = RSTRING_PTR(value);
|
178
|
+
*(unsigned long*)(ptr+offset_len) = RSTRING_LEN(value);
|
179
|
+
return value;
|
180
|
+
}
|
181
|
+
|
182
|
+
static VALUE
|
183
|
+
get_struct_inline(VALUE obj, VALUE klass, const char *name, off_t offset)
|
184
|
+
{
|
185
|
+
char *ptr = (char*)DATA_PTR(obj) + offset;
|
186
|
+
VALUE inline_obj = Data_Wrap_Struct(klass, 0, 0, ptr);
|
187
|
+
rb_iv_set(inline_obj, name, obj);
|
188
|
+
return inline_obj;
|
189
|
+
}
|
190
|
+
|
191
|
+
static VALUE
|
192
|
+
set_struct_inline(VALUE obj, VALUE klass, const char *struct_name, VALUE value, const char *name, off_t offset, int sizeofstruct)
|
193
|
+
{
|
194
|
+
char *ptr = (char*)DATA_PTR(obj) + offset;
|
195
|
+
if (!rb_obj_is_kind_of(value, klass))
|
196
|
+
rb_raise(rb_eArgError, "arg must be a PKCS11::%s", struct_name);
|
197
|
+
memcpy(ptr, DATA_PTR(value), sizeofstruct);
|
198
|
+
return value;
|
199
|
+
}
|
200
|
+
|
201
|
+
static VALUE
|
202
|
+
get_struct_ptr(VALUE obj, VALUE klass, const char *name, off_t offset, int sizeofstruct)
|
203
|
+
{
|
204
|
+
char *ptr = (char*)DATA_PTR(obj);
|
205
|
+
char *p = *(char**)(ptr+offset);
|
206
|
+
void *mem;
|
207
|
+
VALUE new_obj;
|
208
|
+
if (!p) return Qnil;
|
209
|
+
mem = xmalloc(sizeofstruct);
|
210
|
+
memcpy(mem, p, sizeofstruct);
|
211
|
+
new_obj = Data_Wrap_Struct(klass, 0, -1, mem);
|
212
|
+
return new_obj;
|
213
|
+
}
|
214
|
+
|
215
|
+
static VALUE
|
216
|
+
set_struct_ptr(VALUE obj, VALUE klass, const char *struct_name, VALUE value, const char *name, off_t offset)
|
217
|
+
{
|
218
|
+
char *ptr = (char*)DATA_PTR(obj) + offset;
|
219
|
+
if (NIL_P(value)){
|
220
|
+
rb_iv_set(obj, name, value);
|
221
|
+
*(CK_VOID_PTR*)ptr = NULL_PTR;
|
222
|
+
return value;
|
223
|
+
}
|
224
|
+
if (!rb_obj_is_kind_of(value, klass))
|
225
|
+
rb_raise(rb_eArgError, "arg must be a PKCS11::%s", struct_name);
|
226
|
+
*(CK_VOID_PTR*)ptr = DATA_PTR(value);
|
227
|
+
rb_iv_set(obj, name, value);
|
228
|
+
return value;
|
229
|
+
}
|
230
|
+
|
231
|
+
static VALUE
|
232
|
+
get_struct_ptr_array(VALUE obj, VALUE klass, off_t offset, off_t offset_len, int sizeofstruct)
|
233
|
+
{
|
234
|
+
unsigned long i;
|
235
|
+
char *ptr = DATA_PTR(obj);
|
236
|
+
char *p = *(char **)(ptr+offset);
|
237
|
+
unsigned long l = *(unsigned long*)(ptr+offset_len);
|
238
|
+
VALUE ary = rb_ary_new();
|
239
|
+
for (i = 0; i < l; i++){
|
240
|
+
VALUE new_obj;
|
241
|
+
void *mem = xmalloc(sizeofstruct);
|
242
|
+
memcpy(mem, p + sizeofstruct * i, sizeofstruct);
|
243
|
+
new_obj = Data_Wrap_Struct(klass, 0, -1, mem);
|
244
|
+
rb_ary_push(ary, new_obj);
|
245
|
+
}
|
246
|
+
return ary;
|
247
|
+
}
|
248
|
+
|
249
|
+
static VALUE
|
250
|
+
set_struct_ptr_array(VALUE obj, VALUE klass, const char *struct_name, VALUE value, const char *name, off_t offset, off_t offset_len, int sizeofstruct)
|
251
|
+
{
|
252
|
+
int i;
|
253
|
+
VALUE str_buf;
|
254
|
+
char *ptr = DATA_PTR(obj);
|
255
|
+
Check_Type(value, T_ARRAY);
|
256
|
+
|
257
|
+
str_buf = rb_str_buf_new(sizeofstruct * RARRAY_LEN(value));
|
258
|
+
|
259
|
+
for (i = 0; i < RARRAY_LEN(value); i++){
|
260
|
+
VALUE entry = rb_ary_entry(value, i);
|
261
|
+
if (!rb_obj_is_kind_of(entry, klass))
|
262
|
+
rb_raise(rb_eArgError, "arg must be array of PKCS11::%s", struct_name);
|
263
|
+
memcpy(RSTRING_PTR(str_buf) + sizeofstruct * i, DATA_PTR(entry), sizeofstruct);
|
264
|
+
}
|
265
|
+
*(CK_VOID_PTR*)(ptr+offset) = RSTRING_PTR(str_buf);
|
266
|
+
*(unsigned long*)(ptr+offset_len) = RARRAY_LEN(value);
|
267
|
+
rb_iv_set(obj, name, str_buf);
|
268
|
+
return value;
|
269
|
+
}
|
270
|
+
|
271
|
+
|
272
|
+
#define OFFSET_OF(s, f) ((off_t)((char*)&(((s*)0)->f) - (char*)0))
|
273
|
+
#define SIZE_OF(s, f) (sizeof(((s*)0)->f))
|
274
|
+
|
275
|
+
#define PKCS11_IMPLEMENT_ALLOCATOR(s) \
|
276
|
+
static VALUE s##_s_alloc(VALUE self){ \
|
277
|
+
s *info; \
|
278
|
+
VALUE obj = Data_Make_Struct(self, s, 0, -1, info); \
|
279
|
+
return obj; \
|
280
|
+
} \
|
281
|
+
static VALUE c##s##_to_s(VALUE self){ \
|
282
|
+
return rb_str_new(DATA_PTR(self), sizeof(s)); \
|
283
|
+
} \
|
284
|
+
static VALUE c##s##_members(VALUE self){ \
|
285
|
+
return a##s##_members; \
|
286
|
+
}
|
287
|
+
|
288
|
+
#define PKCS11_IMPLEMENT_STRUCT_WITH_ALLOCATOR(s) \
|
289
|
+
static VALUE c##s;\
|
290
|
+
static VALUE a##s##_members;\
|
291
|
+
PKCS11_IMPLEMENT_ALLOCATOR(s);
|
292
|
+
|
293
|
+
#define PKCS11_IMPLEMENT_STRING_ACCESSOR(s, f) \
|
294
|
+
static VALUE c##s##_get_##f(VALUE o){ \
|
295
|
+
return get_string(o, OFFSET_OF(s, f), SIZE_OF(s, f)); \
|
296
|
+
} \
|
297
|
+
static VALUE c##s##_set_##f(VALUE o, VALUE v){ \
|
298
|
+
return set_string(o, v, OFFSET_OF(s, f), SIZE_OF(s, f)); \
|
299
|
+
}
|
300
|
+
|
301
|
+
#define PKCS11_IMPLEMENT_ULONG_ACCESSOR(s, f) \
|
302
|
+
static VALUE c##s##_get_##f(VALUE o){ \
|
303
|
+
return get_ulong(o, OFFSET_OF(s, f)); \
|
304
|
+
} \
|
305
|
+
static VALUE c##s##_set_##f(VALUE o, VALUE v){ \
|
306
|
+
return set_ulong(o, v, OFFSET_OF(s, f)); \
|
307
|
+
}
|
308
|
+
|
309
|
+
#define PKCS11_IMPLEMENT_BYTE_ACCESSOR(s, f) \
|
310
|
+
static VALUE c##s##_get_##f(VALUE o){ \
|
311
|
+
return get_byte(o, OFFSET_OF(s, f)); \
|
312
|
+
} \
|
313
|
+
static VALUE c##s##_set_##f(VALUE o, VALUE v){ \
|
314
|
+
return set_byte(o, v, OFFSET_OF(s, f)); \
|
315
|
+
}
|
316
|
+
|
317
|
+
#define PKCS11_IMPLEMENT_ULONG_PTR_ACCESSOR(s, f) \
|
318
|
+
static VALUE c##s##_get_##f(VALUE o){ \
|
319
|
+
return get_ulong_ptr(o, OFFSET_OF(s, f)); \
|
320
|
+
} \
|
321
|
+
static VALUE c##s##_set_##f(VALUE o, VALUE v){ \
|
322
|
+
return set_ulong_ptr(o, v, #f, OFFSET_OF(s, f)); \
|
323
|
+
}
|
324
|
+
|
325
|
+
#define PKCS11_IMPLEMENT_HANDLE_ACCESSOR(s, f) \
|
326
|
+
static VALUE c##s##_get_##f(VALUE o){ \
|
327
|
+
return get_handle(o, OFFSET_OF(s, f)); \
|
328
|
+
} \
|
329
|
+
static VALUE c##s##_set_##f(VALUE o, VALUE v){ \
|
330
|
+
return set_handle(o, v, OFFSET_OF(s, f)); \
|
331
|
+
}
|
332
|
+
|
333
|
+
#define PKCS11_IMPLEMENT_BOOL_ACCESSOR(s, f) \
|
334
|
+
static VALUE c##s##_get_##f(VALUE o){ \
|
335
|
+
return get_bool(o, OFFSET_OF(s, f)); \
|
336
|
+
} \
|
337
|
+
static VALUE c##s##_set_##f(VALUE o, VALUE v){ \
|
338
|
+
return set_bool(o, v, OFFSET_OF(s, f)); \
|
339
|
+
}
|
340
|
+
|
341
|
+
#define PKCS11_IMPLEMENT_STRING_PTR_ACCESSOR(s, f) \
|
342
|
+
static VALUE c##s##_get_##f(VALUE o){ \
|
343
|
+
return get_string_ptr(o, #f, OFFSET_OF(s, f)); \
|
344
|
+
} \
|
345
|
+
static VALUE c##s##_set_##f(VALUE o, VALUE v){ \
|
346
|
+
return set_string_ptr(o, v, #f, OFFSET_OF(s, f)); \
|
347
|
+
}
|
348
|
+
|
349
|
+
#define PKCS11_IMPLEMENT_STRING_PTR_LEN_ACCESSOR(s, f, l) \
|
350
|
+
static VALUE c##s##_get_##f(VALUE o){ \
|
351
|
+
return get_string_ptr_len(o, #f, OFFSET_OF(s, f), OFFSET_OF(s, l)); \
|
352
|
+
} \
|
353
|
+
static VALUE c##s##_set_##f(VALUE o, VALUE v){ \
|
354
|
+
return set_string_ptr_len(o, v, #f, OFFSET_OF(s, f), OFFSET_OF(s, l)); \
|
355
|
+
}
|
356
|
+
|
357
|
+
#define PKCS11_IMPLEMENT_STRUCT_ACCESSOR(s, k, f) \
|
358
|
+
static VALUE c##s##_get_##f(VALUE o){ \
|
359
|
+
return get_struct_inline(o, c##k, #f, OFFSET_OF(s, f)); \
|
360
|
+
} \
|
361
|
+
static VALUE c##s##_set_##f(VALUE o, VALUE v){ \
|
362
|
+
return set_struct_inline(o, c##k, #k, v, #f, OFFSET_OF(s, f), sizeof(k)); \
|
363
|
+
}
|
364
|
+
|
365
|
+
#define PKCS11_IMPLEMENT_PKCS11_STRUCT_ACCESSOR(s, k, f) \
|
366
|
+
static VALUE c##s##_get_##f(VALUE o){ \
|
367
|
+
VALUE klass = rb_const_get(rb_const_get(rb_cObject, rb_intern("PKCS11")), rb_intern(#k)); \
|
368
|
+
return get_struct_inline(o, klass, #f, OFFSET_OF(s, f)); \
|
369
|
+
} \
|
370
|
+
static VALUE c##s##_set_##f(VALUE o, VALUE v){ \
|
371
|
+
VALUE klass = rb_const_get(rb_const_get(rb_cObject, rb_intern("PKCS11")), rb_intern(#k)); \
|
372
|
+
return set_struct_inline(o, klass, #k, v, #f, OFFSET_OF(s, f), sizeof(k)); \
|
373
|
+
}
|
374
|
+
|
375
|
+
#define PKCS11_IMPLEMENT_STRUCT_PTR_ACCESSOR(s, k, f) \
|
376
|
+
static VALUE c##s##_get_##f(VALUE o){ \
|
377
|
+
return get_struct_ptr(o, c##k, #f, OFFSET_OF(s, f), sizeof(k)); \
|
378
|
+
} \
|
379
|
+
static VALUE c##s##_set_##f(VALUE o, VALUE v){ \
|
380
|
+
return set_struct_ptr(o, c##k, #k, v, #f, OFFSET_OF(s, f)); \
|
381
|
+
}
|
382
|
+
|
383
|
+
#define PKCS11_IMPLEMENT_PKCS11_STRUCT_PTR_ACCESSOR(s, k, f) \
|
384
|
+
static VALUE c##s##_get_##f(VALUE o){ \
|
385
|
+
VALUE klass = rb_const_get(rb_const_get(rb_cObject, rb_intern("PKCS11")), rb_intern(#k)); \
|
386
|
+
return get_struct_ptr(o, klass, #f, OFFSET_OF(s, f), sizeof(k)); \
|
387
|
+
} \
|
388
|
+
static VALUE c##s##_set_##f(VALUE o, VALUE v){ \
|
389
|
+
VALUE klass = rb_const_get(rb_const_get(rb_cObject, rb_intern("PKCS11")), rb_intern(#k)); \
|
390
|
+
return set_struct_ptr(o, klass, #k, v, #f, OFFSET_OF(s, f)); \
|
391
|
+
}
|
392
|
+
|
393
|
+
#define PKCS11_IMPLEMENT_STRUCT_PTR_ARRAY_ACCESSOR(s, k, f, l) \
|
394
|
+
static VALUE c##s##_get_##f(VALUE o){ \
|
395
|
+
return get_struct_ptr_array(o, c##k, OFFSET_OF(s, f), OFFSET_OF(s, l), sizeof(k)); \
|
396
|
+
} \
|
397
|
+
static VALUE c##s##_set_##f(VALUE o, VALUE v){ \
|
398
|
+
return set_struct_ptr_array(o, c##k, #k, v, #f, OFFSET_OF(s, f), OFFSET_OF(s, l), sizeof(k)); \
|
399
|
+
}
|
400
|
+
|
401
|
+
#define PKCS11_IMPLEMENT_PKCS11_STRUCT_PTR_ARRAY_ACCESSOR(s, k, f, l) \
|
402
|
+
static VALUE c##s##_get_##f(VALUE o){ \
|
403
|
+
VALUE klass = rb_const_get(rb_const_get(rb_cObject, rb_intern("PKCS11")), rb_intern(#k)); \
|
404
|
+
return get_struct_ptr_array(o, klass, OFFSET_OF(s, f), OFFSET_OF(s, l), sizeof(k)); \
|
405
|
+
} \
|
406
|
+
static VALUE c##s##_set_##f(VALUE o, VALUE v){ \
|
407
|
+
VALUE klass = rb_const_get(rb_const_get(rb_cObject, rb_intern("PKCS11")), rb_intern(#k)); \
|
408
|
+
return set_struct_ptr_array(o, klass, #k, v, #f, OFFSET_OF(s, f), OFFSET_OF(s, l), sizeof(k)); \
|
409
|
+
}
|
410
|
+
|
411
|
+
|
412
|
+
/**************************************************/
|
413
|
+
/* struct/attribute definition */
|
414
|
+
/**************************************************/
|
415
|
+
|
416
|
+
#define PKCS11_DEFINE_STRUCT(s) \
|
417
|
+
do { \
|
418
|
+
c##s = rb_define_class_under(MODULE_FOR_STRUCTS, #s, BASECLASS_FOR_STRUCTS); \
|
419
|
+
a##s##_members = rb_ary_new(); \
|
420
|
+
rb_define_alloc_func(c##s, s##_s_alloc); \
|
421
|
+
rb_define_const(c##s, "SIZEOF_STRUCT", ULONG2NUM(sizeof(s))); \
|
422
|
+
rb_define_method(c##s, "to_s", c##s##_to_s, 0); \
|
423
|
+
rb_define_method(c##s, "members", c##s##_members, 0); \
|
424
|
+
rb_iv_set(c##s, "members", a##s##_members); \
|
425
|
+
} while(0)
|
426
|
+
|
427
|
+
#define PKCS11_DEFINE_MEMBER(s, f) \
|
428
|
+
do { \
|
429
|
+
rb_define_method(c##s, #f, c##s##_get_##f, 0); \
|
430
|
+
rb_define_method(c##s, #f "=", c##s##_set_##f, 1); \
|
431
|
+
rb_ary_push(a##s##_members, rb_str_new2(#f)); \
|
432
|
+
} while(0)
|
433
|
+
|
434
|
+
|
435
|
+
#endif
|
@@ -0,0 +1,411 @@
|
|
1
|
+
#include "pk11_thread_funcs.h"
|
2
|
+
#ifdef HAVE_RB_THREAD_BLOCKING_REGION
|
3
|
+
VALUE tbf_C_Initialize( void *data ){
|
4
|
+
struct tbr_C_Initialize_params *p = (struct tbr_C_Initialize_params*)data;
|
5
|
+
p->retval = p->func( p->params.pInitArgs );
|
6
|
+
return Qnil;
|
7
|
+
}
|
8
|
+
|
9
|
+
VALUE tbf_C_Finalize( void *data ){
|
10
|
+
struct tbr_C_Finalize_params *p = (struct tbr_C_Finalize_params*)data;
|
11
|
+
p->retval = p->func( p->params.pReserved );
|
12
|
+
return Qnil;
|
13
|
+
}
|
14
|
+
|
15
|
+
VALUE tbf_C_GetInfo( void *data ){
|
16
|
+
struct tbr_C_GetInfo_params *p = (struct tbr_C_GetInfo_params*)data;
|
17
|
+
p->retval = p->func( p->params.pInfo );
|
18
|
+
return Qnil;
|
19
|
+
}
|
20
|
+
|
21
|
+
VALUE tbf_C_GetFunctionList( void *data ){
|
22
|
+
struct tbr_C_GetFunctionList_params *p = (struct tbr_C_GetFunctionList_params*)data;
|
23
|
+
p->retval = p->func( p->params.ppFunctionList );
|
24
|
+
return Qnil;
|
25
|
+
}
|
26
|
+
|
27
|
+
VALUE tbf_C_GetSlotList( void *data ){
|
28
|
+
struct tbr_C_GetSlotList_params *p = (struct tbr_C_GetSlotList_params*)data;
|
29
|
+
p->retval = p->func( p->params.tokenPresent,p->params.pSlotList,p->params.pulCount );
|
30
|
+
return Qnil;
|
31
|
+
}
|
32
|
+
|
33
|
+
VALUE tbf_C_GetSlotInfo( void *data ){
|
34
|
+
struct tbr_C_GetSlotInfo_params *p = (struct tbr_C_GetSlotInfo_params*)data;
|
35
|
+
p->retval = p->func( p->params.slotID,p->params.pInfo );
|
36
|
+
return Qnil;
|
37
|
+
}
|
38
|
+
|
39
|
+
VALUE tbf_C_GetTokenInfo( void *data ){
|
40
|
+
struct tbr_C_GetTokenInfo_params *p = (struct tbr_C_GetTokenInfo_params*)data;
|
41
|
+
p->retval = p->func( p->params.slotID,p->params.pInfo );
|
42
|
+
return Qnil;
|
43
|
+
}
|
44
|
+
|
45
|
+
VALUE tbf_C_GetMechanismList( void *data ){
|
46
|
+
struct tbr_C_GetMechanismList_params *p = (struct tbr_C_GetMechanismList_params*)data;
|
47
|
+
p->retval = p->func( p->params.slotID,p->params.pMechanismList,p->params.pulCount );
|
48
|
+
return Qnil;
|
49
|
+
}
|
50
|
+
|
51
|
+
VALUE tbf_C_GetMechanismInfo( void *data ){
|
52
|
+
struct tbr_C_GetMechanismInfo_params *p = (struct tbr_C_GetMechanismInfo_params*)data;
|
53
|
+
p->retval = p->func( p->params.slotID,p->params.type,p->params.pInfo );
|
54
|
+
return Qnil;
|
55
|
+
}
|
56
|
+
|
57
|
+
VALUE tbf_C_InitToken( void *data ){
|
58
|
+
struct tbr_C_InitToken_params *p = (struct tbr_C_InitToken_params*)data;
|
59
|
+
p->retval = p->func( p->params.slotID,p->params.pPin,p->params.ulPinLen,p->params.pLabel );
|
60
|
+
return Qnil;
|
61
|
+
}
|
62
|
+
|
63
|
+
VALUE tbf_C_InitPIN( void *data ){
|
64
|
+
struct tbr_C_InitPIN_params *p = (struct tbr_C_InitPIN_params*)data;
|
65
|
+
p->retval = p->func( p->params.hSession,p->params.pPin,p->params.ulPinLen );
|
66
|
+
return Qnil;
|
67
|
+
}
|
68
|
+
|
69
|
+
VALUE tbf_C_SetPIN( void *data ){
|
70
|
+
struct tbr_C_SetPIN_params *p = (struct tbr_C_SetPIN_params*)data;
|
71
|
+
p->retval = p->func( p->params.hSession,p->params.pOldPin,p->params.ulOldLen,p->params.pNewPin,p->params.ulNewLen );
|
72
|
+
return Qnil;
|
73
|
+
}
|
74
|
+
|
75
|
+
VALUE tbf_C_OpenSession( void *data ){
|
76
|
+
struct tbr_C_OpenSession_params *p = (struct tbr_C_OpenSession_params*)data;
|
77
|
+
p->retval = p->func( p->params.slotID,p->params.flags,p->params.pApplication,p->params.Notify,p->params.phSession );
|
78
|
+
return Qnil;
|
79
|
+
}
|
80
|
+
|
81
|
+
VALUE tbf_C_CloseSession( void *data ){
|
82
|
+
struct tbr_C_CloseSession_params *p = (struct tbr_C_CloseSession_params*)data;
|
83
|
+
p->retval = p->func( p->params.hSession );
|
84
|
+
return Qnil;
|
85
|
+
}
|
86
|
+
|
87
|
+
VALUE tbf_C_CloseAllSessions( void *data ){
|
88
|
+
struct tbr_C_CloseAllSessions_params *p = (struct tbr_C_CloseAllSessions_params*)data;
|
89
|
+
p->retval = p->func( p->params.slotID );
|
90
|
+
return Qnil;
|
91
|
+
}
|
92
|
+
|
93
|
+
VALUE tbf_C_GetSessionInfo( void *data ){
|
94
|
+
struct tbr_C_GetSessionInfo_params *p = (struct tbr_C_GetSessionInfo_params*)data;
|
95
|
+
p->retval = p->func( p->params.hSession,p->params.pInfo );
|
96
|
+
return Qnil;
|
97
|
+
}
|
98
|
+
|
99
|
+
VALUE tbf_C_GetOperationState( void *data ){
|
100
|
+
struct tbr_C_GetOperationState_params *p = (struct tbr_C_GetOperationState_params*)data;
|
101
|
+
p->retval = p->func( p->params.hSession,p->params.pOperationState,p->params.pulOperationStateLen );
|
102
|
+
return Qnil;
|
103
|
+
}
|
104
|
+
|
105
|
+
VALUE tbf_C_SetOperationState( void *data ){
|
106
|
+
struct tbr_C_SetOperationState_params *p = (struct tbr_C_SetOperationState_params*)data;
|
107
|
+
p->retval = p->func( p->params.hSession,p->params.pOperationState,p->params.ulOperationStateLen,p->params.hEncryptionKey,p->params.hAuthenticationKey );
|
108
|
+
return Qnil;
|
109
|
+
}
|
110
|
+
|
111
|
+
VALUE tbf_C_Login( void *data ){
|
112
|
+
struct tbr_C_Login_params *p = (struct tbr_C_Login_params*)data;
|
113
|
+
p->retval = p->func( p->params.hSession,p->params.userType,p->params.pPin,p->params.ulPinLen );
|
114
|
+
return Qnil;
|
115
|
+
}
|
116
|
+
|
117
|
+
VALUE tbf_C_Logout( void *data ){
|
118
|
+
struct tbr_C_Logout_params *p = (struct tbr_C_Logout_params*)data;
|
119
|
+
p->retval = p->func( p->params.hSession );
|
120
|
+
return Qnil;
|
121
|
+
}
|
122
|
+
|
123
|
+
VALUE tbf_C_CreateObject( void *data ){
|
124
|
+
struct tbr_C_CreateObject_params *p = (struct tbr_C_CreateObject_params*)data;
|
125
|
+
p->retval = p->func( p->params.hSession,p->params.pTemplate,p->params.ulCount,p->params.phObject );
|
126
|
+
return Qnil;
|
127
|
+
}
|
128
|
+
|
129
|
+
VALUE tbf_C_CopyObject( void *data ){
|
130
|
+
struct tbr_C_CopyObject_params *p = (struct tbr_C_CopyObject_params*)data;
|
131
|
+
p->retval = p->func( p->params.hSession,p->params.hObject,p->params.pTemplate,p->params.ulCount,p->params.phNewObject );
|
132
|
+
return Qnil;
|
133
|
+
}
|
134
|
+
|
135
|
+
VALUE tbf_C_DestroyObject( void *data ){
|
136
|
+
struct tbr_C_DestroyObject_params *p = (struct tbr_C_DestroyObject_params*)data;
|
137
|
+
p->retval = p->func( p->params.hSession,p->params.hObject );
|
138
|
+
return Qnil;
|
139
|
+
}
|
140
|
+
|
141
|
+
VALUE tbf_C_GetObjectSize( void *data ){
|
142
|
+
struct tbr_C_GetObjectSize_params *p = (struct tbr_C_GetObjectSize_params*)data;
|
143
|
+
p->retval = p->func( p->params.hSession,p->params.hObject,p->params.pulSize );
|
144
|
+
return Qnil;
|
145
|
+
}
|
146
|
+
|
147
|
+
VALUE tbf_C_GetAttributeValue( void *data ){
|
148
|
+
struct tbr_C_GetAttributeValue_params *p = (struct tbr_C_GetAttributeValue_params*)data;
|
149
|
+
p->retval = p->func( p->params.hSession,p->params.hObject,p->params.pTemplate,p->params.ulCount );
|
150
|
+
return Qnil;
|
151
|
+
}
|
152
|
+
|
153
|
+
VALUE tbf_C_SetAttributeValue( void *data ){
|
154
|
+
struct tbr_C_SetAttributeValue_params *p = (struct tbr_C_SetAttributeValue_params*)data;
|
155
|
+
p->retval = p->func( p->params.hSession,p->params.hObject,p->params.pTemplate,p->params.ulCount );
|
156
|
+
return Qnil;
|
157
|
+
}
|
158
|
+
|
159
|
+
VALUE tbf_C_FindObjectsInit( void *data ){
|
160
|
+
struct tbr_C_FindObjectsInit_params *p = (struct tbr_C_FindObjectsInit_params*)data;
|
161
|
+
p->retval = p->func( p->params.hSession,p->params.pTemplate,p->params.ulCount );
|
162
|
+
return Qnil;
|
163
|
+
}
|
164
|
+
|
165
|
+
VALUE tbf_C_FindObjects( void *data ){
|
166
|
+
struct tbr_C_FindObjects_params *p = (struct tbr_C_FindObjects_params*)data;
|
167
|
+
p->retval = p->func( p->params.hSession,p->params.phObject,p->params.ulMaxObjectCount,p->params.pulObjectCount );
|
168
|
+
return Qnil;
|
169
|
+
}
|
170
|
+
|
171
|
+
VALUE tbf_C_FindObjectsFinal( void *data ){
|
172
|
+
struct tbr_C_FindObjectsFinal_params *p = (struct tbr_C_FindObjectsFinal_params*)data;
|
173
|
+
p->retval = p->func( p->params.hSession );
|
174
|
+
return Qnil;
|
175
|
+
}
|
176
|
+
|
177
|
+
VALUE tbf_C_EncryptInit( void *data ){
|
178
|
+
struct tbr_C_EncryptInit_params *p = (struct tbr_C_EncryptInit_params*)data;
|
179
|
+
p->retval = p->func( p->params.hSession,p->params.pMechanism,p->params.hKey );
|
180
|
+
return Qnil;
|
181
|
+
}
|
182
|
+
|
183
|
+
VALUE tbf_C_Encrypt( void *data ){
|
184
|
+
struct tbr_C_Encrypt_params *p = (struct tbr_C_Encrypt_params*)data;
|
185
|
+
p->retval = p->func( p->params.hSession,p->params.pData,p->params.ulDataLen,p->params.pEncryptedData,p->params.pulEncryptedDataLen );
|
186
|
+
return Qnil;
|
187
|
+
}
|
188
|
+
|
189
|
+
VALUE tbf_C_EncryptUpdate( void *data ){
|
190
|
+
struct tbr_C_EncryptUpdate_params *p = (struct tbr_C_EncryptUpdate_params*)data;
|
191
|
+
p->retval = p->func( p->params.hSession,p->params.pPart,p->params.ulPartLen,p->params.pEncryptedPart,p->params.pulEncryptedPartLen );
|
192
|
+
return Qnil;
|
193
|
+
}
|
194
|
+
|
195
|
+
VALUE tbf_C_EncryptFinal( void *data ){
|
196
|
+
struct tbr_C_EncryptFinal_params *p = (struct tbr_C_EncryptFinal_params*)data;
|
197
|
+
p->retval = p->func( p->params.hSession,p->params.pLastEncryptedPart,p->params.pulLastEncryptedPartLen );
|
198
|
+
return Qnil;
|
199
|
+
}
|
200
|
+
|
201
|
+
VALUE tbf_C_DecryptInit( void *data ){
|
202
|
+
struct tbr_C_DecryptInit_params *p = (struct tbr_C_DecryptInit_params*)data;
|
203
|
+
p->retval = p->func( p->params.hSession,p->params.pMechanism,p->params.hKey );
|
204
|
+
return Qnil;
|
205
|
+
}
|
206
|
+
|
207
|
+
VALUE tbf_C_Decrypt( void *data ){
|
208
|
+
struct tbr_C_Decrypt_params *p = (struct tbr_C_Decrypt_params*)data;
|
209
|
+
p->retval = p->func( p->params.hSession,p->params.pEncryptedData,p->params.ulEncryptedDataLen,p->params.pData,p->params.pulDataLen );
|
210
|
+
return Qnil;
|
211
|
+
}
|
212
|
+
|
213
|
+
VALUE tbf_C_DecryptUpdate( void *data ){
|
214
|
+
struct tbr_C_DecryptUpdate_params *p = (struct tbr_C_DecryptUpdate_params*)data;
|
215
|
+
p->retval = p->func( p->params.hSession,p->params.pEncryptedPart,p->params.ulEncryptedPartLen,p->params.pPart,p->params.pulPartLen );
|
216
|
+
return Qnil;
|
217
|
+
}
|
218
|
+
|
219
|
+
VALUE tbf_C_DecryptFinal( void *data ){
|
220
|
+
struct tbr_C_DecryptFinal_params *p = (struct tbr_C_DecryptFinal_params*)data;
|
221
|
+
p->retval = p->func( p->params.hSession,p->params.pLastPart,p->params.pulLastPartLen );
|
222
|
+
return Qnil;
|
223
|
+
}
|
224
|
+
|
225
|
+
VALUE tbf_C_DigestInit( void *data ){
|
226
|
+
struct tbr_C_DigestInit_params *p = (struct tbr_C_DigestInit_params*)data;
|
227
|
+
p->retval = p->func( p->params.hSession,p->params.pMechanism );
|
228
|
+
return Qnil;
|
229
|
+
}
|
230
|
+
|
231
|
+
VALUE tbf_C_Digest( void *data ){
|
232
|
+
struct tbr_C_Digest_params *p = (struct tbr_C_Digest_params*)data;
|
233
|
+
p->retval = p->func( p->params.hSession,p->params.pData,p->params.ulDataLen,p->params.pDigest,p->params.pulDigestLen );
|
234
|
+
return Qnil;
|
235
|
+
}
|
236
|
+
|
237
|
+
VALUE tbf_C_DigestUpdate( void *data ){
|
238
|
+
struct tbr_C_DigestUpdate_params *p = (struct tbr_C_DigestUpdate_params*)data;
|
239
|
+
p->retval = p->func( p->params.hSession,p->params.pPart,p->params.ulPartLen );
|
240
|
+
return Qnil;
|
241
|
+
}
|
242
|
+
|
243
|
+
VALUE tbf_C_DigestKey( void *data ){
|
244
|
+
struct tbr_C_DigestKey_params *p = (struct tbr_C_DigestKey_params*)data;
|
245
|
+
p->retval = p->func( p->params.hSession,p->params.hKey );
|
246
|
+
return Qnil;
|
247
|
+
}
|
248
|
+
|
249
|
+
VALUE tbf_C_DigestFinal( void *data ){
|
250
|
+
struct tbr_C_DigestFinal_params *p = (struct tbr_C_DigestFinal_params*)data;
|
251
|
+
p->retval = p->func( p->params.hSession,p->params.pDigest,p->params.pulDigestLen );
|
252
|
+
return Qnil;
|
253
|
+
}
|
254
|
+
|
255
|
+
VALUE tbf_C_SignInit( void *data ){
|
256
|
+
struct tbr_C_SignInit_params *p = (struct tbr_C_SignInit_params*)data;
|
257
|
+
p->retval = p->func( p->params.hSession,p->params.pMechanism,p->params.hKey );
|
258
|
+
return Qnil;
|
259
|
+
}
|
260
|
+
|
261
|
+
VALUE tbf_C_Sign( void *data ){
|
262
|
+
struct tbr_C_Sign_params *p = (struct tbr_C_Sign_params*)data;
|
263
|
+
p->retval = p->func( p->params.hSession,p->params.pData,p->params.ulDataLen,p->params.pSignature,p->params.pulSignatureLen );
|
264
|
+
return Qnil;
|
265
|
+
}
|
266
|
+
|
267
|
+
VALUE tbf_C_SignUpdate( void *data ){
|
268
|
+
struct tbr_C_SignUpdate_params *p = (struct tbr_C_SignUpdate_params*)data;
|
269
|
+
p->retval = p->func( p->params.hSession,p->params.pPart,p->params.ulPartLen );
|
270
|
+
return Qnil;
|
271
|
+
}
|
272
|
+
|
273
|
+
VALUE tbf_C_SignFinal( void *data ){
|
274
|
+
struct tbr_C_SignFinal_params *p = (struct tbr_C_SignFinal_params*)data;
|
275
|
+
p->retval = p->func( p->params.hSession,p->params.pSignature,p->params.pulSignatureLen );
|
276
|
+
return Qnil;
|
277
|
+
}
|
278
|
+
|
279
|
+
VALUE tbf_C_SignRecoverInit( void *data ){
|
280
|
+
struct tbr_C_SignRecoverInit_params *p = (struct tbr_C_SignRecoverInit_params*)data;
|
281
|
+
p->retval = p->func( p->params.hSession,p->params.pMechanism,p->params.hKey );
|
282
|
+
return Qnil;
|
283
|
+
}
|
284
|
+
|
285
|
+
VALUE tbf_C_SignRecover( void *data ){
|
286
|
+
struct tbr_C_SignRecover_params *p = (struct tbr_C_SignRecover_params*)data;
|
287
|
+
p->retval = p->func( p->params.hSession,p->params.pData,p->params.ulDataLen,p->params.pSignature,p->params.pulSignatureLen );
|
288
|
+
return Qnil;
|
289
|
+
}
|
290
|
+
|
291
|
+
VALUE tbf_C_VerifyInit( void *data ){
|
292
|
+
struct tbr_C_VerifyInit_params *p = (struct tbr_C_VerifyInit_params*)data;
|
293
|
+
p->retval = p->func( p->params.hSession,p->params.pMechanism,p->params.hKey );
|
294
|
+
return Qnil;
|
295
|
+
}
|
296
|
+
|
297
|
+
VALUE tbf_C_Verify( void *data ){
|
298
|
+
struct tbr_C_Verify_params *p = (struct tbr_C_Verify_params*)data;
|
299
|
+
p->retval = p->func( p->params.hSession,p->params.pData,p->params.ulDataLen,p->params.pSignature,p->params.ulSignatureLen );
|
300
|
+
return Qnil;
|
301
|
+
}
|
302
|
+
|
303
|
+
VALUE tbf_C_VerifyUpdate( void *data ){
|
304
|
+
struct tbr_C_VerifyUpdate_params *p = (struct tbr_C_VerifyUpdate_params*)data;
|
305
|
+
p->retval = p->func( p->params.hSession,p->params.pPart,p->params.ulPartLen );
|
306
|
+
return Qnil;
|
307
|
+
}
|
308
|
+
|
309
|
+
VALUE tbf_C_VerifyFinal( void *data ){
|
310
|
+
struct tbr_C_VerifyFinal_params *p = (struct tbr_C_VerifyFinal_params*)data;
|
311
|
+
p->retval = p->func( p->params.hSession,p->params.pSignature,p->params.ulSignatureLen );
|
312
|
+
return Qnil;
|
313
|
+
}
|
314
|
+
|
315
|
+
VALUE tbf_C_VerifyRecoverInit( void *data ){
|
316
|
+
struct tbr_C_VerifyRecoverInit_params *p = (struct tbr_C_VerifyRecoverInit_params*)data;
|
317
|
+
p->retval = p->func( p->params.hSession,p->params.pMechanism,p->params.hKey );
|
318
|
+
return Qnil;
|
319
|
+
}
|
320
|
+
|
321
|
+
VALUE tbf_C_VerifyRecover( void *data ){
|
322
|
+
struct tbr_C_VerifyRecover_params *p = (struct tbr_C_VerifyRecover_params*)data;
|
323
|
+
p->retval = p->func( p->params.hSession,p->params.pSignature,p->params.ulSignatureLen,p->params.pData,p->params.pulDataLen );
|
324
|
+
return Qnil;
|
325
|
+
}
|
326
|
+
|
327
|
+
VALUE tbf_C_DigestEncryptUpdate( void *data ){
|
328
|
+
struct tbr_C_DigestEncryptUpdate_params *p = (struct tbr_C_DigestEncryptUpdate_params*)data;
|
329
|
+
p->retval = p->func( p->params.hSession,p->params.pPart,p->params.ulPartLen,p->params.pEncryptedPart,p->params.pulEncryptedPartLen );
|
330
|
+
return Qnil;
|
331
|
+
}
|
332
|
+
|
333
|
+
VALUE tbf_C_DecryptDigestUpdate( void *data ){
|
334
|
+
struct tbr_C_DecryptDigestUpdate_params *p = (struct tbr_C_DecryptDigestUpdate_params*)data;
|
335
|
+
p->retval = p->func( p->params.hSession,p->params.pEncryptedPart,p->params.ulEncryptedPartLen,p->params.pPart,p->params.pulPartLen );
|
336
|
+
return Qnil;
|
337
|
+
}
|
338
|
+
|
339
|
+
VALUE tbf_C_SignEncryptUpdate( void *data ){
|
340
|
+
struct tbr_C_SignEncryptUpdate_params *p = (struct tbr_C_SignEncryptUpdate_params*)data;
|
341
|
+
p->retval = p->func( p->params.hSession,p->params.pPart,p->params.ulPartLen,p->params.pEncryptedPart,p->params.pulEncryptedPartLen );
|
342
|
+
return Qnil;
|
343
|
+
}
|
344
|
+
|
345
|
+
VALUE tbf_C_DecryptVerifyUpdate( void *data ){
|
346
|
+
struct tbr_C_DecryptVerifyUpdate_params *p = (struct tbr_C_DecryptVerifyUpdate_params*)data;
|
347
|
+
p->retval = p->func( p->params.hSession,p->params.pEncryptedPart,p->params.ulEncryptedPartLen,p->params.pPart,p->params.pulPartLen );
|
348
|
+
return Qnil;
|
349
|
+
}
|
350
|
+
|
351
|
+
VALUE tbf_C_GenerateKey( void *data ){
|
352
|
+
struct tbr_C_GenerateKey_params *p = (struct tbr_C_GenerateKey_params*)data;
|
353
|
+
p->retval = p->func( p->params.hSession,p->params.pMechanism,p->params.pTemplate,p->params.ulCount,p->params.phKey );
|
354
|
+
return Qnil;
|
355
|
+
}
|
356
|
+
|
357
|
+
VALUE tbf_C_GenerateKeyPair( void *data ){
|
358
|
+
struct tbr_C_GenerateKeyPair_params *p = (struct tbr_C_GenerateKeyPair_params*)data;
|
359
|
+
p->retval = p->func( p->params.hSession,p->params.pMechanism,p->params.pPublicKeyTemplate,p->params.ulPublicKeyAttributeCount,p->params.pPrivateKeyTemplate,p->params.ulPrivateKeyAttributeCount,p->params.phPublicKey,p->params.phPrivateKey );
|
360
|
+
return Qnil;
|
361
|
+
}
|
362
|
+
|
363
|
+
VALUE tbf_C_WrapKey( void *data ){
|
364
|
+
struct tbr_C_WrapKey_params *p = (struct tbr_C_WrapKey_params*)data;
|
365
|
+
p->retval = p->func( p->params.hSession,p->params.pMechanism,p->params.hWrappingKey,p->params.hKey,p->params.pWrappedKey,p->params.pulWrappedKeyLen );
|
366
|
+
return Qnil;
|
367
|
+
}
|
368
|
+
|
369
|
+
VALUE tbf_C_UnwrapKey( void *data ){
|
370
|
+
struct tbr_C_UnwrapKey_params *p = (struct tbr_C_UnwrapKey_params*)data;
|
371
|
+
p->retval = p->func( p->params.hSession,p->params.pMechanism,p->params.hUnwrappingKey,p->params.pWrappedKey,p->params.ulWrappedKeyLen,p->params.pTemplate,p->params.ulAttributeCount,p->params.phKey );
|
372
|
+
return Qnil;
|
373
|
+
}
|
374
|
+
|
375
|
+
VALUE tbf_C_DeriveKey( void *data ){
|
376
|
+
struct tbr_C_DeriveKey_params *p = (struct tbr_C_DeriveKey_params*)data;
|
377
|
+
p->retval = p->func( p->params.hSession,p->params.pMechanism,p->params.hBaseKey,p->params.pTemplate,p->params.ulAttributeCount,p->params.phKey );
|
378
|
+
return Qnil;
|
379
|
+
}
|
380
|
+
|
381
|
+
VALUE tbf_C_SeedRandom( void *data ){
|
382
|
+
struct tbr_C_SeedRandom_params *p = (struct tbr_C_SeedRandom_params*)data;
|
383
|
+
p->retval = p->func( p->params.hSession,p->params.pSeed,p->params.ulSeedLen );
|
384
|
+
return Qnil;
|
385
|
+
}
|
386
|
+
|
387
|
+
VALUE tbf_C_GenerateRandom( void *data ){
|
388
|
+
struct tbr_C_GenerateRandom_params *p = (struct tbr_C_GenerateRandom_params*)data;
|
389
|
+
p->retval = p->func( p->params.hSession,p->params.RandomData,p->params.ulRandomLen );
|
390
|
+
return Qnil;
|
391
|
+
}
|
392
|
+
|
393
|
+
VALUE tbf_C_GetFunctionStatus( void *data ){
|
394
|
+
struct tbr_C_GetFunctionStatus_params *p = (struct tbr_C_GetFunctionStatus_params*)data;
|
395
|
+
p->retval = p->func( p->params.hSession );
|
396
|
+
return Qnil;
|
397
|
+
}
|
398
|
+
|
399
|
+
VALUE tbf_C_CancelFunction( void *data ){
|
400
|
+
struct tbr_C_CancelFunction_params *p = (struct tbr_C_CancelFunction_params*)data;
|
401
|
+
p->retval = p->func( p->params.hSession );
|
402
|
+
return Qnil;
|
403
|
+
}
|
404
|
+
|
405
|
+
VALUE tbf_C_WaitForSlotEvent( void *data ){
|
406
|
+
struct tbr_C_WaitForSlotEvent_params *p = (struct tbr_C_WaitForSlotEvent_params*)data;
|
407
|
+
p->retval = p->func( p->params.flags,p->params.pSlot,p->params.pRserved );
|
408
|
+
return Qnil;
|
409
|
+
}
|
410
|
+
|
411
|
+
#endif
|