Skip to content

Commit

Permalink
Release 1.19.5
Browse files Browse the repository at this point in the history
- [BUGFIX] Use correct public key from PUBS based on KEXS index.
- [BUGFIX] Check flags before dispatching writes, avoiding assert.
- [BUGFIX] Set :scheme to "https" (instead of "HTTP").
  • Loading branch information
Dmitri Tikhonov committed Mar 5, 2019
1 parent 90fe3b2 commit 8437e4a
Show file tree
Hide file tree
Showing 5 changed files with 68 additions and 16 deletions.
8 changes: 7 additions & 1 deletion CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
2019-02-15
2019-03-05
- 1.19.5
- [BUGFIX] Use correct public key from PUBS based on KEXS index.
- [BUGFIX] Check flags before dispatching writes, avoiding assert.
- [BUGFIX] Set :scheme to "https" (instead of "HTTP").

2019-02-25
- 1.19.4
- [BUGFIX] Check buffer bounds when looking up version in 0-RTT blob.
- [BUGFIX] http_client: don't fetch 0-rtt info if handshake failed.
Expand Down
2 changes: 1 addition & 1 deletion include/lsquic.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ extern "C" {

#define LSQUIC_MAJOR_VERSION 1
#define LSQUIC_MINOR_VERSION 19
#define LSQUIC_PATCH_VERSION 4
#define LSQUIC_PATCH_VERSION 5

/**
* Engine flags:
Expand Down
3 changes: 2 additions & 1 deletion src/liblsquic/lsquic_full_conn.c
Original file line number Diff line number Diff line change
Expand Up @@ -2655,7 +2655,8 @@ process_streams_write_events (struct full_conn *conn, int high_prio)

for (stream = lsquic_spi_first(&spi); stream && write_is_possible(conn);
stream = lsquic_spi_next(&spi))
lsquic_stream_dispatch_write_events(stream);
if (stream->stream_flags & STREAM_WRITE_Q_FLAGS)
lsquic_stream_dispatch_write_events(stream);

maybe_conn_flush_headers_stream(conn);
}
Expand Down
69 changes: 57 additions & 12 deletions src/liblsquic/lsquic_handshake.c
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ typedef struct hs_ctx_st

struct lsquic_str csct;
struct lsquic_str crt; /* compressed certs buffer */
struct lsquic_str scfg_pubs; /* Need to copy PUBS, as KEXS comes after it */
} hs_ctx_t;


Expand Down Expand Up @@ -450,6 +451,7 @@ lsquic_enc_session_destroy (lsquic_enc_session_t *enc_session)
lsquic_str_d(&hs_ctx->prof);
lsquic_str_d(&hs_ctx->csct);
lsquic_str_d(&hs_ctx->crt);
lsquic_str_d(&hs_ctx->scfg_pubs);
lsquic_str_d(&enc_session->chlo);
lsquic_str_d(&enc_session->sstk);
lsquic_str_d(&enc_session->ssno);
Expand Down Expand Up @@ -586,18 +588,10 @@ static int parse_hs_data (lsquic_enc_session_t *enc_session, uint32_t tag,
break;

case QTAG_PUBS:
/* FIXME:Server side may send a list of pubs,
* we support only ONE kenx now.
* REJ is 35 bytes, SHLO is 32 bytes
* Only save other peer's pubs to hs_ctx
*/
if( len < 32)
break;
memcpy(hs_ctx->pubs, val + (len - 32), 32);
if (head_tag == QTAG_SCFG)
{
memcpy(enc_session->info->spubs, hs_ctx->pubs, 32);
}
lsquic_str_setto(&hs_ctx->scfg_pubs, val, len);
else if (len == 32)
memcpy(hs_ctx->pubs, val, len);
break;

case QTAG_RCID:
Expand Down Expand Up @@ -647,7 +641,58 @@ static int parse_hs_data (lsquic_enc_session_t *enc_session, uint32_t tag,
break;

case QTAG_KEXS:
enc_session->info->kexs = get_tag_value_i32(val, len);
{
if (head_tag == QTAG_SCFG && 0 == len % 4)
{
const unsigned char *p, *end;
unsigned pub_idx, idx;

for (p = val; p < val + len; p += 4)
if (0 == memcmp(p, "C255", 4))
{
memcpy(&enc_session->info->kexs, p, 4);
pub_idx = (p - val) / 4;
LSQ_DEBUG("Parsing SCFG: supported KEXS C255 at "
"index %u", pub_idx);
break;
}
if (p >= val + len)
{
LSQ_INFO("supported KEXS not found, trouble ahead");
break;
}
if (lsquic_str_len(&hs_ctx->scfg_pubs) > 0)
{
p = (const unsigned char *)
lsquic_str_cstr(&hs_ctx->scfg_pubs);
end = p + lsquic_str_len(&hs_ctx->scfg_pubs);

for (idx = 0; p < end; ++idx)
{
uint32_t sz = 0;
if (p + 3 > end)
break;
sz |= *p++;
sz |= *p++ << 8;
sz |= *p++ << 16;
if (p + sz > end)
break;
if (idx == pub_idx)
{
if (sz == 32)
{
memcpy(hs_ctx->pubs, p, 32);
memcpy(enc_session->info->spubs, p, 32);
}
break;
}
p += sz;
}
}
else
LSQ_INFO("No PUBS from SCFG to parse");
}
}
break;

case QTAG_NONC:
Expand Down
2 changes: 1 addition & 1 deletion test/http_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -506,7 +506,7 @@ send_headers (lsquic_stream_ctx_t *st_h)
},
{
.name = { .iov_base = ":scheme", .iov_len = 7, },
.value = { .iov_base = "HTTP", .iov_len = 4, }
.value = { .iov_base = "https", .iov_len = 5, }
},
{
.name = { .iov_base = ":path", .iov_len = 5, },
Expand Down

0 comments on commit 8437e4a

Please sign in to comment.