summaryrefslogtreecommitdiff
path: root/openssl/src/sign.rs
diff options
context:
space:
mode:
authorjohnthagen <johnthagen@gmail.com>2017-10-03 17:44:02 -0400
committerjohnthagen <johnthagen@gmail.com>2017-10-03 17:44:02 -0400
commitb5bb8de4f2bd18735346a6062a13d95bcf82bdee (patch)
tree11a6f6d11bc412fc89a4bfb3517ced56bf047012 /openssl/src/sign.rs
parent7159215e45b8ddd7d423f9fd2b8c37a4cbb90563 (diff)
downloadrust-openssl-b5bb8de4f2bd18735346a6062a13d95bcf82bdee.zip
Convert try! usage to ?
Diffstat (limited to 'openssl/src/sign.rs')
-rw-r--r--openssl/src/sign.rs16
1 files changed, 8 insertions, 8 deletions
diff --git a/openssl/src/sign.rs b/openssl/src/sign.rs
index 96ec8f75..f8735526 100644
--- a/openssl/src/sign.rs
+++ b/openssl/src/sign.rs
@@ -97,7 +97,7 @@ impl<'a> Signer<'a> {
unsafe {
ffi::init();
- let ctx = try!(cvt_p(EVP_MD_CTX_new()));
+ let ctx = cvt_p(EVP_MD_CTX_new())?;
let mut pctx: *mut ffi::EVP_PKEY_CTX = ptr::null_mut();
let r = ffi::EVP_DigestSignInit(
ctx,
@@ -142,17 +142,17 @@ impl<'a> Signer<'a> {
pub fn finish(&self) -> Result<Vec<u8>, ErrorStack> {
unsafe {
let mut len = 0;
- try!(cvt(ffi::EVP_DigestSignFinal(
+ cvt(ffi::EVP_DigestSignFinal(
self.md_ctx,
ptr::null_mut(),
&mut len,
- )));
+ ))?;
let mut buf = vec![0; len];
- try!(cvt(ffi::EVP_DigestSignFinal(
+ cvt(ffi::EVP_DigestSignFinal(
self.md_ctx,
buf.as_mut_ptr() as *mut _,
&mut len,
- )));
+ ))?;
// The advertised length is not always equal to the real length for things like DSA
buf.truncate(len);
Ok(buf)
@@ -162,7 +162,7 @@ impl<'a> Signer<'a> {
impl<'a> Write for Signer<'a> {
fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
- try!(self.update(buf));
+ self.update(buf)?;
Ok(buf.len())
}
@@ -191,7 +191,7 @@ impl<'a> Verifier<'a> {
unsafe {
ffi::init();
- let ctx = try!(cvt_p(EVP_MD_CTX_new()));
+ let ctx = cvt_p(EVP_MD_CTX_new())?;
let mut pctx: *mut ffi::EVP_PKEY_CTX = ptr::null_mut();
let r = ffi::EVP_DigestVerifyInit(
ctx,
@@ -251,7 +251,7 @@ impl<'a> Verifier<'a> {
impl<'a> Write for Verifier<'a> {
fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
- try!(self.update(buf));
+ self.update(buf)?;
Ok(buf.len())
}