Skip to content
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

Reverting code changes #9

Merged
merged 1 commit into from
Sep 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions jnsm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@ license = "MIT"
edition = "2018"

[dependencies]
aws-nitro-enclaves-cose = "0.4"
aws-nitro-enclaves-nsm-api = "0.4.0"
jni = "0.21.1"
bincode = "1.3.3"
aws-nitro-enclaves-cose = "0.1"
nsm-driver = { git = "https://github.com/aws/aws-nitro-enclaves-nsm-api.git", rev = "b05bc2a6ef1906204496438d47f60c4fc2e997cc" }
nsm-io = { git = "https://github.com/aws/aws-nitro-enclaves-nsm-api.git", rev = "b05bc2a6ef1906204496438d47f60c4fc2e997cc" }
jni = "0.19.0"
bincode = "1.3.2"
serde_bytes = "0.11"
thiserror = "1.0"

Expand Down
9 changes: 4 additions & 5 deletions jnsm/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
use jni::JNIEnv;
use jni::objects::JClass;
use jni::sys::{jbyteArray, jint, jbyte};
use aws_nitro_enclaves_nsm_api::api::{Digest, ErrorCode, Request, Response};
use aws_nitro_enclaves_nsm_api::driver::{nsm_exit, nsm_init, nsm_process_request};
use nsm_io::{Request, Response, ErrorCode};
use serde_bytes::ByteBuf;

#[no_mangle]
Expand Down Expand Up @@ -46,19 +45,19 @@ struct Nsm {

impl Drop for Nsm {
fn drop(&mut self) {
nsm_exit(self.fd);
nsm_driver::nsm_exit(self.fd);
}
}

impl Nsm {
pub fn connect() -> Self {
Self {
fd: nsm_init(),
fd: nsm_driver::nsm_init(),
}
}

pub fn generate_attestation(&self, params: AttestationParams) -> Result<Vec<u8>, i32> {
match nsm_process_request(self.fd, Request::Attestation {
match nsm_driver::nsm_process_request(self.fd, Request::Attestation {
user_data: params.user_data.map(ByteBuf::from),
nonce: params.nonce.map(ByteBuf::from),
public_key: params.public_key.map(ByteBuf::from),
Expand Down
Loading