profile
viewpoint
Jeffrey Seyfried jseyfried Mountain View, CA

jseyfried/rust-core_io 1

Rust std::io with all the parts that don't work in core removed.

jseyfried/cargo 0

The Rust package manager

jseyfried/GBArs 0

A GBA emulator written in Rust.

jseyfried/mio 0

Metal IO library for Rust

jseyfried/multipart 0

A backend-agnostic extension for file uploads in HTTP libraries for Rust

jseyfried/pkg-config-rs 0

Build library for invoking pkg-config for Rust

jseyfried/radiant-rs 0

Rust sprite rendering engine

jseyfried/rfcs 0

RFCs for changes to Rust

jseyfried/rust 0

A safe, concurrent, practical language.

jseyfried/rust-bindgen 0

Automatically generates Rust FFI bindings to C (and some C++) libraries.

push eventjseyfried/rust-mbedtls

Jeffrey Seyfried

commit sha a896541680c9d99c7b448a02af7a8875f689b5c5

Update bindgen.

view details

push time in 2 months

push eventjseyfried/rust-bindgen

Jeffrey Seyfried

commit sha 9632f62bc8caeb9d89de2c18da66b5c5cccd45cd

Add `can_blacklisted_derive` callback.

view details

push time in 2 months

create barnchjseyfried/rust-bindgen

branch : can-blacklisted-derive

created branch time in 2 months

fork jseyfried/rust-bindgen

Automatically generates Rust FFI bindings to C (and some C++) libraries.

https://rust-lang.github.io/rust-bindgen/

fork in 2 months

push eventjseyfried/rust-mbedtls

Jeffrey Seyfried

commit sha 3bcfdda356a0b7a2346d0c5014d8f20d941c2293

Update bindgen.

view details

push time in 2 months

push eventjseyfried/rust-mbedtls

Jeffrey Seyfried

commit sha 3a6dd16d9ea3110e787f6e47027a5976f0a0800f

Update bindgen.

view details

push time in 2 months

push eventjseyfried/rust-mbedtls

Jeffrey Seyfried

commit sha 958e57310221bc1c14106dd533a23d2067b87a78

Update bindgen.

view details

push time in 2 months

push eventjseyfried/rust-mbedtls

Jeffrey Seyfried

commit sha 082b5799cd6ead63206c575c09c0eb7f43f7965d

Update bindgen.

view details

push time in 2 months

push eventjseyfried/rust-mbedtls

Jeffrey Seyfried

commit sha 3bcfdda356a0b7a2346d0c5014d8f20d941c2293

Update bindgen.

view details

push time in 2 months

PR opened fortanix/rust-mbedtls

Update bindgen.

Closes https://github.com/fortanix/rust-mbedtls/issues/5.

Also bump serde_derive minor version to match that of serde and to reduce Cargo.lock bloat associated with this PR.

+255 -228

0 comment

7 changed files

pr created time in 2 months

push eventjseyfried/rust-mbedtls

Jeffrey Seyfried

commit sha f0f020a3f0c4fe2d5d6d1ab867f1c19b5f7c315e

Update bindgen.

view details

push time in 2 months

push eventjseyfried/rust-mbedtls

Jack Lloyd

commit sha c20a31c19241ed9b9e2b6ec7ccac968907d6ac96

Don't parse Certificates in Pkcs12 until requested This avoids having any C structures in Pkcs12

view details

Jack Lloyd

commit sha 920cec1e5fcf04e3977b3c8e2df85a9f313eddfe

Return Result to indicate if cert parsing failed

view details

Jack Lloyd

commit sha 812f0e9090b80b016428014dae14bb2aa0ceb6b5

Change PKCS12 API to return iterators

view details

Jack Lloyd

commit sha cc6ea12c715b972bf1c2f106a1ec22605d6e749f

Assert that the certs are parsed successfully

view details

bors[bot]

commit sha 523ae8024f0213fc39307f350c6c6b7bd2524506

Merge #70 70: Don't parse Certificates in Pkcs12 until requested r=jethrogb a=jack-fortanix This avoids having any C structures in Pkcs12 which makes life easier in rust-native-tls land Also makes parsing of structures more tolerant, previously if certificate parsing failed the whole structure parse was abandoned. Now we just ignore certs we cannot parse. Co-authored-by: Jack Lloyd <jack.lloyd@fortanix.com>

view details

bors[bot]

commit sha 23434709ed6da4e9f0bdef6ae592ca46cb2d23d9

Merge #71 71: Update bindgen r=jack-fortanix a=jethrogb Co-authored-by: Jethro Beekman <jethro@fortanix.com>

view details

Dario Gonzalez

commit sha 2c8f1c6fbe87aa096de0a72476ffe0f1e4b901fb

unfreeze nightly ci after syntex-syntax update

view details

bors[bot]

commit sha 51fb53d20098266f5abc0b4e649d81ce65d3e63e

