openssl 2.0.9 → 2.1.0.beta1
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.
Potentially problematic release.
This version of openssl might be problematic. Click here for more details.
- checksums.yaml +5 -5
 - data/History.md +28 -69
 - data/README.md +1 -1
 - data/ext/openssl/deprecation.rb +0 -3
 - data/ext/openssl/extconf.rb +8 -52
 - data/ext/openssl/openssl_missing.c +0 -67
 - data/ext/openssl/openssl_missing.h +3 -50
 - data/ext/openssl/ossl.c +81 -74
 - data/ext/openssl/ossl.h +14 -27
 - data/ext/openssl/ossl_asn1.c +287 -374
 - data/ext/openssl/ossl_asn1.h +0 -4
 - data/ext/openssl/ossl_bio.c +5 -20
 - data/ext/openssl/ossl_bio.h +0 -2
 - data/ext/openssl/ossl_bn.c +70 -28
 - data/ext/openssl/ossl_cipher.c +18 -42
 - data/ext/openssl/ossl_cipher.h +1 -1
 - data/ext/openssl/ossl_digest.c +8 -12
 - data/ext/openssl/ossl_digest.h +1 -1
 - data/ext/openssl/ossl_engine.c +47 -47
 - data/ext/openssl/ossl_hmac.c +19 -22
 - data/ext/openssl/ossl_kdf.c +221 -0
 - data/ext/openssl/ossl_kdf.h +6 -0
 - data/ext/openssl/ossl_ns_spki.c +17 -21
 - data/ext/openssl/ossl_ocsp.c +85 -80
 - data/ext/openssl/ossl_pkcs12.c +15 -21
 - data/ext/openssl/ossl_pkcs7.c +8 -21
 - data/ext/openssl/ossl_pkey.c +24 -48
 - data/ext/openssl/ossl_pkey.h +1 -6
 - data/ext/openssl/ossl_pkey_dh.c +11 -11
 - data/ext/openssl/ossl_pkey_dsa.c +16 -22
 - data/ext/openssl/ossl_pkey_ec.c +43 -56
 - data/ext/openssl/ossl_pkey_rsa.c +19 -19
 - data/ext/openssl/ossl_rand.c +12 -12
 - data/ext/openssl/ossl_ssl.c +291 -243
 - data/ext/openssl/ossl_ssl.h +0 -5
 - data/ext/openssl/ossl_ssl_session.c +7 -9
 - data/ext/openssl/ossl_version.h +1 -1
 - data/ext/openssl/ossl_x509.c +0 -15
 - data/ext/openssl/ossl_x509.h +0 -7
 - data/ext/openssl/ossl_x509attr.c +3 -7
 - data/ext/openssl/ossl_x509cert.c +17 -54
 - data/ext/openssl/ossl_x509crl.c +15 -25
 - data/ext/openssl/ossl_x509ext.c +9 -14
 - data/ext/openssl/ossl_x509name.c +76 -41
 - data/ext/openssl/ossl_x509req.c +10 -47
 - data/ext/openssl/ossl_x509revoked.c +8 -8
 - data/ext/openssl/ossl_x509store.c +15 -45
 - data/ext/openssl/ruby_missing.h +2 -13
 - data/lib/openssl.rb +1 -0
 - data/lib/openssl/bn.rb +2 -1
 - data/lib/openssl/buffering.rb +24 -23
 - data/lib/openssl/config.rb +12 -11
 - data/lib/openssl/digest.rb +3 -6
 - data/lib/openssl/pkcs5.rb +22 -0
 - data/lib/openssl/pkey.rb +0 -41
 - data/lib/openssl/ssl.rb +118 -16
 - data/lib/openssl/x509.rb +7 -1
 - metadata +8 -7
 - data/ext/openssl/ossl_pkcs5.c +0 -180
 - data/ext/openssl/ossl_pkcs5.h +0 -6
 
| 
         @@ -23,10 +23,6 @@ 
     | 
|
| 
       23 
23 
     | 
    
         
             
            	ossl_raise(rb_eRuntimeError, "REV wasn't initialized!"); \
         
     | 
| 
       24 
24 
     | 
    
         
             
                } \
         
     | 
| 
       25 
25 
     | 
    
         
             
            } while (0)
         
     | 
| 
       26 
     | 
    
         
            -
            #define SafeGetX509Rev(obj, rev) do { \
         
     | 
| 
       27 
     | 
    
         
            -
                OSSL_Check_Kind((obj), cX509Rev); \
         
     | 
| 
       28 
     | 
    
         
            -
                GetX509Rev((obj), (rev)); \
         
     | 
| 
       29 
     | 
    
         
            -
            } while (0)
         
     | 
| 
       30 
26 
     | 
    
         | 
| 
       31 
