Giter VIP home page Giter VIP logo

Comments (2)

dragan-ponos avatar dragan-ponos commented on June 15, 2024

@gilles-peskine-arm You have considered a fix that would return WANT_WRITE instead of returning 0. I think that would create a problem for developers that use edge-based I/O (epoll). My code would end up waiting for the EPOLLOUT event that would never come.

I think that proper logic would require that flush is handled similarly to handshake. Maybe have a successful flush be followed by a close_notify attempt. I think this would require an additional field keeping track of the currently pending operation, as out_left would be insufficient.

from mbedtls.

dragan-ponos avatar dragan-ponos commented on June 15, 2024

I have found an existing problems when using edge-based I/O. With TLS 1.3 when the server sends a ticket, I get WANT_READ, even though more data is already available for reading. Since EPOLLIN never arrives, my code never proceeds further. I suspect similar use of WANT_* in other parts of the library.

In my opinion, a proper way to handle this would be to have WANT_READ, WANT_WRITE, and WANT_AGAIN. The last error code would cover exactly this case, and I would call the function again immediately.

Since that change would break existing code, I would propose a backward-compatibility layer such as:

mbedtls_ssl_read(...) {
    int ret = WANT_AGAIN;
    while (ret == WANT_AGAIN) {
        ret = mbed_ssl_read_impl(...);
    }
    return ret;
}

from mbedtls.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.