Merge #73 73: unfreeze nightly ci after syntex-syntax update r=jack-fortanix a=Goirad Co-authored-by: Dario Gonzalez <dario.gonzalez@fortanix.com>

view details

Dario Gonzalez

commit sha f068d250ba04537d0b51ef679b6f2ebf52fabc07

bump mbedtls to 0.5.0 in prepartion for release Also fixes a warning that was causing CI to fail

view details

bors[bot]

commit sha 07c4aa63e4f5f8eb3d630b20f2440906f7022c8c

Merge #76 76: bump mbedtls to 0.5.0 in prepartion for release r=jack-fortanix a=Goirad This a major version bump due to a change in the PKCS12 API made by #70 . Also of note, this version makes the crate compatible with versions of rust that no longer downgrade some NLL errors. Co-authored-by: Dario Gonzalez <dario.gonzalez@fortanix.com>

view details

Dario Gonzalez

commit sha b3961706a8b697e9578aeab06d41716f394f4932

Update bindgen to 0.19.2 This change makes it so that update also applies to crates that rely on mbedtls.

view details

bors[bot]

commit sha 44691edcccff33a7ac159b5a45846afd3b0cf797

Merge #77 77: Update bindgen to 0.19.2 r=jack-fortanix a=Goirad This change makes it so that update also applies to crates that rely on mbedtls. Co-authored-by: Dario Gonzalez <dario.gonzalez@fortanix.com>

view details

Dario Gonzalez

commit sha 9cb3d28afa18379d22481603da9eec81e92b2e86

Bump mbedtls to 0.5.1, mbedtls-sys-auto to 2.18.1

view details

bors[bot]

commit sha 00af66858de8f6d593416846fbb2326e21d7fbfe

Merge #79 79: Bump mbedtls to 0.5.1, mbedtls-sys-auto to 2.18.1 r=jack-fortanix a=Goirad version bumps to pick up the `Cargo.toml` changes to `mbedtls-sys-auto` Co-authored-by: Dario Gonzalez <dario.gonzalez@fortanix.com>

view details

Jack Lloyd

commit sha 715caafb6ce24317e135b85a183eb5c57b81143d

Fix typo in README

view details

bors[bot]

commit sha 71bad0cdecf93c70c247c1662c801296b8032168

Merge #80 80: Fix typo in README r=Goirad a=jack-fortanix Co-authored-by: Jack Lloyd <jack.lloyd@fortanix.com>

view details

Dario Gonzalez

commit sha 9364773649ca9c1d5220e8b9138bbbb8f5cee83e

Revert chane to bindgen dependency in mbedtls-sys Reverts an unnecesary change to mbedtls-sys's bindgen dependency so that it again only requires 0.19.0. Crate versions 2.18.1 and 0.5.1 will be yanked.

view details

Dario Gonzalez

commit sha 307d3884443c1b5bcc3f5363d5aa44b63c4823b3

Silence unsafe FFI warnings The rust compiler is issuing false positive improper_ctypes warning, but this is not an issue because only pointers are being passed to mbedtls, and they are used completely opaquely.

view details

bors[bot]

commit sha 13a12559d0b10815b85cb6ad6a62281f4e2c9f8d

Merge #82 82: Silence unsafe FFI warnings r=jack-fortanix a=Goirad The rust compiler is issuing false positive improper_ctypes warning, but this is not an issue because only pointers are being passed to mbedtls, and they are used completely opaquely. Co-authored-by: Dario Gonzalez <dario.gonzalez@fortanix.com>

view details

Jack Lloyd

commit sha 95e998d389e86d6ae96c9c0df1bd3d58ee912713

Bump SGX toolchain to match what we are using in backend

view details

push time in 2 months

fork jseyfried/rust-mbedtls

Idiomatic Rust wrapper for MbedTLS

fork in 2 months

Pull request review commentfortanix/rust-sgx