27 
     | 
    
         
             
            /*
         
     | 
| 
       32 
28 
     | 
    
         
             
             * Classes
         
     | 
| 
         @@ -76,7 +72,7 @@ DupX509RevokedPtr(VALUE obj) 
     | 
|
| 
       76 
72 
     | 
    
         
             
            {
         
     | 
| 
       77 
73 
     | 
    
         
             
                X509_REVOKED *rev, *new;
         
     | 
| 
       78 
74 
     | 
    
         | 
| 
       79 
     | 
    
         
            -
                 
     | 
| 
      
 75 
     | 
    
         
            +
                GetX509Rev(obj, rev);
         
     | 
| 
       80 
76 
     | 
    
         
             
                if (!(new = X509_REVOKED_dup(rev))) {
         
     | 
| 
       81 
77 
     | 
    
         
             
            	ossl_raise(eX509RevError, NULL);
         
     | 
| 
       82 
78 
     | 
    
         
             
                }
         
     | 
| 
         @@ -116,7 +112,7 @@ ossl_x509revoked_initialize_copy(VALUE self, VALUE other) 
     | 
|
| 
       116 
112 
     | 
    
         | 
| 
       117 
113 
     | 
    
         
             
                rb_check_frozen(self);
         
     | 
| 
       118 
114 
     | 
    
         
             
                GetX509Rev(self, rev);
         
     | 
| 
       119 
     | 
    
         
            -
                 
     | 
| 
      
 115 
     | 
    
         
            +
                GetX509Rev(other, rev_other);
         
     | 
| 
       120 
116 
     | 
    
         | 
| 
       121 
117 
     | 
    
         
             
                rev_new = X509_REVOKED_dup(rev_other);
         
     | 
| 
       122 
118 
     | 
    
         
             
                if (!rev_new)
         
     | 
| 
         @@ -159,10 +155,14 @@ static VALUE 
     | 
|
| 
       159 
155 
     | 
    
         
             
            ossl_x509revoked_get_time(VALUE self)
         
     | 
| 
       160 
156 
     | 
    
         
             
            {
         
     | 
| 
       161 
157 
     | 
    
         
             
                X509_REVOKED *rev;
         
     | 
| 
      
 158 
     | 
    
         
            +
                const ASN1_TIME *time;
         
     | 
| 
       162 
159 
     | 
    
         | 
| 
       163 
160 
     | 
    
         
             
                GetX509Rev(self, rev);
         
     | 
| 
      
 161 
     | 
    
         
            +
                time = X509_REVOKED_get0_revocationDate(rev);
         
     | 
| 
      
 162 
     | 
    
         
            +
                if (!time)
         
     | 
| 
      
 163 
     | 
    
         
            +
            	return Qnil;
         
     | 
| 
       164 
164 
     | 
    
         | 
| 
       165 
     | 
    
         
            -
                return asn1time_to_time( 
     | 
| 
      
 165 
     | 
    
         
            +
                return asn1time_to_time(time);
         
     | 
| 
       166 
166 
     | 
    
         
             
            }
         
     | 
| 
       167 
167 
     | 
    
         | 
| 
       168 
168 
     | 
    
         
             
            static VALUE
         
     | 
| 
         @@ -267,7 +267,7 @@ Init_ossl_x509revoked(void) 
     | 
|
| 
       267 
267 
     | 
    
         | 
| 
       268 
268 
     | 
    
         
             
                rb_define_alloc_func(cX509Rev, ossl_x509revoked_alloc);
         
     | 
| 
       269 
269 
     | 
    
         
             
                rb_define_method(cX509Rev, "initialize", ossl_x509revoked_initialize, -1);
         
     | 
| 
       270 
     | 
    
         
            -
                 
     | 
| 
      
 270 
     | 
    
         
            +
                rb_define_method(cX509Rev, "initialize_copy", ossl_x509revoked_initialize_copy, 1);
         
     | 
| 
       271 
271 
     | 
    
         | 
| 
       272 
272 
     | 
    
         
             
                rb_define_method(cX509Rev, "serial", ossl_x509revoked_get_serial, 0);
         
     | 
| 
       273 
273 
     | 
    
         
             
                rb_define_method(cX509Rev, "serial=", ossl_x509revoked_set_serial, 1);
         
     | 
| 
         @@ -23,10 +23,6 @@ 
     | 
|
| 
       23 
23 
     | 
    
         
             
            	ossl_raise(rb_eRuntimeError, "STORE wasn't initialized!"); \
         
     | 
| 
       24 
24 
     | 
    
         
             
                } \
         
     | 
| 
       25 
25 
     | 
    
         
             
            } while (0)
         
     | 
| 
       26 
     | 
    
         
            -
            #define SafeGetX509Store(obj, st) do { \
         
     | 
| 
       27 
     | 
    
         
            -
                OSSL_Check_Kind((obj), cX509Store); \
         
     | 
| 
       28 
     | 
    
         
            -
                GetX509Store((obj), (st)); \
         
     | 
| 
       29 
     | 
    
         
            -
            } while (0)
         
     | 
| 
       30 
26 
     | 
    
         | 
| 
       31 
27 
     | 
    
         
             
            #define NewX509StCtx(klass) \
         
     | 
| 
       32 
28 
     | 
    
         
             
                TypedData_Wrap_Struct((klass), &ossl_x509stctx_type, 0)
         
     | 
| 
         @@ -42,10 +38,6 @@ 
     | 
|
| 
       42 
38 
     | 
    
         
             
            	ossl_raise(rb_eRuntimeError, "STORE_CTX is out of scope!"); \
         
     | 
| 
       43 
39 
     | 
    
         
             
                } \
         
     | 
| 
       44 
40 
     | 
    
         
             
            } while (0)
         
     | 
| 
       45 
     | 
    
         
            -
            #define SafeGetX509StCtx(obj, storep) do { \
         
     | 
| 
       46 
     | 
    
         
            -
                OSSL_Check_Kind((obj), cX509StoreContext); \
         
     | 
| 
       47 
     | 
    
         
            -
                GetX509Store((obj), (ctx)); \
         
     | 
| 
       48 
     | 
    
         
            -
            } while (0)
         
     | 
| 
       49 
41 
     | 
    
         | 
| 
       50 
42 
     | 
    
         
             
            /*
         
     | 
| 
       51 
43 
     | 
    
         
             
             * Verify callback stuff
         
     | 
| 
         @@ -130,34 +122,12 @@ static const rb_data_type_t ossl_x509store_type = { 
     | 
|
| 
       130 
122 
     | 
    
         
             
            /*
         
     | 
| 
       131 
123 
     | 
    
         
             
             * Public functions
         
     | 
| 
       132 
124 
     | 
    
         
             
             */
         
     | 
| 
       133 
     | 
    
         
            -
            VALUE
         
     | 
| 
       134 
     | 
    
         
            -
            ossl_x509store_new(X509_STORE *store)
         
     | 
| 
       135 
     | 
    
         
            -
            {
         
     | 
| 
       136 
     | 
    
         
            -
                VALUE obj;
         
     | 
| 
       137 
     | 
    
         
            -
             
     | 
| 
       138 
     | 
    
         
            -
                obj = NewX509Store(cX509Store);
         
     | 
| 
       139 
     | 
    
         
            -
                SetX509Store(obj, store);
         
     | 
| 
       140 
     | 
    
         
            -
             
     | 
| 
       141 
     | 
    
         
            -
                return obj;
         
     | 
| 
       142 
     | 
    
         
            -
            }
         
     | 
| 
       143 
     | 
    
         
            -
             
     | 
| 
       144 
125 
     | 
    
         
             
            X509_STORE *
         
     | 
| 
       145 
126 
     | 
    
         
             
            GetX509StorePtr(VALUE obj)
         
     | 
| 
       146 
