Unverified Commit e292320e authored by Huw Jones's avatar Huw Jones
Browse files

pkey_ctx: add ctx.set_ec_paramgen_curve_nid

parent ca425b87
Loading
Loading
Loading
Loading
+17 −0
Original line number Diff line number Diff line
@@ -68,6 +68,7 @@ let cmac_key = ctx.keygen().unwrap();
use crate::cipher::CipherRef;
use crate::error::ErrorStack;
use crate::md::MdRef;
use crate::nid::Nid;
use crate::pkey::{HasPrivate, HasPublic, Id, PKey, PKeyRef, Params, Private};
use crate::rsa::Padding;
use crate::sign::RsaPssSaltlen;
@@ -463,6 +464,22 @@ impl<T> PkeyCtxRef<T> {
        Ok(())
    }

    /// Sets the EC paramgen curve NID.
    ///
    /// This is only useful for EC keys.
    #[corresponds(EVP_PKEY_CTX_set_ec_paramgen_curve_nid)]
    #[inline]
    pub fn set_ec_paramgen_curve_nid(&mut self, nid: Nid) -> Result<(), ErrorStack> {
        unsafe {
            cvt(ffi::EVP_PKEY_CTX_set_ec_paramgen_curve_nid(
                self.as_ptr(),
                nid.as_raw(),
            ))?;
        }

        Ok(())
    }

    /// Returns the RSA padding mode in use.
    ///
    /// This is only useful for RSA keys.