rubysl-openssl 2.1.0 → 2.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
- ---
2
- SHA1:
3
- metadata.gz: ec2fe860dc0818eb7d9e1adb4cbe97d99eee63c1
4
- data.tar.gz: 5902d7b0637599095ba8b0ca8649dafc77a06d5f
5
- SHA512:
6
- metadata.gz: 464e5e0a80b148566ddccdbd3d99a1cd7cf4a20ae3f6b6a83430b8f2d3ca86310f81050dd192f80a25e11ff2729afc0e23906b1876727dd77087376faa0a65a0
7
- data.tar.gz: c72fe13a360ad5ca0c07bbc3820fa3c25a325187b06e75a020ebbb14cb90bd250584f052ea9041b611d0b9dc0e9808c7630aacd9c1c33f292e57b86fa4d9eee6
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 6b3988369f86f1fbb46045c54d623c57099d55c5
4
+ data.tar.gz: 35112e17b1e09c08fb9418716efae287097b3356
5
+ SHA512:
6
+ metadata.gz: dc8425d85daf0d3605f1c6cac3015556df849c79d206efa71d629dbaa351473ac6c86c4bc5b17e250c50c7e62d42fab21114b38617ffcafe044a2708a3af12b2
7
+ data.tar.gz: 25dcc1ecb2117d1427d79c6f01d256e0a70e21c48a454a7ae3adfc517ec781a48384ecf27cb8423f0a912c7ef3df1b2e64b13d3ecd43572a28a11dbb8dba4c11
@@ -31,9 +31,6 @@ if with_config("debug") or enable_config("debug")
31
31
  $defs.push("-DOSSL_DEBUG") unless $defs.include? "-DOSSL_DEBUG"
32
32
  end
33
33
 
34
- # Nothing we can do about these problems.
35
- $CPPFLAGS += " -Wno-deprecated-declarations -Wno-pointer-sign"
36
-
37
34
  Logging::message "=== Checking for system dependent stuff... ===\n"
38
35
  have_library("nsl", "t_open")
39
36
  have_library("socket", "socket")
@@ -61,6 +58,9 @@ end
61
58
  unless have_header("openssl/conf_api.h")
62
59
  raise "OpenSSL 0.9.6 or later required."
63
60
  end
61
+ unless OpenSSL.check_func("SSL_library_init()", "openssl/ssl.h")
62
+ raise "Ignore OpenSSL broken by Apple.\nPlease use another openssl. (e.g. using `configure --with-openssl-dir=/path/to/openssl')"
63
+ end
64
64
 
65
65
  Logging::message "=== Checking for OpenSSL features... ===\n"
66
66
  have_func("ERR_peek_last_error")
@@ -144,6 +144,7 @@ if checking_for('OpenSSL version is 0.9.7 or later') {
144
144
  }
145
145
  have_header("openssl/ocsp.h")
146
146
  end
147
+ have_struct_member("CRYPTO_THREADID", "ptr", "openssl/crypto.h")
147
148
  have_struct_member("EVP_CIPHER_CTX", "flags", "openssl/evp.h")
148
149
  have_struct_member("EVP_CIPHER_CTX", "engine", "openssl/evp.h")
149
150
  have_struct_member("X509_ATTRIBUTE", "single", "openssl/x509.h")
