diff options
| author | Steven Fackler <[email protected]> | 2016-11-03 20:54:08 -0700 |
|---|---|---|
| committer | Steven Fackler <[email protected]> | 2016-11-03 20:54:08 -0700 |
| commit | e87b75fa03ab6ec78903087a069fd868cf02903e (patch) | |
| tree | 1e3ebd069450f37a865861181e1ff2474929bf1e | |
| parent | Avoid lhash weirdness (diff) | |
| download | rust-openssl-e87b75fa03ab6ec78903087a069fd868cf02903e.tar.xz rust-openssl-e87b75fa03ab6ec78903087a069fd868cf02903e.zip | |
Rename BnCtx
| -rw-r--r-- | openssl/src/bn.rs | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/openssl/src/bn.rs b/openssl/src/bn.rs index 989f65e0..a64d18bf 100644 --- a/openssl/src/bn.rs +++ b/openssl/src/bn.rs @@ -23,12 +23,12 @@ pub enum RNGProperty { TwoMsbOne = 1, } -type_!(BnCtx, ffi::BN_CTX, ffi::BN_CTX_free); +type_!(BigNumContext, ffi::BN_CTX, ffi::BN_CTX_free); -impl BnCtx { - /// Returns a new `BnCtx`. - pub fn new() -> Result<BnCtx, ErrorStack> { - unsafe { cvt_p(ffi::BN_CTX_new()).map(BnCtx) } +impl BigNumContext { + /// Returns a new `BigNumContext`. + pub fn new() -> Result<BigNumContext, ErrorStack> { + unsafe { cvt_p(ffi::BN_CTX_new()).map(BigNumContext) } } /// Places the result of `a * b` in `r`. @@ -681,7 +681,7 @@ impl<'a, 'b> Mul<&'b Ref<BigNum>> for &'a Ref<BigNum> { type Output = BigNum; fn mul(self, oth: &Ref<BigNum>) -> BigNum { - let mut ctx = BnCtx::new().unwrap(); + let mut ctx = BigNumContext::new().unwrap(); let mut r = BigNum::new().unwrap(); ctx.mul(&mut r, self, oth).unwrap(); r @@ -694,7 +694,7 @@ impl<'a, 'b> Div<&'b Ref<BigNum>> for &'a Ref<BigNum> { type Output = BigNum; fn div(self, oth: &'b Ref<BigNum>) -> BigNum { - let mut ctx = BnCtx::new().unwrap(); + let mut ctx = BigNumContext::new().unwrap(); let mut dv = BigNum::new().unwrap(); ctx.div(Some(&mut dv), None, self, oth).unwrap(); dv @@ -707,7 +707,7 @@ impl<'a, 'b> Rem<&'b Ref<BigNum>> for &'a Ref<BigNum> { type Output = BigNum; fn rem(self, oth: &'b Ref<BigNum>) -> BigNum { - let mut ctx = BnCtx::new().unwrap(); + let mut ctx = BigNumContext::new().unwrap(); let mut rem = BigNum::new().unwrap(); ctx.div(None, Some(&mut rem), self, oth).unwrap(); rem @@ -780,7 +780,7 @@ impl Neg for BigNum { #[cfg(test)] mod tests { - use bn::{BnCtx, BigNum}; + use bn::{BigNumContext, BigNum}; #[test] fn test_to_from_slice() { @@ -805,7 +805,7 @@ mod tests { let mut p = BigNum::new().unwrap(); BigNum::generate_prime(&mut p, 128, true, None, Some(&a)).unwrap(); - let mut ctx = BnCtx::new().unwrap(); + let mut ctx = BigNumContext::new().unwrap(); assert!(ctx.is_prime(&p, 100).unwrap()); assert!(ctx.is_prime_fasttest(&p, 100, true).unwrap()); } |