Add space for new DTLS fields in handshake
diff --git a/library/ssl_srv.c b/library/ssl_srv.c
index 5ab626a..07bbd3d 100644
--- a/library/ssl_srv.c
+++ b/library/ssl_srv.c
@@ -354,7 +354,7 @@
#if defined(POLARSSL_SSL_SERVER_NAME_INDICATION)
/*
* Wrapper around f_sni, allowing use of ssl_set_own_cert() but
- * making it act on ssl->hanshake->sni_key_cert instead.
+ * making it act on ssl->handshake->sni_key_cert instead.
*/
static int ssl_sni_wrapper( ssl_context *ssl,
const unsigned char* name, size_t len )
@@ -1206,6 +1206,19 @@
ssl->handshake->update_checksum( ssl, buf, n );
/*
+ * For DTLS, we move data so that is looks like TLS handshake format
+ */
+#if defined(POLARSSL_SSL_PROTO_DTLS)
+ if( ssl->transport == SSL_TRANSPORT_DATAGRAM )
+ {
+ // TODO: DTLS: actually use the additional fields before removing them!
+
+ memmove( buf + 4, buf + 12, n - 12 );
+ n -= 8;
+ }
+#endif /* POLARSSL_SSL_PROTO_DTLS */
+
+ /*
* SSL layer:
* 0 . 0 handshake type
* 1 . 3 handshake length