[ZIRC-203] EnclaveOS diagnostics added for pre and post installation

 pub trait Name {     fn name(&self) -> &'static str; } +#[derive(Debug, PartialEq)]+pub enum BuildType {+    Generic,+    EnclaveOSPreInstall,+    EnclaveOSPostInstall,+}+ pub trait Print: Name {-    fn try_supported(&self) -> Option<Status> {-        Some(self.supported())+    fn try_supported(&self, build_type: &BuildType) -> Option<Status> {+            Some(self.supported_for_config(build_type))

nit: fix indent

prawalgangwar

comment created time in 3 months

CommitCommentEvent

Pull request review commentfortanix/rust-sgx

Implementing ServiceApi changes for bind call.

 pub trait SyncStream: 'static + Send + Sync { }  -trait SyncListener: 'static + Send + Sync {-    fn accept(&self) -> IoResult<(FileDesc, Box<dyn ToString>, Box<dyn ToString>)>;+/// SyncListener lets an implementation implement a slightly modified form of `std::net::TcpListener::accept`.+pub trait SyncListener: 'static + Send + Sync {+    /// The enclave may optionally request the local or peer addresses+    /// be returned in `local_addr` or `peer_addr`, respectively.+    /// If `local_addr` and/or `peer_addr` are not `None`, they will point to an empty `String`.+    /// On success, user-space can fill in the strings as appropriate.+    ///+    /// The enclave must not make any security decisions based on the local address received.+    fn accept(&self, local_addr: Option<&mut String>, peer_addr: Option<&mut String>) -> IoResult<Box<dyn SyncStream>>; }  impl SyncListener for TcpListener {-    fn accept(&self) -> IoResult<(FileDesc, Box<dyn ToString>, Box<dyn ToString>)> {+    fn accept(&self, local_addr: Option<&mut String>, peer_addr: Option<&mut String>) -> IoResult<Box<dyn SyncStream>> {         TcpListener::accept(self).map(|(s, peer)| {-            let local = match s.local_addr() {-                Ok(local) => Box::new(local) as _,-                Err(_) => Box::new("error") as _,-            };-            (FileDesc::stream(s), local, Box::new(peer) as _)+            if let Some(local_addr) = local_addr {+                match self.local_addr() {+                    Ok(local) => {*local_addr = local.to_string()},+                    Err(_) => {*local_addr = "error".to_string()},

Sorry to complain, this is unimportant.

VardhanThigle

comment created time in 4 months

Pull request review commentfortanix/rust-sgx

Implementing ServiceApi changes for bind call.

 pub trait SyncStream: 'static + Send + Sync { }  -trait SyncListener: 'static + Send + Sync {-    fn accept(&self) -> IoResult<(FileDesc, Box<dyn ToString>, Box<dyn ToString>)>;+/// SyncListener lets an implementation implement a slightly modified form of `std::net::TcpListener::accept`.+pub trait SyncListener: 'static + Send + Sync {+    /// The enclave may optionally request the local or peer addresses+    /// be returned in `local_addr` or `peer_addr`, respectively.+    /// If `local_addr` and/or `peer_addr` are not `None`, they will point to an empty `String`.+    /// On success, user-space can fill in the strings as appropriate.+    ///+    /// The enclave must not make any security decisions based on the local address received.+    fn accept(&self, local_addr: Option<&mut String>, peer_addr: Option<&mut String>) -> IoResult<Box<dyn SyncStream>>; }  impl SyncListener for TcpListener {-    fn accept(&self) -> IoResult<(FileDesc, Box<dyn ToString>, Box<dyn ToString>)> {+    fn accept(&self, local_addr: Option<&mut String>, peer_addr: Option<&mut String>) -> IoResult<Box<dyn SyncStream>> {         TcpListener::accept(self).map(|(s, peer)| {-            let local = match s.local_addr() {-                Ok(local) => Box::new(local) as _,-                Err(_) => Box::new("error") as _,-            };-            (FileDesc::stream(s), local, Box::new(peer) as _)+            if let Some(local_addr) = local_addr {+                match self.local_addr() {+                    Ok(local) => {*local_addr = local.to_string()},+                    Err(_) => {*local_addr = "error".to_string()},

cc @mzohreva

VardhanThigle

comment created time in 4 months

Pull request review commentfortanix/rust-sgx

Implementing ServiceApi changes for bind call.

 pub trait SyncStream: 'static + Send + Sync { }  -trait SyncListener: 'static + Send + Sync {-    fn accept(&self) -> IoResult<(FileDesc, Box<dyn ToString>, Box<dyn ToString>)>;+/// SyncListener lets an implementation implement a slightly modified form of `std::net::TcpListener::accept`.+pub trait SyncListener: 'static + Send + Sync {+    /// The enclave may optionally request the local or peer addresses+    /// be returned in `local_addr` or `peer_addr`, respectively.+    /// If `local_addr` and/or `peer_addr` are not `None`, they will point to an empty `String`.+    /// On success, user-space can fill in the strings as appropriate.+    ///+    /// The enclave must not make any security decisions based on the local address received.+    fn accept(&self, local_addr: Option<&mut String>, peer_addr: Option<&mut String>) -> IoResult<Box<dyn SyncStream>>; }  impl SyncListener for TcpListener {-    fn accept(&self) -> IoResult<(FileDesc, Box<dyn ToString>, Box<dyn ToString>)> {+    fn accept(&self, local_addr: Option<&mut String>, peer_addr: Option<&mut String>) -> IoResult<Box<dyn SyncStream>> {         TcpListener::accept(self).map(|(s, peer)| {-            let local = match s.local_addr() {-                Ok(local) => Box::new(local) as _,-                Err(_) => Box::new("error") as _,-            };-            (FileDesc::stream(s), local, Box::new(peer) as _)+            if let Some(local_addr) = local_addr {+                match self.local_addr() {+                    Ok(local) => {*local_addr = local.to_string()},+                    Err(_) => {*local_addr = "error".to_string()},

I don't think there is case where self.local_addr() returns an error but we still want to return successfully.

VardhanThigle

comment created time in 4 months

Pull request review commentfortanix/rust-sgx

Implementing ServiceApi changes for bind call.

 pub trait SyncStream: 'static + Send + Sync { }  -trait SyncListener: 'static + Send + Sync {-    fn accept(&self) -> IoResult<(FileDesc, Box<dyn ToString>, Box<dyn ToString>)>;+/// SyncListener lets an implementation implement a slightly modified form of `std::net::TcpListener::accept`.+pub trait SyncListener: 'static + Send + Sync {+    /// The enclave may optionally request the local or peer addresses+    /// be returned in `local_addr` or `peer_addr`, respectively.+    /// If `local_addr` and/or `peer_addr` are not `None`, they will point to an empty `String`.+    /// On success, user-space can fill in the strings as appropriate.+    ///+    /// The enclave must not make any security decisions based on the local address received.+    fn accept(&self, local_addr: Option<&mut String>, peer_addr: Option<&mut String>) -> IoResult<Box<dyn SyncStream>>; }  impl SyncListener for TcpListener {-    fn accept(&self) -> IoResult<(FileDesc, Box<dyn ToString>, Box<dyn ToString>)> {+    fn accept(&self, local_addr: Option<&mut String>, peer_addr: Option<&mut String>) -> IoResult<Box<dyn SyncStream>> {         TcpListener::accept(self).map(|(s, peer)| {-            let local = match s.local_addr() {-                Ok(local) => Box::new(local) as _,-                Err(_) => Box::new("error") as _,-            };-            (FileDesc::stream(s), local, Box::new(peer) as _)+            if let Some(local_addr) = local_addr {+                match self.local_addr() {+                    Ok(local) => {*local_addr = local.to_string()},+                    Err(_) => {*local_addr = "error".to_string()},

The empty string or early returning an error. See http://man7.org/linux/man-pages/man2/getsockname.2.html

VardhanThigle

comment created time in 4 months

Pull request review commentfortanix/rust-sgx

Implementing ServiceApi changes for bind call.

 pub trait SyncStream: 'static + Send + Sync { }  -trait SyncListener: 'static + Send + Sync {-    fn accept(&self) -> IoResult<(FileDesc, Box<dyn ToString>, Box<dyn ToString>)>;+/// SyncListener lets an implementation implement a slightly modified form of `std::net::TcpListener::accept`.+pub trait SyncListener: 'static + Send + Sync {+    /// The enclave may optionally request the local or peer addresses+    /// be returned in `local_addr` or `peer_addr`, respectively.+    /// If `local_addr` and/or `peer_addr` are not `None`, they will point to an empty `String`.+    /// On success, user-space can fill in the strings as appropriate.+    ///+    /// The enclave must not make any security decisions based on the local address received.+    fn accept(&self, local_addr: Option<&mut String>, peer_addr: Option<&mut String>) -> IoResult<Box<dyn SyncStream>>; }  impl SyncListener for TcpListener {-    fn accept(&self) -> IoResult<(FileDesc, Box<dyn ToString>, Box<dyn ToString>)> {+    fn accept(&self, local_addr: Option<&mut String>, peer_addr: Option<&mut String>) -> IoResult<Box<dyn SyncStream>> {         TcpListener::accept(self).map(|(s, peer)| {-            let local = match s.local_addr() {-                Ok(local) => Box::new(local) as _,-                Err(_) => Box::new("error") as _,-            };-            (FileDesc::stream(s), local, Box::new(peer) as _)+            if let Some(local_addr) = local_addr {+                match self.local_addr() {+                    Ok(local) => {*local_addr = local.to_string()},+                    Err(_) => {*local_addr = "error".to_string()},

After further discussion, we were thinking it could make more sense to early return from this function if self.local_addr() returns error, or alternatively not set local_addr in that case.

VardhanThigle

comment created time in 4 months

Pull request review commentfortanix/rust-sgx

Implementing ServiceApi changes for bind call.

 pub trait SyncStream: 'static + Send + Sync { }  -trait SyncListener: 'static + Send + Sync {-    fn accept(&self) -> IoResult<(FileDesc, Box<dyn ToString>, Box<dyn ToString>)>;+/// SyncListener lets an implementation implement a slightly modified form of `std::net::TcpListener::accept`.+pub trait SyncListener: 'static + Send + Sync {+    /// The enclave may optionally request the local or peer addresses+    /// be returned in `local_addr` or `peer_addr`, respectively.+    /// If `local_addr` and/or `peer_addr` are not `None`, they will point to an empty `String`.+    /// On success, user-space can fill in the strings as appropriate.+    ///+    /// The enclave must not make any security decisions based on the local address received.+    fn accept(&self, local_addr: Option<&mut String>, peer_addr: Option<&mut String>) -> IoResult<Box<dyn SyncStream>>; }  impl SyncListener for TcpListener {-    fn accept(&self) -> IoResult<(FileDesc, Box<dyn ToString>, Box<dyn ToString>)> {+    fn accept(&self, local_addr: Option<&mut String>, peer_addr: Option<&mut String>) -> IoResult<Box<dyn SyncStream>> {         TcpListener::accept(self).map(|(s, peer)| {-            let local = match s.local_addr() {-                Ok(local) => Box::new(local) as _,-                Err(_) => Box::new("error") as _,-            };-            (FileDesc::stream(s), local, Box::new(peer) as _)+            if let Some(local_addr) = local_addr {+                match self.local_addr() {+                    Ok(local) => {*local_addr = local.to_string()},+                    Err(_) => {*local_addr = "error".to_string()},

Why do we set "error" here? It doesn't make sense to me -- it's not an IP address.

VardhanThigle

comment created time in 4 months

Pull request review commentfortanix/rust-sgx

[ZIRC-203] EnclaveOS diagnostics added for pre and post installation

 mod serde {         }     } }++#[derive(Debug, Clone, Copy, Serialize, Deserialize)]+pub enum DSStatus {+    Running,+    NotRunning,+}++#[derive(Debug, Clone, Serialize, Deserialize)]+pub struct NodeAgentStatus{+    pub current_ver: String,+}++#[derive(Debug, PartialEq)]+pub enum BuildType {+    Generic,+    EnclaveOSPreInstall,+    EnclaveOSPostInstall,+}++lazy_static! {+    pub static ref BUILD_FOR: Mutex<BuildType> = Mutex::new(BuildType::Generic);

I think passing in BuildType into fn detect as well as fn print would be sufficient.

prawalgangwar

comment created time in 5 months

Pull request review commentfortanix/rust-sgx

[ZIRC-203] EnclaveOS diagnostics added for pre and post installation

 impl Tests {             self.functions.lookup::<Psw>().supported() == Status::Supported {             println!("\nYou're all set to start running SGX programs!");         }++        // Creating two variables as mutex lock could not be taken up twice in a single expression+        let eos_pre_install_check = {*BUILD_FOR.lock().unwrap() == BuildType::EnclaveOSPreInstall};+        let eos_post_install_check= {*BUILD_FOR.lock().unwrap() == BuildType::EnclaveOSPostInstall};

Probably a moot point, but

  • the { } are not needed on the above two lines
  • you don't need to lock BUILD_FOR twice -- you can instead just assign a local variable of type BuildType to *BUILD_FOR.lock().unwrap().
prawalgangwar

comment created time in 5 months

Pull request review commentfortanix/rust-sgx

[ZIRC-203] EnclaveOS diagnostics added for pre and post installation

 mod serde {         }     } }++#[derive(Debug, Clone, Copy, Serialize, Deserialize)]+pub enum DSStatus {+    Running,+    NotRunning,+}++#[derive(Debug, Clone, Serialize, Deserialize)]+pub struct NodeAgentStatus{+    pub current_ver: String,+}++#[derive(Debug, PartialEq)]+pub enum BuildType {+    Generic,+    EnclaveOSPreInstall,+    EnclaveOSPostInstall,+}++lazy_static! {+    pub static ref BUILD_FOR: Mutex<BuildType> = Mutex::new(BuildType::Generic);

I think passing in BuildType into fn detect as well as print (add it beside the verbose argument) would be sufficient.

prawalgangwar

comment created time in 5 months

Pull request review commentfortanix/rust-sgx

[ZIRC-203] EnclaveOS diagnostics added for pre and post installation

 impl Dependency<RunEnclaveProdWl> for RunEnclaveProd {     const CONTROL_VISIBILITY: bool = true; } +#[derive(Default, DebugSupport, Update)]+struct Eor {+    graphene : Status,+    nodeagent : Status,+    permdaemon : Status,+}++impl Print for Eor {+    fn supported(&self) -> Status {+        if {*BUILD_FOR.lock().unwrap() == BuildType::EnclaveOSPostInstall} {+            self.graphene & self.nodeagent & self.permdaemon+        } else {+            self.graphene & self.permdaemon+        }+    }+}++#[optional_inner]+#[derive(Clone, DebugSupport)]+struct GrapheneDevice {+    service: Result<(), Rc<Error>>,+}++impl Update for GrapheneDevice {+    fn update(&mut self, support: &SgxSupport) {+        self.inner = Some(GrapheneDeviceInner {+            service: match support.enclaveos_dev {+                Ok(_) => Ok(()),+                Err(ref e) => Err(e.clone()),+            },+        });+    }+}++impl Print for GrapheneDevice {+    fn supported(&self) -> Status {+        self.inner.as_ref().map(|inner| inner.service.is_ok()).as_req()+    }++    fn print(&self, level: usize) {+        print!("{:width$}{}{} (/dev/gsgx)", "", self.supported().paint(), self.name(), width = level * 2);+        println!("");+    }+}++#[optional_inner]+#[derive(Clone, DebugSupport)]+struct NodeAgent {+    version: Result<String, Rc<Error>>,+}++impl Update for NodeAgent{+    fn update(&mut self, support: &SgxSupport) {+        self.inner = Some(NodeAgentInner {+            version: match support.nodeagent {+                Ok(_) => Ok(support.nodeagent.clone().unwrap().current_ver),+                Err(ref e) => Err(e.clone()),+            },+        });+    }+}++impl Print for NodeAgent {+    fn supported(&self) -> Status {+        self.inner.as_ref().map(|inner| inner.version.is_ok()).as_req()+    }++    fn print(&self, level: usize) {+        if self.supported() == Status::Supported  {+            println!("{:width$}{}{} ({})", "", self.supported().paint(), self.name(), self.inner.as_ref().map(|inner| inner.version.clone().unwrap()).unwrap(), width = level * 2);+        }+        else {+            println!("{:width$}{}{}", "", self.supported().paint(), self.name(), width = level * 2);+        }+    }+}++#[optional_inner]+#[derive(Clone, DebugSupport)]+struct PermDaemon {+    service: Result<(), Rc<Error>>,+}++impl Update for PermDaemon{+    fn update(&mut self, support: &SgxSupport) {+        self.inner = Some(PermDaemonInner {+            service: match support.permdaemon {+                Ok(v) => Ok(v),+                Err(ref e) => Err(e.clone()),+            },

No need for match -- just do service: support.permdaemon.clone()

prawalgangwar

comment created time in 5 months

Pull request review commentfortanix/rust-sgx

[ZIRC-203] EnclaveOS diagnostics added for pre and post installation

 impl Tests {                     "Production mode (Intel whitelisted)" => Test(RunEnclaveProdWl),                 }),             }),+            "EnclavesOS system requirements" => Category(Eor, tests: {+                @[update_supported = graphene]+                "Graphene kernel device" => Test(GrapheneDevice),+                @[update_supported = nodeagent]+                "Node Agent " => Test(NodeAgent),

nit: space between Agent and " (not sure if this matters).

prawalgangwar

comment created time in 5 months

Pull request review commentfortanix/rust-sgx

[ZIRC-203] EnclaveOS diagnostics added for pre and post installation

 impl SgxSupport {             }             Ok(Rc::new(RefCell::new(lib.build())))         })();+        let gsgxdev= match File::open("/dev/gsgx") {+            Ok(_) => Ok(()),+            Err(e) => Err(e.into()),+        };+        let nodeagent_status = (|| {+            let request_url = format!("http://localhost:9092/v1/sys/version");+            let mut response = reqwest::get(&request_url)?;+            let ver :Version = response.json().unwrap();

Nit: ver :Version -> ver: Version. Also ideally we wouldn't unwrap here.

prawalgangwar

comment created time in 5 months

Pull request review commentfortanix/rust-sgx

[ZIRC-203] EnclaveOS diagnostics added for pre and post installation

 impl Dependency<RunEnclaveProdWl> for RunEnclaveProd {     const CONTROL_VISIBILITY: bool = true; } +#[derive(Default, DebugSupport, Update)]+struct Eor {+    graphene : Status,+    nodeagent : Status,+    permdaemon : Status,+}++impl Print for Eor {+    fn supported(&self) -> Status {+        if {*BUILD_FOR.lock().unwrap() == BuildType::EnclaveOSPostInstall} {+            self.graphene & self.nodeagent & self.permdaemon+        } else {+            self.graphene & self.permdaemon+        }+    }+}++#[optional_inner]+#[derive(Clone, DebugSupport)]+struct GrapheneDevice {+    service: Result<(), Rc<Error>>,+}++impl Update for GrapheneDevice {+    fn update(&mut self, support: &SgxSupport) {+        self.inner = Some(GrapheneDeviceInner {+            service: match support.enclaveos_dev {+                Ok(_) => Ok(()),+                Err(ref e) => Err(e.clone()),+            },+        });+    }+}++impl Print for GrapheneDevice {+    fn supported(&self) -> Status {+        self.inner.as_ref().map(|inner| inner.service.is_ok()).as_req()+    }++    fn print(&self, level: usize) {+        print!("{:width$}{}{} (/dev/gsgx)", "", self.supported().paint(), self.name(), width = level * 2);+        println!("");+    }+}++#[optional_inner]+#[derive(Clone, DebugSupport)]+struct NodeAgent {+    version: Result<String, Rc<Error>>,+}++impl Update for NodeAgent{+    fn update(&mut self, support: &SgxSupport) {+        self.inner = Some(NodeAgentInner {+            version: match support.nodeagent {+                Ok(_) => Ok(support.nodeagent.clone().unwrap().current_ver),

No need to unwrap -- do Ok(nodeagent) => nodeagent.current_ver here

prawalgangwar

comment created time in 5 months

Pull request review commentfortanix/rust-sgx

[ZIRC-203] EnclaveOS diagnostics added for pre and post installation

 impl Dependency<RunEnclaveProdWl> for RunEnclaveProd {     const CONTROL_VISIBILITY: bool = true; } +#[derive(Default, DebugSupport, Update)]+struct Eor {+    graphene : Status,+    nodeagent : Status,+    permdaemon : Status,+}++impl Print for Eor {+    fn supported(&self) -> Status {+        if {*BUILD_FOR.lock().unwrap() == BuildType::EnclaveOSPostInstall} {+            self.graphene & self.nodeagent & self.permdaemon+        } else {+            self.graphene & self.permdaemon+        }+    }+}++#[optional_inner]+#[derive(Clone, DebugSupport)]+struct GrapheneDevice {+    service: Result<(), Rc<Error>>,+}++impl Update for GrapheneDevice {+    fn update(&mut self, support: &SgxSupport) {+        self.inner = Some(GrapheneDeviceInner {+            service: match support.enclaveos_dev {+                Ok(_) => Ok(()),+                Err(ref e) => Err(e.clone()),+            },

I don't think you need a match here -- just do service: support.enclaveos_dev.clone().

prawalgangwar

comment created time in 5 months

Pull request review commentfortanix/rust-sgx

[ZIRC-203] EnclaveOS diagnostics added for pre and post installation

 impl Dependency<RunEnclaveProdWl> for RunEnclaveProd {     const CONTROL_VISIBILITY: bool = true; } +#[derive(Default, DebugSupport, Update)]+struct Eor {+    graphene : Status,+    nodeagent : Status,+    permdaemon : Status,+}++impl Print for Eor {+    fn supported(&self) -> Status {+        if {*BUILD_FOR.lock().unwrap() == BuildType::EnclaveOSPostInstall} {

Probably moot point, but the { } are not needed here

prawalgangwar

comment created time in 5 months

Pull request review commentfortanix/rust-sgx

[ZIRC-203] EnclaveOS diagnostics added for pre and post installation

 impl Dependency<RunEnclaveProdWl> for RunEnclaveProd {     const CONTROL_VISIBILITY: bool = true; } +#[derive(Default, DebugSupport, Update)]+struct Eor {

What does Eor mean?

prawalgangwar

comment created time in 5 months

Pull request review commentfortanix/rust-sgx

[ZIRC-203] EnclaveOS diagnostics added for pre and post installation

 mod serde {         }     } }++#[derive(Debug, Clone, Copy, Serialize, Deserialize)]+pub enum DSStatus {+    Running,+    NotRunning,+}++#[derive(Debug, Clone, Serialize, Deserialize)]+pub struct NodeAgentStatus{+    pub current_ver: String,+}++#[derive(Debug, PartialEq)]+pub enum BuildType {

Can we deduplicate this with https://github.com/fortanix/rust-sgx/pull/166/files#diff-250353eda07cb81b9a56e1ba1f579063R346?

prawalgangwar

comment created time in 5 months

Pull request review commentfortanix/rust-sgx

[ZIRC-203] EnclaveOS diagnostics added for pre and post installation

 impl Tests {             self.functions.lookup::<Psw>().supported() == Status::Supported {             println!("\nYou're all set to start running SGX programs!");         }++        // Creating two variables as mutex lock could not be taken up twice in a single expression+        let eos_pre_install_check = {*BUILD_FOR.lock().unwrap() == BuildType::EnclaveOSPreInstall};+        let eos_post_install_check= {*BUILD_FOR.lock().unwrap() == BuildType::EnclaveOSPostInstall};+        if  eos_pre_install_check || eos_post_install_check {+            if self.functions.lookup::<Isa>().supported() &+                self.functions.lookup::<Psw>().supported() &+                self.functions.lookup::<Eor>().supported() == Status::Supported {+                println!("The system is configured for EnclaveOS applications!");+            } else {+                println!("The system is not configured for EnclaveOS applications!");+                // Using a non standard exit code for the failure case+                *EXIT_CODE.lock().unwrap() = 10;

Could we just process::exit(10) here and avoid both the EXIT_CODE lazy_static as well as the process::exit at the end of main?

prawalgangwar

comment created time in 5 months

Pull request review commentfortanix/rust-sgx

[ZIRC-203] EnclaveOS diagnostics added for pre and post installation

 impl SgxSupport {             }             Ok(Rc::new(RefCell::new(lib.build())))         })();+        let gsgxdev= match File::open("/dev/gsgx") {+            Ok(_) => Ok(()),+            Err(e) => Err(e.into()),+        };+        let nodeagent_status = (|| {+            let request_url = format!("http://localhost:9092/v1/sys/version");

No need for format!() -- you can just let request_url = "..." and then git rid of the & in the subsequent line.

prawalgangwar

comment created time in 5 months

Pull request review commentfortanix/rust-sgx

[ZIRC-203] EnclaveOS diagnostics added for pre and post installation

 mod serde {         }     } }++#[derive(Debug, Clone, Copy, Serialize, Deserialize)]+pub enum DSStatus {+    Running,+    NotRunning,+}++#[derive(Debug, Clone, Serialize, Deserialize)]+pub struct NodeAgentStatus{+    pub current_ver: String,

