Ruby 2.1.5p273(2014-11-13revision48405)

- Main Page
- Modules
- Data Structures
- Files

- File List
- Globals

ossl_engine.c
Go to the documentation of this file.
1 /*
2 * $Id: ossl_engine.c 43742 2013-11-21 04:37:14Z zzak $
3 * 'OpenSSL for Ruby' project
4 * Copyright (C) 2003 GOTOU Yuuzou <gotoyuzo@notwork.org>
5 * All rights reserved.
6 */
7 /*
8 * This program is licenced under the same licence as Ruby.
9 * (See the file 'LICENCE'.)
10 */
11 #include "ossl.h"
12
13 #if defined(OSSL_ENGINE_ENABLED)
14
15 #define WrapEngine(klass, obj, engine) do { \
16 if (!(engine)) { \
17 ossl_raise(rb_eRuntimeError, "ENGINE wasn't initialized."); \
18 } \
19 (obj) = Data_Wrap_Struct((klass), 0, ENGINE_free, (engine)); \
20 } while(0)
21 #define GetEngine(obj, engine) do { \
22 Data_Get_Struct((obj), ENGINE, (engine)); \
23 if (!(engine)) { \
24 ossl_raise(rb_eRuntimeError, "ENGINE wasn't initialized."); \
25 } \
26 } while (0)
27 #define SafeGetEngine(obj, engine) do { \
28 OSSL_Check_Kind((obj), cEngine); \
29 GetPKCS7((obj), (engine)); \
30 } while (0)
31
32 /*
33 * Classes
34 */
35 /* Document-class: OpenSSL::Engine
36 *
37 * This class is the access to openssl's ENGINE cryptographic module
38 * implementation.
39 *
40 * See also, https://www.openssl.org/docs/crypto/engine.html
41 */
42 VALUE cEngine;
43 /* Document-class: OpenSSL::Engine::EngineError
44 *
45 * This is the generic exception for OpenSSL::Engine related errors
46 */
47 VALUE eEngineError;
48
49 /*
50 * Private
51 */
52 #define OSSL_ENGINE_LOAD_IF_MATCH(x) \
53 do{\
54 if(!strcmp(#x, RSTRING_PTR(name))){\
55 ENGINE_load_##x();\
56 return Qtrue;\
57 }\
58 }while(0)
59
60 /* Document-method: OpenSSL::Engine.load
61 *
62 * call-seq:
63 * load(enginename = nil)
64 *
65 * This method loads engines. If +name+ is nil, then all builtin engines are
66 * loaded. Otherwise, the given +name+, as a string, is loaded if available to
67 * your runtime, and returns true. If +name+ is not found, then nil is
68 * returned.
69 *
70 */
71 static VALUE
72 ossl_engine_s_load(int argc, VALUE *argv, VALUE klass)
73 {
74 #if !defined(HAVE_ENGINE_LOAD_BUILTIN_ENGINES)
75 return Qnil;
76 #else
77 VALUE name;
78
79 rb_scan_args(argc, argv, "01", &name);
80 if(NIL_P(name)){
81 ENGINE_load_builtin_engines();
82 return Qtrue;
83 }
84 StringValue(name);
85 #ifndef OPENSSL_NO_STATIC_ENGINE
86 #if HAVE_ENGINE_LOAD_DYNAMIC
87 OSSL_ENGINE_LOAD_IF_MATCH(dynamic);
88 #endif
89 #if HAVE_ENGINE_LOAD_4758CCA
90 OSSL_ENGINE_LOAD_IF_MATCH(4758cca);
91 #endif
92 #if HAVE_ENGINE_LOAD_AEP
93 OSSL_ENGINE_LOAD_IF_MATCH(aep);
94 #endif
95 #if HAVE_ENGINE_LOAD_ATALLA
96 OSSL_ENGINE_LOAD_IF_MATCH(atalla);
97 #endif
98 #if HAVE_ENGINE_LOAD_CHIL
99 OSSL_ENGINE_LOAD_IF_MATCH(chil);
100 #endif
101 #if HAVE_ENGINE_LOAD_CSWIFT
102 OSSL_ENGINE_LOAD_IF_MATCH(cswift);
103 #endif
104 #if HAVE_ENGINE_LOAD_NURON
105 OSSL_ENGINE_LOAD_IF_MATCH(nuron);
106 #endif
107 #if HAVE_ENGINE_LOAD_SUREWARE
108 OSSL_ENGINE_LOAD_IF_MATCH(sureware);
109 #endif
110 #if HAVE_ENGINE_LOAD_UBSEC
111 OSSL_ENGINE_LOAD_IF_MATCH(ubsec);
112 #endif
113 #if HAVE_ENGINE_LOAD_PADLOCK
114 OSSL_ENGINE_LOAD_IF_MATCH(padlock);
115 #endif
116 #if HAVE_ENGINE_LOAD_CAPI
117 OSSL_ENGINE_LOAD_IF_MATCH(capi);
118 #endif
119 #if HAVE_ENGINE_LOAD_GMP
120 OSSL_ENGINE_LOAD_IF_MATCH(gmp);
121 #endif
122 #if HAVE_ENGINE_LOAD_GOST
123 OSSL_ENGINE_LOAD_IF_MATCH(gost);
124 #endif
125 #if HAVE_ENGINE_LOAD_CRYPTODEV
126 OSSL_ENGINE_LOAD_IF_MATCH(cryptodev);
127 #endif
128 #if HAVE_ENGINE_LOAD_AESNI
129 OSSL_ENGINE_LOAD_IF_MATCH(aesni);
130 #endif
131 #endif
132 #ifdef HAVE_ENGINE_LOAD_OPENBSD_DEV_CRYPTO
133 OSSL_ENGINE_LOAD_IF_MATCH(openbsd_dev_crypto);
134 #endif
135 OSSL_ENGINE_LOAD_IF_MATCH(openssl);
136 rb_warning("no such builtin loader for `%s'", RSTRING_PTR(name));
137 return Qnil;
138 #endif /* HAVE_ENGINE_LOAD_BUILTIN_ENGINES */
139 }
140
141 /* Document-method: OpenSSL::Engine.cleanup
142 * call-seq:
143 * OpenSSL::Engine.cleanup
144 *
145 * It is only necessary to run cleanup when engines are loaded via
146 * OpenSSL::Engine.load. However, running cleanup before exit is recommended.
147 *
148 * See also, https://www.openssl.org/docs/crypto/engine.html
149 */
150 static VALUE
151 ossl_engine_s_cleanup(VALUE self)
152 {
153 #if defined(HAVE_ENGINE_CLEANUP)
154 ENGINE_cleanup();
155 #endif
156 return Qnil;
157 }
158
159 /* Document-method: OpenSSL::Engine.engines
160 *
161 * Returns an array of currently loaded engines.
162 */
163 static VALUE
164 ossl_engine_s_engines(VALUE klass)
165 {
166 ENGINE *e;
167 VALUE ary, obj;
168
169 ary = rb_ary_new();
170 for(e = ENGINE_get_first(); e; e = ENGINE_get_next(e)){
171 /* Need a ref count of two here because of ENGINE_free being
172 * called internally by OpenSSL when moving to the next ENGINE
173 * and by us when releasing the ENGINE reference */
174 ENGINE_up_ref(e);
175 WrapEngine(klass, obj, e);
176 rb_ary_push(ary, obj);
177 }
178
179 return ary;
180 }
181
182 /* Document-method: OpenSSL::Engine.by_id
183 *
184 * call-seq:
185 * by_id(name) -> engine
186 *
187 * Fetch the engine as specified by the +id+ String
188 *
189 * OpenSSL::Engine.by_id("openssl")
190 * => #<OpenSSL::Engine id="openssl" name="Software engine support">
191 *
192 * See OpenSSL::Engine.engines for the currently loaded engines
193 */
194 static VALUE
195 ossl_engine_s_by_id(VALUE klass, VALUE id)
196 {
197 ENGINE *e;
198 VALUE obj;
199
200 StringValue(id);
201 ossl_engine_s_load(1, &id, klass);
202 if(!(e = ENGINE_by_id(RSTRING_PTR(id))))
203 ossl_raise(eEngineError, NULL);
204 WrapEngine(klass, obj, e);
205 if(rb_block_given_p()) rb_yield(obj);
206 if(!ENGINE_init(e))
207 ossl_raise(eEngineError, NULL);
208 ENGINE_ctrl(e, ENGINE_CTRL_SET_PASSWORD_CALLBACK,
209 0, NULL, (void(*)(void))ossl_pem_passwd_cb);
210 ERR_clear_error();
211
212 return obj;
213 }
214
215 static VALUE
216 ossl_engine_s_alloc(VALUE klass)
217 {
218 ENGINE *e;
219 VALUE obj;
220
221 if (!(e = ENGINE_new())) {
222 ossl_raise(eEngineError, NULL);
223 }
224 WrapEngine(klass, obj, e);
225
226 return obj;
227 }
228
229 /* Document-method: OpenSSL::Engine#id
230 *
231 * Get the id for this engine
232 *
233 * OpenSSL::Engine.load
234 * OpenSSL::Engine.engines #=> [#<OpenSSL::Engine#>, ...]
235 * OpenSSL::Engine.engines.first.id
236 * #=> "rsax"
237 */
238 static VALUE
239 ossl_engine_get_id(VALUE self)
240 {
241 ENGINE *e;
242 GetEngine(self, e);
243 return rb_str_new2(ENGINE_get_id(e));
244 }
245
246 /* Document-method: OpenSSL::Engine#name
247 *
248 * Get the descriptive name for this engine
249 *
250 * OpenSSL::Engine.load
251 * OpenSSL::Engine.engines #=> [#<OpenSSL::Engine#>, ...]
252 * OpenSSL::Engine.engines.first.name
253 * #=> "RSAX engine support"
254 *
255 */
256 static VALUE
257 ossl_engine_get_name(VALUE self)
258 {
259 ENGINE *e;
260 GetEngine(self, e);
261 return rb_str_new2(ENGINE_get_name(e));
262 }
263
264 /* Document-method: OpenSSL::Engine#finish
265 *
266 * Releases all internal structural references for this engine.
267 *
268 * May raise an EngineError if the engine is unavailable
269 */
270 static VALUE
271 ossl_engine_finish(VALUE self)
272 {
273 ENGINE *e;
274
275 GetEngine(self, e);
276 if(!ENGINE_finish(e)) ossl_raise(eEngineError, NULL);
277
278 return Qnil;
279 }
280
281 #if defined(HAVE_ENGINE_GET_CIPHER)
282 /* Document-method: OpenSSL::Engine#cipher
283 *
284 * call-seq:
285 * engine.cipher(name) -> OpenSSL::Cipher
286 *
287 * This returns an OpenSSL::Cipher by +name+, if it is available in this
288 * engine.
289 *
290 * A EngineError will be raised if the cipher is unavailable.
291 *
292 * e = OpenSSL::Engine.by_id("openssl")
293 * => #<OpenSSL::Engine id="openssl" name="Software engine support">
294 * e.cipher("RC4")
295 * => #<OpenSSL::Cipher:0x007fc5cacc3048>
296 *
297 */
298 static VALUE
299 ossl_engine_get_cipher(VALUE self, VALUE name)
300 {
301 ENGINE *e;
302 const EVP_CIPHER *ciph, *tmp;
303 char *s;
304 int nid;
305
306 s = StringValuePtr(name);
307 tmp = EVP_get_cipherbyname(s);
308 if(!tmp) ossl_raise(eEngineError, "no such cipher `%s'", s);
309 nid = EVP_CIPHER_nid(tmp);
310 GetEngine(self, e);
311 ciph = ENGINE_get_cipher(e, nid);
312 if(!ciph) ossl_raise(eEngineError, NULL);
313
314 return ossl_cipher_new(ciph);
315 }
316 #else
317 #define ossl_engine_get_cipher rb_f_notimplement
318 #endif
319
320 #if defined(HAVE_ENGINE_GET_DIGEST)
321 /* Document-method: OpenSSL::Engine#digest
322 *
323 * call-seq:
324 * engine.digest(name) -> OpenSSL::Digest
325 *
326 * This returns an OpenSSL::Digest by +name+.
327 *
328 * Will raise an EngineError if the digest is unavailable.
329 *
330 * e = OpenSSL::Engine.by_id("openssl")
331 * #=> #<OpenSSL::Engine id="openssl" name="Software engine support">
332 * e.digest("SHA1")
333 * #=> #<OpenSSL::Digest: da39a3ee5e6b4b0d3255bfef95601890afd80709>
334 * e.digest("zomg")
335 * #=> OpenSSL::Engine::EngineError: no such digest `zomg'
336 */
337 static VALUE
338 ossl_engine_get_digest(VALUE self, VALUE name)
339 {
340 ENGINE *e;
341 const EVP_MD *md, *tmp;
342 char *s;
343 int nid;
344
345 s = StringValuePtr(name);
346 tmp = EVP_get_digestbyname(s);
347 if(!tmp) ossl_raise(eEngineError, "no such digest `%s'", s);
348 nid = EVP_MD_nid(tmp);
349 GetEngine(self, e);
350 md = ENGINE_get_digest(e, nid);
351 if(!md) ossl_raise(eEngineError, NULL);
352
353 return ossl_digest_new(md);
354 }
355 #else
356 #define ossl_engine_get_digest rb_f_notimplement
357 #endif
358
359 /* Document-method: OpenSSL::Engine#load_private_key
360 *
361 * call-seq:
362 * engine.load_private_key(id = nil, data = nil) -> OpenSSL::PKey
363 *
364 * Loads the given private key by +id+ and +data+.
365 *
366 * An EngineError is raised of the OpenSSL::PKey is unavailable.
367 *
368 */
369 static VALUE
370 ossl_engine_load_privkey(int argc, VALUE *argv, VALUE self)
371 {
372 ENGINE *e;
373 EVP_PKEY *pkey;
374 VALUE id, data, obj;
375 char *sid, *sdata;
376
377 rb_scan_args(argc, argv, "02", &id, &data);
378 sid = NIL_P(id) ? NULL : StringValuePtr(id);
379 sdata = NIL_P(data) ? NULL : StringValuePtr(data);
380 GetEngine(self, e);
381 #if OPENSSL_VERSION_NUMBER < 0x00907000L
382 pkey = ENGINE_load_private_key(e, sid, sdata);
383 #else
384 pkey = ENGINE_load_private_key(e, sid, NULL, sdata);
385 #endif
386 if (!pkey) ossl_raise(eEngineError, NULL);
387 obj = ossl_pkey_new(pkey);
388 OSSL_PKEY_SET_PRIVATE(obj);
389
390 return obj;
391 }
392
393 /* Document-method: OpenSSL::Engine#load_public_key
394 *
395 * call-seq:
396 * engine.load_public_key(id = nil, data = nil) -> OpenSSL::PKey
397 *
398 * Loads the given private key by +id+ and +data+.
399 *
400 * An EngineError is raised of the OpenSSL::PKey is unavailable.
401 *
402 */
403 static VALUE
404 ossl_engine_load_pubkey(int argc, VALUE *argv, VALUE self)
405 {
406 ENGINE *e;
407 EVP_PKEY *pkey;
408 VALUE id, data;
409 char *sid, *sdata;
410
411 rb_scan_args(argc, argv, "02", &id, &data);
412 sid = NIL_P(id) ? NULL : StringValuePtr(id);
413 sdata = NIL_P(data) ? NULL : StringValuePtr(data);
414 GetEngine(self, e);
415 #if OPENSSL_VERSION_NUMBER < 0x00907000L
416 pkey = ENGINE_load_public_key(e, sid, sdata);
417 #else
418 pkey = ENGINE_load_public_key(e, sid, NULL, sdata);
419 #endif
420 if (!pkey) ossl_raise(eEngineError, NULL);
421
422 return ossl_pkey_new(pkey);
423 }
424
425 /* Document-method: OpenSSL::Engine#set_default
426 *
427 * call-seq:
428 * engine.set_default(flag)
429 *
430 * Set the defaults for this engine with the given +flag+.
431 *
432 * These flags are used to control combinations of algorithm methods.
433 *
434 * +flag+ can be one of the following, other flags are available depending on
435 * your OS.
436 *
437 * [All flags] 0xFFFF
438 * [No flags] 0x0000
439 *
440 * See also <openssl/engine.h>
441 */
442 static VALUE
443 ossl_engine_set_default(VALUE self, VALUE flag)
444 {
445 ENGINE *e;
446 int f = NUM2INT(flag);
447
448 GetEngine(self, e);
449 ENGINE_set_default(e, f);
450
451 return Qtrue;
452 }
453
454 /* Document-method: OpenSSL::Engine#ctrl_cmd
455 *
456 * call-seq:
457 * engine.ctrl_cmd(command, value = nil) -> engine
458 *
459 * Send the given +command+ to this engine.
460 *
461 * Raises an EngineError if the +command+ fails.
462 */
463 static VALUE
464 ossl_engine_ctrl_cmd(int argc, VALUE *argv, VALUE self)
465 {
466 ENGINE *e;
467 VALUE cmd, val;
468 int ret;
469
470 GetEngine(self, e);
471 rb_scan_args(argc, argv, "11", &cmd, &val);
472 StringValue(cmd);
473 if (!NIL_P(val)) StringValue(val);
474 ret = ENGINE_ctrl_cmd_string(e, RSTRING_PTR(cmd),
475 NIL_P(val) ? NULL : RSTRING_PTR(val), 0);
476 if (!ret) ossl_raise(eEngineError, NULL);
477
478 return self;
479 }
480
481 static VALUE
482 ossl_engine_cmd_flag_to_name(int flag)
483 {
484 switch(flag){
485 case ENGINE_CMD_FLAG_NUMERIC: return rb_str_new2("NUMERIC");
486 case ENGINE_CMD_FLAG_STRING: return rb_str_new2("STRING");
487 case ENGINE_CMD_FLAG_NO_INPUT: return rb_str_new2("NO_INPUT");
488 case ENGINE_CMD_FLAG_INTERNAL: return rb_str_new2("INTERNAL");
489 default: return rb_str_new2("UNKNOWN");
490 }
491 }
492
493 /* Document-method: OpenSSL::Engine#cmds
494 *
495 * Returns an array of command definitions for the current engine
496 */
497 static VALUE
498 ossl_engine_get_cmds(VALUE self)
499 {
500 ENGINE *e;
501 const ENGINE_CMD_DEFN *defn, *p;
502 VALUE ary, tmp;
503
504 GetEngine(self, e);
505 ary = rb_ary_new();
506 if ((defn = ENGINE_get_cmd_defns(e)) != NULL){
507 for (p = defn; p->cmd_num > 0; p++){
508 tmp = rb_ary_new();
509 rb_ary_push(tmp, rb_str_new2(p->cmd_name));
510 rb_ary_push(tmp, rb_str_new2(p->cmd_desc));
511 rb_ary_push(tmp, ossl_engine_cmd_flag_to_name(p->cmd_flags));
512 rb_ary_push(ary, tmp);
513 }
514 }
515
516 return ary;
517 }
518
519 /* Document-method: OpenSSL::Engine#inspect
520 *
521 * Pretty print this engine
522 */
523 static VALUE
524 ossl_engine_inspect(VALUE self)
525 {
526 VALUE str;
527 const char *cname = rb_class2name(rb_obj_class(self));
528
529 str = rb_str_new2("#<");
530 rb_str_cat2(str, cname);
531 rb_str_cat2(str, " id=\"");
532 rb_str_append(str, ossl_engine_get_id(self));
533 rb_str_cat2(str, "\" name=\"");
534 rb_str_append(str, ossl_engine_get_name(self));
535 rb_str_cat2(str, "\">");
536
537 return str;
538 }
539
540 #define DefEngineConst(x) rb_define_const(cEngine, #x, INT2NUM(ENGINE_##x))
541
542 void
543 Init_ossl_engine()
544 {
545 cEngine = rb_define_class_under(mOSSL, "Engine", rb_cObject);
546 eEngineError = rb_define_class_under(cEngine, "EngineError", eOSSLError);
547
548 rb_define_alloc_func(cEngine, ossl_engine_s_alloc);
549 rb_define_singleton_method(cEngine, "load", ossl_engine_s_load, -1);
550 rb_define_singleton_method(cEngine, "cleanup", ossl_engine_s_cleanup, 0);
551 rb_define_singleton_method(cEngine, "engines", ossl_engine_s_engines, 0);
552 rb_define_singleton_method(cEngine, "by_id", ossl_engine_s_by_id, 1);
553 rb_undef_method(CLASS_OF(cEngine), "new");
554
555 rb_define_method(cEngine, "id", ossl_engine_get_id, 0);
556 rb_define_method(cEngine, "name", ossl_engine_get_name, 0);
557 rb_define_method(cEngine, "finish", ossl_engine_finish, 0);
558 rb_define_method(cEngine, "cipher", ossl_engine_get_cipher, 1);
559 rb_define_method(cEngine, "digest", ossl_engine_get_digest, 1);
560 rb_define_method(cEngine, "load_private_key", ossl_engine_load_privkey, -1);
561 rb_define_method(cEngine, "load_public_key", ossl_engine_load_pubkey, -1);
562 rb_define_method(cEngine, "set_default", ossl_engine_set_default, 1);
563 rb_define_method(cEngine, "ctrl_cmd", ossl_engine_ctrl_cmd, -1);
564 rb_define_method(cEngine, "cmds", ossl_engine_get_cmds, 0);
565 rb_define_method(cEngine, "inspect", ossl_engine_inspect, 0);
566
567 DefEngineConst(METHOD_RSA);
568 DefEngineConst(METHOD_DSA);
569 DefEngineConst(METHOD_DH);
570 DefEngineConst(METHOD_RAND);
571 #ifdef ENGINE_METHOD_BN_MOD_EXP
572 DefEngineConst(METHOD_BN_MOD_EXP);
573 #endif
574 #ifdef ENGINE_METHOD_BN_MOD_EXP_CRT
575 DefEngineConst(METHOD_BN_MOD_EXP_CRT);
576 #endif
577 #ifdef ENGINE_METHOD_CIPHERS
578 DefEngineConst(METHOD_CIPHERS);
579 #endif
580 #ifdef ENGINE_METHOD_DIGESTS
581 DefEngineConst(METHOD_DIGESTS);
582 #endif
583 DefEngineConst(METHOD_ALL);
584 DefEngineConst(METHOD_NONE);
585 }
586 #else
587 void
588 Init_ossl_engine()
589 {
590 }
591 #endif
mOSSL
VALUE mOSSL
Definition: ossl.c:259
NUM2INT
#define NUM2INT(x)
Definition: ruby.h:630
rb_define_singleton_method
void rb_define_singleton_method(VALUE obj, const char *name, VALUE(*func)(ANYARGS), int argc)
Defines a singleton method for obj.
Definition: class.c:1655
CLASS_OF
#define CLASS_OF(v)
Definition: ruby.h:440
Qtrue
#define Qtrue
Definition: ruby.h:426
id
const int id
Definition: nkf.c:209
eEngineError
VALUE eEngineError
rb_ary_push
VALUE rb_ary_push(VALUE ary, VALUE item)
Definition: array.c:896
rb_define_class_under
VALUE rb_define_class_under(VALUE outer, const char *name, VALUE super)
Defines a class under the namespace of outer.
Definition: class.c:676
rb_define_alloc_func
void rb_define_alloc_func(VALUE, rb_alloc_func_t)
ossl_pkey_new
VALUE ossl_pkey_new(EVP_PKEY *pkey)
Definition: ossl_pkey.c:76
rb_undef_method
void rb_undef_method(VALUE klass, const char *name)
Definition: class.c:1506
cEngine
VALUE cEngine
ossl_cipher_new
VALUE ossl_cipher_new(const EVP_CIPHER *cipher)
Definition: ossl_cipher.c:55
OSSL_PKEY_SET_PRIVATE
#define OSSL_PKEY_SET_PRIVATE(obj)
Definition: ossl_pkey.h:19
rb_block_given_p
int rb_block_given_p(void)
Definition: eval.c:712
val
#define val
rb_cObject
RUBY_EXTERN VALUE rb_cObject
Definition: ruby.h:1553
rb_str_cat2
VALUE rb_str_cat2(VALUE, const char *)
Definition: string.c:2159
rb_ary_new
VALUE rb_ary_new(void)
Definition: array.c:495
ossl_digest_new
VALUE ossl_digest_new(const EVP_MD *md)
Definition: ossl_digest.c:64
NIL_P
#define NIL_P(v)
Definition: ruby.h:438
eOSSLError
VALUE eOSSLError
Definition: ossl.c:264
argc
int argc
Definition: ruby.c:131
rb_str_new2
#define rb_str_new2
Definition: intern.h:840
Init_ossl_engine
void Init_ossl_engine()
Definition: ossl_engine.c:588
rb_yield
VALUE rb_yield(VALUE)
Definition: vm_eval.c:942
rb_scan_args
int rb_scan_args(int argc, const VALUE *argv, const char *fmt,...)
Definition: class.c:1728
Qnil
#define Qnil
Definition: ruby.h:427
VALUE
unsigned long VALUE
Definition: ruby.h:88
rb_class2name
const char * rb_class2name(VALUE)
Definition: variable.c:397
RSTRING_PTR
#define RSTRING_PTR(str)
Definition: ruby.h:845
f
#define f
ossl_raise
void ossl_raise(VALUE exc, const char *fmt,...)
Definition: ossl.c:333
name
const char * name
Definition: nkf.c:208
ossl.h
StringValuePtr
#define StringValuePtr(v)
Definition: ruby.h:540
ossl_pem_passwd_cb
int ossl_pem_passwd_cb(char *buf, int max_len, int flag, void *pwd)
Definition: ossl.c:162
rb_warning
void rb_warning(const char *fmt,...)
Definition: error.c:236
NULL
#define NULL
Definition: _sdbm.c:103
rb_define_method
void rb_define_method(VALUE klass, const char *name, VALUE(*func)(ANYARGS), int argc)
Definition: class.c:1488
rb_str_append
VALUE rb_str_append(VALUE, VALUE)
Definition: string.c:2298
argv
char ** argv
Definition: ruby.c:132
StringValue
#define StringValue(v)
Definition: ruby.h:539
rb_obj_class
VALUE rb_obj_class(VALUE)
Definition: object.c:226