• Bug#1108958: unblock: openssl (11/16)

    From Sebastian Andrzej Siewior@21:1/5 to Paul Gevers on Sat Jul 12 19:20:02 2025
    [continued from previous message]

    - ossl_quic_set_connect_state(s);
    + if (!ossl_quic_set_connect_state(s, 1))
    + return -1;

    /* Begin or continue the handshake */
    return ossl_quic_do_handshake(s);
    @@ -1993,7 +2035,8 @@
    int ossl_quic_accept(SSL *s)
    {
    /* Ensure we are in accept state (no-op if non-idle). */
    - ossl_quic_set_accept_state(s);
    + if (!ossl_quic_set_accept_state(s, 1))
    + return -1;

    /* Begin or continue the handshake */
    return ossl_quic_do_handshake(s);
    @@ -2325,8 +2368,9 @@
    QCTX ctx;
    int net_error, last_error;

    - if (!expect_quic_cs(s, &ctx))
    - return 0;
    + /* SSL_get_errors() should not raise new errors */
    + if (!is_quic_cs(s, &ctx, 0 /* suppress errors */))
    + return SSL_ERROR_SSL;

    qctx_lock(&ctx);
    net_error = ossl_quic_channel_net_error(ctx.qc->ch);
    @@ -4849,6 +4893,9 @@
    return 0;

    key = ossl_quic_build_new_token(peer, NULL, 0);
    + if (key == NULL)
    + return 0;
    +
    ossl_crypto_mutex_lock(c->mutex);
    tok = lh_QUIC_TOKEN_retrieve(c->cache, key);
    if (tok != NULL) {
    @@ -5106,6 +5153,8 @@
    && ossl_quic_stream_has_send_buffer(xso->stream)
    && ossl_quic_sstream_get_buffer_avail(xso->stream->sstream)
    && !ossl_quic_sstream_get_final_size(xso->stream->sstream, NULL)
    + && ossl_quic_txfc_get_cwm(&xso->stream->txfc)
    + > ossl_quic_sstream_get_cur_size(xso->stream->sstream)
    && quic_mutation_allowed(xso->conn, /*req_active=*/1);
    }

    diff -Nru -w openssl-3.5.0/ssl/quic/quic_method.c openssl-3.5.1/ssl/quic/quic_method.c
    --- openssl-3.5.0/ssl/quic/quic_method.c 2025-04-08 15:09:06.000000000 +0200
    +++ openssl-3.5.1/ssl/quic/quic_method.c 2025-07-01 13:52:08.000000000 +0200
    @@ -23,5 +23,5 @@

    IMPLEMENT_quic_meth_func(OSSL_QUIC_ANY_VERSION,
    OSSL_QUIC_server_method,
    - ssl_undefined_function,
    - ossl_quic_connect, ssl3_undef_enc_method)
    + ossl_quic_accept,
    + ssl_undefined_function, ssl3_undef_enc_method)
    diff -Nru -w openssl-3.5.0/ssl/quic/quic_port.c openssl-3.5.1/ssl/quic/quic_port.c
    --- openssl-3.5.0/ssl/quic/quic_port.c 2025-04-08 15:09:06.000000000 +0200
    +++ openssl-3.5.1/ssl/quic/quic_port.c 2025-07-01 13:52:08.000000000 +0200
    @@ -458,34 +458,38 @@
    QUIC_CONNECTION *qc = NULL;
    QUIC_LISTENER *ql = NULL;

    - if (port->get_conn_user_ssl != NULL) {
    + /*
    + * It only makes sense to call this function if we know how to associate
    + * the handshake layer we are about to cr