OPENSSL_free(sc->psksession_id);
sc->psksession_id = NULL;
sc->psksession_id_len = 0;
- sc->hello_retry_request = 0;
+ sc->hello_retry_request = SSL_HRR_NONE;
sc->sent_tickets = 0;
sc->error = 0;
ossl_statem_clear(sc);
- /* TODO(QUIC): Version handling not yet clear */
sc->version = s->method->version;
sc->client_version = sc->version;
sc->rwstate = SSL_NOTHING;
{
STACK_OF(SSL_CIPHER) *sk;
+ if (IS_QUIC_CTX(ctx)) {
+ ERR_raise(ERR_LIB_SSL, SSL_R_WRONG_SSL_VERSION);
+ return 0;
+ }
+
ctx->method = meth;
if (!SSL_CTX_set_ciphersuites(ctx, OSSL_default_ciphersuites())) {
{
ssl->type = type;
- ssl->references = 1;
ssl->lock = CRYPTO_THREAD_lock_new();
if (ssl->lock == NULL)
return 0;
+ if (!CRYPTO_NEW_REF(&ssl->references, 1)) {
+ CRYPTO_THREAD_lock_free(ssl->lock);
+ return 0;
+ }
+
if (!CRYPTO_new_ex_data(CRYPTO_EX_INDEX_SSL, ssl, &ssl->ex_data)) {
CRYPTO_THREAD_lock_free(ssl->lock);
+ CRYPTO_FREE_REF(&ssl->references);
ssl->lock = NULL;
return 0;
}
RECORD_LAYER_init(&s->rlayer, s);
s->options = ctx->options;
+
s->dane.flags = ctx->dane.flags;
if (method->version == ctx->method->version) {
s->min_proto_version = ctx->min_proto_version;
s->max_proto_version = ctx->max_proto_version;
}
+
s->mode = ctx->mode;
s->max_cert_list = ctx->max_cert_list;
s->max_early_data = ctx->max_early_data;
s->recv_max_early_data = ctx->recv_max_early_data;
+
s->num_tickets = ctx->num_tickets;
s->pha_enabled = ctx->pha_enabled;
if (s->param == NULL)
goto asn1err;
X509_VERIFY_PARAM_inherit(s->param, ctx->param);
- s->quiet_shutdown = ctx->quiet_shutdown;
+ s->quiet_shutdown = IS_QUIC_CTX(ctx) ? 0 : ctx->quiet_shutdown;
+
+ if (!IS_QUIC_CTX(ctx))
+ s->ext.max_fragment_len_mode = ctx->ext.max_fragment_len_mode;
- s->ext.max_fragment_len_mode = ctx->ext.max_fragment_len_mode;
s->max_send_fragment = ctx->max_send_fragment;
s->split_send_fragment = ctx->split_send_fragment;
s->max_pipelines = ctx->max_pipelines;
s->key_update = SSL_KEY_UPDATE_NONE;
- s->allow_early_data_cb = ctx->allow_early_data_cb;
- s->allow_early_data_cb_data = ctx->allow_early_data_cb_data;
+ if (!IS_QUIC_CTX(ctx)) {
+ s->allow_early_data_cb = ctx->allow_early_data_cb;
+ s->allow_early_data_cb_data = ctx->allow_early_data_cb_data;
+ }
if (!method->ssl_init(ssl))
goto sslerr;
{
int i;
- if (CRYPTO_UP_REF(&s->references, &i, s->lock) <= 0)
+ if (CRYPTO_UP_REF(&s->references, &i) <= 0)
return 0;
REF_PRINT_COUNT("SSL", s);
if (s == NULL)
return;
- CRYPTO_DOWN_REF(&s->references, &i, s->lock);
+ CRYPTO_DOWN_REF(&s->references, &i);
REF_PRINT_COUNT("SSL", s);
if (i > 0)
return;
SSL_CTX_free(s->ctx);
CRYPTO_THREAD_lock_free(s->lock);
+ CRYPTO_FREE_REF(&s->references);
OPENSSL_free(s);
}
}
#ifndef OPENSSL_NO_SOCK
+static const BIO_METHOD *fd_method(SSL *s)
+{
+#ifndef OPENSSL_NO_DGRAM
+ if (IS_QUIC(s))
+ return BIO_s_datagram();
+#endif
+
+ return BIO_s_socket();
+}
+
int SSL_set_fd(SSL *s, int fd)
{
int ret = 0;
BIO *bio = NULL;
- bio = BIO_new(BIO_s_socket());
+ if (s->type == SSL_TYPE_QUIC_XSO) {
+ ERR_raise(ERR_LIB_SSL, SSL_R_CONN_USE_ONLY);
+ goto err;
+ }
+
+ bio = BIO_new(fd_method(s));
if (bio == NULL) {
ERR_raise(ERR_LIB_SSL, ERR_R_BUF_LIB);
int SSL_set_wfd(SSL *s, int fd)
{
BIO *rbio = SSL_get_rbio(s);
+ int desired_type = IS_QUIC(s) ? BIO_TYPE_DGRAM : BIO_TYPE_SOCKET;
+
+ if (s->type == SSL_TYPE_QUIC_XSO) {
+ ERR_raise(ERR_LIB_SSL, SSL_R_CONN_USE_ONLY);
+ return 0;
+ }
- if (rbio == NULL || BIO_method_type(rbio) != BIO_TYPE_SOCKET
+ if (rbio == NULL || BIO_method_type(rbio) != desired_type
|| (int)BIO_get_fd(rbio, NULL) != fd) {
- BIO *bio = BIO_new(BIO_s_socket());
+ BIO *bio = BIO_new(fd_method(s));
if (bio == NULL) {
ERR_raise(ERR_LIB_SSL, ERR_R_BUF_LIB);
int SSL_set_rfd(SSL *s, int fd)
{
BIO *wbio = SSL_get_wbio(s);
+ int desired_type = IS_QUIC(s) ? BIO_TYPE_DGRAM : BIO_TYPE_SOCKET;
+
+ if (s->type == SSL_TYPE_QUIC_XSO) {
+ ERR_raise(ERR_LIB_SSL, SSL_R_CONN_USE_ONLY);
+ return 0;
+ }
- if (wbio == NULL || BIO_method_type(wbio) != BIO_TYPE_SOCKET
+ if (wbio == NULL || BIO_method_type(wbio) != desired_type
|| ((int)BIO_get_fd(wbio, NULL) != fd)) {
- BIO *bio = BIO_new(BIO_s_socket());
+ BIO *bio = BIO_new(fd_method(s));
if (bio == NULL) {
ERR_raise(ERR_LIB_SSL, ERR_R_BUF_LIB);
void SSL_set_read_ahead(SSL *s, int yes)
{
- SSL_CONNECTION *sc = SSL_CONNECTION_FROM_SSL(s);
+ SSL_CONNECTION *sc = SSL_CONNECTION_FROM_SSL_ONLY(s);
OSSL_PARAM options[2], *opts = options;
if (sc == NULL)
int SSL_get_read_ahead(const SSL *s)
{
- const SSL_CONNECTION *sc = SSL_CONNECTION_FROM_CONST_SSL(s);
+ const SSL_CONNECTION *sc = SSL_CONNECTION_FROM_CONST_SSL_ONLY(s);
if (sc == NULL)
return 0;
* the records for some reason.
*/
const SSL_CONNECTION *sc;
-#ifndef OPENSSL_NO_QUIC
- const QUIC_CONNECTION *qc = QUIC_CONNECTION_FROM_CONST_SSL(s);
- if (qc != NULL)
+#ifndef OPENSSL_NO_QUIC
+ if (IS_QUIC(s))
return ossl_quic_has_pending(s);
#endif
-
sc = SSL_CONNECTION_FROM_CONST_SSL(s);
/* Check buffered app data if any first */
int SSL_copy_session_id(SSL *t, const SSL *f)
{
int i;
- /* TODO(QUIC): Do we want to support this for QUIC connections? */
+ /* TODO(QUIC FUTURE): Not allowed for QUIC currently. */
SSL_CONNECTION *tsc = SSL_CONNECTION_FROM_SSL_ONLY(t);
const SSL_CONNECTION *fsc = SSL_CONNECTION_FROM_CONST_SSL_ONLY(f);
return 0;
}
- CRYPTO_UP_REF(&fsc->cert->references, &i, fsc->cert->lock);
+ CRYPTO_UP_REF(&fsc->cert->references, &i);
ssl_cert_free(tsc->cert);
tsc->cert = fsc->cert;
if (!SSL_set_session_id_context(t, fsc->sid_ctx, (int)fsc->sid_ctx_length)) {
int ret;
SSL_CONNECTION *sc = SSL_CONNECTION_FROM_SSL_ONLY(s);
- /* TODO(QUIC): This will need special handling for QUIC */
- if (sc == NULL)
- return 0;
-
- if (!sc->server) {
+ /* TODO(QUIC 0RTT): 0-RTT support */
+ if (sc == NULL || !sc->server) {
ERR_raise(ERR_LIB_SSL, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
return SSL_READ_EARLY_DATA_ERROR;
}
{
const SSL_CONNECTION *sc = SSL_CONNECTION_FROM_CONST_SSL_ONLY(s);
- /* TODO(QUIC): This will need special handling for QUIC */
+ /* TODO(QUIC 0RTT): 0-RTT support */
if (sc == NULL)
return 0;
uint32_t partialwrite;
SSL_CONNECTION *sc = SSL_CONNECTION_FROM_SSL_ONLY(s);
- /* TODO(QUIC): This will need special handling for QUIC */
+ /* TODO(QUIC 0RTT): This will need special handling for QUIC */
if (sc == NULL)
return 0;
* (see ssl3_shutdown).
*/
SSL_CONNECTION *sc = SSL_CONNECTION_FROM_SSL(s);
-#ifndef OPENSSL_NO_QUIC
- QUIC_CONNECTION *qc = QUIC_CONNECTION_FROM_SSL(s);
- if (qc != NULL)
+#ifndef OPENSSL_NO_QUIC
+ if (IS_QUIC(s))
return ossl_quic_conn_shutdown(s, 0, NULL, 0);
#endif
{
SSL_CONNECTION *sc = SSL_CONNECTION_FROM_SSL(s);
+#ifndef OPENSSL_NO_QUIC
+ if (IS_QUIC(s))
+ return ossl_quic_key_update(s, updatetype);
+#endif
+
if (sc == NULL)
return 0;
{
const SSL_CONNECTION *sc = SSL_CONNECTION_FROM_CONST_SSL(s);
+#ifndef OPENSSL_NO_QUIC
+ if (IS_QUIC(s))
+ return ossl_quic_get_key_update_type(s);
+#endif
+
if (sc == NULL)
return 0;
}
long SSL_ctrl(SSL *s, int cmd, long larg, void *parg)
+{
+ return ossl_ctrl_internal(s, cmd, larg, parg, /*no_quic=*/0);
+}
+
+long ossl_ctrl_internal(SSL *s, int cmd, long larg, void *parg, int no_quic)
{
long l;
SSL_CONNECTION *sc = SSL_CONNECTION_FROM_SSL(s);
- /* TODO(QUIC): Special handling for some ctrls will be needed */
- if (sc == NULL)
- return 0;
+ /*
+ * Routing of ctrl calls for QUIC is a little counterintuitive:
+ *
+ * - Firstly (no_quic=0), we pass the ctrl directly to our QUIC
+ * implementation in case it wants to handle the ctrl specially.
+ *
+ * - If our QUIC implementation does not care about the ctrl, it
+ * will reenter this function with no_quic=1 and we will try to handle
+ * it directly using the QCSO SSL object stub (not the handshake layer
+ * SSL object). This is important for e.g. the version configuration
+ * ctrls below, which must use s->defltmeth (and not sc->defltmeth).
+ *
+ * - If we don't handle a ctrl here specially, then processing is
+ * redirected to the handshake layer SSL object.
+ */
+ if (!no_quic && IS_QUIC(s))
+ return s->method->ssl_ctrl(s, cmd, larg, parg);
switch (cmd) {
case SSL_CTRL_GET_READ_AHEAD:
RECORD_LAYER_set_read_ahead(&sc->rlayer, larg);
return l;
- case SSL_CTRL_SET_MSG_CALLBACK_ARG:
- sc->msg_callback_arg = parg;
- return 1;
-
case SSL_CTRL_MODE:
{
OSSL_PARAM options[2], *opts = options;
case SSL_CTRL_GET_MAX_PROTO_VERSION:
return sc->max_proto_version;
default:
- return s->method->ssl_ctrl(s, cmd, larg, parg);
+ if (IS_QUIC(s))
+ return SSL_ctrl((SSL *)sc, cmd, larg, parg);
+ else
+ return s->method->ssl_ctrl(s, cmd, larg, parg);
}
}
long SSL_callback_ctrl(SSL *s, int cmd, void (*fp) (void))
{
- SSL_CONNECTION *sc = SSL_CONNECTION_FROM_SSL(s);
-
- if (sc == NULL)
- return 0;
-
- switch (cmd) {
- case SSL_CTRL_SET_MSG_CALLBACK:
- sc->msg_callback = (void (*)
- (int write_p, int version, int content_type,
- const void *buf, size_t len, SSL *ssl,
- void *arg))(fp);
- return 1;
-
- default:
- return s->method->ssl_callback_ctrl(s, cmd, fp);
- }
+ return s->method->ssl_callback_ctrl(s, cmd, fp);
}
LHASH_OF(SSL_SESSION) *SSL_CTX_sessions(SSL_CTX *ctx)
if (sk_SSL_CIPHER_find(srvrsk, c) < 0)
continue;
- n = strlen(c->name);
- if (n + 1 > size) {
+ n = OPENSSL_strnlen(c->name, size);
+ if (n >= size) {
if (p != buf)
--p;
*p = '\0';
return buf;
}
- strcpy(p, c->name);
+ memcpy(p, c->name, n);
p += n;
*(p++) = ':';
size -= n + 1;
SSL_CTX_npn_advertised_cb_func cb,
void *arg)
{
+ if (IS_QUIC_CTX(ctx))
+ /* NPN not allowed for QUIC */
+ return;
+
ctx->ext.npn_advertised_cb = cb;
ctx->ext.npn_advertised_cb_arg = arg;
}
SSL_CTX_npn_select_cb_func cb,
void *arg)
{
+ if (IS_QUIC_CTX(ctx))
+ /* NPN not allowed for QUIC */
+ return;
+
ctx->ext.npn_select_cb = cb;
ctx->ext.npn_select_cb_arg = arg;
}
if (!OPENSSL_init_ssl(OPENSSL_INIT_LOAD_SSL_STRINGS, NULL))
return NULL;
+ /* Doing this for the run once effect */
if (SSL_get_ex_data_X509_STORE_CTX_idx() < 0) {
ERR_raise(ERR_LIB_SSL, SSL_R_X509_VERIFICATION_SETUP_PROBLEMS);
goto err;
}
+
ret = OPENSSL_zalloc(sizeof(*ret));
if (ret == NULL)
- goto err;
+ return NULL;
/* Init the reference counting before any call to SSL_CTX_free */
- ret->references = 1;
+ if (!CRYPTO_NEW_REF(&ret->references, 1)) {
+ OPENSSL_free(ret);
+ return NULL;
+ }
+
ret->lock = CRYPTO_THREAD_lock_new();
if (ret->lock == NULL) {
ERR_raise(ERR_LIB_SSL, ERR_R_CRYPTO_LIB);
{
int i;
- if (CRYPTO_UP_REF(&ctx->references, &i, ctx->lock) <= 0)
+ if (CRYPTO_UP_REF(&ctx->references, &i) <= 0)
return 0;
REF_PRINT_COUNT("SSL_CTX", ctx);
if (a == NULL)
return;
- CRYPTO_DOWN_REF(&a->references, &i, a->lock);
+ CRYPTO_DOWN_REF(&a->references, &i);
REF_PRINT_COUNT("SSL_CTX", a);
if (i > 0)
return;
OPENSSL_free(a->server_cert_type);
CRYPTO_THREAD_lock_free(a->lock);
+ CRYPTO_FREE_REF(&a->references);
#ifdef TSAN_REQUIRES_LOCKING
CRYPTO_THREAD_lock_free(a->tsan_lock);
#endif
int ret = 1;
SSL_CONNECTION *sc = SSL_CONNECTION_FROM_SSL(s);
- /* TODO(QUIC): Do we want this for QUIC? */
+ /* Not allowed for QUIC */
if (sc == NULL
- || (s->type != SSL_TYPE_SSL_CONNECTION && s->method != meth))
+ || (s->type != SSL_TYPE_SSL_CONNECTION && s->method != meth)
+ || (s->type == SSL_TYPE_SSL_CONNECTION && IS_QUIC_METHOD(meth)))
return 0;
if (s->method != meth) {
}
int SSL_get_error(const SSL *s, int i)
+{
+ return ossl_ssl_get_error(s, i, /*check_err=*/1);
+}
+
+int ossl_ssl_get_error(const SSL *s, int i, int check_err)
{
int reason;
unsigned long l;
* Make things return SSL_ERROR_SYSCALL when doing SSL_do_handshake etc,
* where we do encode the error
*/
- if ((l = ERR_peek_error()) != 0) {
+ if (check_err && (l = ERR_peek_error()) != 0) {
if (ERR_GET_LIB(l) == ERR_LIB_SYS)
return SSL_ERROR_SYSCALL;
else
return ssl_protocol_to_string(sc->version);
}
+__owur int SSL_get_handshake_rtt(const SSL *s, uint64_t *rtt)
+{
+ const SSL_CONNECTION *sc = SSL_CONNECTION_FROM_CONST_SSL(s);
+
+ if (sc == NULL)
+ return -1;
+ if (sc->ts_msg_write.t <= 0 || sc->ts_msg_read.t <= 0)
+ return 0; /* data not (yet) available */
+ if (sc->ts_msg_read.t < sc->ts_msg_write.t)
+ return -1;
+
+ *rtt = ossl_time2us(ossl_time_subtract(sc->ts_msg_read, sc->ts_msg_write));
+ return 1;
+}
+
static int dup_ca_names(STACK_OF(X509_NAME) **dst, STACK_OF(X509_NAME) *src)
{
STACK_OF(X509_NAME) *sk;
{
SSL *ret;
int i;
- /* TODO(QUIC): Add a SSL_METHOD function for duplication */
+ /* TODO(QUIC FUTURE): Add a SSL_METHOD function for duplication */
SSL_CONNECTION *retsc;
SSL_CONNECTION *sc = SSL_CONNECTION_FROM_SSL_ONLY(s);
/* If we're not quiescent, just up_ref! */
if (!SSL_in_init(s) || !SSL_in_before(s)) {
- CRYPTO_UP_REF(&s->references, &i, s->lock);
+ CRYPTO_UP_REF(&s->references, &i);
return s;
}
{
SSL_CONNECTION *sc = SSL_CONNECTION_FROM_SSL_ONLY(s);
- /* TODO(QUIC): Do we want this for QUIC? */
+ /* TODO(QUIC): Currently not supported for QUIC. */
if (sc == NULL)
return;
{
const SSL_CONNECTION *sc = SSL_CONNECTION_FROM_CONST_SSL_ONLY(s);
- /* TODO(QUIC): Do we want this for QUIC? */
+ /* TODO(QUIC): Currently not supported for QUIC. */
if (sc == NULL)
return 0;
if (s->type == SSL_TYPE_QUIC_CONNECTION || s->type == SSL_TYPE_QUIC_XSO)
return OSSL_QUIC1_VERSION;
#endif
- /* TODO(QUIC): Do we want to report QUIC version this way instead? */
if (sc == NULL)
return 0;
{
const SSL_CONNECTION *sc = SSL_CONNECTION_FROM_CONST_SSL(s);
- /* TODO(QUIC): Do we want to report QUIC version this way instead? */
+#ifndef OPENSSL_NO_QUIC
+ /* We only support QUICv1 - so if its QUIC its QUICv1 */
+ if (s->type == SSL_TYPE_QUIC_CONNECTION || s->type == SSL_TYPE_QUIC_XSO)
+ return OSSL_QUIC1_VERSION;
+#endif
if (sc == NULL)
return 0;
CERT *new_cert;
SSL_CONNECTION *sc = SSL_CONNECTION_FROM_SSL_ONLY(ssl);
- /* TODO(QUIC): Do we need this for QUIC support? */
+ /* TODO(QUIC FUTURE): Add support for QUIC */
if (sc == NULL)
return NULL;
{
const SSL_CONNECTION *sc = SSL_CONNECTION_FROM_CONST_SSL(s);
+#ifndef OPENSSL_NO_QUIC
+ if (IS_QUIC(s))
+ return ossl_quic_want(s);
+#endif
+
if (sc == NULL)
return SSL_NOTHING;
int SSL_CTX_set_block_padding(SSL_CTX *ctx, size_t block_size)
{
+ if (IS_QUIC_CTX(ctx) && block_size > 1)
+ return 0;
+
/* block size of 0 or 1 is basically no padding */
if (block_size == 1)
ctx->block_padding = 0;
size_t len, void *arg))
{
BIO *b;
- SSL_CONNECTION *sc = SSL_CONNECTION_FROM_SSL(ssl);
+ SSL_CONNECTION *sc = SSL_CONNECTION_FROM_SSL_ONLY(ssl);
if (sc == NULL)
return 0;
{
SSL_CONNECTION *sc = SSL_CONNECTION_FROM_SSL(ssl);
- if (sc == NULL)
+ if (sc == NULL || (IS_QUIC(ssl) && block_size > 1))
return 0;
/* block size of 0 or 1 is basically no padding */
{
const SSL_CONNECTION *sc = SSL_CONNECTION_FROM_CONST_SSL(s);
+#ifndef OPENSSL_NO_QUIC
+ if (IS_QUIC(s))
+ return ossl_quic_get_options(s);
+#endif
+
if (sc == NULL)
return 0;
uint64_t SSL_set_options(SSL *s, uint64_t op)
{
- SSL_CONNECTION *sc = SSL_CONNECTION_FROM_SSL(s);
+ SSL_CONNECTION *sc;
OSSL_PARAM options[2], *opts = options;
+#ifndef OPENSSL_NO_QUIC
+ if (IS_QUIC(s))
+ return ossl_quic_set_options(s, op);
+#endif
+
+ sc = SSL_CONNECTION_FROM_SSL(s);
if (sc == NULL)
return 0;
{
SSL_CONNECTION *sc = SSL_CONNECTION_FROM_SSL(s);
+#ifndef OPENSSL_NO_QUIC
+ if (IS_QUIC(s))
+ return ossl_quic_clear_options(s, op);
+#endif
+
if (sc == NULL)
return 0;
return NULL;
}
-static int ct_permissive(const CT_POLICY_EVAL_CTX * ctx,
+static int ct_permissive(const CT_POLICY_EVAL_CTX *ctx,
const STACK_OF(SCT) *scts, void *unused_arg)
{
return 1;
}
-static int ct_strict(const CT_POLICY_EVAL_CTX * ctx,
+static int ct_strict(const CT_POLICY_EVAL_CTX *ctx,
const STACK_OF(SCT) *scts, void *unused_arg)
{
int count = scts != NULL ? sk_SCT_num(scts) : 0;
return CTLOG_STORE_load_file(ctx->ctlog_store, path);
}
-void SSL_CTX_set0_ctlog_store(SSL_CTX *ctx, CTLOG_STORE * logs)
+void SSL_CTX_set0_ctlog_store(SSL_CTX *ctx, CTLOG_STORE *logs)
{
CTLOG_STORE_free(ctx->ctlog_store);
ctx->ctlog_store = logs;
int SSL_free_buffers(SSL *ssl)
{
RECORD_LAYER *rl;
- SSL_CONNECTION *sc = SSL_CONNECTION_FROM_SSL(ssl);
+ SSL_CONNECTION *sc = SSL_CONNECTION_FROM_SSL_ONLY(ssl);
if (sc == NULL)
return 0;
if (sc == NULL)
return 0;
+ /* QUIC always has buffers allocated. */
+ if (IS_QUIC(ssl))
+ return 1;
+
rl = &sc->rlayer;
return rl->rrlmethod->alloc_buffers(rl->rrl)
int SSL_set_max_early_data(SSL *s, uint32_t max_early_data)
{
- SSL_CONNECTION *sc = SSL_CONNECTION_FROM_SSL(s);
+ SSL_CONNECTION *sc = SSL_CONNECTION_FROM_SSL_ONLY(s);
if (sc == NULL)
return 0;
int SSL_set_recv_max_early_data(SSL *s, uint32_t recv_max_early_data)
{
- SSL_CONNECTION *sc = SSL_CONNECTION_FROM_SSL(s);
+ SSL_CONNECTION *sc = SSL_CONNECTION_FROM_SSL_ONLY(s);
if (sc == NULL)
return 0;
int SSL_stateless(SSL *s)
{
int ret;
- SSL_CONNECTION *sc = SSL_CONNECTION_FROM_SSL(s);
+ SSL_CONNECTION *sc = SSL_CONNECTION_FROM_SSL_ONLY(s);
- /* TODO(QUIC): This will need further work. */
if (sc == NULL)
return 0;
void SSL_set_post_handshake_auth(SSL *ssl, int val)
{
- SSL_CONNECTION *sc = SSL_CONNECTION_FROM_SSL(ssl);
+ SSL_CONNECTION *sc = SSL_CONNECTION_FROM_SSL_ONLY(ssl);
if (sc == NULL)
return;
{
SSL_CONNECTION *sc = SSL_CONNECTION_FROM_SSL(ssl);
+#ifndef OPENSSL_NO_QUIC
+ if (IS_QUIC(ssl)) {
+ ERR_raise(ERR_LIB_SSL, SSL_R_WRONG_SSL_VERSION);
+ return 0;
+ }
+#endif
+
if (sc == NULL)
return 0;
SSL_allow_early_data_cb_fn cb,
void *arg)
{
- SSL_CONNECTION *sc = SSL_CONNECTION_FROM_SSL(s);
+ SSL_CONNECTION *sc = SSL_CONNECTION_FROM_SSL_ONLY(s);
if (sc == NULL)
return;
}
/* QUIC-specific methods which are supported on QUIC connections only. */
-int SSL_tick(SSL *s)
+int SSL_handle_events(SSL *s)
{
SSL_CONNECTION *sc;
#ifndef OPENSSL_NO_QUIC
if (IS_QUIC(s))
- return ossl_quic_tick(s);
+ return ossl_quic_handle_events(s);
#endif
sc = SSL_CONNECTION_FROM_SSL_ONLY(s);
return 1;
}
-int SSL_get_tick_timeout(SSL *s, struct timeval *tv)
+int SSL_get_event_timeout(SSL *s, struct timeval *tv, int *is_infinite)
{
SSL_CONNECTION *sc;
#ifndef OPENSSL_NO_QUIC
if (IS_QUIC(s))
- return ossl_quic_get_tick_timeout(s, tv);
+ return ossl_quic_get_event_timeout(s, tv, is_infinite);
#endif
sc = SSL_CONNECTION_FROM_SSL_ONLY(s);
if (sc != NULL && SSL_CONNECTION_IS_DTLS(sc)
- && DTLSv1_get_timeout(s, tv))
+ && DTLSv1_get_timeout(s, tv)) {
+ *is_infinite = 0;
return 1;
+ }
- tv->tv_sec = -1;
+ tv->tv_sec = 1000000;
tv->tv_usec = 0;
+ *is_infinite = 1;
return 1;
}
#endif
}
-int SSL_set_initial_peer_addr(SSL *s, const BIO_ADDR *peer_addr)
+int SSL_set1_initial_peer_addr(SSL *s, const BIO_ADDR *peer_addr)
{
#ifndef OPENSSL_NO_QUIC
if (!IS_QUIC(s))
#endif
}
+int SSL_is_stream_local(SSL *s)
+{
+#ifndef OPENSSL_NO_QUIC
+ if (!IS_QUIC(s))
+ return -1;
+
+ return ossl_quic_is_stream_local(s);
+#else
+ return -1;
+#endif
+}
+
int SSL_set_default_stream_mode(SSL *s, uint32_t mode)
{
#ifndef OPENSSL_NO_QUIC
#endif
}
-SSL *SSL_detach_stream(SSL *s)
+int SSL_set_incoming_stream_policy(SSL *s, int policy, uint64_t aec)
+{
+#ifndef OPENSSL_NO_QUIC
+ if (!IS_QUIC(s))
+ return 0;
+
+ return ossl_quic_set_incoming_stream_policy(s, policy, aec);
+#else
+ return 0;
+#endif
+}
+
+SSL *SSL_accept_stream(SSL *s, uint64_t flags)
{
#ifndef OPENSSL_NO_QUIC
if (!IS_QUIC(s))
return NULL;
- return ossl_quic_detach_stream(s);
+ return ossl_quic_accept_stream(s, flags);
#else
return NULL;
#endif
}
-int SSL_attach_stream(SSL *conn, SSL *stream)
+size_t SSL_get_accept_stream_queue_len(SSL *s)
{
#ifndef OPENSSL_NO_QUIC
- if (!IS_QUIC(conn))
+ if (!IS_QUIC(s))
return 0;
- return ossl_quic_attach_stream(conn, stream);
+ return ossl_quic_get_accept_stream_queue_len(s);
#else
- return NULL;
+ return 0;
#endif
}
-int SSL_set_incoming_stream_reject_policy(SSL *s, int policy, uint64_t aec)
+int SSL_stream_reset(SSL *s,
+ const SSL_STREAM_RESET_ARGS *args,
+ size_t args_len)
{
#ifndef OPENSSL_NO_QUIC
if (!IS_QUIC(s))
return 0;
- return ossl_quic_set_incoming_stream_reject_policy(s, policy, aec);
+ return ossl_quic_stream_reset(s, args, args_len);
#else
return 0;
#endif
}
-SSL *SSL_accept_stream(SSL *s, uint64_t flags)
+int SSL_get_stream_read_state(SSL *s)
{
#ifndef OPENSSL_NO_QUIC
if (!IS_QUIC(s))
- return NULL;
+ return SSL_STREAM_STATE_NONE;
- return ossl_quic_accept_stream(s, flags);
+ return ossl_quic_get_stream_read_state(s);
#else
- return NULL;
+ return SSL_STREAM_STATE_NONE;
#endif
}
-size_t SSL_get_accept_stream_queue_len(SSL *s)
+int SSL_get_stream_write_state(SSL *s)
{
#ifndef OPENSSL_NO_QUIC
if (!IS_QUIC(s))
- return 0;
+ return SSL_STREAM_STATE_NONE;
- return ossl_quic_get_accept_stream_queue_len(s);
+ return ossl_quic_get_stream_write_state(s);
#else
- return 0;
+ return SSL_STREAM_STATE_NONE;
+#endif
+}
+
+int SSL_get_stream_read_error_code(SSL *s, uint64_t *app_error_code)
+{
+#ifndef OPENSSL_NO_QUIC
+ if (!IS_QUIC(s))
+ return -1;
+
+ return ossl_quic_get_stream_read_error_code(s, app_error_code);
+#else
+ return -1;
+#endif
+}
+
+int SSL_get_stream_write_error_code(SSL *s, uint64_t *app_error_code)
+{
+#ifndef OPENSSL_NO_QUIC
+ if (!IS_QUIC(s))
+ return -1;
+
+ return ossl_quic_get_stream_write_error_code(s, app_error_code);
+#else
+ return -1;
+#endif
+}
+
+int SSL_get_conn_close_info(SSL *s, SSL_CONN_CLOSE_INFO *info,
+ size_t info_len)
+{
+#ifndef OPENSSL_NO_QUIC
+ if (!IS_QUIC(s))
+ return -1;
+
+ return ossl_quic_get_conn_close_info(s, info, info_len);
+#else
+ return -1;
#endif
}