-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(sealing-enclave): initial implementation #14
base: main
Are you sure you want to change the base?
Conversation
Ignore build artifacts, environment files and keys.
let user_data_buf = unsafe { slice::from_raw_parts(user_data, sealed_user_data_size) }; | ||
|
||
let mut rng = SgxRng::new().expect("SGX: RDRAND instruction failed"); | ||
let mut user_sealing_key = SecretKey::new([0u8; 32]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
32
feels like it should an associated type of SecretKey, such that...
SecretKey::new([0u8; SecretKey::SIZE])
Maybe even better is to do a Default derive on SecretKey, so that you could just...
SecretKey::default()
I have not tested if it would work, so just a guess.
let mut user_sealing_key = SecretKey::new([0u8; 32]); | ||
rng.fill_bytes(user_sealing_key.as_mut()); | ||
|
||
let user_data_nonce = Nonce::new([0u8; Nonce::SIZE]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps another candidate for a Default derive.
let sealed_user_data = | ||
match sealing::seal(user_data_buf, user_sealing_key, user_data_nonce, user_id) { | ||
Ok(sealed_data) => sealed_data, | ||
Err(_) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't expect the seal function would reveal sensitive info, easpecially since the error ultimately comes from ring_compat::aead::Error
, which I believe practices good hygiene :)
) | ||
.unwrap(); // never panics due to array usage | ||
|
||
let enclave_key_nonce = Nonce::new([0u8; Nonce::SIZE]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One more candidate for Default derive.
let enclave_key_nonce = Nonce::new([0u8; Nonce::SIZE]); | ||
let sealed_key = match sealing::seal(user_data_buf, enclave_key, enclave_key_nonce, user_id) { | ||
Ok(sealed_key) => sealed_key, | ||
Err(_) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see #14 (comment)
09e6e8c
to
76b166e
Compare
76b166e
to
7d0da0b
Compare
Initial implementation of the sealing enclave