@@ -153,5 +154,7 @@ have_macro("EVP_CTRL_GCM_GET_TAG", ['openssl/evp.h']) && $defs.push("-DHAVE_AUTH
153
154
  Logging::message "=== Checking done. ===\n"
154
155
 
155
156
  create_header
156
- create_makefile("openssl/openssl")
157
+ create_makefile("openssl/openssl") {|conf|
158
+ conf << "THREAD_MODEL = #{CONFIG["THREAD_MODEL"]}\n"
159
+ }
157
160
  Logging::message "Done.\n"
@@ -10,7 +10,7 @@
10
10
  */
11
11
  #include RUBY_EXTCONF_H
12
12
 
13
- #if defined(HAVE_OPENSSL_ENGINE_H) && defined(HAVE_ST_ENGINE)
13
+ #if defined(HAVE_OPENSSL_ENGINE_H) && defined(HAVE_EVP_CIPHER_CTX_ENGINE)
14
14
  # include <openssl/engine.h>
15
15
  #endif
16
16
  #include <openssl/x509_vfy.h>
@@ -122,7 +122,7 @@ EVP_CIPHER_CTX_copy(EVP_CIPHER_CTX *out, EVP_CIPHER_CTX *in)
122
122
  {
123
123
  memcpy(out, in, sizeof(EVP_CIPHER_CTX));
124
124
 
125
- #if defined(HAVE_ENGINE_ADD) && defined(HAVE_ST_ENGINE)
125
+ #if defined(HAVE_ENGINE_ADD) && defined(HAVE_EVP_CIPHER_CTX_ENGINE)
126
126
  if (in->engine) ENGINE_add(out->engine);
127
127
  if (in->cipher_data) {
128
128
  out->cipher_data = OPENSSL_malloc(in->cipher->ctx_size);
@@ -293,10 +293,9 @@ ossl_to_der_if_possible(VALUE obj)
293
293
  static VALUE
294
294
  ossl_make_error(VALUE exc, const char *fmt, va_list args)
295
295
  {
296
- char buf[BUFSIZ];
296
+ VALUE str = Qnil;
297
297
  const char *msg;
298
298
  long e;
299
- int len = 0;
300
299
 
301
300
  #ifdef HAVE_ERR_PEEK_LAST_ERROR
302
301
  e = ERR_peek_last_error();
@@ -304,14 +303,20 @@ ossl_make_error(VALUE exc, const char *fmt, va_list args)
304
303
  e = ERR_peek_error();
305
304
  #endif
306
305
  if (fmt) {
307
- len = vsnprintf(buf, BUFSIZ, fmt, args);
306
+ str = rb_sprintf(fmt, args);
308
307
  }
309
- if (len < BUFSIZ && e) {
308
+ if (e) {
310
309
  if (dOSSL == Qtrue) /* FULL INFO */
311
310
  msg = ERR_error_string(e, NULL);
312
311
  else
313
312
  msg = ERR_reason_error_string(e);
314
- len += snprintf(buf+len, BUFSIZ-len, "%s%s", (len ? ": " : ""), msg);
313
+ if (NIL_P(str)) {
314
+ if (msg) str = rb_str_new_cstr(msg);
315
+ }
316
+ else {
317
+ if (RSTRING_LEN(str)) rb_str_cat2(str, ": ");
318
+ rb_str_cat2(str, msg ? msg : "(null)");
319
+ }
315
320
  }
316
321
  if (dOSSL == Qtrue){ /* show all errors on the stack */
317
322
  while ((e = ERR_get_error()) != 0){
@@ -320,8 +325,8 @@ ossl_make_error(VALUE exc, const char *fmt, va_list args)
320
325
  }
321
326
  ERR_clear_error();
322
327
 
323
- if(len > BUFSIZ) len = rb_long2int(strlen(buf));
324
- return rb_exc_new(exc, buf, len);
328
+ if (NIL_P(str)) str = rb_str_new(0, 0);
329
+ return rb_exc_new3(exc, str);
325
330
  }
326
331
 
327
332
  void
@@ -461,33 +466,89 @@ ossl_fips_mode_set(VALUE self, VALUE enabled)
461
466
  /**
462
467
  * Stores locks needed for OpenSSL thread safety
463
468
  */
464
- static VALUE* ossl_locks;
469
+ #include "ruby/thread_native.h"
470
+ static rb_nativethread_lock_t *ossl_locks;
471
+
472
+ static void
473
+ ossl_lock_unlock(int mode, rb_nativethread_lock_t *lock)
474
+ {
475
+ if (mode & CRYPTO_LOCK) {
476
+ rb_nativethread_lock_lock(lock);
477
+ } else {
478
+ rb_nativethread_lock_unlock(lock);
479
+ }
480
+ }
481
+
482
+ static void
483
+ ossl_lock_callback(int mode, int type, const char *file, int line)
484
+ {
485
+ ossl_lock_unlock(mode, &ossl_locks[type]);
486
+ }
487
+
488
+ struct CRYPTO_dynlock_value {
489
+ rb_nativethread_lock_t lock;
490
+ };
491
+
492
+ static struct CRYPTO_dynlock_value *
493
+ ossl_dyn_create_callback(const char *file, int line)
494
+ {
495
+ struct CRYPTO_dynlock_value *dynlock = (struct CRYPTO_dynlock_value *)OPENSSL_malloc((int)sizeof(struct CRYPTO_dynlock_value));
496
+ rb_nativethread_lock_initialize(&dynlock->lock);
497
+ return dynlock;
498
+ }
499
+
500
+ static void
501
+ ossl_dyn_lock_callback(int mode, struct CRYPTO_dynlock_value *l, const char *file, int line)
502
+ {
503
+ ossl_lock_unlock(mode, &l->lock);
504
+ }
465
505
 
466
- static void ossl_lock_callback(int mode, int type, char *file, int line)
506
+ static void
507
+ ossl_dyn_destroy_callback(struct CRYPTO_dynlock_value *l, const char *file, int line)
467
508
  {
468
- if (mode & CRYPTO_LOCK) {
469
- rb_mutex_lock(ossl_locks[type]);
470
- } else {
471
- rb_mutex_unlock(ossl_locks[type]);
472
- }
509
+ rb_nativethread_lock_destroy(&l->lock);
510
+ OPENSSL_free(l);
473
511
  }
474
512
 
513
+ #ifdef HAVE_CRYPTO_THREADID_PTR
514
+ static void ossl_threadid_func(CRYPTO_THREADID *id)
515
+ {
516
+ /* register native thread id */
517
+ CRYPTO_THREADID_set_pointer(id, (void *)rb_nativethread_self());
518
+ }
519
+ #else
475
520
  static unsigned long ossl_thread_id(void)
476
521
  {
477
- return NUM2ULONG(rb_obj_id(rb_thread_current()));
522
+ /* before OpenSSL 1.0, this is 'unsigned long' */
523
+ return (unsigned long)rb_nativethread_self();
478
524
  }
525
+ #endif
479
526
 
480
527
  static void Init_ossl_locks(void)
481
528
  {
482
- int i;
483
- ossl_locks = (VALUE*) OPENSSL_malloc(CRYPTO_num_locks() * sizeof(VALUE));
484
- for (i = 0; i < CRYPTO_num_locks(); i++) {
485
- ossl_locks[i] = rb_mutex_new();
486
- rb_global_variable(&(ossl_locks[i]));
487
- }
488
-
489
- CRYPTO_set_id_callback((unsigned long (*)())ossl_thread_id);
490
- CRYPTO_set_locking_callback((void (*)())ossl_lock_callback);
529
+ int i;
530
+ int num_locks = CRYPTO_num_locks();
531
+
532
+ if ((unsigned)num_locks >= INT_MAX / (int)sizeof(VALUE)) {
533
+ rb_raise(rb_eRuntimeError, "CRYPTO_num_locks() is too big: %d", num_locks);
534
+ }
535
+ ossl_locks = (rb_nativethread_lock_t *) OPENSSL_malloc(num_locks * (int)sizeof(rb_nativethread_lock_t));
536
+ if (!ossl_locks) {
537
+ rb_raise(rb_eNoMemError, "CRYPTO_num_locks() is too big: %d", num_locks);
538
+ }
539
+ for (i = 0; i < num_locks; i++) {
540
+ rb_nativethread_lock_initialize(&ossl_locks[i]);
541
+ }
542
+
543
+ #ifdef HAVE_CRYPTO_THREADID_PTR
544
+ CRYPTO_THREADID_set_callback(ossl_threadid_func);
545
+ #else
546
+ CRYPTO_set_id_callback(ossl_thread_id);
547
+ #endif
548
+ CRYPTO_set_locking_callback(ossl_lock_callback);
549
+ CRYPTO_set_dynlock_create_callback(ossl_dyn_create_callback);
550
+ CRYPTO_set_dynlock_lock_callback(ossl_dyn_lock_callback);
551
+ CRYPTO_set_dynlock_destroy_callback(ossl_dyn_destroy_callback);
491
552
  }
492
553
 
493
554
  /*
@@ -788,7 +849,7 @@ static void Init_ossl_locks(void)
788
849
  * cipher = OpenSSL::Cipher::Cipher.new 'AES-128-CBC'
789
850
  *
790
851
  * open 'ca_key.pem', 'w', 0400 do |io|
791
- * io.write key.export(cipher, pass_phrase)
852
+ * io.write ca_key.export(cipher, pass_phrase)
792
853
  * end
793
854
  *
794
855
  * === CA Certificate
@@ -1021,6 +1082,11 @@ Init_openssl()
1021
1082
  */
1022
1083
  rb_define_const(mOSSL, "OPENSSL_VERSION", rb_str_new2(OPENSSL_VERSION_TEXT));
1023
1084
 
1085
+ /*
1086
+ * Version of OpenSSL the ruby OpenSSL extension is running with
1087
+ */
1088
+ rb_define_const(mOSSL, "OPENSSL_LIBRARY_VERSION", rb_str_new2(SSLeay_version(SSLEAY_VERSION)));
1089
+
1024
1090
  /*
1025
1091
  * Version number of OpenSSL the ruby OpenSSL extension was built with
1026
1092
  * (base 16)
@@ -28,7 +28,6 @@ extern "C" {
28
28
  #if defined(RFILE) /*&& !defined(OSSL_DEBUG)*/
29
29
  # undef RFILE
30
30
  #endif
31
- #define RSTRING_NOT_MODIFIED 1
32
31
  #include <ruby.h>
33
32
  #include <ruby/io.h>
34
33
  #include <ruby/thread.h>
@@ -67,7 +66,7 @@ extern "C" {
67
66
  #include <openssl/conf_api.h>
68
67
  #undef X509_NAME
69
68
  #undef PKCS7_SIGNER_INFO
70
- #if defined(HAVE_OPENSSL_ENGINE_H) && defined(HAVE_ST_ENGINE)
69
+ #if defined(HAVE_OPENSSL_ENGINE_H) && defined(HAVE_EVP_CIPHER_CTX_ENGINE)
71
70
  # define OSSL_ENGINE_ENABLED
72
71
  # include <openssl/engine.h>
73
72
  #endif
@@ -97,14 +96,14 @@ extern VALUE eOSSLError;
97
96
  #define OSSL_Check_Kind(obj, klass) do {\
98
97
  if (!rb_obj_is_kind_of((obj), (klass))) {\
99
98
  ossl_raise(rb_eTypeError, "wrong argument (%s)! (Expected kind of %s)",\
100
- rb_obj_classname(obj), rb_class2name(klass));\
99
+ rb_obj_classname(obj), RSTRING_PTR(rb_class_name(klass)));\
101
100
  }\
102
101
  } while (0)
103
102
 
104
103
  #define OSSL_Check_Instance(obj, klass) do {\
105
104
  if (!rb_obj_is_instance_of((obj), (klass))) {\
106
105
  ossl_raise(rb_eTypeError, "wrong argument (%s)! (Expected instance of %s)",\
107
- rb_obj_classname(obj), rb_class2name(klass));\
106
+ rb_obj_classname(obj), RSTRING_PTR(rb_class_name(klass)));\
108
107
  }\
109
108
  } while (0)
110
109
 
@@ -33,15 +33,22 @@ asn1time_to_time(ASN1_TIME *time)
33
33
  {
34
34
  struct tm tm;
35
35
  VALUE argv[6];
36
+ int count;
36
37
 
37
38
  if (!time || !time->data) return Qnil;
38
39
  memset(&tm, 0, sizeof(struct tm));
39
40
 
40
41
  switch (time->type) {
41
42
  case V_ASN1_UTCTIME:
42
- if (sscanf((const char *)time->data, "%2d%2d%2d%2d%2d%2dZ", &tm.tm_year, &tm.tm_mon,
43
- &tm.tm_mday, &tm.tm_hour, &tm.tm_min, &tm.tm_sec) != 6) {
44
- ossl_raise(rb_eTypeError, "bad UTCTIME format");
43
+ count = sscanf((const char *)time->data, "%2d%2d%2d%2d%2d%2dZ",
44
+ &tm.tm_year, &tm.tm_mon, &tm.tm_mday, &tm.tm_hour, &tm.tm_min,
45
+ &tm.tm_sec);
46
+
47
+ if (count == 5) {
48
+ tm.tm_sec = 0;
49
+ } else if (count != 6) {
50
+ ossl_raise(rb_eTypeError, "bad UTCTIME format: \"%s\"",
51
+ time->data);
45
52
  }
46
53
  if (tm.tm_year < 69) {
47
54
  tm.tm_year += 2000;
@@ -618,7 +625,7 @@ ossl_asn1_default_tag(VALUE obj)
618
625
  tmp_class = rb_class_superclass(tmp_class);
619
626
  }
620
627
  ossl_raise(eASN1Error, "universal tag for %s not found",
621
- rb_class2name(CLASS_OF(obj)));
628
+ rb_obj_class(obj));
622
629
 
623
630
  return -1; /* dummy */
624
631
  }
@@ -726,7 +733,7 @@ ossl_asn1data_initialize(VALUE self, VALUE value, VALUE tag, VALUE tag_class)
726
733
  }
727
734
 
728
735
  static VALUE
729
- join_der_i(VALUE i, VALUE str)
736
+ join_der_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, str))
730
737
  {
731
738
  i = ossl_to_der_if_possible(i);
732
739
  StringValue(i);
@@ -1143,7 +1150,7 @@ ossl_asn1_initialize(int argc, VALUE *argv, VALUE self)
1143
1150
  }
