openssl 2.1.2 → 3.0.0

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.
Files changed (60) hide show
  1. checksums.yaml +4 -4
  2. data/CONTRIBUTING.md +35 -45
  3. data/History.md +232 -0
  4. data/README.md +2 -2
  5. data/ext/openssl/extconf.rb +61 -46
  6. data/ext/openssl/openssl_missing.c +0 -66
  7. data/ext/openssl/openssl_missing.h +60 -44
  8. data/ext/openssl/ossl.c +112 -66
  9. data/ext/openssl/ossl.h +28 -11
  10. data/ext/openssl/ossl_asn1.c +42 -5
  11. data/ext/openssl/ossl_bn.c +276 -146
  12. data/ext/openssl/ossl_bn.h +2 -1
  13. data/ext/openssl/ossl_cipher.c +38 -29
  14. data/ext/openssl/ossl_config.c +412 -41
  15. data/ext/openssl/ossl_config.h +4 -7
  16. data/ext/openssl/ossl_digest.c +31 -62
  17. data/ext/openssl/ossl_engine.c +18 -27
  18. data/ext/openssl/ossl_hmac.c +52 -145
  19. data/ext/openssl/ossl_kdf.c +11 -19
  20. data/ext/openssl/ossl_ns_spki.c +1 -1
  21. data/ext/openssl/ossl_ocsp.c +9 -62
  22. data/ext/openssl/ossl_ocsp.h +3 -3
  23. data/ext/openssl/ossl_pkcs12.c +21 -3
  24. data/ext/openssl/ossl_pkcs7.c +45 -78
  25. data/ext/openssl/ossl_pkcs7.h +16 -0
  26. data/ext/openssl/ossl_pkey.c +1255 -178
  27. data/ext/openssl/ossl_pkey.h +40 -77
  28. data/ext/openssl/ossl_pkey_dh.c +125 -335
  29. data/ext/openssl/ossl_pkey_dsa.c +93 -398
  30. data/ext/openssl/ossl_pkey_ec.c +155 -318
  31. data/ext/openssl/ossl_pkey_rsa.c +105 -484
  32. data/ext/openssl/ossl_rand.c +2 -40
  33. data/ext/openssl/ossl_ssl.c +395 -364
  34. data/ext/openssl/ossl_ssl_session.c +24 -29
  35. data/ext/openssl/ossl_ts.c +1539 -0
  36. data/ext/openssl/ossl_ts.h +16 -0
  37. data/ext/openssl/ossl_x509.c +86 -1
  38. data/ext/openssl/ossl_x509cert.c +166 -10
  39. data/ext/openssl/ossl_x509crl.c +10 -7
  40. data/ext/openssl/ossl_x509ext.c +15 -2
  41. data/ext/openssl/ossl_x509name.c +16 -5
  42. data/ext/openssl/ossl_x509req.c +10 -7
  43. data/ext/openssl/ossl_x509store.c +193 -92
  44. data/lib/openssl/bn.rb +1 -1
  45. data/lib/openssl/buffering.rb +42 -17
  46. data/lib/openssl/cipher.rb +1 -1
  47. data/lib/openssl/digest.rb +10 -12
  48. data/lib/openssl/hmac.rb +78 -0
  49. data/lib/openssl/marshal.rb +30 -0
  50. data/lib/openssl/pkcs5.rb +1 -1
  51. data/lib/openssl/pkey.rb +435 -1
  52. data/lib/openssl/ssl.rb +53 -14
  53. data/lib/openssl/version.rb +5 -0
  54. data/lib/openssl/x509.rb +177 -1
  55. data/lib/openssl.rb +24 -9
  56. metadata +13 -69
  57. data/ext/openssl/deprecation.rb +0 -23
  58. data/ext/openssl/ossl_version.h +0 -15
  59. data/ext/openssl/ruby_missing.h +0 -24
  60. data/lib/openssl/config.rb +0 -474
@@ -67,8 +67,6 @@ ossl_rand_add(VALUE self, VALUE str, VALUE entropy)
67
67
  static VALUE
