Commit f3a35f87 authored by John Tyner's avatar John Tyner
Browse files

replace clone() with copy() to better mimic openssl interface

parent 19b7a64b
Loading
Loading
Loading
Loading
+5 −6
Original line number Original line Diff line number Diff line
@@ -102,18 +102,17 @@ impl CipherCtx {
            Ok(CipherCtx::from_ptr(ptr))
            Ok(CipherCtx::from_ptr(ptr))
        }
        }
    }
    }
}


impl CipherCtxRef {
    #[corresponds(EVP_CIPHER_CTX_copy)]
    #[corresponds(EVP_CIPHER_CTX_copy)]
    pub fn clone(&self) -> Result<Self, ErrorStack> {
    pub fn copy(&mut self, src: &CipherCtx) -> Result<(), ErrorStack> {
        let n = CipherCtx::new()?;
        unsafe {
        unsafe {
            cvt(ffi::EVP_CIPHER_CTX_copy(n.as_ptr(), self.as_ptr()))?;
            cvt(ffi::EVP_CIPHER_CTX_copy(self.as_ptr(), src.as_ptr()))?;
        }
            Ok(())
        Ok(n)
        }
        }
    }
    }


impl CipherCtxRef {
    /// Initializes the context for encryption.
    /// Initializes the context for encryption.
    ///
    ///
    /// Normally this is called once to set all of the cipher, key, and IV. However, this process can be split up
    /// Normally this is called once to set all of the cipher, key, and IV. However, this process can be split up