src/coap_openssl.c: Fix broken ASN1 setup in coap_dtls_context_set_pki()
src/coap_openssl.c: Fix broken ASN1 setup in coap_dtls_context_set_pki()

coap_dtls_pki_t struct has been enhanced to have more configuration options.
These configuruation options then tell libcoap what needs to get checked by
the underlying OpenSSL library rather than the user application has to do it.
There still is support for the user application to do all the Certificate
checking etc.

A late change to the PKI Pull request got missed for the TLS case
in coap_dtls_context_set_pki() for the mapping of private key types to
the OpenSSL version.  Have now pulled common DTLS and TLS code into a seperate
function

Fixed coap_(d)tls_free_session to not shut down a session that is not yet
fully started, as well as calling SSL_shutdown() twice if appropriate
The ssl parameter is set to NULL after closedown

Made coap_dtls_context_set_psk() smarter in what was updated, depending on
whether called by a client or server

Make sure that coap_dtls_psk_client_callback is defined in
coap_dtls_context_set_psk() in case coap_dtls_context_set_pki() was called
first.  This fixes the first time issue after startup where a PSK client
was unable to establish a DTLS session - subsequent times were successful

Added in a set of callbacks, invoked from coap_dtls_context_set_pki(), so that
a server can differentiate between an incoming PSK or PKI connection request.
These are only invoked if no full_call_back was defined in the setup_data

Add in a set of user definable callbacs for checking CN and SNI provided
information

Add in support for the generation and detection of ALPN externsion

Output error message if PKI or PSK was not set up before a server endpoint was
set up and (D)TLS is being used.

Allow a client to talk to a server that is PKI enabled without the need for
a PreShared Key or PKI Certificate

Set the SSL information at the SSL, not the CTX level when it is a client

authmillenon/libcoap,authmillenon/libcoap,authmillenon/libcoap