github.com/epfl-dcsl/gotee@v0.0.0-20200909122901-014b35f5e5e9/example/hello-world/README.md (about)

     1  # Hello World Example
     2  
     3  This folder contains a hello-world sample code that executes a print from both the untrusted and trusted domains.
     4  
     5  ## Compiling
     6  
     7  Just type `make` in `example/hello-world/`.
     8  This will generate a `main` executable.
     9  If you have a look at the `Makefile`, you'll see that the command used to compile is `gotee build src/main.go`.
    10  We set the `GOPATH` variable before that to allow importing nested folders (pre-go-module way of doing things).
    11  
    12  ## Running
    13  
    14  Execute the generate program, i.e., `./main`. 
    15  The expected output is: 
    16  
    17  ```
    18  From an untrusted domain:
    19  Hello World!
    20  From a trusted domain:
    21  Hello World!
    22  ```
    23  
    24  Executing the script will generate a `enclavebin` binary, i.e., the code and data loaded inside the enclave.
    25  This is just for your convinience, to allow you to inspect what code is loaded inside the enclave.
    26  
    27  Optionally, you can run the code in simulation mode like this `SIM=1 ./main`. This allows to run Gotee programs without SGX.
    28  
    29  ## Comments
    30  
    31  As you can see in `src/main.go`, you need to import explicitly the `gosec` package.
    32  As mentionned in the general README, we had to disable `gosecure` calls that target functions defined in main.
    33  We also discourage using the `gosecure` keyword outside of the main package for the moment (see README for more information).