diff options
author | Stuart Stock <stuart@int08h.com> | 2018-10-18 21:01:56 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-10-18 21:01:56 -0500 |
commit | b801eda92ec0bb85057ee3c78f864ae2fa9f14b6 (patch) | |
tree | 4bba44243589dbd3dbbd0b01217d6a65a763ab04 /src/kms | |
parent | 54955e4126a6da3aa233ccf837d7ba03f40be6d3 (diff) | |
parent | 358de5e93e85b2ee9f48c25f981bd5938bd8d1f7 (diff) | |
download | roughenough-b801eda92ec0bb85057ee3c78f864ae2fa9f14b6.zip |
Merge pull request #11 from Aaron1011/better-fuzz
Support server fuzzing
Diffstat (limited to 'src/kms')
-rw-r--r-- | src/kms/awskms.rs | 1 | ||||
-rw-r--r-- | src/kms/envelope.rs | 9 | ||||
-rw-r--r-- | src/kms/gcpkms.rs | 12 | ||||
-rw-r--r-- | src/kms/mod.rs | 2 |
4 files changed, 15 insertions, 9 deletions
diff --git a/src/kms/awskms.rs b/src/kms/awskms.rs index 96d4a38..14f0804 100644 --- a/src/kms/awskms.rs +++ b/src/kms/awskms.rs @@ -121,4 +121,3 @@ pub mod inner { } } } - diff --git a/src/kms/envelope.rs b/src/kms/envelope.rs index 1f6d615..da75961 100644 --- a/src/kms/envelope.rs +++ b/src/kms/envelope.rs @@ -73,7 +73,6 @@ fn vec_zero_filled(len: usize) -> Vec<u8> { pub struct EnvelopeEncryption; impl EnvelopeEncryption { - /// Decrypt a seed previously encrypted with `encrypt_seed()` pub fn decrypt_seed(kms: &KmsProvider, ciphertext_blob: &[u8]) -> Result<Vec<u8>, KmsError> { if ciphertext_blob.len() < MIN_PAYLOAD_SIZE { @@ -107,7 +106,13 @@ impl EnvelopeEncryption { // Decrypt the seed value using the DEK let dek_open_key = OpeningKey::new(&AES_256_GCM, &dek)?; - match open_in_place(&dek_open_key, &nonce, AD, IN_PREFIX_LEN, &mut encrypted_seed) { + match open_in_place( + &dek_open_key, + &nonce, + AD, + IN_PREFIX_LEN, + &mut encrypted_seed, + ) { Ok(plaintext_seed) => Ok(plaintext_seed.to_vec()), Err(_) => Err(KmsError::OperationFailed( "failed to decrypt plaintext seed".to_string(), diff --git a/src/kms/gcpkms.rs b/src/kms/gcpkms.rs index c0fbb5d..13303db 100644 --- a/src/kms/gcpkms.rs +++ b/src/kms/gcpkms.rs @@ -19,14 +19,16 @@ extern crate log; pub mod inner { extern crate base64; + extern crate google_cloudkms1 as cloudkms1; extern crate hyper; extern crate hyper_rustls; extern crate yup_oauth2 as oauth2; - extern crate google_cloudkms1 as cloudkms1; + use std::fmt; use std::env; use std::fmt::Formatter; + use std::result::Result; use std::str::FromStr; use std::result::Result; use std::default::Default; @@ -34,13 +36,15 @@ pub mod inner { use std::path::Path; use std::time::Duration; - use self::oauth2::{service_account_key_from_file, ServiceAccountAccess, ServiceAccountKey}; use self::cloudkms1::CloudKMS; - use self::cloudkms1::{Result as CloudKmsResult, Error as CloudKmsError, EncryptRequest, DecryptRequest}; + use self::cloudkms1::{ + DecryptRequest, EncryptRequest, Error as CloudKmsError, Result as CloudKmsResult, + }; use self::hyper::net::HttpsConnector; use self::hyper::header::Headers; use self::hyper::status::StatusCode; use self::hyper_rustls::TlsClient; + use self::oauth2::{service_account_key_from_file, ServiceAccountAccess, ServiceAccountKey}; use kms::{EncryptedDEK, KmsError, KmsProvider, PlaintextDEK}; @@ -156,5 +160,3 @@ pub mod inner { panic!("Failed to load service account credential. Is GOOGLE_APPLICATION_CREDENTIALS set?"); } } - - diff --git a/src/kms/mod.rs b/src/kms/mod.rs index 810623a..56e7631 100644 --- a/src/kms/mod.rs +++ b/src/kms/mod.rs @@ -52,9 +52,9 @@ mod envelope; use base64; +use ring; use std; use std::error::Error; -use ring; use config::ServerConfig; use error; |