project-oak / oak

Meaningful control of data in distributed systems.
Apache License 2.0
1.32k stars 113 forks source link

Implement trusted time API in Oak runtime #350

Closed tiziano88 closed 2 years ago

tiziano88 commented 4 years ago

We should have an API available to the Oak Runtime nodes (and also probably also exposed as a WebAssembly function) to retrieve the current time in a trusted way. In C++ this may be used to validate HTTPS certificate and other time-based assertions. In WebAssembly it may be used by application developer as part of the application logic.

A possible approach would be to use roughtime and hardcode a number of server endpoints (and their certificates) in the Oak Runtime itself, and use a threshold (k out of n) to periodically request a trusted wall-clock time reference. Then we can use internal relative timer in SGX to keep counting between those trusted references.

See also:

conradgrobler commented 4 years ago

The first implementation will use roughtime:

As a later addition, acccess to sgx trusted time will be added:

C++ API will provide finer-grained control, with separate calls to roughtime and sgx trusted time.

The API exposed to web assembly will be simplified with a single call, which would try and optimise the request using either roughtime or sgx trusted time as appropriate.

conradgrobler commented 4 years ago

Initial roughtime client is implemented.

conradgrobler commented 4 years ago

The SGX trusted time is no longer supported on Linux, so there is not point in trying to implement support for it. We can revist the issue later when new options become available.

daviddrysdale commented 4 years ago

Roughtime client functionality made available to Oak Nodes as a pseudo-Node in #845