GithubHelp home page GithubHelp logo

Comments (3)

kaleb-himes avatar kaleb-himes commented on May 28, 2024

zhq0918,

I think you are confused on what close is undefined here. That error is in reference to a function not a member of a struct or union.

NOTE this section of code:

        if (bio->close) {
            if (bio->ssl)
                wolfSSL_free(bio->ssl);
            if (bio->fd)
                CloseSocket(bio->fd); // <---- Source of Error
        }

You'll note that in wolfssl/wolfio.h CloseSocket is defined as "close":

342     #ifndef CloseSocket                                                          
343         #define CloseSocket(s) close(s)                                          
344     #endif

So the code expansion there is:

        if (bio->close) {
            if (bio->ssl)
                wolfSSL_free(bio->ssl);
            if (bio->fd)
                close(bio->fd); // <---- Source of Error
        }

I provided a solution for this already on our forums, please see https://www.wolfssl.com/forums/topic1368-in-sgx-enclavecant-use-function-wolfsslx509verifycert.html, my post on 17th May 2019 11:17:22

Regards,

K

from wolfssl-examples.

zhq0918 avatar zhq0918 commented on May 28, 2024

@kaleb-himes thank you for your answer, I commented out the line and the problem was solved temporarily.
Regards
zhq0918

from wolfssl-examples.

kaleb-himes avatar kaleb-himes commented on May 28, 2024

zhq0918,

Allow me to re-iterate the solution here. You need to create this function for the library. close is a system level function. Enclaves are protected execution spaces with no access to the system. Enclaves can only execute whatever functions are inside the enclave. To call out to the system you need to create an untrusted out call to access the system.

Step 1: Checkout https://github.com/wolfSSL/wolfssl-examples/blob/master/SGX_Linux/trusted/Wolfssl_Enclave.c and see how we made functions for printf, recv, send, current_time, .... etc. The enclave can't even call "printf" because it doesn't have access to the system. It doesn't know what the stdout stream is so we have to give the enclave access to those system level functions via untrusted out calls. Write a close function in https://github.com/wolfSSL/wolfssl-examples/blob/master/SGX_Linux/trusted/Wolfssl_Enclave.c and have it call ocall_close passing along the item to be closed.

Step 2: Prototype ocall_close so the enclave can call out to the untrusted execution space. Prototype this ocall in https://github.com/wolfSSL/wolfssl-examples/blob/master/SGX_Linux/trusted/Wolfssl_Enclave.edl in the untrusted { } section.

Step 3: Write the ocall_close in the untrusted application https://github.com/wolfSSL/wolfssl-examples/blob/master/SGX_Linux/untrusted/App.c. Have it call the system function "close" on the socket descriptor.

  • K

from wolfssl-examples.

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.