1144
1151
  if(!SYMBOL_P(tag_class))
1145
1152
  ossl_raise(eASN1Error, "invalid tag class");
1146
- if(SYM2ID(tagging) == sIMPLICIT && NUM2INT(tag) > 31)
1153
+ if(!NIL_P(tagging) && SYM2ID(tagging) == sIMPLICIT && NUM2INT(tag) > 31)
1147
1154
  ossl_raise(eASN1Error, "tag number for Universal too large");
1148
1155
  }
1149
1156
  else{
@@ -1351,6 +1358,17 @@ ossl_asn1cons_each(VALUE self)
1351
1358
  return self;
1352
1359
  }
1353
1360
 
1361
+ /*
1362
+ * call-seq:
1363
+ * ObjectId.register(object_id, short_name, long_name)
1364
+ *
1365
+ * This adds a new ObjectId to the internal tables. Where +object_id+ is the
1366
+ * numerical form, +short_name+ is the short name, and +long_name+ is the long
1367
+ * name.
1368
+ *
1369
+ * Returns +true+ if successful. Raises an ASN1Error otherwise.
1370
+ *
1371
+ */
1354
1372
  static VALUE
1355
1373
  ossl_asn1obj_s_register(VALUE self, VALUE oid, VALUE sn, VALUE ln)
