aboutsummaryrefslogtreecommitdiff
path: root/openssl/src/x509
diff options
context:
space:
mode:
authorSteven Fackler <[email protected]>2016-05-16 23:03:00 -0700
committerSteven Fackler <[email protected]>2016-05-16 23:03:13 -0700
commit1b0757409d634f67b37d4c35af8fec878c2ecc27 (patch)
treeaea16e97de8d023e26417f844052f237a55234ce /openssl/src/x509
parentClean up RSA signature API (diff)
downloadrust-openssl-1b0757409d634f67b37d4c35af8fec878c2ecc27.tar.xz
rust-openssl-1b0757409d634f67b37d4c35af8fec878c2ecc27.zip
Rustfmt
Diffstat (limited to 'openssl/src/x509')
-rw-r--r--openssl/src/x509/mod.rs20
-rw-r--r--openssl/src/x509/tests.rs16
2 files changed, 20 insertions, 16 deletions
diff --git a/openssl/src/x509/mod.rs b/openssl/src/x509/mod.rs
index 0a242a15..3150cc6e 100644
--- a/openssl/src/x509/mod.rs
+++ b/openssl/src/x509/mod.rs
@@ -379,7 +379,9 @@ impl X509Generator {
ffi::X509_set_issuer_name(x509.handle, name);
for (exttype, ext) in self.extensions.iter() {
- try!(X509Generator::add_extension_internal(x509.handle, &exttype, &ext.to_string()));
+ try!(X509Generator::add_extension_internal(x509.handle,
+ &exttype,
+ &ext.to_string()));
}
let hash_fn = self.hash_type.evp_md();
@@ -539,9 +541,9 @@ extern "C" {
impl<'ctx> Clone for X509<'ctx> {
fn clone(&self) -> X509<'ctx> {
unsafe { rust_X509_clone(self.handle) }
- /* FIXME: given that we now have refcounting control, 'owned' should be uneeded, the 'ctx
- * is probably also uneeded. We can remove both to condense the x509 api quite a bit
- */
+ // FIXME: given that we now have refcounting control, 'owned' should be uneeded, the 'ctx
+ // is probably also uneeded. We can remove both to condense the x509 api quite a bit
+ //
X509::new(self.handle, true)
}
}
@@ -671,7 +673,7 @@ impl Extensions {
pub fn add(&mut self, ext: Extension) {
let ext_type = ext.get_type();
- if let Some(index) = self.indexes.get(&ext_type) {
+ if let Some(index) = self.indexes.get(&ext_type) {
self.extensions[*index] = ext;
return;
}
@@ -693,7 +695,7 @@ impl Extensions {
/// extension in the collection.
struct ExtensionsIter<'a> {
current: usize,
- extensions: &'a Vec<Extension>
+ extensions: &'a Vec<Extension>,
}
impl<'a> Iterator for ExtensionsIter<'a> {
@@ -798,9 +800,7 @@ pub struct GeneralNames<'a> {
impl<'a> GeneralNames<'a> {
/// Returns the number of `GeneralName`s in this structure.
pub fn len(&self) -> usize {
- unsafe {
- (*self.stack).stack.num as usize
- }
+ unsafe { (*self.stack).stack.num as usize }
}
/// Returns the specified `GeneralName`.
@@ -823,7 +823,7 @@ impl<'a> GeneralNames<'a> {
pub fn iter(&self) -> GeneralNamesIter {
GeneralNamesIter {
names: self,
- idx: 0
+ idx: 0,
}
}
}
diff --git a/openssl/src/x509/tests.rs b/openssl/src/x509/tests.rs
index 744aba9e..f547a982 100644
--- a/openssl/src/x509/tests.rs
+++ b/openssl/src/x509/tests.rs
@@ -56,9 +56,10 @@ fn test_cert_gen_extension_ordering() {
#[test]
fn test_cert_gen_extension_bad_ordering() {
let result = get_generator()
- .add_extension(OtherNid(Nid::AuthorityKeyIdentifier, "keyid:always".to_owned()))
- .add_extension(OtherNid(Nid::SubjectKeyIdentifier, "hash".to_owned()))
- .generate();
+ .add_extension(OtherNid(Nid::AuthorityKeyIdentifier,
+ "keyid:always".to_owned()))
+ .add_extension(OtherNid(Nid::SubjectKeyIdentifier, "hash".to_owned()))
+ .generate();
assert!(result.is_err());
}
@@ -162,7 +163,8 @@ fn test_subject_alt_name() {
let subject_alt_names = cert.subject_alt_names().unwrap();
assert_eq!(3, subject_alt_names.len());
assert_eq!(Some("foobar.com"), subject_alt_names.get(0).dnsname());
- assert_eq!(subject_alt_names.get(1).ipaddress(), Some(&[127, 0, 0, 1][..]));
+ assert_eq!(subject_alt_names.get(1).ipaddress(),
+ Some(&[127, 0, 0, 1][..]));
assert_eq!(subject_alt_names.get(2).ipaddress(),
Some(&b"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\x01"[..]));
}
@@ -174,8 +176,10 @@ fn test_subject_alt_name_iter() {
let subject_alt_names = cert.subject_alt_names().unwrap();
let mut subject_alt_names_iter = subject_alt_names.iter();
- assert_eq!(subject_alt_names_iter.next().unwrap().dnsname(), Some("foobar.com"));
- assert_eq!(subject_alt_names_iter.next().unwrap().ipaddress(), Some(&[127, 0, 0, 1][..]));
+ assert_eq!(subject_alt_names_iter.next().unwrap().dnsname(),
+ Some("foobar.com"));
+ assert_eq!(subject_alt_names_iter.next().unwrap().ipaddress(),
+ Some(&[127, 0, 0, 1][..]));
assert_eq!(subject_alt_names_iter.next().unwrap().ipaddress(),
Some(&b"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\x01"[..]));
assert!(subject_alt_names_iter.next().is_none());