rubysl-openssl 0.0.1 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (88) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +0 -1
  3. data/.travis.yml +7 -0
  4. data/README.md +2 -2
  5. data/Rakefile +0 -1
  6. data/ext/rubysl/openssl/extconf.h +50 -0
  7. data/ext/rubysl/openssl/extconf.rb +144 -0
  8. data/ext/rubysl/openssl/openssl_missing.c +343 -0
  9. data/ext/rubysl/openssl/openssl_missing.h +191 -0
  10. data/ext/rubysl/openssl/ossl.c +552 -0
  11. data/ext/rubysl/openssl/ossl.h +233 -0
  12. data/ext/rubysl/openssl/ossl_asn1.c +1160 -0
  13. data/ext/rubysl/openssl/ossl_asn1.h +59 -0
  14. data/ext/rubysl/openssl/ossl_bio.c +86 -0
  15. data/ext/rubysl/openssl/ossl_bio.h +21 -0
  16. data/ext/rubysl/openssl/ossl_bn.c +852 -0
  17. data/ext/rubysl/openssl/ossl_bn.h +25 -0
  18. data/ext/rubysl/openssl/ossl_cipher.c +569 -0
  19. data/ext/rubysl/openssl/ossl_cipher.h +22 -0
  20. data/ext/rubysl/openssl/ossl_config.c +75 -0
  21. data/ext/rubysl/openssl/ossl_config.h +22 -0
  22. data/ext/rubysl/openssl/ossl_digest.c +259 -0
  23. data/ext/rubysl/openssl/ossl_digest.h +22 -0
  24. data/ext/rubysl/openssl/ossl_engine.c +411 -0
  25. data/ext/rubysl/openssl/ossl_engine.h +20 -0
  26. data/ext/rubysl/openssl/ossl_hmac.c +268 -0
  27. data/ext/rubysl/openssl/ossl_hmac.h +19 -0
  28. data/ext/rubysl/openssl/ossl_ns_spki.c +257 -0
  29. data/ext/rubysl/openssl/ossl_ns_spki.h +21 -0
  30. data/ext/rubysl/openssl/ossl_ocsp.c +769 -0
  31. data/ext/rubysl/openssl/ossl_ocsp.h +24 -0
  32. data/ext/rubysl/openssl/ossl_pkcs12.c +210 -0
  33. data/ext/rubysl/openssl/ossl_pkcs12.h +15 -0
  34. data/ext/rubysl/openssl/ossl_pkcs5.c +99 -0
  35. data/ext/rubysl/openssl/ossl_pkcs5.h +6 -0
  36. data/ext/rubysl/openssl/ossl_pkcs7.c +1039 -0
  37. data/ext/rubysl/openssl/ossl_pkcs7.h +22 -0
  38. data/ext/rubysl/openssl/ossl_pkey.c +240 -0
  39. data/ext/rubysl/openssl/ossl_pkey.h +141 -0
  40. data/ext/rubysl/openssl/ossl_pkey_dh.c +532 -0
  41. data/ext/rubysl/openssl/ossl_pkey_dsa.c +484 -0
  42. data/ext/rubysl/openssl/ossl_pkey_ec.c +1593 -0
  43. data/ext/rubysl/openssl/ossl_pkey_rsa.c +593 -0
  44. data/ext/rubysl/openssl/ossl_rand.c +202 -0
  45. data/ext/rubysl/openssl/ossl_rand.h +20 -0
  46. data/ext/rubysl/openssl/ossl_ssl.c +1484 -0
  47. data/ext/rubysl/openssl/ossl_ssl.h +36 -0
  48. data/ext/rubysl/openssl/ossl_ssl_session.c +307 -0
  49. data/ext/rubysl/openssl/ossl_version.h +16 -0
  50. data/ext/rubysl/openssl/ossl_x509.c +104 -0
  51. data/ext/rubysl/openssl/ossl_x509.h +114 -0
  52. data/ext/rubysl/openssl/ossl_x509attr.c +274 -0
  53. data/ext/rubysl/openssl/ossl_x509cert.c +764 -0
  54. data/ext/rubysl/openssl/ossl_x509crl.c +535 -0
  55. data/ext/rubysl/openssl/ossl_x509ext.c +458 -0
  56. data/ext/rubysl/openssl/ossl_x509name.c +399 -0
  57. data/ext/rubysl/openssl/ossl_x509req.c +466 -0
  58. data/ext/rubysl/openssl/ossl_x509revoked.c +229 -0
  59. data/ext/rubysl/openssl/ossl_x509store.c +625 -0
  60. data/ext/rubysl/openssl/ruby_missing.h +41 -0
  61. data/lib/openssl.rb +1 -0
  62. data/lib/openssl/bn.rb +35 -0
  63. data/lib/openssl/buffering.rb +241 -0
  64. data/lib/openssl/cipher.rb +65 -0
  65. data/lib/openssl/config.rb +316 -0
  66. data/lib/openssl/digest.rb +61 -0
  67. data/lib/openssl/net/ftptls.rb +53 -0
  68. data/lib/openssl/net/telnets.rb +251 -0
  69. data/lib/openssl/pkcs7.rb +25 -0
  70. data/lib/openssl/ssl-internal.rb +187 -0
  71. data/lib/openssl/ssl.rb +1 -0
  72. data/lib/openssl/x509-internal.rb +153 -0
  73. data/lib/openssl/x509.rb +1 -0
  74. data/lib/rubysl/openssl.rb +28 -0
  75. data/lib/rubysl/openssl/version.rb +5 -0
  76. data/rubysl-openssl.gemspec +19 -18
  77. data/spec/cipher_spec.rb +16 -0
  78. data/spec/config/freeze_spec.rb +17 -0
  79. data/spec/hmac/digest_spec.rb +15 -0
  80. data/spec/hmac/hexdigest_spec.rb +15 -0
  81. data/spec/random/pseudo_bytes_spec.rb +5 -0
  82. data/spec/random/random_bytes_spec.rb +5 -0
  83. data/spec/random/shared/random_bytes.rb +28 -0
  84. data/spec/shared/constants.rb +11 -0
  85. data/spec/x509/name/parse_spec.rb +47 -0
  86. metadata +153 -89
  87. data/lib/rubysl-openssl.rb +0 -7
  88. data/lib/rubysl-openssl/version.rb +0 -5
