dtls: move the converting of ecc keys to dtls.c

The next step is to check the size of the key and make it possible to
encode it in the smallest form possible like it is enforced by the
ANS.1 standard.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
dtls: add handshake header after creating the content

In some cases we will not know how big a handshake message will be
before sending it. The handshake header should be added to the message
after the message body was created. This also reduces the code size.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>