summaryrefslogtreecommitdiff
path: root/lib/libssl
AgeCommit message (Collapse)Author
2014-10-07Use strdup() instead of malloc() + memcpy().Miod Vallat
ok doug@ jsing@
2014-10-07EC_KEY_set_group() does an EC_GROUP_dup() of its argument, so we don'tMiod Vallat
need to do it in ec_copy_parameters() prior to invoking EC_KEY_set_group(). ok doug@ jsing@
2014-10-05The fixes to X509_PURPOSE_add() in r1.18 actually could cause a globalMiod Vallat
X509_PURPOSE object (obtained with X509_PURPOSE_get0() instead of being allocated in the function) to be freed if modifying that object would fail due to a low memory condition, while this object would still be referenced elsewhere. Fix this by only cleaning the object if we did not allocate it here. While there, fail early if either `name' or `sname' are NULL, rather than allocating an object and realizing we have nothing to strdup() into it. ok guenther@
2014-10-05Be sure to check the stack push operation for success in v2i_POLICY_MAPPINGS();Miod Vallat
if it fails, free the object we were about to push. Factor error handling to avoid having four copies of about the same code. ok guenther@
2014-10-05In v2i_AUTHORITY_INFO_ACCESS(), separate object allocation from object pushMiod Vallat
on a stack; if the latter fails, we need to free the object before returning failure. ok guenther@
2014-10-05Memory leak upon error in set_dist_point_name().Miod Vallat
ok guenther@
2014-10-05Be sure to check object allocation for success before using them.Miod Vallat
Tweaks and ok guenther@
2014-10-05Missing deallocation upon error.Miod Vallat
ok deraadt@ guenther@
2014-10-05Fix memory leak in the error path of v2i_AUTHORITY_KEYID().Miod Vallat
ok deraadt@ guenther@
2014-10-05compile with c89 (code / decl ordering); from Joakim.Tjernlund@transmode.seTheo de Raadt
ok miod
2014-10-05Use more specific curves/formats naming for local variables inJoel Sing
ssl_add_clienthello_tlsext() and ssl_add_serverhello_tlsext(), rather than the current generic naming. ok miod@
2014-10-05Use tls1_get_curvelist() in ssl_add_clienthello_tlsext(), rather thanJoel Sing
hand rolling the same code. ok miod@
2014-10-05Make tls1_get_formatlist() behave the same as tls1_get_curvelist() andJoel Sing
return the client format list if the client_formats flag is specified. Use tls1_get_formatlist()/tls1_get_curvelist() in tls1_check_ec_key(), simplifying the code. ok miod@
2014-10-03Bump minor version for ECDH auto.Joel Sing
While there are no additional symbols, there is an additional command that clients will potentially depend on.
2014-10-03Add support for automatic ephemeral EC keys.Joel Sing
This allows an SSL server to enable ECDHE ciphers with a single setting, which results in an EC key being generated using the first preference shared curve. Based on OpenSSL with inspiration from boringssl. ok miod@
2014-10-03Use string literals in printf style calls so gcc's -Wformat works.Doug Hogan
ok tedu@, miod@
2014-09-30Clean up EC cipher handling in ssl3_choose_cipher().Joel Sing
The existing code reaches around into various internals of EC, which it should not know anything about. Replace this with a set of functions that that can correctly extract the necessary details and handle the comparisions. Based on a commit to OpenSSL, with some inspiration from boringssl. ok miod@
2014-09-29Previous fix (1.12) would cause a NULL pointer dereference in the error pathMiod Vallat
if a NULL stack was passed as argument. Fix this by returning NULL early in that case.
2014-09-29check_cert(): be sure to reset ctx->current_crl to NULL before freeing it.Miod Vallat
X509_STORE_CTX_init(): do not free the X509_STORE_CTX * parameter upon failure, for we did not allocate it and it might not come from the heap, such as in check_crl_path() in this very same file where X509_STORE_CTX_init() gets invoked with a stack address. ok bcook@
2014-09-29X509_NAME_get_text_by_OBJ(): make sure we do not pass a negative size toMiod Vallat
memcpy(). ok bcook@
2014-09-29X509_VERIFY_PARAM_set1_name(): if invoked with NULL as the secondMiod Vallat
parameter, correctly set param->name to NULL after having freed it. ok bcook@
2014-09-28Bump minor after adding SSL_CTX_use_certificate_chain().Reyk Floeter
ok jsing@ miod@
2014-09-28Add a new API function SSL_CTX_use_certificate_chain() that allows toReyk Floeter
read the PEM-encoded certificate chain from memory instead of a file. This idea is derived from an older implementation in relayd that was needed to use the function with a privep'ed process in a chroot. Now it is time to get it into LibreSSL to make the API more privsep- friendly and to make it available for other programs and the ressl library. ok jsing@ miod@
2014-09-28X509v3_add_ext(): do not free stuff we did not allocate in the error path.Miod Vallat
ok bcook@
2014-09-28X509_TRUST_add(): check X509_TRUST_get0() return value before dereferencing it,Miod Vallat
for it may be NULL. Do not leak memory upon error. ok bcook@
2014-09-28Someone (TM) thought it was smart to save memory by using malloc(1) andMiod Vallat
manual field fiddling to create an ASN1_INTEGER object, instead of using M_ASN1_INTEGER_new() which will allocate sizeof(long) bytes. That person had probably never looked into malloc(3) and never heard of allocation size rounding. Thus, replace the obfuscated code with M_ASN1_INTEGER_new() followed by ASN1_INTEGER_set(), to achieve a similar result, without the need for /* version == 0 */ comments. ok bcook@
2014-09-27Doh, rev 1.4 had left out one routine with both 32-bit and 64-bit code, whereMiod Vallat
the 64-bit code has to be disabled under OpenBSD/hppa.
2014-09-27There is not much point checking ecdhp is not NULL... twice.Joel Sing
ok miod@
2014-09-27Check that the specified curve is one of the client preferences.Joel Sing
Based on OpenSSL. ok miod@
2014-09-26X509_STORE_new(): do not leak memory upon error.Miod Vallat
X509_STORE_get1_certs(), X509_STORE_get1_crls(): check the result of allocations. ok tedu@
2014-09-26X509_issuer_and_serial_hash(): do not leak memory if an error occurs duringMiod Vallat
the first EVP block. ok tedu@
2014-09-26X509at_add1_attr(): do not free stuff we did not allocate in the error path.Miod Vallat
ok tedu@
2014-09-26Now that we have a static version of the default EC formats, also use itJoel Sing
for the server hello. From OpenSSL. ok miod@
2014-09-23Fix regression introduced in revision 1.15 by using strndup() instead ofMiod Vallat
strdup() to allocated directory list components. ok jsing@
2014-09-22Refactor and simplify the ECC extension handling. The existing codeJoel Sing
effectively built two "static" data structures - instead of doing this, just use static data structures to start with. From OpenSSL (part of a larger commit). ok miod@
2014-09-22Also check the result from final_finish_mac() against finish_mac_length inJoel Sing
ssl3_send_finished(). While this previously checked against a zero return value (which could occur on failure), we may as well test against the expected length, since we already know what that is.
2014-09-22It is possible (although unlikely in practice) for peer_finish_md_len toJoel Sing
end up with a value of zero, primarily since ssl3_take_mac() fails to check the return value from the final_finish_mac() call. This would then mean that an SSL finished message with a zero-byte payload would successfully match against the calculated finish MAC. Avoid this by checking the length of peer_finish_md_len and the SSL finished message payload, against the known length already stored in the SSL3_ENC_METHOD finish_mac_length field (making use of a previously unused field). ok miod@ (a little while back)
2014-09-21Document SSL_OP_TLSEXT_PADDING.Joel Sing
From OpenSSL.
2014-09-21Move the TLS padding extension under an SSL_OP_TLSEXT_PADDING option, whichJoel Sing
is off by default (instead of being enabled unconditionally). The TLS padding extension was added as a workaround for a bug in F5 SSL terminators, however appears to trigger bugs in IronPort SMTP appliances. Now the SSL client gets to choose which of these devices it wants to trigger bugs in... Ported from OpenSSL. Discussed with many. ok miod@
2014-09-21a_enum.c used to be a copy of a_int.c with s/INTEGER/ENUMERATED/g , butMiod Vallat
some changes an a_int.c did not get applied to a_enum.c; despite style changes, make sure BN_to_ASN1_ENUMERATED() correctly handles a zero value the same way BN_to_ASN1_INTEGER() does. ok bcook@ beck@ jsing@
2014-09-21Fix a memory leak in the error path in ASN1_mbstring_ncopy().Miod Vallat
Replace an if() posse with a switch() statement in traverse_string(). Remove unnecessary casts in cpy_*(), with tweaks from guenther@; ok bcook@ jsing@ guenther@
2014-09-19Add CHACHA20 as a cipher symmetric encryption alias.Joel Sing
From Ming <gzchenym at 126.com>
2014-09-19remove obfuscating parens. man operator is your friend.Ted Unangst
2014-09-07Remove SSL_kDHr, SSL_kDHd and SSL_aDH. No supported ciphersuites use them,Joel Sing
nor do we plan on supporting them. ok guenther@
2014-08-26Move openssl(1) from /usr/sbin/openssl to /usr/bin/openssl, since it is notJoel Sing
a system/superuser binary. At the same time, move the source code from its current lib/libssl/src/apps location to a more appropriate home under usr.bin/openssl. ok deraadt@ miod@
2014-08-24constify strerror return valueBrent Cook
There is no intention to modify the string returned by strerror and doing so is forbidden by the standard. from Jonas 'Sortie' Termansen ok tedu@ deraadt@
2014-08-24Include <sys/time.h> to get struct timevalBrent Cook
The crypto/bio/bss_dgram.c file assumes that another file indirectly includes <stdlib.h> that includes <sys/time.h>. from Jonas 'Sortie' Termansen ok deraadt@ tedu@
2014-08-24Include <sys/select.h> to get selectBrent Cook
These files currently depends on the wrapper <stdlib.h> file indirectly including a header that provides select(). from Jonas 'Sortie' Termansen ok deraadt@ tedu@
2014-08-24Let SSL_CIPHER_description() allocate the buffer for the description,Joel Sing
rather than passing in a fixed size buffer. This is yet another example of a horribly designed API - if the given buffer is NULL then SSL_CIPHER_description() allocates one for us (great!), which we then need to free (no problem). However, if this allocation fails it returns a pointer to a static string "OPENSSL_malloc Error" - obviously bad things happen if we call free() with this pointer. Unfortunately, there is no way of knowing that the function failed, other than comparing the returned string against the string literal - so do that before calling free()... Joint work with beck@ during g2k14.
2014-08-24Replace the remaining uses of ssl3_put_cipher_by_char() with s2n and aJoel Sing
ssl3_cipher_get_value() helper function, which returns the cipher suite value for the given cipher. ok miod@