Commit 69aa3358 authored by Steven Fackler's avatar Steven Fackler
Browse files

Drop data_encoding dev dependency

parent 9ccdcdb8
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -30,4 +30,3 @@ openssl-sys = { version = "0.9.40", path = "../openssl-sys" }
[dev-dependencies]
tempdir = "0.3"
hex = "0.3"
data-encoding = "2.0"
+34 −23
Original line number Diff line number Diff line
@@ -163,7 +163,8 @@ impl EcGroupRef {
                a.as_ptr(),
                b.as_ptr(),
                ctx.as_ptr(),
            )).map(|_| ())
            ))
            .map(|_| ())
        }
    }

@@ -192,7 +193,8 @@ impl EcGroupRef {
                a.as_ptr(),
                b.as_ptr(),
                ctx.as_ptr(),
            )).map(|_| ())
            ))
            .map(|_| ())
        }
    }

@@ -220,7 +222,8 @@ impl EcGroupRef {
                self.as_ptr(),
                order.as_ptr(),
                ctx.as_ptr(),
            )).map(|_| ())
            ))
            .map(|_| ())
        }
    }

@@ -272,7 +275,8 @@ impl EcPointRef {
                a.as_ptr(),
                b.as_ptr(),
                ctx.as_ptr(),
            )).map(|_| ())
            ))
            .map(|_| ())
        }
    }

@@ -296,7 +300,8 @@ impl EcPointRef {
                q.as_ptr(),
                m.as_ptr(),
                ctx.as_ptr(),
            )).map(|_| ())
            ))
            .map(|_| ())
        }
    }

@@ -315,7 +320,8 @@ impl EcPointRef {
                ptr::null(),
                ptr::null(),
                ctx.as_ptr(),
            )).map(|_| ())
            ))
            .map(|_| ())
        }
    }

@@ -336,7 +342,8 @@ impl EcPointRef {
                q.as_ptr(),
                m.as_ptr(),
                ctx.as_ptr(),
            )).map(|_| ())
            ))
            .map(|_| ())
        }
    }

@@ -351,7 +358,8 @@ impl EcPointRef {
                group.as_ptr(),
                self.as_ptr(),
                ctx.as_ptr(),
            )).map(|_| ())
            ))
            .map(|_| ())
        }
    }

@@ -437,7 +445,8 @@ impl EcPointRef {
                x.as_ptr(),
                y.as_ptr(),
                ctx.as_ptr(),
            )).map(|_| ())
            ))
            .map(|_| ())
        }
    }

@@ -462,7 +471,8 @@ impl EcPointRef {
                x.as_ptr(),
                y.as_ptr(),
                ctx.as_ptr(),
            )).map(|_| ())
            ))
            .map(|_| ())
        }
    }
}
@@ -688,7 +698,8 @@ impl EcKey<Public> {
                    cvt(ffi::EC_KEY_set_public_key(
                        key.as_ptr(),
                        public_key.as_ptr(),
                    )).map(|_| key)
                    ))
                    .map(|_| key)
                })
        }
    }
@@ -710,7 +721,8 @@ impl EcKey<Public> {
                        key.as_ptr(),
                        x.as_ptr(),
                        y.as_ptr(),
                    )).map(|_| key)
                    ))
                    .map(|_| key)
                })
        }
    }
@@ -745,13 +757,15 @@ impl EcKey<Private> {
                    cvt(ffi::EC_KEY_set_private_key(
                        key.as_ptr(),
                        private_number.as_ptr(),
                    )).map(|_| key)
                    ))
                    .map(|_| key)
                })
                .and_then(|key| {
                    cvt(ffi::EC_KEY_set_public_key(
                        key.as_ptr(),
                        public_key.as_ptr(),
                    )).map(|_| key)
                    ))
                    .map(|_| key)
                })
        }
    }
@@ -803,9 +817,10 @@ impl<T> Clone for EcKey<T> {

#[cfg(test)]
mod test {
    use hex::FromHex;

    use super::*;
    use bn::{BigNum, BigNumContext};
    use data_encoding::BASE64URL_NOPAD;
    use nid::Nid;

    #[test]
@@ -889,11 +904,9 @@ mod test {
    #[test]
    fn key_from_affine_coordinates() {
        let group = EcGroup::from_curve_name(Nid::X9_62_PRIME256V1).unwrap();
        let x = BASE64URL_NOPAD
            .decode("MKBCTNIcKUSDii11ySs3526iDZ8AiTo7Tu6KPAqv7D4".as_bytes())
        let x = Vec::from_hex("30a0424cd21c2944838a2d75c92b37e76ea20d9f00893a3b4eee8a3c0aafec3e")
            .unwrap();
        let y = BASE64URL_NOPAD
            .decode("4Etl6SRW2YiLUrN5vfvVHuhp7x8PxltmWWlbbM4IFyM".as_bytes())
        let y = Vec::from_hex("e04b65e92456d9888b52b379bdfbd51ee869ef1f0fc65b6659695b6cce081723")
            .unwrap();

        let xbn = BigNum::from_slice(&x).unwrap();
@@ -906,11 +919,9 @@ mod test {
    #[test]
    fn get_affine_coordinates() {
        let group = EcGroup::from_curve_name(Nid::X9_62_PRIME256V1).unwrap();
        let x = BASE64URL_NOPAD
            .decode("MKBCTNIcKUSDii11ySs3526iDZ8AiTo7Tu6KPAqv7D4".as_bytes())
        let x = Vec::from_hex("30a0424cd21c2944838a2d75c92b37e76ea20d9f00893a3b4eee8a3c0aafec3e")
            .unwrap();
        let y = BASE64URL_NOPAD
            .decode("4Etl6SRW2YiLUrN5vfvVHuhp7x8PxltmWWlbbM4IFyM".as_bytes())
        let y = Vec::from_hex("e04b65e92456d9888b52b379bdfbd51ee869ef1f0fc65b6659695b6cce081723")
            .unwrap();

        let xbn = BigNum::from_slice(&x).unwrap();
+0 −2
Original line number Diff line number Diff line
@@ -120,8 +120,6 @@ extern crate lazy_static;
extern crate libc;
extern crate openssl_sys as ffi;

#[cfg(test)]
extern crate data_encoding;
#[cfg(test)]
extern crate hex;
#[cfg(test)]