diff --git a/jnsm/Cargo.toml b/jnsm/Cargo.toml index 0c220df..a2d8d7a 100644 --- a/jnsm/Cargo.toml +++ b/jnsm/Cargo.toml @@ -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" diff --git a/jnsm/src/lib.rs b/jnsm/src/lib.rs index 65ffada..2a78100 100644 --- a/jnsm/src/lib.rs +++ b/jnsm/src/lib.rs @@ -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] @@ -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, 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),