formatting
ok bcook@
missing \
Provide LIBRESSL_VERSION_NUMBER for people who use such things to
detect versions distinct from OPENSSL_BLAH_WOOF..
ok jsing@ tedu@ deraadt@
As reported by David Ramos, most consumer of ssl_get_message() perform late
bounds check, after reading the 2-, 3- or 4-byte size of the next chunk to
process. But the size fields themselves are not checked for being entirely
contained in the buffer.

Since reading past your bounds is bad practice, and may not possible if you
are using a secure memory allocator, we need to add the necessary bounds check,
at the expense of some readability.

As a bonus, a wrong size GOST session key will now trigger an error instead of
a printf to stderr and it being handled as if it had the correct size.

Creating this diff made my eyes bleed (in the real sense); reviewing it
made guenther@'s and beck@'s eyes bleed too (in the literal sense).

ok guenther@ beck@
enough churn, a crank is advised by guenther..
-DOPENSSL_NO_KRB5 is no longer needed
ok guenther
Make disabling last cipher work.
From Thijs Alkemade via OpenSSL trunk
ok miod@
Place comments in a block above the if statement, rather than attempting
to interleave them within the conditions. Also fix wrapping and
indentation.
typos
Remove remnants from PSK, KRB5 and SRP.

ok beck@ miod@
Principle of least surprise: make CMAC_CTX_free(), OCSP_REQ_CTX_free() and
X509_STORE_CTX_free() accept NULL pointers as input without dereferencing them,
like all the other well-behaved *_CTX_free() functions do.
if (x) FOO_free(x) -> FOO_free(x).
Improves readability, keeps the code smaller so that it is warmer in your
cache.

review & ok deraadt@
Make sure the return value of X509_NAME_oneline(, NULL,) is checked against
NULL.
ok deraadt@ guenther@ jsing@
A few fixes/improvements:
- first, BN_free == BN_clear_free in our libcrypto, so we do not need to
  treat CBIGNUM (crypto BN) separately from BIGNUM (regular BN).
- then, in bn_i2c(), since BN_bn2bin returns BN_num_bytes(input), take
  advantage of this to avoid calling BN_num_bytes() a second time.
  BN_num_bytes() is cheap, but this not a reason to perform redundant
  work.
- finally, in bn_c2i, if bn_new() fails, return early. Otherwise
  BN_bin2bn will try to create a BN too, and although this will probably
  fail since we were already out of memory, if we are on a threaded
  process and suddenly the allocation succeeds, we will leak it since it
  will never be stored in *pval.

ok jsing@
jsing and I are investigating removal of all? most? 'getenv from library'
instances.  This one for OPENSSL_ALLOW_PROXY_CERTS gets turned off first,
especially since it had this special comment:
/* A hack to keep people who don't want to modify their software happy */
ok beck jsing
openssl(1) is only built as a single monolithic binary, so just call
load_config() once when we start.

ok miod@
need_cert is now always true, so remove the variable and associated
conditionals.

ok miod@
Remove extra parenthesis.
Make the BLOCK_CIPHER_{generic,custom} macros expand to more readable struct
definitions using C99 field initializers. No functional change.
In openssl_startup(), call SSL_library_init() and SSL_load_error_strings().
This allows us to remove the ERR_load_crypto_strings() call, along with
the various SSL_load_error_strings() and OpenSSL_add_ssl_algorithms()
calls scattered around the place.

ok beck@