AC works with GnuTLS 3 now.

No certifacte verification and no psk supprt for now.

FossilOrigin-Name: 3809cff8b383f71541f4324949d9f89dc1db56aacada12bd45ba9a28b2b39cca
This commit is contained in:
7u83@mail.ru
2015-02-08 10:42:01 +00:00
parent 843d10055e
commit 36d5368316
15 changed files with 244 additions and 100 deletions

View File

@ -37,33 +37,37 @@ int dtls_bio_read(struct conn *conn, char *out, int maxlen)
memcpy(out, conn->dtls_buffer + conn->dtls_buffer_pos, maxlen);
conn->dtls_buffer_len -= maxlen;
conn->dtls_buffer_pos += maxlen;
cw_dbg(DBG_DTLS_BIO, "SSL BIO read: (maxlen = %d), remain %d", maxlen,conn->dtls_buffer_len);
cw_dbg_dmp(DBG_DTLS_BIO_DMP,(uint8_t*)out,maxlen,"Dump...");
cw_dbg(DBG_DTLS_BIO, "SSL BIO read: (maxlen = %d), read %d, remain %d", maxlen,
maxlen, conn->dtls_buffer_len);
cw_dbg_dmp(DBG_DTLS_BIO_DMP, (uint8_t *) out, maxlen, "Dump...");
return maxlen;
}
memcpy(out, conn->dtls_buffer + conn->dtls_buffer_pos, conn->dtls_buffer_len);
int ret = conn->dtls_buffer_len;
conn->dtls_buffer_len = 0;
cw_dbg(DBG_DTLS_BIO, "SSL BIO read: (maxlen = %d), remain %d", ret,conn->dtls_buffer_len);
cw_dbg_dmp(DBG_DTLS_BIO_DMP,(uint8_t*)out,ret,"Dump...");
cw_dbg(DBG_DTLS_BIO, "SSL BIO read: (maxlen = %d), read %d, remain %d", maxlen, ret,
conn->dtls_buffer_len);
cw_dbg_dmp(DBG_DTLS_BIO_DMP, (uint8_t *) out, ret, "Dump...");
return ret;
}
int dtls_bio_write(struct conn * conn, const char *data, int len)
int dtls_bio_write(struct conn *conn, const char *data, int len)
{
uint8_t buffer[2048];
*((uint32_t *) buffer) = htonl(1 << 24);
memcpy(buffer + 4, data, len);
int rc = conn->send_packet(conn, buffer, len + 4);
if (rc>=0)
rc-=4;
cw_dbg(DBG_DTLS_BIO, "SSL BIO write: %d bytes, rc=%d, ptr: %p", len, rc, data);
cw_dbg_dmp(DBG_DTLS_BIO_DMP,(uint8_t*)data,len,"Dump ...");
cw_dbg(DBG_DTLS_BIO, "SSL BIO write: %d bytes, wrote=%d, ptr: %p", len, rc, data);
cw_dbg_dmp(DBG_DTLS_BIO_DMP, (uint8_t *) data, len, "Dump ...");
if (rc < 0)
return rc;
return rc - 4;
return rc ;
}