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

Add KeylimeTpmError support and change return type in tpm.rs #53

Merged
merged 3 commits into from
Mar 21, 2019
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
13 changes: 7 additions & 6 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ use hyper::service::service_fn;
use hyper::{Body, Method, Request, Response, Server, StatusCode};
use serde_json::Map;
use std::collections::HashMap;
use std::error::Error;
use std::fs::File;
use std::io::BufReader;
use std::io::Read;
Expand Down Expand Up @@ -368,8 +369,8 @@ fn get_request_handler(
common::RSA_PUBLICKEY_EXPORTABLE.to_string(),
p.to_string(),
) {
Some(q) => q,
None => {
Ok(q) => q,
Err(err) => {
if let Err(e) = set_response_content(
400,
"Failed to crate quote from TPM.",
Expand All @@ -383,7 +384,7 @@ fn get_request_handler(
}
return emsg(
"TPM error. Failed to create quote from TPM.",
None::<String>,
Some(err.description().to_string()),
);
}
};
Expand All @@ -396,8 +397,8 @@ fn get_request_handler(
v.to_string(),
p.to_string(),
) {
Some(q) => q,
None => {
Ok(q) => q,
Err(err) => {
if let Err(e) = set_response_content(
400,
"Failed to create deep quote from TPM.",
Expand All @@ -411,7 +412,7 @@ fn get_request_handler(
}
return emsg(
"TPM error. Failed to create deep quote from TPM.",
None::<String>,
Some(err.description().to_string()),
);
}
};
Expand Down
10 changes: 4 additions & 6 deletions src/secure_mount.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
use super::*;

use common::emsg;
use std::error::Error;
use std::fs;
use std::os::unix::fs::PermissionsExt;
use std::process::Command;

/*
* Input: secure mount directory
* Return: Result wrap boolean with error message
Expand Down Expand Up @@ -128,11 +128,9 @@ fn mount() -> Result<String, Box<String>> {
common::SECURE_SIZE,
s,
),
tpm::EXIT_SUCCESS,
true,
false,
String::new(),
);
None,
)
.map_err(|e| e.description().to_string())?;

Ok(s.to_string())
}
Expand Down
Loading