68
68
  ossl_rand_load_file(VALUE self, VALUE filename)
69
69
  {
70
- rb_check_safe_obj(filename);
71
-
72
70
  if(!RAND_load_file(StringValueCStr(filename), -1)) {
73
71
  ossl_raise(eRandomError, NULL);
74
72
  }
@@ -86,8 +84,6 @@ ossl_rand_load_file(VALUE self, VALUE filename)
86
84
  static VALUE
87
85
  ossl_rand_write_file(VALUE self, VALUE filename)
88
86
  {
89
- rb_check_safe_obj(filename);
90
-
91
87
  if (RAND_write_file(StringValueCStr(filename)) == -1) {
92
88
  ossl_raise(eRandomError, NULL);
93
89
  }
@@ -124,36 +120,6 @@ ossl_rand_bytes(VALUE self, VALUE len)
124
120
  return str;
125
121
  }
126
122
 
127
- #if defined(HAVE_RAND_PSEUDO_BYTES)
128
- /*
129
- * call-seq:
130
- * pseudo_bytes(length) -> string
131
- *
132
- * Generates a String with _length_ number of pseudo-random bytes.
133
- *
134
- * Pseudo-random byte sequences generated by ::pseudo_bytes will be unique if
135
- * they are of sufficient length, but are not necessarily unpredictable.
136
- *
137
- * === Example
138
- *
139
- * OpenSSL::Random.pseudo_bytes(12)
140
- * #=> "..."
141
- */
142
- static VALUE
143
- ossl_rand_pseudo_bytes(VALUE self, VALUE len)
144
- {
145
- VALUE str;
146
- int n = NUM2INT(len);
147
-
148
- str = rb_str_new(0, n);
149
- if (RAND_pseudo_bytes((unsigned char *)RSTRING_PTR(str), n) < 1) {
150
- ossl_raise(eRandomError, NULL);
151
- }
152
-
153
- return str;
154
- }
155
- #endif
156
-
157
123
  #ifdef HAVE_RAND_EGD
158
124
  /*
159
125
  * call-seq:
@@ -164,8 +130,6 @@ ossl_rand_pseudo_bytes(VALUE self, VALUE len)
164
130
  static VALUE
165
131
  ossl_rand_egd(VALUE self, VALUE filename)
166
132
  {
167
- rb_check_safe_obj(filename);
168
-
169
133
  if (RAND_egd(StringValueCStr(filename)) == -1) {
170
134
  ossl_raise(eRandomError, NULL);
171
135
  }
@@ -186,8 +150,6 @@ ossl_rand_egd_bytes(VALUE self, VALUE filename, VALUE len)
186
150
  {
187
151
  int n = NUM2INT(len);
188
152
 
189
- rb_check_safe_obj(filename);
190
-
191
153
  if (RAND_egd_bytes(StringValueCStr(filename), n) == -1) {
192
154
  ossl_raise(eRandomError, NULL);
193
155
  }
@@ -227,8 +189,8 @@ Init_ossl_rand(void)
227
189
  rb_define_module_function(mRandom, "load_random_file", ossl_rand_load_file, 1);
228
190
  rb_define_module_function(mRandom, "write_random_file", ossl_rand_write_file, 1);
229
191
  rb_define_module_function(mRandom, "random_bytes", ossl_rand_bytes, 1);
230
- #if defined(HAVE_RAND_PSEUDO_BYTES)
231
- rb_define_module_function(mRandom, "pseudo_bytes", ossl_rand_pseudo_bytes, 1);
192
+ #if OPENSSL_VERSION_NUMBER < 0x10101000 || defined(LIBRESSL_VERSION_NUMBER)
193
+ rb_define_alias(rb_singleton_class(mRandom), "pseudo_bytes", "random_bytes");
232
194
  #endif
233
195
  #ifdef HAVE_RAND_EGD
234
196
  rb_define_module_function(mRandom, "egd", ossl_rand_egd, 1);