summaryrefslogtreecommitdiff
path: root/openssl/src/sign.rs
diff options
context:
space:
mode:
authorSteven Fackler <sfackler@palantir.com>2020-02-04 21:50:40 +0000
committerSteven Fackler <sfackler@palantir.com>2020-02-04 21:50:40 +0000
commit4b1564ebc19130b2817b19cdd1e9fd1e08f03f04 (patch)
tree63632da9f34d044aa4403547cfe294071af20ed0 /openssl/src/sign.rs
parent972c7ae11a97d1e76c9007da9665b984e4a27036 (diff)
downloadrust-openssl-4b1564ebc19130b2817b19cdd1e9fd1e08f03f04.zip
Fix mutability of oneshot sign/verify methods
Diffstat (limited to 'openssl/src/sign.rs')
-rw-r--r--openssl/src/sign.rs10
1 files changed, 5 insertions, 5 deletions
diff --git a/openssl/src/sign.rs b/openssl/src/sign.rs
index cf7657e1..07548893 100644
--- a/openssl/src/sign.rs
+++ b/openssl/src/sign.rs
@@ -354,7 +354,7 @@ impl<'a> Signer<'a> {
///
/// [`EVP_DigestSign`]: https://www.openssl.org/docs/man1.1.1/man3/EVP_DigestSign.html
#[cfg(ossl111)]
- pub fn sign_oneshot(&self, sig_buf: &mut [u8], data_buf: &[u8]) -> Result<usize, ErrorStack> {
+ pub fn sign_oneshot(&mut self, sig_buf: &mut [u8], data_buf: &[u8]) -> Result<usize, ErrorStack> {
unsafe {
let mut sig_len = sig_buf.len();
cvt(ffi::EVP_DigestSign(
@@ -372,7 +372,7 @@ impl<'a> Signer<'a> {
///
/// This is a simple convenience wrapper over `len` and `sign_oneshot`.
#[cfg(ossl111)]
- pub fn sign_oneshot_to_vec(&self, data_buf: &[u8]) -> Result<Vec<u8>, ErrorStack> {
+ pub fn sign_oneshot_to_vec(&mut self, data_buf: &[u8]) -> Result<Vec<u8>, ErrorStack> {
let mut sig_buf = vec![0; self.len()?];
let len = self.sign_oneshot(&mut sig_buf, data_buf)?;
// The advertised length is not always equal to the real length for things like DSA
@@ -584,7 +584,7 @@ impl<'a> Verifier<'a> {
///
/// [`EVP_DigestVerify`]: https://www.openssl.org/docs/man1.1.1/man3/EVP_DigestVerify.html
#[cfg(ossl111)]
- pub fn verify_oneshot(&self, signature: &[u8], buf: &[u8]) -> Result<bool, ErrorStack> {
+ pub fn verify_oneshot(&mut self, signature: &[u8], buf: &[u8]) -> Result<bool, ErrorStack> {
unsafe {
let r = ffi::EVP_DigestVerify(
self.md_ctx,
@@ -831,10 +831,10 @@ mod test {
fn eddsa() {
let key = PKey::generate_ed25519().unwrap();
- let signer = Signer::new_without_digest(&key).unwrap();
+ let mut signer = Signer::new_without_digest(&key).unwrap();
let signature = signer.sign_oneshot_to_vec(b"hello world").unwrap();
- let verifier = Verifier::new_without_digest(&key).unwrap();
+ let mut verifier = Verifier::new_without_digest(&key).unwrap();
assert!(verifier.verify_oneshot(&signature, b"hello world").unwrap());
}