| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
| |
Use rb_attr_get() instead of rb_iv_get() so that we can remove
SSLContext::INIT_VARS.
SSLContext::INIT_VARS contains the names of the instance variables used
in SSLContext. SSLContext#initialize sets nil for those variables. It
is necessary to suppress "instance variable @foo not initialized"
warnings emitted by rb_iv_get(). The warnings can be avoided by using
rb_attr_get() that does not check the existence of the variable. So use
it.
|
|
|
|
|
|
|
|
|
| |
Remove '@' prefix from the variable name to hide it from Ruby.
Currently a SSLSocket instance allows modifying the value of
@callback_state if an user use Object#instance_variable_set. This is
dangerous because the variable is used for storing the tag jump state -
modifying it from Ruby can crash the process.
|
|
|
|
|
|
|
|
| |
The OpenSSL::PKey::{DH,EC} object is stored in an instance variable to
prevent the object from being GC'd (cf. r51460). However it turned out
to be unnecessary. The underlying object, DH and EC_KEY, have a
reference counter and OpenSSL increments it for the object returned by
the callback functions.
|
|
|
|
|
|
| |
The function can fail on memory allocation error. Note that the
function returns 0 on success unlike other almost all functions in
OpenSSL.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
They aren't exception safe - they are called during parsing the
Client/Server Hello from OpenSSL code. An exception raised in the
callbacks escapes directly from OpenSSL code so it can break internal
status of OpenSSL.
We have a procedure for handling such exceptions raised during an
handshake: catch them and store the state number in the SSLSocket
object, and then check it in ossl_ssl_start() and re-raise after the
control turned back to our side.
This fixes the instability of
TestSSL::test_alpn_protocol_selection_cancel.
|
|
|
|
| |
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56028 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
| |
|
|
|
|
|
| |
This suppresses runtime warning of "instance variable @group not
initialized".
|
|
|
|
|
|
|
| |
The assumption in commit 1b1d520818e0 ("x509ext: fix memory leak in
X509::ExtensionFactory#config=") was wrong. The uninitialized
X509V3_CTX::db can be referred through "r2i" functions when creating
certain types of extension that use them.
|
|
|
|
|
|
|
| |
Remove string2hex() and replace with newly added ossl_bin2hex(). Since
the output hex string is always returned to users as a String, we can
avoid the memory allocation by writing directly to the String buffer.
This also reduces some lines of code.
|
|\
| |
| |
| |
| | |
* topic/cipher-auth-tag-len:
cipher: add Cipher#auth_tag_len=
|
| |
| |
| |
| |
| |
| | |
Add a method to set the authentication tag length to be generate by an
AEAD ciphers. In particular, OCB mode which is implemented in OpenSSL
1.1.0 requires this.
|
| |
| |
| |
| |
| | |
OCSP_{basic,request}_verify() can return a negative value for
verification failure.
|
| |
| |
| |
| |
| |
| | |
The variable names 'flg' and 'flags' are mixed up and it doesn't set
OCSP_NOCERTS flag correctly when the 'certs' argument is not given.
[Bug #12704] [ruby-core:77061]
|
| |
| |
| |
| |
| |
| |
| | |
Fix compiler errors and warnings. The order of parameters of
X509_{CRL,REQ}_get0_signature() has been changed, and certificate and
CRL time accessors have been reorganized: *_get_* functions are
deprecated and replaced by *_get0_* that return a const pointer.
|
| |
| |
| |
| | |
In order to avoid compiler warnings when build with OpenSSL 1.1.0.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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
}
|
| | |
|
| | |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The function GetCipherPtr() is used when we want a const EVP_CIPHER that
represents a cipher algorithm. This change allows users to write a code
that exports a PKey encrypted without creating an OpenSSL::Cipher
instance:
pkey = OpenSSL::PKey.read(...)
pkey.export("aes-128-cbc") { password }
This is the same as what happened to GetDigestPtr() in r12128.
|
|\ \
| | |
| | | |
[WIP] Add NEWS and update CONTRIBUTING.md
|
| |\ \ |
|
| | | | |
|
| | | | |
|
| | | | |
|
| | | | |
|
| | | | |
|
| | | | |
|
| | | | |
|
| | | | |
|
|\ \ \ \
| | | | |
| | | | |
| | | | |
| | | | | |
* topic/cipher-doc-aead:
cipher: follow up for the previous documentation update
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
Add some explaination about the associated data. Also fix the
description of the AES-GCM example: the IV (nonce) doesn't need to be
unpredictable.
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
Similar to 0789643d7333 or 9af69abcec15, EVP_VerifyFinal() may put an
error to the error queue when the verification failed.
|
| | | | |
| | | | |
| | | | |
| | | | | |
All usages can be replaced with GetX509ExtPtr().
|
| | | | |
| | | | |
| | | | |
| | | | | |
OCSP_CERTID can leak in case OCSP_request_add0_id() fails.
|
| | | | |
| | | | |
| | | | |
| | | | | |
X509_REVOKED can leak when X509_CRL_add0_revoked() fails.
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
The BIO returned by PKCS7_dataInit() must be free'd using
BIO_free_all().
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
ossl_obj2bio() must be called after other functions that may raise.
Also, the variable `x509s` is not free'd when PKCS7_verify() fails.
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
It leaks when invalid value is passed as the `cipher` or `pass`
argument.
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
ossl_*_ary2sk() function must be called after any other functions that
may raise.
|
| | | | |
| | | | |
| | | | |
| | | | | |
X509_REVOKED_add_ext() dups the X509_EXTENSION.
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
X509_REQ_add1_attr() dups the X509_ATTRIBUTE given as the argument, so
we don't need to duplicate beforehand.
|
| | | | |
| | | | |
| | | | |
| | | | | |
ASN1_OBJECT returned by OBJ_txt2obj() must be free'd.
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
X509_EXTENSION_set_data() dups the ASN1_OCTET_STRING, so we must free
the temporary ASN1_OCTET_STRING object. However we can retrieve the
current ASN1_OCTET_STRING object by X509_EXTENSION_get_data() and modify
it directly.
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
X509_EXTENSION_set_object() dups the ASN1_OBJECT passed via the
argument so we need to free.
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
X509V3_set_nconf() sets the CONF passed via the argument to X509V3_CTX,
but it doesn't free CONF. However we don't actually need it so replace
with a simple Ruby-level attribute.
|
| | | | |
| | | | |
| | | | |
| | | | | |
The CONF returned by DupConfigPtr() must be free'd by the caller.
|
|/ / / /
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
Make it follow the convention. Other Get*Ptr() functions return a
pointer to OpenSSL object that the caller doesn't need to free.
Indeed DupConfigPtr() is not the best name (OpenSSL::Config does not
actually wrap a CONF object), but should be better than GetConfigPtr().
|
| |_|/
|/| |
| | |
| | |
| | | |
Add a note about GCM mode - warn of the risk of reusing nonce and
authentication tag truncation. [GH ruby/openssl#63]
|
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
SSL_CTX_set_tmp_ecdh() increments the reference counter of EC_KEY so we
must decrement with EC_KEY_free().
Fixes: fcb9b4a6b5c6 (openssl: add SSLContext#ecdh_curves=)
|