1356
1374
  {
@@ -1364,6 +1382,14 @@ ossl_asn1obj_s_register(VALUE self, VALUE oid, VALUE sn, VALUE ln)
1364
1382
  return Qtrue;
1365
1383
  }
1366
1384
 
1385
+ /* Document-method: OpenSSL::ASN1::ObjectId#sn
1386
+ *
1387
+ * The short name of the ObjectId, as defined in +openssl/objects.h+.
1388
+ */
1389
+ /* Document-method: OpenSSL::ASN1::ObjectId#short_name
1390
+ *
1391
+ * #short_name is an alias to #sn
1392
+ */
1367
1393
  static VALUE
1368
1394
  ossl_asn1obj_get_sn(VALUE self)
1369
1395
  {
@@ -1377,6 +1403,14 @@ ossl_asn1obj_get_sn(VALUE self)
1377
1403
  return ret;
1378
1404
  }
1379
1405
 
1406
+ /* Document-method: OpenSSL::ASN1::ObjectId#ln
1407
+ *
1408
+ * The long name of the ObjectId, as defined in +openssl/objects.h+.
1409
+ */
1410
+ /* Document-method: OpenSSL::ASN1::ObjectId.long_name
1411
+ *
1412
+ * #long_name is an alias to #ln
1413
+ */
1380
1414
  static VALUE