127 
     | 
    
         
             
            {
         
     | 
| 
       147 
128 
     | 
    
         
             
                X509_STORE *store;
         
     | 
| 
       148 
129 
     | 
    
         | 
| 
       149 
     | 
    
         
            -
                 
     | 
| 
       150 
     | 
    
         
            -
             
     | 
| 
       151 
     | 
    
         
            -
                return store;
         
     | 
| 
       152 
     | 
    
         
            -
            }
         
     | 
| 
       153 
     | 
    
         
            -
             
     | 
| 
       154 
     | 
    
         
            -
            X509_STORE *
         
     | 
| 
       155 
     | 
    
         
            -
            DupX509StorePtr(VALUE obj)
         
     | 
| 
       156 
     | 
    
         
            -
            {
         
     | 
| 
       157 
     | 
    
         
            -
                X509_STORE *store;
         
     | 
| 
       158 
     | 
    
         
            -
             
     | 
| 
       159 
     | 
    
         
            -
                SafeGetX509Store(obj, store);
         
     | 
| 
       160 
     | 
    
         
            -
                X509_STORE_up_ref(store);
         
     | 
| 
      
 130 
     | 
    
         
            +
                GetX509Store(obj, store);
         
     | 
| 
       161 
131 
     | 
    
         | 
| 
       162 
132 
     | 
    
         
             
                return store;
         
     | 
| 
       163 
133 
     | 
    
         
             
            }
         
     | 
| 
         @@ -242,9 +212,9 @@ ossl_x509store_initialize(int argc, VALUE *argv, VALUE self) 
     | 
|
| 
       242 
212 
     | 
    
         | 
| 
       243 
213 
     | 
    
         
             
            /*
         
     | 
| 
       244 
214 
     | 
    
         
             
             * call-seq:
         
     | 
| 
       245 
     | 
    
         
            -
             *   store.flags =  
     | 
| 
      
 215 
     | 
    
         
            +
             *   store.flags = flags
         
     | 
| 
       246 
216 
     | 
    
         
             
             *
         
     | 
| 
       247 
     | 
    
         
            -
             * Sets  
     | 
| 
      
 217 
     | 
    
         
            +
             * Sets _flags_ to the Store. _flags_ consists of zero or more of the constants
         
     | 
| 
       248 
218 
     | 
    
         
             
             * defined in with name V_FLAG_* or'ed together.
         
     | 
| 
       249 
219 
     | 
    
         
             
             */
         
     | 
| 
       250 
220 
     | 
    
         
             
            static VALUE
         
     | 
| 
         @@ -263,7 +233,7 @@ ossl_x509store_set_flags(VALUE self, VALUE flags) 
     | 
|
| 
       263 
233 
     | 
    
         
             
             * call-seq:
         
     | 
| 
       264 
234 
     | 
    
         
             
             *   store.purpose = purpose
         
     | 
| 
       265 
235 
     | 
    
         
             
             *
         
     | 
| 
       266 
     | 
    
         
            -
             * Sets the store's purpose to  
     | 
| 
      
 236 
     | 
    
         
            +
             * Sets the store's purpose to _purpose_. If specified, the verifications on
         
     | 
| 
       267 
237 
     | 
    
         
             
             * the store will check every untrusted certificate's extensions are consistent
         
     | 
| 
       268 
238 
     | 
    
         
             
             * with the purpose. The purpose is specified by constants:
         
     | 
| 
       269 
239 
     | 
    
         
             
             *
         
     | 
| 
         @@ -322,8 +292,9 @@ ossl_x509store_set_time(VALUE self, VALUE time) 
     | 
|
| 
       322 
292 
     | 
    
         
             
             * call-seq:
         
     | 
| 
       323 
293 
     | 
    
         
             
             *   store.add_file(file) -> self
         
     | 
| 
       324 
294 
     | 
    
         
             
             *
         
     | 
| 
       325 
     | 
    
         
            -
             * Adds the certificates in  
     | 
| 
       326 
     | 
    
         
            -
             *  
     | 
| 
      
 295 
     | 
    
         
            +
             * Adds the certificates in _file_ to the certificate store. _file_ is the path
         
     | 
| 
      
 296 
     | 
    
         
            +
             * to the file, and the file contains one or more certificates in PEM format
         
     | 
| 
      
 297 
     | 
    
         
            +
             * concatenated together.
         
     | 
| 
       327 
298 
     | 
    
         
             
             */
         
     | 
| 
       328 
299 
     | 
    
         
             
            static VALUE
         
     | 
| 
       329 
300 
     | 
    
         
             
            ossl_x509store_add_file(VALUE self, VALUE file)
         
     | 
| 
         @@ -359,7 +330,7 @@ ossl_x509store_add_file(VALUE self, VALUE file) 
     | 
|
| 
       359 
330 
     | 
    
         
             
             * call-seq:
         
     | 
| 
       360 
331 
     | 
    
         
             
             *   store.add_path(path) -> self
         
     | 
| 
       361 
332 
     | 
    
         
             
             *
         
     | 
| 
       362 
     | 
    
         
            -
             * Adds  
     | 
| 
      
 333 
     | 
    
         
            +
             * Adds _path_ as the hash dir to be looked up by the store.
         
     | 
| 
       363 
334 
     | 
    
         
             
             */
         
     | 
| 
       364 
335 
     | 
    
         
             
            static VALUE
         
     | 
| 
       365 
336 
     | 
    
         
             
            ossl_x509store_add_path(VALUE self, VALUE dir)
         
     | 
| 
         @@ -386,7 +357,7 @@ ossl_x509store_add_path(VALUE self, VALUE dir) 
     | 
|
| 
       386 
357 
     | 
    
         
             
             * call-seq:
         
     | 
| 
       387 
358 
     | 
    
         
             
             *   store.set_default_paths
         
     | 
| 
       388 
359 
     | 
    
         
             
             *
         
     | 
| 
       389 
     | 
    
         
            -
             * Configures  
     | 
| 
      
 360 
     | 
    
         
            +
             * Configures _store_ to look up CA certificates from the system default
         
     | 
| 
       390 
361 
     | 
    
         
             
             * certificate store as needed basis. The location of the store can usually be
         
     | 
| 
       391 
362 
     | 
    
         
             
             * determined by:
         
     | 
| 
       392 
