Commit 90acfaea authored by Steven Fackler's avatar Steven Fackler
Browse files

Split EcKey::mul

parent e929e092
Loading
Loading
Loading
Loading
+22 −6
Original line number Diff line number Diff line
@@ -126,12 +126,28 @@ 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: &BigNumContextRef)
               -> Result<(), ErrorStack> {
        unsafe {
            cvt(ffi::EC_POINT_mul(group.as_ptr(),
                                  self.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)
@@ -139,7 +155,7 @@ impl EcPointRef {
        unsafe {
            cvt(ffi::EC_POINT_mul(group.as_ptr(),
                                  self.as_ptr(),
                                  n.map_or(ptr::null(), |n| n.as_ptr()),
                                  n.as_ptr(),
                                  q.as_ptr(),
                                  m.as_ptr(),
                                  ctx.as_ptr()))