Could we just name this field version and unify the struct with the other struct Version (maybe call it NodeAgentVersion)?.

prawalgangwar

comment created time in 5 months

Pull request review commentfortanix/rust-sgx

[ZIRC-203] EnclaveOS diagnostics added for pre and post installation

 mod serde {         }     } }++#[derive(Debug, Clone, Copy, Serialize, Deserialize)]+pub enum DSStatus {+    Running,+    NotRunning,+}++#[derive(Debug, Clone, Serialize, Deserialize)]+pub struct NodeAgentStatus{+    pub current_ver: String,+}++#[derive(Debug, PartialEq)]+pub enum BuildType {+    Generic,+    EnclaveOSPreInstall,+    EnclaveOSPostInstall,+}++lazy_static! {+    pub static ref BUILD_FOR: Mutex<BuildType> = Mutex::new(BuildType::Generic);

Putting this in a global lazy static obscures the data flow. Ideally the BuildType would be passed directly to the functions that use it.

prawalgangwar

comment created time in 5 months

Pull request review commentfortanix/rust-sgx

[ZIRC-203] EnclaveOS diagnostics added for pre and post installation

 impl SgxSupport {             }             Ok(Rc::new(RefCell::new(lib.build())))         })();+        let gsgxdev= match File::open("/dev/gsgx") {+            Ok(_) => Ok(()),+            Err(e) => Err(e.into()),+        };+        let nodeagent_status = (|| {+            let request_url = format!("http://localhost:9092/v1/sys/version");+            let mut response = reqwest::get(&request_url)?;+            let ver :Version = response.json().unwrap();+            Ok(NodeAgentStatus{current_ver: ver.version.clone()})

You don't need the .clone() here, since we own ver.

prawalgangwar

comment created time in 5 months

Pull request review commentfortanix/rust-sgx

[ZIRC-203] EnclaveOS diagnostics added for pre and post installation

 impl SgxSupport {             }             Ok(Rc::new(RefCell::new(lib.build())))         })();+        let gsgxdev= match File::open("/dev/gsgx") {+            Ok(_) => Ok(()),+            Err(e) => Err(e.into()),+        };

