Skip to content

Commit 8adc97e

Browse files
committed
pkey_ctx: add set dh prime_len and generator
1 parent e991abc commit 8adc97e

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

openssl/src/pkey_ctx.rs

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -447,6 +447,38 @@ impl<T> PkeyCtxRef<T> {
447447
Ok(())
448448
}
449449

450+
/// Sets the DH paramgen prime length.
451+
///
452+
/// This is only useful for DH keys.
453+
#[corresponds(EVP_PKEY_CTX_set_dh_paramgen_prime_len)]
454+
#[inline]
455+
pub fn set_dh_paramgen_prime_len(&mut self, bits: u32) -> Result<(), ErrorStack> {
456+
unsafe {
457+
cvt(ffi::EVP_PKEY_CTX_set_dh_paramgen_prime_len(
458+
self.as_ptr(),
459+
bits as i32,
460+
))?;
461+
}
462+
463+
Ok(())
464+
}
465+
466+
/// Sets the DH paramgen generator.
467+
///
468+
/// This is only useful for DH keys.
469+
#[corresponds(EVP_PKEY_CTX_set_dh_paramgen_generator)]
470+
#[inline]
471+
pub fn set_dh_paramgen_generator(&mut self, bits: u32) -> Result<(), ErrorStack> {
472+
unsafe {
473+
cvt(ffi::EVP_PKEY_CTX_set_dh_paramgen_generator(
474+
self.as_ptr(),
475+
bits as i32,
476+
))?;
477+
}
478+
479+
Ok(())
480+
}
481+
450482
/// Sets the DSA paramgen bits.
451483
///
452484
/// This is only useful for DSA keys.

0 commit comments

Comments
 (0)