363 
     | 
    
         
             
             *
         
     | 
| 
         @@ -410,7 +381,7 @@ ossl_x509store_set_default_paths(VALUE self) 
     | 
|
| 
       410 
381 
     | 
    
         
             
             * call-seq:
         
     | 
| 
       411 
382 
     | 
    
         
             
             *   store.add_cert(cert)
         
     | 
| 
       412 
383 
     | 
    
         
             
             *
         
     | 
| 
       413 
     | 
    
         
            -
             * Adds the OpenSSL::X509::Certificate  
     | 
| 
      
 384 
     | 
    
         
            +
             * Adds the OpenSSL::X509::Certificate _cert_ to the certificate store.
         
     | 
| 
       414 
385 
     | 
    
         
             
             */
         
     | 
| 
       415 
386 
     | 
    
         
             
            static VALUE
         
     | 
| 
       416 
387 
     | 
    
         
             
            ossl_x509store_add_cert(VALUE self, VALUE arg)
         
     | 
| 
         @@ -431,7 +402,7 @@ ossl_x509store_add_cert(VALUE self, VALUE arg) 
     | 
|
| 
       431 
402 
     | 
    
         
             
             * call-seq:
         
     | 
| 
       432 
403 
     | 
    
         
             
             *   store.add_crl(crl) -> self
         
     | 
| 
       433 
404 
     | 
    
         
             
             *
         
     | 
| 
       434 
     | 
    
         
            -
             * Adds the OpenSSL::X509::CRL  
     | 
| 
      
 405 
     | 
    
         
            +
             * Adds the OpenSSL::X509::CRL _crl_ to the store.
         
     | 
| 
       435 
406 
     | 
    
         
             
             */
         
     | 
| 
       436 
407 
     | 
    
         
             
            static VALUE
         
     | 
| 
       437 
408 
     | 
    
         
             
            ossl_x509store_add_crl(VALUE self, VALUE arg)
         
     | 
| 
         @@ -456,15 +427,15 @@ static VALUE ossl_x509stctx_get_chain(VALUE); 
     | 
|
| 
       456 
427 
     | 
    
         
             
             * call-seq:
         
     | 
| 
       457 
428 
     | 
    
         
             
             *   store.verify(cert, chain = nil) -> true | false
         
     | 
| 
       458 
429 
     | 
    
         
             
             *
         
     | 
| 
       459 
     | 
    
         
            -
             * Performs a certificate verification on the OpenSSL::X509::Certificate  
     | 
| 
      
 430 
     | 
    
         
            +
             * Performs a certificate verification on the OpenSSL::X509::Certificate _cert_.
         
     | 
| 
       460 
431 
     | 
    
         
             
             *
         
     | 
| 
       461 
     | 
    
         
            -
             *  
     | 
| 
      
 432 
     | 
    
         
            +
             * _chain_ can be an array of OpenSSL::X509::Certificate that is used to
         
     | 
| 
       462 
433 
     | 
    
         
             
             * construct the certificate chain.
         
     | 
| 
       463 
434 
     | 
    
         
             
             *
         
     | 
| 
       464 
435 
     | 
    
         
             
             * If a block is given, it overrides the callback set by #verify_callback=.
         
     | 
| 
       465 
436 
     | 
    
         
             
             *
         
     | 
| 
       466 
437 
     | 
    
         
             
             * After finishing the verification, the error information can be retrieved by
         
     | 
| 
       467 
     | 
    
         
            -
             * #error, #error_string, and the  
     | 
| 
      
 438 
     | 
    
         
            +
             * #error, #error_string, and the resulting complete certificate chain can be
         
     | 
| 
       468 
439 
     | 
    
         
             
             * retrieved by #chain.
         
     | 
| 
       469 
440 
     | 
    
         
             
             */
         
     | 
| 
       470 
441 
     | 
    
         
             
            static VALUE
         
     | 
| 
         @@ -561,7 +532,7 @@ ossl_x509stctx_initialize(int argc, VALUE *argv, VALUE self) 
     | 
|
| 
       561 
532 
     | 
    
         | 
| 
       562 
533 
     | 
    
         
             
                rb_scan_args(argc, argv, "12", &store, &cert, &chain);
         
     | 
| 
       563 
534 
     | 
    
         
             
                GetX509StCtx(self, ctx);
         
     | 
| 
       564 
     | 
    
         
            -
                 
     | 
| 
      
 535 
     | 
    
         
            +
                GetX509Store(store, x509st);
         
     | 
| 
       565 
536 
     | 
    
         
             
                if(!NIL_P(cert)) x509 = DupX509CertPtr(cert); /* NEED TO DUP */
         
     | 
| 
       566 
537 
     | 
    
         
             
                if(!NIL_P(chain)) x509s = ossl_x509_ary2sk(chain);
         
     | 
| 
       567 