nit:

let gsxgdev = (|| -> Result<(), Error> {
    File::open("/dev/gsgx")?;
    Ok(())
})();

for consistency.

prawalgangwar

comment created time in 5 months

Pull request review commentfortanix/rust-sgx

[ZIRC-203] EnclaveOS diagnostics added for pre and post installation

 pub struct SgxSupport {     sgxdev_status: Result<KmodStatus, Rc<Error>>,     #[serde(skip, default = "no_deserialize")]     loader_encllib: Result<Rc<RefCell<EnclCommonLib>>, Rc<Error>>,+    #[serde(with = "detect_result")]+    enclaveos_dev: Result<(), Rc<Error>>,+    #[serde(with = "detect_result")]+    nodeagent: Result<NodeAgentStatus, Rc<Error>>,+    #[serde(with = "detect_result")]+    permdaemon: Result<(), Rc<Error>>,

nit: perm_daemon

prawalgangwar

comment created time in 5 months

Pull request review commentfortanix/rust-sgx

[ZIRC-203] EnclaveOS diagnostics added for pre and post installation

 pub struct SgxSupport {     sgxdev_status: Result<KmodStatus, Rc<Error>>,     #[serde(skip, default = "no_deserialize")]     loader_encllib: Result<Rc<RefCell<EnclCommonLib>>, Rc<Error>>,+    #[serde(with = "detect_result")]+    enclaveos_dev: Result<(), Rc<Error>>,+    #[serde(with = "detect_result")]+    nodeagent: Result<NodeAgentStatus, Rc<Error>>,

nit: node_agent

prawalgangwar

comment created time in 5 months

Pull request review commentfortanix/rust-sgx

[ZIRC-203] EnclaveOS diagnostics added for pre and post installation

 mod serde {         }     } }++#[derive(Debug, Clone, Copy, Serialize, Deserialize)]+pub enum DSStatus {+    Running,+    NotRunning,+}++#[derive(Debug, Clone, Serialize, Deserialize)]+pub struct NodeAgentStatus{+    pub current_ver: String,

This could use a comment describing the format of the string.

prawalgangwar

comment created time in 5 months

Pull request review commentfortanix/rust-sgx

[ZIRC-203] EnclaveOS diagnostics added for pre and post installation

 mod serde {         }     } }++#[derive(Debug, Clone, Copy, Serialize, Deserialize)]+pub enum DSStatus {+    Running,+    NotRunning,+}++#[derive(Debug, Clone, Serialize, Deserialize)]+pub struct NodeAgentStatus{

nit: space before {

prawalgangwar

comment created time in 5 months

more