Skip to content

Commit

Permalink
Merge pull request #9 from IABTechLab/tjm-IM-1000-revert-changes-2
Browse files Browse the repository at this point in the history
Reverting code changes
  • Loading branch information
thomasm-ttd authored Sep 27, 2023
2 parents 055a57b + f06383f commit afa63cf
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
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

0 comments on commit afa63cf

Please sign in to comment.