aboutsummaryrefslogtreecommitdiffstats
path: root/ext/openssl/ossl_bn.c
Commit message (Collapse)AuthorAgeFilesLines
* bn: implement OpenSSL::BN#negative?topic/bn-updatesKazuki Yamaguchi2016-12-231-0/+16
| | | | | Numeric class implemented #negative? and #positive? in Ruby 2.3. Let's follow that.
* bn: implement unary {plus,minus} operators for OpenSSL::BNKazuki Yamaguchi2016-12-231-0/+34
| | | | | For consistency with Numeric. Not sure why they aren't currently; maybe they were simply forgotten.
* bn: keep reference to temporary OpenSSL::BN object created by GetBNPtr()Kazuki Yamaguchi2016-12-041-15/+21
| | | | | | | | | GetBNPtr() accepts both OpenSSL::BN and Ruby integers. In the latter case, it creates a temporary OpenSSL::BN internally. The OpenSSL::BN object immediately disappears from the stack and is not protected from GC. Fixes: https://github.com/ruby/openssl/issues/87
* Use rb_obj_class() instead of CLASS_OF()Kazuki Yamaguchi2016-09-081-8/+9
| | | | | | CLASS_OF() (or, rb_class_of()) may return the singleton class of the object; so avoid using it and replace with rb_obj_class() that returns the actual class of the object.
* bn: optimize try_convert_to_bnptr() for non-BN objectstopic/argument-conversionKazuki Yamaguchi2016-08-221-46/+55
| | | | | | | | | | | Use the same logic as BN#initialize. It is used through GetBNPtr(). For example, with this change, the following code will be about 7x faster: puts Benchmark.measure { a = 0.to_bn b = 2 ** 2048 i = 0; a + b while (i += 1) <= 1_000_000 }
* Avoid using *2FIX() where we don't know if it really fits in FixnumKazuki Yamaguchi2016-08-221-2/+2
|
* Fix RDoc styletopic/rdoc-fixesKazuki Yamaguchi2016-07-091-16/+44
|
* openssl: adapt to OpenSSL 1.1.0 opaque structsrhe2016-06-091-9/+4
| | | | | | | | | | | | | | | * ext/openssl/extconf.rb: Check existence of accessor functions that don't exist in OpenSSL 0.9.8. OpenSSL 1.1.0 made most of its structures opaque and requires use of these accessor functions. [ruby-core:75225] [Feature #12324] * ext/openssl/openssl_missing.[ch]: Implement them if missing. * ext/openssl/ossl*.c: Use these accessor functions. * test/openssl/test_hmac.rb: Add missing test for HMAC#reset. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55287 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* openssl: avoid deprecated BN_*prime* functionsrhe2016-06-091-9/+15
| | | | | | | | | | * ext/openssl/ossl_bn.c (ossl_bn_s_generate_prime, ossl_bn_is_prime, ossl_bn_is_prime_fasttest): Avoid deprecated BN_generate_prime(), BN_is_prime{,_fasttest}(). They are deprecated because they expect an old style callback function (we don't use it here). They can be simply replaced by _ex suffixed functions. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55273 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* openssl: use StringValueCStr() where NUL-terminated string is expectedrhe2016-05-311-6/+5
| | | | | | | | | | | | | | * ext/openssl/ossl_asn1.c, ext/openssl/ossl_bn.c, ext/openssl/ossl_cipher.c, ext/openssl/ossl_digest.c ext/openssl/ossl_engine.c, ext/openssl/ossl_ns_spki.c ext/openssl/ossl_pkcs12.c, ext/openssl/ossl_pkcs7.c ext/openssl/ossl_pkey.c, ext/openssl/ossl_pkey_ec.c ext/openssl/ossl_rand.c, ext/openssl/ossl_ssl.c ext/openssl/ossl_x509attr.c, ext/openssl/ossl_x509cert.c ext/openssl/ossl_x509ext.c, ext/openssl/ossl_x509store.c: Use StringValueCStr() where NUL-terminated string is expected. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55134 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* openssl: fix equality test methods of OpenSSL::BNrhe2016-05-311-13/+77
| | | | | | | | | | | | | | | | * ext/openssl/ossl_bn.c (try_convert_to_bnptr): Extracted from GetBNPtr(). This doesn't raise exception but returns NULL on error. (GetBNPtr): Raise TypeError if conversion fails. (ossl_bn_eq): Implement BN#==. (ossl_bn_eql): #eql? should not raise TypeError even if the argument is not compatible with BN. (ossl_bn_hash): Implement BN#hash. * ext/openssl/ossl_bn.c (Init_ossl_bn): Define #== and #hash. * test/openssl/test_bn.rb: Test BN#eql?, #== and #hash git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55047 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Sync with ruby trunkZachary Scott2015-09-231-2/+0
|
* Upstream ruby/ruby@451fe26 from r50673Zachary Scott2015-06-031-17/+31
|
* Apply ruby/ruby@325a50fc572516a171d640765d6ddf9b20be14dc to fix typosZachary Scott2015-05-041-1/+1
| | | | See also r50351 from ruby/ruby#876
* Upstream the following commits from trunk ruby:Zachary Scott2015-03-251-61/+164
| | | | | | | | | | - r49681: 97f9589c4b0641141af32244021dd9eba001b3c7 - r49682: c5d781dded856a86609ebd9fd4904c3e9f3474fd - r49948: aaf2d070a8351dc3118422bae478978f3d3e3966 - r49954: ddf2558a167652cfec6a901b2116b832221e6e83b - r49955: 9941f348e056a5e717cb943cee37ba8ba2396e6f Fixes #6 and #7
* Apply documentation fixes from ruby/ruby#834, patch by @vbattsZachary Scott2015-02-211-15/+37
|
* Sync with ruby trunkZachary Scott2015-01-051-1/+1
|
* import ruby trunkSHIBATA Hiroshi2014-10-271-0/+915