To read early data with AWS-LC (and BoringSSL), we have to use
SSL_read(). But SSL_read() will also try to do the handshake if it
hasn't been done yet, and at some point will do the handshake and will
return data that are actually not early data. So use SSL_in_early_data()
to make sure that the data we received are actually early data, and only
if so add the CO_FL_EARLY_DATA flag. Otherwise any data first received will be
considered early, and a Early-data header will be added.
As this bug was introduced by
76ba026548975a6d1bc23d1344807c64d994bf1e,
it should be backported with it.
ret = SSL_read(ctx->ssl, b_tail(&ctx->early_buf),
b_room(&ctx->early_buf));
if (ret > 0) {
- conn->flags |= CO_FL_EARLY_DATA;
+ if (SSL_in_early_data(ctx->ssl))
+ conn->flags |= CO_FL_EARLY_DATA;
b_add(&ctx->early_buf, ret);
} else {
int err = SSL_get_error(ctx->ssl, ret);