Skip to content
This repository has been archived by the owner on May 9, 2022. It is now read-only.

Commit

Permalink
docs: add & update rustdoc comments
Browse files Browse the repository at this point in the history
  • Loading branch information
PiDelport committed May 28, 2021
1 parent d920134 commit bce9c8c
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 2 deletions.
5 changes: 3 additions & 2 deletions rtc_data_enclave/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,9 @@ pub unsafe extern "C" fn validate_and_save(
}
}

/// Tries to perform local attestation to an enclave at dest_enclave_id. The enclave needs to be
/// initialized as a `ResponderSys` in rtc_udh'
/// Tries to perform local attestation to an enclave at dest_enclave_id.
///
/// See: [`DhSessions::establish_new`]
#[no_mangle]
pub unsafe extern "C" fn local_attestation(dest_enclave_id: sgx_enclave_id_t) -> sgx_status_t {
let res = rtc_tenclave::dh::dh_sessions().establish_new(dest_enclave_id);
Expand Down
4 changes: 4 additions & 0 deletions rtc_tenclave/src/dh/mod.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//! Support for establishing secure local inter-enclave sessions using [`sgx_tdh`].
mod protected_channel;
mod sessions;
mod types;
Expand All @@ -6,6 +8,8 @@ pub use sessions::*;

#[cfg(test)]
mod enclave {
//! Stub [`sgx_tstd::enclave`] for testing.
use sgx_types::sgx_enclave_id_t;

pub fn get_enclave_id() -> sgx_enclave_id_t {
Expand Down
2 changes: 2 additions & 0 deletions rtc_tenclave/src/dh/protected_channel.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//! Secure symmetric communication channels based on [`sgx_tcrypto`]'s AES-GCM.
use secrecy::{ExposeSecret, Secret};
use sgx_tcrypto::{rsgx_rijndael128GCM_decrypt, rsgx_rijndael128GCM_encrypt};
use sgx_types::*;
Expand Down
3 changes: 3 additions & 0 deletions rtc_tenclave/src/dh/sessions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,9 @@ where
Ok(())
}

/// Attest and establish a new active session between this enclave and `dest_enclave_id`.
///
/// The responding enclave must be registered using [`rtc_udh::set_responder`].
pub fn establish_new(
&self,
dest_enclave_id: sgx_enclave_id_t,
Expand Down
2 changes: 2 additions & 0 deletions rtc_udh/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ fn dh_responders() -> &'static RwLock<DhResponders> {
DH_RESPONDERS.get_or_init(|| RwLock::new(HashMap::new()))
}

/// Register enclave as a DH responder.
pub fn set_responder(
enclave_id: sgx_enclave_id_t,
responder: Box<(dyn ResponderSys + 'static)>,
Expand All @@ -39,6 +40,7 @@ pub fn set_responder(
}
}

/// Retrieve enclave's registered responder.
fn get_responder(enclave_id: sgx_enclave_id_t) -> Result<SyncSendResponder, sgx_status_t> {
dh_responders()
.read()
Expand Down

0 comments on commit bce9c8c

Please sign in to comment.