538 
     | 
    
         
             
                if(X509_STORE_CTX_init(ctx, x509st, x509, x509s) != 1){
         
     | 
| 
         @@ -800,7 +771,6 @@ ossl_x509stctx_set_time(VALUE self, VALUE time) 
     | 
|
| 
       800 
771 
     | 
    
         
             
            void
         
     | 
| 
       801 
772 
     | 
    
         
             
            Init_ossl_x509store(void)
         
     | 
| 
       802 
773 
     | 
    
         
             
            {
         
     | 
| 
       803 
     | 
    
         
            -
            #undef rb_intern
         
     | 
| 
       804 
774 
     | 
    
         
             
            #if 0
         
     | 
| 
       805 
775 
     | 
    
         
             
                mOSSL = rb_define_module("OpenSSL");
         
     | 
| 
       806 
776 
     | 
    
         
             
                eOSSLError = rb_define_class_under(mOSSL, "OpenSSLError", rb_eStandardError);
         
     | 
    
        data/ext/openssl/ruby_missing.h
    CHANGED
    
    | 
         @@ -10,20 +10,9 @@ 
     | 
|
| 
       10 
10 
     | 
    
         
             
            #if !defined(_OSSL_RUBY_MISSING_H_)
         
     | 
| 
       11 
11 
     | 
    
         
             
            #define _OSSL_RUBY_MISSING_H_
         
     | 
| 
       12 
12 
     | 
    
         | 
| 
       13 
     | 
    
         
            -
            #define rb_define_copy_func(klass, func) \
         
     | 
| 
       14 
     | 
    
         
            -
            	rb_define_method((klass), "initialize_copy", (func), 1)
         
     | 
| 
       15 
     | 
    
         
            -
             
     | 
| 
       16 
     | 
    
         
            -
            #define FPTR_TO_FD(fptr) ((fptr)->fd)
         
     | 
| 
       17 
     | 
    
         
            -
             
     | 
| 
       18 
     | 
    
         
            -
            /* Ruby 2.4 */
         
     | 
| 
       19 
13 
     | 
    
         
             
            #ifndef RB_INTEGER_TYPE_P
         
     | 
| 
       20 
     | 
    
         
            -
             
     | 
| 
       21 
     | 
    
         
            -
            # 
     | 
| 
       22 
     | 
    
         
            -
             
     | 
| 
       23 
     | 
    
         
            -
            /* Ruby 2.5 */
         
     | 
| 
       24 
     | 
    
         
            -
            #ifndef ST2FIX
         
     | 
| 
       25 
     | 
    
         
            -
            # define RB_ST2FIX(h) LONG2FIX((long)(h))
         
     | 
| 
       26 
     | 
    
         
            -
            # define ST2FIX(h) RB_ST2FIX(h)
         
     | 
| 
      
 14 
     | 
    
         
            +
            /* for Ruby 2.3 compatibility */
         
     | 
| 
      
 15 
     | 
    
         
            +
            #define RB_INTEGER_TYPE_P(obj) (RB_FIXNUM_P(obj) || RB_TYPE_P(obj, T_BIGNUM))
         
     | 
| 
       27 
16 
     | 
    
         
             
            #endif
         
     | 
| 
       28 
17 
     | 
    
         | 
| 
       29 
18 
     | 
    
         
             
            #endif /* _OSSL_RUBY_MISSING_H_ */
         
     | 
    
        data/lib/openssl.rb
    CHANGED
    
    
    
        data/lib/openssl/bn.rb
    CHANGED
    
    
    
        data/lib/openssl/buffering.rb
    CHANGED
    
    | 
         @@ -63,7 +63,7 @@ module OpenSSL::Buffering 
     | 
|
| 
       63 
63 
     | 
    
         
             
              end
         
     | 
| 
       64 
64 
     | 
    
         | 
| 
       65 
65 
     | 
    
         
             
              ##
         
     | 
| 
       66 
     | 
    
         
            -
              # Consumes  
     | 
| 
      
 66 
     | 
    
         
            +
              # Consumes _size_ bytes from the buffer
         
     | 
| 
       67 
67 
     | 
    
         | 
| 
       68 
68 
     | 
    
         
             
              def consume_rbuff(size=nil)
         
     | 
| 
       69 
69 
     | 
    
         
             
                if @rbuffer.empty?
         
     | 
| 
         @@ -79,7 +79,7 @@ module OpenSSL::Buffering 
     | 
|
| 
       79 
79 
     | 
    
         
             
              public
         
     | 
| 
       80 
80 
     | 
    
         | 
| 
       81 
81 
     | 
    
         
             
              ##
         
     | 
| 
       82 
     | 
    
         
            -
              # Reads  
     | 
| 
      
 82 
     | 
    
         
            +
              # Reads _size_ bytes from the stream.  If _buf_ is provided it must
         
     | 
| 
       83 
83 
     | 
    
         
             
              # reference a string which will receive the data.
         
     | 
| 
       84 
84 
     | 
    
         
             
              #
         
     | 
| 
       85 
85 
     | 
    
         
             
              # See IO#read for full details.
         
     | 
| 
         @@ -106,7 +106,7 @@ module OpenSSL::Buffering 
     | 
|
| 
       106 
106 
     | 
    
         
             
              end
         
     | 
| 
       107 
107 
     | 
    
         | 
| 
       108 
108 
     | 
    
         
             
              ##
         
     | 
| 
       109 
     | 
    
         
            -
              # Reads at most  
     | 
| 
      
 109 
     | 
    
         
            +
              # Reads at most _maxlen_ bytes from the stream.  If _buf_ is provided it
         
     | 
| 
       110 
110 
     | 
    
         
             
              # must reference a string which will receive the data.
         
     | 
| 
       111 
111 
     | 
    
         
             
              #
         
     | 
| 
       112 
112 
     | 
    
         
             
              # See IO#readpartial for full details.
         
     | 
| 
         @@ -136,7 +136,7 @@ module OpenSSL::Buffering 
     | 
|
| 
       136 
136 
     | 
    
         
             
              end
         
     | 
| 
       137 
137 
     | 
    
         | 
| 
       138 
138 
     | 
    
         
             
              ##
         
     | 
| 
       139 
     | 
    
         
            -
              # Reads at most  
     | 
| 
      
 139 
     | 
    
         
            +
              # Reads at most _maxlen_ bytes in the non-blocking manner.
         
     | 
| 
       140 
140 
     | 
    
         
             
              #
         
     | 
| 
       141 
141 
     | 
    
         
             
              # When no data can be read without blocking it raises
         
     | 
| 
       142 
142 
     | 
    
         
             
              # OpenSSL::SSL::SSLError extended by IO::WaitReadable or IO::WaitWritable.
         
     | 
| 
         @@ -164,9 +164,10 @@ module OpenSSL::Buffering 
     | 
|
| 
       164 
164 
     | 
    
         
             
              # when the peer requests a new TLS/SSL handshake.  See openssl the FAQ for
         
     | 
| 
       165 
165 
     | 
    
         
             
              # more details.  http://www.openssl.org/support/faq.html
         
     | 
| 
       166 
166 
     | 
    
         
             
              #
         
     | 
| 
       167 
     | 
    
         
            -
              # By specifying  
     | 
| 
      
 167 
     | 
    
         
            +
              # By specifying a keyword argument _exception_ to +false+, you can indicate
         
     | 
| 
       168 
168 
     | 
    
         
             
              # that read_nonblock should not raise an IO::Wait*able exception, but
         
     | 
| 
       169 
     | 
    
         
            -
              # return the symbol  
     | 
| 
      
 169 
     | 
    
         
            +
              # return the symbol +:wait_writable+ or +:wait_readable+ instead. At EOF,
         
     | 
| 
      
 170 
     | 
    
         
            +
              # it will return +nil+ instead of raising EOFError.
         
     | 
| 
       170 
171 
     | 
    
         | 
| 
       171 
172 
     | 
    
         
             
              def read_nonblock(maxlen, buf=nil, exception: true)
         
     | 
| 
       172 
173 
     | 
    
         
             
                if maxlen == 0
         
     | 
| 
         @@ -189,11 +190,11 @@ module OpenSSL::Buffering 
     | 
|
| 
       189 
190 
     | 
    
         
             
              end
         
     | 
| 
       190 
191 
     | 
    
         | 
| 
       191 
192 
     | 
    
         
             
              ##
         
     | 
| 
       192 
     | 
    
         
            -
              # Reads the next "line" from the stream.  Lines are separated by  
     | 
| 
       193 
     | 
    
         
            -
              #  
     | 
| 
      
 193 
     | 
    
         
            +
              # Reads the next "line" from the stream.  Lines are separated by _eol_.  If
         
     | 
| 
      
 194 
     | 
    
         
            +
              # _limit_ is provided the result will not be longer than the given number of
         
     | 
| 
       194 
195 
     | 
    
         
             
              # bytes.
         
     | 
| 
       195 
196 
     | 
    
         
             
              #
         
     | 
| 
       196 
     | 
    
         
            -
              #  
     | 
| 
      
 197 
     | 
    
         
            +
              # _eol_ may be a String or Regexp.
         
     | 
| 
       197 
198 
     | 
    
         
             
              #
         
     | 
| 
       198 
199 
     | 
    
         
             
              # Unlike IO#gets the line read will not be assigned to +$_+.
         
     | 
| 
       199 
200 
     | 
    
         
             
              #
         
     | 
| 
         @@ -219,7 +220,7 @@ module OpenSSL::Buffering 
     | 
|
| 
       219 
220 
     | 
    
         | 
| 
       220 
221 
     | 
    
         
             
              ##
         
     | 
| 
       221 
222 
     | 
    
         
             
              # Executes the block for every line in the stream where lines are separated
         
     | 
| 
       222 
     | 
    
         
            -
              # by  
     | 
| 
      
 223 
     | 
    
         
            +
              # by _eol_.
         
     | 
| 
       223 
224 
     | 
    
         
             
              #
         
     | 
| 
       224 
225 
     | 
    
         
             
              # See also #gets
         
     | 
| 
       225 
226 
     | 
    
         | 
| 
         @@ -231,7 +232,7 @@ module OpenSSL::Buffering 
     | 
|
| 
       231 
232 
     | 
    
         
             
              alias each_line each
         
     | 
| 
       232 
233 
     | 
    
         | 
| 
       233 
234 
     | 
    
         
             
              ##
         
     | 
| 
       234 
     | 
    
         
            -
              # Reads lines from the stream which are separated by  
     | 
| 
      
 235 
     | 
    
         
            +
              # Reads lines from the stream which are separated by _eol_.
         
     | 
| 
       235 
236 
     | 
    
         
             
              #
         
     | 
| 
       236 
237 
     | 
    
         
             
              # See also #gets
         
     | 
| 
       237 
238 
     | 
    
         | 
| 
         @@ -244,7 +245,7 @@ module OpenSSL::Buffering 
     | 
|
| 
       244 
245 
     | 
    
         
             
              end
         
     | 
| 
       245 
246 
     | 
    
         | 
| 
       246 
247 
     | 
    
         
             
              ##
         
     | 
| 
       247 
     | 
    
         
            -
              # Reads a line from the stream which is separated by  
     | 
| 
      
 248 
     | 
    
         
            +
              # Reads a line from the stream which is separated by _eol_.
         
     | 
| 
       248 
249 
     | 
    
         
             
              #
         
     | 
| 
       249 
250 
     | 
    
         
             
              # Raises EOFError if at end of file.
         
     | 
| 
       250 
251 
     | 
    
         | 
| 
         @@ -280,7 +281,7 @@ module OpenSSL::Buffering 
     | 
|
| 
       280 
281 
     | 
    
         
             
              end
         
     | 
| 
       281 
282 
     | 
    
         | 
| 
       282 
283 
     | 
    
         
             
              ##
         
     | 
| 
       283 
     | 
    
         
            -
              # Pushes character  
     | 
| 
      
 284 
     | 
    
         
            +
              # Pushes character _c_ back onto the stream such that a subsequent buffered
         
     | 
| 
       284 
285 
     | 
    
         
             
              # character read will return it.
         
     | 
| 
       285 
286 
     | 
    
         
             
              #
         
     | 
| 
       286 
287 
     | 
    
         
             
              # Unlike IO#getc multiple bytes may be pushed back onto the stream.
         
     | 
| 
         @@ -307,7 +308,7 @@ module OpenSSL::Buffering 
     | 
|
| 
       307 
308 
     | 
    
         
             
              private
         
     | 
| 
       308 
309 
     | 
    
         | 
| 
       309 
310 
     | 
    
         
             
              ##
         
     | 
| 
       310 
     | 
    
         
            -
              # Writes  
     | 
| 
      
 311 
     | 
    
         
            +
              # Writes _s_ to the buffer.  When the buffer is full or #sync is true the
         
     | 
| 
       311 
312 
     | 
    
         
             
              # buffer is flushed to the underlying socket.
         
     | 
| 
       312 
313 
     | 
    
         | 
| 
       313 
314 
     | 
    
         
             
              def do_write(s)
         
     | 
| 
         @@ -335,8 +336,8 @@ module OpenSSL::Buffering 
     | 
|
| 
       335 
336 
     | 
    
         
             
              public
         
     | 
| 
       336 
337 
     | 
    
         | 
| 
       337 
338 
     | 
    
         
             
              ##
         
     | 
| 
       338 
     | 
    
         
            -
              # Writes  
     | 
| 
       339 
     | 
    
         
            -
              # converted using  
     | 
| 
      
 339 
     | 
    
         
            +
              # Writes _s_ to the stream.  If the argument is not a String it will be
         
     | 
| 
      
 340 
     | 
    
         
            +
              # converted using +.to_s+ method.  Returns the number of bytes written.
         
     | 
| 
       340 
341 
     | 
    
         | 
| 
       341 
342 
     | 
    
         
             
              def write(s)
         
     | 
| 
       342 
343 
     | 
    
         
             
                do_write(s)
         
     | 
| 
         @@ -344,7 +345,7 @@ module OpenSSL::Buffering 
     | 
|
| 
       344 
345 
     | 
    
         
             
              end
         
     | 
| 
       345 
346 
     | 
    
         | 
| 
       346 
347 
     | 
    
         
             
              ##
         
     | 
| 
       347 
     | 
    
         
            -
              # Writes  
     | 
| 
      
 348 
     | 
    
         
            +
              # Writes _s_ in the non-blocking manner.
         
     | 
| 
       348 
349 
     | 
    
         
             
              #
         
     | 
| 
       349 
350 
     | 
    
         
             
              # If there is buffered data, it is flushed first.  This may block.
         
     | 
| 
       350 
351 
     | 
    
         
             
              #
         
     | 
| 
         @@ -376,9 +377,9 @@ module OpenSSL::Buffering 
     | 
|
| 
       376 
377 
     | 
    
         
             
              # is when the peer requests a new TLS/SSL handshake.  See the openssl FAQ
         
     | 
| 
       377 
378 
     | 
    
         
             
              # for more details.  http://www.openssl.org/support/faq.html
         
     | 
| 
       378 
379 
     | 
    
         
             
              #
         
     | 
| 
       379 
     | 
    
         
            -
              # By specifying  
     | 
| 
      
 380 
     | 
    
         
            +
              # By specifying a keyword argument _exception_ to +false+, you can indicate
         
     | 
| 
       380 
381 
     | 
    
         
             
              # that write_nonblock should not raise an IO::Wait*able exception, but
         
     | 
| 
       381 
     | 
    
         
            -
              # return the symbol  
     | 
| 
      
 382 
     | 
    
         
            +
              # return the symbol +:wait_writable+ or +:wait_readable+ instead.
         
     | 
| 
       382 
383 
     | 
    
         | 
| 
       383 
384 
     | 
    
         
             
              def write_nonblock(s, exception: true)
         
     | 
| 
       384 
385 
     | 
    
         
             
                flush
         
     | 
| 
         @@ -386,8 +387,8 @@ module OpenSSL::Buffering 
     | 
|
| 
       386 
387 
     | 
    
         
             
              end
         
     | 
| 
       387 
388 
     | 
    
         | 
| 
       388 
389 
     | 
    
         
             
              ##
         
     | 
| 
       389 
     | 
    
         
            -
              # Writes  
     | 
| 
       390 
     | 
    
         
            -
              #  
     | 
| 
      
 390 
     | 
    
         
            +
              # Writes _s_ to the stream.  _s_ will be converted to a String using
         
     | 
| 
      
 391 
     | 
    
         
            +
              # +.to_s+ method.
         
     | 
| 
       391 
392 
     | 
    
         | 
| 
       392 
393 
     | 
    
         
             
              def <<(s)
         
     | 
| 
       393 
394 
     | 
    
         
             
                do_write(s)
         
     | 
| 
         @@ -395,7 +396,7 @@ module OpenSSL::Buffering 
     | 
|
| 
       395 
396 
     | 
    
         
             
              end
         
     | 
| 
       396 
397 
     | 
    
         | 
| 
       397 
398 
     | 
    
         
             
              ##
         
     | 
| 
       398 
     | 
    
         
            -
              # Writes  
     | 
| 
      
 399 
     | 
    
         
            +
              # Writes _args_ to the stream along with a record separator.
         
     | 
| 
       399 
400 
     | 
    
         
             
              #
         
     | 
| 
       400 
401 
     | 
    
         
             
              # See IO#puts for full details.
         
     | 
| 
       401 
402 
     | 
    
         | 
| 
         @@ -415,7 +416,7 @@ module OpenSSL::Buffering 
     | 
|
| 
       415 
416 
     | 
    
         
             
              end
         
     | 
| 
       416 
417 
     | 
    
         | 
| 
       417 
418 
     | 
    
         
             
              ##
         
     | 
| 
       418 
     | 
    
         
            -
              # Writes  
     | 
| 
      
 419 
     | 
    
         
            +
              # Writes _args_ to the stream.
         
     | 
| 
       419 
420 
     | 
    
         
             
              #
         
     | 
| 
       420 
421 
     | 
    
         
             
              # See IO#print for full details.
         
     | 
| 
       421 
422 
     | 
    
         | 
    
        data/lib/openssl/config.rb
    CHANGED
    
    | 
         @@ -30,7 +30,8 @@ module OpenSSL 
     | 
|
| 
       30 
30 
     | 
    
         
             
                class << self
         
     | 
| 
       31 
31 
     | 
    
         | 
| 
       32 
32 
     | 
    
         
             
                  ##
         
     | 
| 
       33 
     | 
    
         
            -
                  # Parses a given  
     | 
| 
      
 33 
     | 
    
         
            +
                  # Parses a given _string_ as a blob that contains configuration for
         
     | 
| 
      
 34 
     | 
    
         
            +
                  # OpenSSL.
         
     | 
| 
       34 
35 
     | 
    
         
             
                  #
         
     | 
| 
       35 
36 
     | 
    
         
             
                  # If the source of the IO is a file, then consider using #parse_config.
         
     | 
| 
       36 
37 
     | 
    
         
             
                  def parse(string)
         
     | 
| 
         @@ -46,7 +47,7 @@ module OpenSSL 
     | 
|
| 
       46 
47 
     | 
    
         
             
                  alias load new
         
     | 
| 
       47 
48 
     | 
    
         | 
| 
       48 
49 
     | 
    
         
             
                  ##
         
     | 
| 
       49 
     | 
    
         
            -
                  # Parses the configuration data read from  
     | 
| 
      
 50 
     | 
    
         
            +
                  # Parses the configuration data read from _io_, see also #parse.
         
     | 
| 
       50 
51 
     | 
    
         
             
                  #
         
     | 
| 
       51 
52 
     | 
    
         
             
                  # Raises a ConfigError on invalid configuration data.
         
     | 
| 
       52 
53 
     | 
    
         
             
                  def parse_config(io)
         
     | 
| 
         @@ -236,7 +237,7 @@ module OpenSSL 
     | 
|
| 
       236 
237 
     | 
    
         
             
                #
         
     | 
| 
       237 
238 
     | 
    
         
             
                # This can be used in contexts like OpenSSL::X509::ExtensionFactory.config=
         
     | 
| 
       238 
239 
     | 
    
         
             
                #
         
     | 
| 
       239 
     | 
    
         
            -
                # If the optional  
     | 
| 
      
 240 
     | 
    
         
            +
                # If the optional _filename_ parameter is provided, then it is read in and
         
     | 
| 
       240 
241 
     | 
    
         
             
                # parsed via #parse_config.
         
     | 
| 
       241 
242 
     | 
    
         
             
                #
         
     | 
| 
       242 
243 
     | 
    
         
             
                # This can raise IO exceptions based on the access, or availability of the
         
     | 
| 
         @@ -255,7 +256,7 @@ module OpenSSL 
     | 
|
| 
       255 
256 
     | 
    
         
             
                end
         
     | 
| 
       256 
257 
     | 
    
         | 
| 
       257 
258 
     | 
    
         
             
                ##
         
     | 
| 
       258 
     | 
    
         
            -
                # Gets the value of  
     | 
| 
      
 259 
     | 
    
         
            +
                # Gets the value of _key_ from the given _section_
         
     | 
| 
       259 
260 
     | 
    
         
             
                #
         
     | 
| 
       260 
261 
     | 
    
         
             
                # Given the following configurating file being loaded:
         
     | 
| 
       261 
262 
     | 
    
         
             
                #
         
     | 
| 
         @@ -265,8 +266,8 @@ module OpenSSL 
     | 
|
| 
       265 
266 
     | 
    
         
             
                #     #=> [ default ]
         
     | 
| 
       266 
267 
     | 
    
         
             
                #     #   foo=bar
         
     | 
| 
       267 
268 
     | 
    
         
             
                #
         
     | 
| 
       268 
     | 
    
         
            -
                # You can get a specific value from the config if you know the  
     | 
| 
       269 
     | 
    
         
            -
                # and  
     | 
| 
      
 269 
     | 
    
         
            +
                # You can get a specific value from the config if you know the _section_
         
     | 
| 
      
 270 
     | 
    
         
            +
                # and _key_ like so:
         
     | 
| 
       270 
271 
     | 
    
         
             
                #
         
     | 
| 
       271 
272 
     | 
    
         
             
                #   config.get_value('default','foo')
         
     | 
| 
       272 
273 
     | 
    
         
             
                #     #=> "bar"
         
     | 
| 
         @@ -297,7 +298,7 @@ module OpenSSL 
     | 
|
| 
       297 
298 
     | 
    
         
             
                end
         
     | 
| 
       298 
299 
     | 
    
         | 
| 
       299 
300 
     | 
    
         
             
                ##
         
     | 
| 
       300 
     | 
    
         
            -
                # Set the target  
     | 
| 
      
 301 
     | 
    
         
            +
                # Set the target _key_ with a given _value_ under a specific _section_.
         
     | 
| 
       301 
302 
     | 
    
         
             
                #
         
     | 
| 
       302 
303 
     | 
    
         
             
                # Given the following configurating file being loaded:
         
     | 
| 
       303 
304 
     | 
    
         
             
                #
         
     | 
| 
         @@ -307,7 +308,7 @@ module OpenSSL 
     | 
|
| 
       307 
308 
     | 
    
         
             
                #     #=> [ default ]
         
     | 
| 
       308 
309 
     | 
    
         
             
                #     #   foo=bar
         
     | 
| 
       309 
310 
     | 
    
         
             
                #
         
     | 
| 
       310 
     | 
    
         
            -
                # You can set the value of  
     | 
| 
      
 311 
     | 
    
         
            +
                # You can set the value of _foo_ under the _default_ section to a new
         
     | 
| 
       311 
312 
     | 
    
         
             
                # value:
         
     | 
| 
       312 
313 
     | 
    
         
             
                #
         
     | 
| 
       313 
314 
     | 
    
         
             
                #   config.add_value('default', 'foo', 'buzz')
         
     | 
| 
         @@ -322,7 +323,7 @@ module OpenSSL 
     | 
|
| 
       322 
323 
     | 
    
         
             
                end
         
     | 
| 
       323 
324 
     | 
    
         | 
| 
       324 
325 
     | 
    
         
             
                ##
         
     | 
| 
       325 
     | 
    
         
            -
                # Get a specific  
     | 
| 
      
 326 
     | 
    
         
            +
                # Get a specific _section_ from the current configuration
         
     | 
| 
       326 
327 
     | 
    
         
             
                #
         
     | 
| 
       327 
328 
     | 
    
         
             
                # Given the following configurating file being loaded:
         
     | 
| 
       328 
329 
     | 
    
         
             
                #
         
     | 
| 
         @@ -351,7 +352,7 @@ module OpenSSL 
     | 
|
| 
       351 
352 
     | 
    
         
             
                end
         
     | 
| 
       352 
353 
     | 
    
         | 
| 
       353 
354 
     | 
    
         
             
                ##
         
     | 
| 
       354 
     | 
    
         
            -
                # Sets a specific  
     | 
| 
      
 355 
     | 
    
         
            +
                # Sets a specific _section_ name with a Hash _pairs_.
         
     | 
| 
       355 
356 
     | 
    
         
             
                #
         
     | 
| 
       356 
357 
     | 
    
         
             
                # Given the following configuration being created:
         
     | 
| 
       357 
358 
     | 
    
         
             
                #
         
     | 
| 
         @@ -365,7 +366,7 @@ module OpenSSL 
     | 
|
| 
       365 
366 
     | 
    
         
             
                #     #   baz=buz
         
     | 
| 
       366 
367 
     | 
    
         
             
                #
         
     | 
| 
       367 
368 
     | 
    
         
             
                # It's important to note that this will essentially merge any of the keys
         
     | 
| 
       368 
     | 
    
         
            -
                # in  
     | 
| 
      
 369 
     | 
    
         
            +
                # in _pairs_ with the existing _section_. For example:
         
     | 
| 
       369 
370 
     | 
    
         
             
                #
         
     | 
| 
       370 
371 
     | 
    
         
             
                #   config['default']
         
     | 
| 
       371 
372 
     | 
    
         
             
                #     #=> {"foo"=>"bar", "baz"=>"buz"}
         
     |