More KNF.
There is no point in checking if a pointer is non-NULL before calling free,
since free already does this for us. Also remove some pointless NULL
assignments, where the result from malloc(3) is immediately assigned to the
same variable.

ok miod@
EVP_MD_CTX_create() calls malloc and can return NULL. However, only one of
the calls in libssl actually checks the return value before using it. Add
NULL checks for the remaining three calls.

ok miod@
Refactor tls1_change_cipher_state() and split the compression handling out
from the cipher and message digest handling, allowing for upcoming changes.

Based on Adam Langley's chromium diffs.

ok miod@
More KNF.
Add missing NULL checks for calls to ssl_replace_hash(). This function
calls EVP_MD_CTX_create(), which will return NULL if it fails to allocate
memory.

ok miod@
initialize variable that can be used uninitialized

If EVP_DecryptInit_ex() returns NULL, j is incremented by a random amount.

clang warning:
pem/pem_lib.c:472:6: error: variable 'i' is used uninitialized whenever 'if' condition is false
      [-Werror,-Wsometimes-uninitialized]
        if (o)
            ^
pem/pem_lib.c:479:7: note: uninitialized use occurs here
        j += i;
             ^
pem/pem_lib.c:472:2: note: remove the 'if' if its condition is always true
        if (o)
        ^~~~~~
pem/pem_lib.c:446:7: note: initialize the variable 'i' to silence this warning
        int i, j, o, klen;
fix type string conversion warning

ASN1_STRING_data returns an unsigned char *, but strlcat's second
parameter is a const char *
remove unused static datastructures

Neither of these is used anywhere within their object files.
do not include public headers as though they are local

Avoid having to use -I trickery to find public header files included as
though they are private.
do not pretend to support -rand in apps

Remove support for parsing the unused -rand option and the unused random
buffer variables.
use BIO_write instead of an unchecked write()

write() warns if its return value is unchecked. Replace with a BIO_write
like all of the surrounding code uses anyway.
sort out pqueue moving to a private interface

 adjust include
 avoid duplication of pqueue typedef