1381
1415
  ossl_asn1obj_get_ln(VALUE self)
1382
1416
  {
@@ -1390,6 +1424,10 @@ ossl_asn1obj_get_ln(VALUE self)
1390
1424
  return ret;
1391
1425
  }
1392
1426
 
1427
+ /* Document-method: OpenSSL::ASN1::ObjectId#oid
1428
+ *
1429
+ * The object identifier as a String.
1430
+ */
1393
1431
  static VALUE
1394
1432
  ossl_asn1obj_get_oid(VALUE self)
1395
1433
  {
@@ -1771,6 +1809,10 @@ Init_ossl_asn1()
1771
1809
  *
1772
1810
  * == OpenSSL::ASN1::ObjectId
1773
1811
  *
1812
+ * While OpenSSL::ASN1::ObjectId.new will allocate a new ObjectId, it is
1813
+ * not typically allocated this way, but rather that are received from
1814
+ * parsed ASN1 encodings.
1815
+ *
1774
1816
  * === Additional attributes
1775
1817
  * * +sn+: the short name as defined in <openssl/objects.h>.
1776
1818
  * * +ln+: the long name as defined in <openssl/objects.h>.
@@ -1910,6 +1952,10 @@ do{\
1910
1952
  OSSL_ASN1_DEFINE_CLASS(EndOfContent, Data);
1911
1953
 
1912
1954
 
1955
+ /* Document-class: OpenSSL::ASN1::ObjectId
1956
+ *
1957
+ * Represents the primitive object id for OpenSSL::ASN1
1958
+ */
1913
1959
  #if 0
1914
1960
  cASN1ObjectId = rb_define_class_under(mASN1, "ObjectId", cASN1Primitive); /* let rdoc know */
1915
1961
  #endif
@@ -25,7 +25,7 @@ ossl_obj2bio(VALUE obj)
25
25
 
26
26
  GetOpenFile(obj, fptr);
27
27
  rb_io_check_readable(fptr);
28
- if ((fd = dup(FPTR_TO_FD(fptr))) < 0){
28
+ if ((fd = rb_cloexec_dup(FPTR_TO_FD(fptr))) < 0){
29
29
  rb_sys_fail(0);
30
30
  }
31
31
  rb_update_max_fd(fd);
@@ -106,6 +106,7 @@ ossl_bn_alloc(VALUE klass)
106
106
  * call-seq:
107
107
  * BN.new => aBN
108
108
  * BN.new(bn) => aBN
109
+ * BN.new(integer) => aBN
109
110
  * BN.new(string) => aBN
110
111
  * BN.new(string, 0 | 2 | 10 | 16) => aBN
111
112
  */
@@ -120,6 +121,40 @@ ossl_bn_initialize(int argc, VALUE *argv, VALUE self)
120
121
  base = NUM2INT(bs);
121
122
  }
122
123
 
124
+ if (RB_TYPE_P(str, T_FIXNUM)) {
125
+ long i;
126
+ unsigned char bin[sizeof(long)];
127
+ long n = FIX2LONG(str);
128
+ unsigned long un = labs(n);
129
+
130
+ for (i = sizeof(long) - 1; 0 <= i; i--) {
131
+ bin[i] = un&0xff;
132
+ un >>= 8;
133
+ }
134
+
135
+ GetBN(self, bn);
136
+ if (!BN_bin2bn(bin, sizeof(bin), bn)) {
137
+ ossl_raise(eBNError, NULL);
138
+ }
139
+ if (n < 0) BN_set_negative(bn, 1);
140
+ return self;
141
+ }
142
+ else if (RB_TYPE_P(str, T_BIGNUM)) {
143
+ int len = rb_big_bytes_used(str);
144
+ unsigned char* bin = (unsigned char*)XMALLOC(len);
145
+
146
+ rb_big_pack(str, (unsigned long*)bin, len / sizeof(long));
147
+
148
+ GetBN(self, bn);
149
+ if (!BN_bin2bn(bin, len, bn)) {
150
+ XFREE(bin);
151
+ ossl_raise(eBNError, NULL);
152
+ }
153
+ XFREE(bin);
154
+
155
+ if (!RBIGNUM_SIGN(str)) BN_set_negative(bn, 1);
156
+ return self;
157
+ }
123
158
  if (RTEST(rb_obj_is_kind_of(str, cBN))) {
124
159
  BIGNUM *other;
125
160
 
@@ -226,10 +261,10 @@ ossl_bn_to_i(VALUE self)
226
261
 
227
262
  GetBN(self, bn);
228
263
 
229
- if (!(txt = BN_bn2dec(bn))) {
264
+ if (!(txt = BN_bn2hex(bn))) {
230
265
  ossl_raise(eBNError, NULL);
231
266
  }
232
- num = rb_cstr_to_inum(txt, 10, Qtrue);
267
+ num = rb_cstr_to_inum(txt, 16, Qtrue);
233
268
  OPENSSL_free(txt);
234
269
 
235
270
  return num;
@@ -213,7 +213,7 @@ ossl_cipher_init(int argc, VALUE *argv, VALUE self, int mode)
213
213
  * We deprecated the arguments for this method, but we decided
214
214
  * keeping this behaviour for backward compatibility.
215
215
  */
216
- const char *cname = rb_class2name(rb_obj_class(self));
216
+ VALUE cname = rb_class_path(rb_obj_class(self));
217
217
  rb_warn("arguments for %s#encrypt and %s#decrypt were deprecated; "
218
218
  "use %s#pkcs5_keyivgen to derive key and IV",
219
219
  cname, cname, cname);
@@ -15,6 +15,11 @@
15
15
  * Classes
16
16
  */
17
17
  VALUE cConfig;
18
+ /* Document-class: OpenSSL::ConfigError
19
+ *
20
+ * General error for openssl library configuration files. Including formating,
21
+ * parsing errors, etc.
22
+ */
18
23
  VALUE eConfigError;
19
24
 
20
25
  /*
@@ -55,6 +60,10 @@ GetConfigPtr(VALUE obj)
55
60
  return conf;
56
61
  }
57
62
 
63
+ /* Document-const: DEFAULT_CONFIG_FILE
64
+ *
65
+ * The default system configuration file for openssl
66
+ */
58
67
 
59
68
  /*
60
69
  * INIT
@@ -296,6 +296,8 @@ ossl_digest_block_length(VALUE self)
296
296
  void
297
297
  Init_ossl_digest()
298
298
  {
299
+ rb_require("digest");
300
+
299
301
  #if 0
300
302
  mOSSL = rb_define_module("OpenSSL"); /* let rdoc know about mOSSL */
301
303
  #endif