X509_VERIFY_PARAM_set1_name(): if invoked with NULL as the second
parameter, correctly set param->name to NULL after having freed it.
ok bcook@
X509_NAME_get_text_by_OBJ(): make sure we do not pass a negative size to
memcpy().
ok bcook@
check_cert(): be sure to reset ctx->current_crl to NULL before freeing it.

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@
When freeing the config, explicitly call ressl_config_clear_keys() rather
than rerolling our own key clearing code.

ok tedu@
Add an option that allows the enabled SSL protocols to be explicitly
configured.

Discussed with several.

ok bcook@
Move cipher configuration handling to the shared SSL configuration function
so that applies to both the ressl client and server.
Previous fix (1.12) would cause a NULL pointer dereference in the error path
if a NULL stack was passed as argument. Fix this by returning NULL early in
that case.
Clean up EC cipher handling in ssl3_choose_cipher().

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@
Switch "openssl req" to using SHA256 for hashes and AES256 to encrypt on-disk
keys by default (instead of SHA1/3DES) and update documentation to match.

Another way to do this is s/NID_sha1/NID_sha256/ in src/crypto/rsa/rsa_ameth.c
("case ASN1_PKEY_CTRL_DEFAULT_MD_NID") but going with the more targetted method
above that only affects "openssl req" for now.

Help/OK jsing@. OKs on earlier diffs changing openssl.cnf from phessler@ aja@
openssl.cnf tweaks following recent changes to usr.bin/openssl:

- don't define default_bits, allowing the compiled-in default (now 2048
bits) to take priority.

- add commented-out default_md line in case somebody needs an easy way
to change this.

- remove some sample sections which aren't really useful in the default
file (/etc/examples is the place for a more descriptive config, this
file should be barebones).

Help/OK jsing@. OKs on earlier diff (openssl.cnf only) from phessler@ aja@.
Use string literals in printf style calls so gcc's -Wformat works.

ok tedu@, miod@
Add support for automatic ephemeral EC keys.

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@
Allow "auto" to be specified as an ECDH curve name and make this the
default. This enables automatic handling of ephemeral EC keys.

Discussed with reyk@ and tedu@
allow disabling hostname and cert verification separately.
if you're careful, cert only verification can be useful.
always enable both though, to avoid accidentally leaving one off.
ok jsing
Bump minor version for ECDH auto.

While there are no additional symbols, there is an additional command that
clients will potentially depend on.
Bump minor for ECHD auto and other recent changes.
verify changes are major change
Make tls1_get_formatlist() behave the same as tls1_get_curvelist() and
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@
Use tls1_get_curvelist() in ssl_add_clienthello_tlsext(), rather than
hand rolling the same code.

ok miod@
Use more specific curves/formats naming for local variables in
ssl_add_clienthello_tlsext() and ssl_add_serverhello_tlsext(), rather than
the current generic naming.

ok miod@