@@ -0,0 +1,484 @@
1
+ /*
2
+ * $Id: ossl_pkey_dsa.c 28004 2010-05-24 23:58:49Z shyouhei $
3
+ * 'OpenSSL for Ruby' project
4
+ * Copyright (C) 2001-2002 Michal Rokos <m.rokos@sh.cvut.cz>
5
+ * All rights reserved.
6
+ */
7
+ /*
8
+ * This program is licenced under the same licence as Ruby.
9
+ * (See the file 'LICENCE'.)
10
+ */
11
+ #if !defined(OPENSSL_NO_DSA)
12
+
13
+ #include "ossl.h"
14
+
15
+ #define GetPKeyDSA(obj, pkey) do { \
16
+ GetPKey(obj, pkey); \
17
+ if (EVP_PKEY_type(pkey->type) != EVP_PKEY_DSA) { /* PARANOIA? */ \
18
+ ossl_raise(rb_eRuntimeError, "THIS IS NOT A DSA!"); \
19
+ } \
20
+ } while (0)
21
+
22
+ #define DSA_HAS_PRIVATE(dsa) ((dsa)->priv_key)
23
+ #define DSA_PRIVATE(obj,dsa) (DSA_HAS_PRIVATE(dsa)||OSSL_PKEY_IS_PRIVATE(obj))
24
+
25
+ /*
26
+ * Classes
27
+ */
28
+ VALUE cDSA;
29
+ VALUE eDSAError;
30
+
31
+ /*
32
+ * Public
33
+ */
34
+ static VALUE
35
+ dsa_instance(VALUE klass, DSA *dsa)
36
+ {
37
+ EVP_PKEY *pkey;
38
+ VALUE obj;
39
+
40
+ if (!dsa) {
41
+ return Qfalse;
42
+ }
43
+ if (!(pkey = EVP_PKEY_new())) {
44
+ return Qfalse;
45
+ }
46
+ if (!EVP_PKEY_assign_DSA(pkey, dsa)) {
47
+ EVP_PKEY_free(pkey);
48
+ return Qfalse;
49
+ }
50
+ WrapPKey(klass, obj, pkey);
51
+
52
+ return obj;
53
+ }
54
+
55
+ VALUE
56
+ ossl_dsa_new(EVP_PKEY *pkey)
57
+ {
58
+ VALUE obj;
59
+
60
+ if (!pkey) {
61
+ obj = dsa_instance(cDSA, DSA_new());
62
+ } else {
63
+ if (EVP_PKEY_type(pkey->type) != EVP_PKEY_DSA) {
64
+ ossl_raise(rb_eTypeError, "Not a DSA key!");
65
+ }
66
+ WrapPKey(cDSA, obj, pkey);
67
+ }
68
+ if (obj == Qfalse) {
69
+ ossl_raise(eDSAError, NULL);
70
+ }
71
+
72
+ return obj;
73
+ }
74
+
75
+ /*
76
+ * Private
77
+ */
78
+ static DSA *
79
+ dsa_generate(int size)
80
+ {
81
+ DSA *dsa;
82
+ unsigned char seed[20];
83
+ int seed_len = 20, counter;
84
+ unsigned long h;
85
+
86
+ if (!RAND_bytes(seed, seed_len)) {
87
+ return 0;
88
+ }
89
+ dsa = DSA_generate_parameters(size, seed, seed_len, &counter, &h,
90
+ rb_block_given_p() ? ossl_generate_cb : NULL,
91
+ NULL);
92
+ if(!dsa) return 0;
93
+
94
+ if (!DSA_generate_key(dsa)) {
95
+ DSA_free(dsa);
96
+ return 0;
97
+ }
98
+
99
+ return dsa;
100
+ }
101
+
102
+ /*
103
+ * call-seq:
104
+ * DSA.generate(size) -> dsa
105
+ *
106
+ * === Parameters
107
+ * * +size+ is an integer representing the desired key size.
108
+ *
109
+ */
110
+ static VALUE
111
+ ossl_dsa_s_generate(VALUE klass, VALUE size)
112
+ {
113
+ DSA *dsa = dsa_generate(NUM2INT(size)); /* err handled by dsa_instance */
114
+ VALUE obj = dsa_instance(klass, dsa);
115
+
116
+ if (obj == Qfalse) {
117
+ DSA_free(dsa);
118
+ ossl_raise(eDSAError, NULL);
119
+ }
120
+
121
+ return obj;
122
+ }
123
+
124
+ /*
125
+ * call-seq:
126
+ * DSA.new([size | string [, pass]) -> dsa
127
+ *
128
+ * === Parameters
129
+ * * +size+ is an integer representing the desired key size.
130
+ * * +string+ contains a DER or PEM encoded key.
131
+ * * +pass+ is a string that contains a optional password.
132
+ *
133
+ * === Examples
134
+ * * DSA.new -> dsa
135
+ * * DSA.new(1024) -> dsa
136
+ * * DSA.new(File.read('dsa.pem')) -> dsa
137
+ * * DSA.new(File.read('dsa.pem'), 'mypassword') -> dsa
138
+ *
139
+ */
140
+ static VALUE
141
+ ossl_dsa_initialize(int argc, VALUE *argv, VALUE self)
142
+ {
143
+ EVP_PKEY *pkey;
144
+ DSA *dsa;
145
+ BIO *in;
146
+ char *passwd = NULL;
147
+ VALUE arg, pass;
148
+
149
+ GetPKey(self, pkey);
150
+ if(rb_scan_args(argc, argv, "02", &arg, &pass) == 0) {
151
+ dsa = DSA_new();
152
+ }
153
+ else if (FIXNUM_P(arg)) {
154
+ if (!(dsa = dsa_generate(FIX2INT(arg)))) {
155
+ ossl_raise(eDSAError, NULL);
156
+ }
157
+ }
158
+ else {
159
+ if (!NIL_P(pass)) passwd = StringValuePtr(pass);
160
+ arg = ossl_to_der_if_possible(arg);
161
+ in = ossl_obj2bio(arg);
162
+ dsa = PEM_read_bio_DSAPrivateKey(in, NULL, ossl_pem_passwd_cb, passwd);
163
+ if (!dsa) {
164
+ BIO_reset(in);
165
+ dsa = PEM_read_bio_DSAPublicKey(in, NULL, NULL, NULL);
166
+ }
167
+ if (!dsa) {
168
+ BIO_reset(in);
169
+ dsa = PEM_read_bio_DSA_PUBKEY(in, NULL, NULL, NULL);
170
+ }
171
+ if (!dsa) {
172
+ BIO_reset(in);
173
+ dsa = d2i_DSAPrivateKey_bio(in, NULL);
174
+ }
175
+ if (!dsa) {
176
+ BIO_reset(in);
177
+ dsa = d2i_DSA_PUBKEY_bio(in, NULL);
178
+ }
179
+ BIO_free(in);
180
+ if (!dsa) ossl_raise(eDSAError, "Neither PUB key nor PRIV key:");
181
+ }
182
+ if (!EVP_PKEY_assign_DSA(pkey, dsa)) {
183
+ DSA_free(dsa);
184
+ ossl_raise(eDSAError, NULL);
185
+ }
186
+
187
+ return self;
188
+ }
189
+
190
+ /*
191
+ * call-seq:
192
+ * dsa.public? -> true | false
193
+ *
194
+ */
195
+ static VALUE
196
+ ossl_dsa_is_public(VALUE self)
197
+ {
198
+ EVP_PKEY *pkey;
199
+
200
+ GetPKeyDSA(self, pkey);
201
+
202
+ return (pkey->pkey.dsa->pub_key) ? Qtrue : Qfalse;
203
+ }
204
+
205
+ /*
206
+ * call-seq:
207
+ * dsa.private? -> true | false
208
+ *
209
+ */
210
+ static VALUE
211
+ ossl_dsa_is_private(VALUE self)
212
+ {
213
+ EVP_PKEY *pkey;
214
+
215
+ GetPKeyDSA(self, pkey);
216
+
217
+ return (DSA_PRIVATE(self, pkey->pkey.dsa)) ? Qtrue : Qfalse;
218
+ }
219
+
220
+ /*
221
+ * call-seq:
222
+ * dsa.to_pem([cipher, password]) -> aString
223
+ *
224
+ * === Parameters
225
+ * +cipher+ is an OpenSSL::Cipher.
226
+ * +password+ is a string containing your password.
227
+ *
228
+ * === Examples
229
+ * * DSA.to_pem -> aString
230
+ * * DSA.to_pem(cipher, 'mypassword') -> aString
231
+ *
232
+ */
233
+ static VALUE
234
+ ossl_dsa_export(int argc, VALUE *argv, VALUE self)
235
+ {
236
+ EVP_PKEY *pkey;
237
+ BIO *out;
238
+ const EVP_CIPHER *ciph = NULL;
239
+ char *passwd = NULL;
240
+ VALUE cipher, pass, str;
241
+
242
+ GetPKeyDSA(self, pkey);
243
+ rb_scan_args(argc, argv, "02", &cipher, &pass);
244
+ if (!NIL_P(cipher)) {
245
+ ciph = GetCipherPtr(cipher);
246
+ if (!NIL_P(pass)) {
247
+ passwd = StringValuePtr(pass);
248
+ }
249
+ }
250
+ if (!(out = BIO_new(BIO_s_mem()))) {
251
+ ossl_raise(eDSAError, NULL);
252
+ }
253
+ if (DSA_HAS_PRIVATE(pkey->pkey.dsa)) {
254
+ if (!PEM_write_bio_DSAPrivateKey(out, pkey->pkey.dsa, ciph,
255
+ NULL, 0, ossl_pem_passwd_cb, passwd)){
256
+ BIO_free(out);
257
+ ossl_raise(eDSAError, NULL);
258
+ }
259
+ } else {
260
+ if (!PEM_write_bio_DSAPublicKey(out, pkey->pkey.dsa)) {
261
+ BIO_free(out);
262
+ ossl_raise(eDSAError, NULL);
263
+ }
264
+ }
265
+ str = ossl_membio2str(out);
266
+
267
+ return str;
268
+ }
269
+
270
+ /*
271
+ * call-seq:
272
+ * dsa.to_der -> aString
273
+ *
274
+ */
275
+ static VALUE
276
+ ossl_dsa_to_der(VALUE self)
277
+ {
278
+ EVP_PKEY *pkey;
279
+ int (*i2d_func)_((DSA*, unsigned char**));
280
+ unsigned char *p;
281
+ long len;
282
+ VALUE str;
283
+
284
+ GetPKeyDSA(self, pkey);
285
+ if(DSA_HAS_PRIVATE(pkey->pkey.dsa))
286
+ i2d_func = (int(*)_((DSA*,unsigned char**)))i2d_DSAPrivateKey;
287
+ else
288
+ i2d_func = i2d_DSA_PUBKEY;
289
+ if((len = i2d_func(pkey->pkey.dsa, NULL)) <= 0)
290
+ ossl_raise(eDSAError, NULL);
291
+ str = rb_str_new(0, len);
292
+ p = RSTRING_PTR(str);
293
+ if(i2d_func(pkey->pkey.dsa, &p) < 0)
294
+ ossl_raise(eDSAError, NULL);
295
+ ossl_str_adjust(str, p);
296
+
297
+ return str;
298
+ }
299
+
300
+ /*
301
+ * call-seq:
302
+ * dsa.params -> hash
303
+ *
304
+ * Stores all parameters of key to the hash
305
+ * INSECURE: PRIVATE INFORMATIONS CAN LEAK OUT!!!
306
+ * Don't use :-)) (I's up to you)
307
+ */
308
+ static VALUE
309
+ ossl_dsa_get_params(VALUE self)
310
+ {
311
+ EVP_PKEY *pkey;
312
+ VALUE hash;
313
+
314
+ GetPKeyDSA(self, pkey);
315
+
316
+ hash = rb_hash_new();
317
+
318
+ rb_hash_aset(hash, rb_str_new2("p"), ossl_bn_new(pkey->pkey.dsa->p));
319
+ rb_hash_aset(hash, rb_str_new2("q"), ossl_bn_new(pkey->pkey.dsa->q));
320
+ rb_hash_aset(hash, rb_str_new2("g"), ossl_bn_new(pkey->pkey.dsa->g));
321
+ rb_hash_aset(hash, rb_str_new2("pub_key"), ossl_bn_new(pkey->pkey.dsa->pub_key));
322
+ rb_hash_aset(hash, rb_str_new2("priv_key"), ossl_bn_new(pkey->pkey.dsa->priv_key));
323
+
324
+ return hash;
325
+ }
326
+
327
+ /*
328
+ * call-seq:
329
+ * dsa.to_text -> aString
330
+ *
331
+ * Prints all parameters of key to buffer
332
+ * INSECURE: PRIVATE INFORMATIONS CAN LEAK OUT!!!
333
+ * Don't use :-)) (I's up to you)
334
+ */
335
+ static VALUE
336
+ ossl_dsa_to_text(VALUE self)
337
+ {
338
+ EVP_PKEY *pkey;
339
+ BIO *out;
340
+ VALUE str;
341
+
342
+ GetPKeyDSA(self, pkey);
343
+ if (!(out = BIO_new(BIO_s_mem()))) {
344
+ ossl_raise(eDSAError, NULL);
345
+ }
346
+ if (!DSA_print(out, pkey->pkey.dsa, 0)) { /* offset = 0 */
347
+ BIO_free(out);
348
+ ossl_raise(eDSAError, NULL);
349
+ }
350
+ str = ossl_membio2str(out);
351
+
352
+ return str;
353
+ }
354
+
355
+ /*
356
+ * call-seq:
357
+ * dsa.public_key -> aDSA
358
+ *
359
+ * Makes new instance DSA PUBLIC_KEY from PRIVATE_KEY
360
+ */
361
+ static VALUE
362
+ ossl_dsa_to_public_key(VALUE self)
363
+ {
364
+ EVP_PKEY *pkey;
365
+ DSA *dsa;
366
+ VALUE obj;
367
+
368
+ GetPKeyDSA(self, pkey);
369
+ /* err check performed by dsa_instance */
370
+ dsa = DSAPublicKey_dup(pkey->pkey.dsa);
371
+ obj = dsa_instance(CLASS_OF(self), dsa);
372
+ if (obj == Qfalse) {
373
+ DSA_free(dsa);
374
+ ossl_raise(eDSAError, NULL);
375
+ }
376
+ return obj;
377
+ }
378
+
379
+ #define ossl_dsa_buf_size(pkey) (DSA_size((pkey)->pkey.dsa)+16)
380
+
381
+ /*
382
+ * call-seq:
383
+ * dsa.syssign(string) -> aString
384
+ *
385
+ */
386
+ static VALUE
387
+ ossl_dsa_sign(VALUE self, VALUE data)
388
+ {
389
+ EVP_PKEY *pkey;
390
+ int buf_len;
391
+ VALUE str;
392
+
393
+ GetPKeyDSA(self, pkey);
394
+ StringValue(data);
395
+ if (!DSA_PRIVATE(self, pkey->pkey.dsa)) {
396
+ ossl_raise(eDSAError, "Private DSA key needed!");
397
+ }
398
+ str = rb_str_new(0, ossl_dsa_buf_size(pkey));
399
+ if (!DSA_sign(0, RSTRING_PTR(data), RSTRING_LEN(data), RSTRING_PTR(str),
400
+ &buf_len, pkey->pkey.dsa)) { /* type is ignored (0) */
401
+ ossl_raise(eDSAError, NULL);
402
+ }
403
+ rb_str_set_len(str, buf_len);
404
+
405
+ return str;
406
+ }
407
+
408
+ /*
409
+ * call-seq:
410
+ * dsa.sysverify(digest, sig) -> true | false
411
+ *
412
+ */
413
+ static VALUE
414
+ ossl_dsa_verify(VALUE self, VALUE digest, VALUE sig)
415
+ {
416
+ EVP_PKEY *pkey;
417
+ int ret;
418
+
419
+ GetPKeyDSA(self, pkey);
420
+ StringValue(digest);
421
+ StringValue(sig);
422
+ /* type is ignored (0) */
423
+ ret = DSA_verify(0, RSTRING_PTR(digest), RSTRING_LEN(digest),
424
+ RSTRING_PTR(sig), RSTRING_LEN(sig), pkey->pkey.dsa);
425
+ if (ret < 0) {
426
+ ossl_raise(eDSAError, NULL);
427
+ }
428
+ else if (ret == 1) {
429
+ return Qtrue;
430
+ }
431
+
432
+ return Qfalse;
433
+ }
434
+
435
+ OSSL_PKEY_BN(dsa, p)
436
+ OSSL_PKEY_BN(dsa, q)
437
+ OSSL_PKEY_BN(dsa, g)
438
+ OSSL_PKEY_BN(dsa, pub_key)
439
+ OSSL_PKEY_BN(dsa, priv_key)
440
+
441
+ /*
442
+ * INIT
443
+ */
444
+ void
445
+ Init_ossl_dsa()
446
+ {
447
+ #if 0 /* let rdoc know about mOSSL and mPKey */
448
+ mOSSL = rb_define_module("OpenSSL");
449
+ mPKey = rb_define_module_under(mOSSL, "PKey");
450
+ #endif
451
+
452
+ eDSAError = rb_define_class_under(mPKey, "DSAError", ePKeyError);
453
+
454
+ cDSA = rb_define_class_under(mPKey, "DSA", cPKey);
455
+
456
+ rb_define_singleton_method(cDSA, "generate", ossl_dsa_s_generate, 1);
457
+ rb_define_method(cDSA, "initialize", ossl_dsa_initialize, -1);
458
+
459
+ rb_define_method(cDSA, "public?", ossl_dsa_is_public, 0);
460
+ rb_define_method(cDSA, "private?", ossl_dsa_is_private, 0);
461
+ rb_define_method(cDSA, "to_text", ossl_dsa_to_text, 0);
462
+ rb_define_method(cDSA, "export", ossl_dsa_export, -1);
463
+ rb_define_alias(cDSA, "to_pem", "export");
464
+ rb_define_alias(cDSA, "to_s", "export");
465
+ rb_define_method(cDSA, "to_der", ossl_dsa_to_der, 0);
466
+ rb_define_method(cDSA, "public_key", ossl_dsa_to_public_key, 0);
467
+ rb_define_method(cDSA, "syssign", ossl_dsa_sign, 1);
468
+ rb_define_method(cDSA, "sysverify", ossl_dsa_verify, 2);
469
+
470
+ DEF_OSSL_PKEY_BN(cDSA, dsa, p);
471
+ DEF_OSSL_PKEY_BN(cDSA, dsa, q);
472
+ DEF_OSSL_PKEY_BN(cDSA, dsa, g);
473
+ DEF_OSSL_PKEY_BN(cDSA, dsa, pub_key);
474
+ DEF_OSSL_PKEY_BN(cDSA, dsa, priv_key);
475
+
476
+ rb_define_method(cDSA, "params", ossl_dsa_get_params, 0);
477
+ }
478
+
479
+ #else /* defined NO_DSA */
480
+ void
481
+ Init_ossl_dsa()
482
+ {
483
+ }
484
+ #endif /* NO_DSA */