diff options
| author | Steven Fackler <[email protected]> | 2016-11-14 22:08:04 +0100 |
|---|---|---|
| committer | Steven Fackler <[email protected]> | 2016-11-14 22:08:04 +0100 |
| commit | 90acfaea513ad079119e7b3485a9a2e35702ad33 (patch) | |
| tree | 925ac5c9612fe951a874db5bcd5920c9678f424d /openssl/src | |
| parent | Add EcPoint::invert (diff) | |
| download | rust-openssl-90acfaea513ad079119e7b3485a9a2e35702ad33.tar.xz rust-openssl-90acfaea513ad079119e7b3485a9a2e35702ad33.zip | |
Split EcKey::mul
Diffstat (limited to 'openssl/src')
| -rw-r--r-- | openssl/src/ec_key.rs | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/openssl/src/ec_key.rs b/openssl/src/ec_key.rs index 3b40496a..ae712430 100644 --- a/openssl/src/ec_key.rs +++ b/openssl/src/ec_key.rs @@ -126,20 +126,36 @@ impl EcPointRef { } } - /// Computes `generator * n + q * m`, storing the result in `self`. - /// - /// If `n` is `None`, `q * m` will be computed instead. + /// Computes `q * m`, storing the result in `self`. pub fn mul(&mut self, group: &EcGroupRef, - n: Option<&BigNumRef>, q: &EcPointRef, m: &BigNumRef, - ctx: &mut BigNumContextRef) + ctx: &BigNumContextRef) -> Result<(), ErrorStack> { unsafe { cvt(ffi::EC_POINT_mul(group.as_ptr(), self.as_ptr(), - n.map_or(ptr::null(), |n| n.as_ptr()), + ptr::null(), + q.as_ptr(), + m.as_ptr(), + ctx.as_ptr())) + .map(|_| ()) + } + } + + /// Computes `generator * n + q * m`, storing the result in `self`. + pub fn mul_generator(&mut self, + group: &EcGroupRef, + n: &BigNumRef, + q: &EcPointRef, + m: &BigNumRef, + ctx: &mut BigNumContextRef) + -> Result<(), ErrorStack> { + unsafe { + cvt(ffi::EC_POINT_mul(group.as_ptr(), + self.as_ptr(), + n.as_ptr(), q.as_ptr(), m.as_ptr(), ctx.as_ptr())) |