Loading openssl-sys/src/evp.rs +5 −0 Original line number Diff line number Diff line Loading @@ -97,6 +97,11 @@ cfg_if! { pub unsafe fn EVP_CIPHER_CTX_iv_length(ctx: *const EVP_CIPHER_CTX) -> c_int { EVP_CIPHER_CTX_get_iv_length(ctx) } #[inline] pub unsafe fn EVP_CIPHER_CTX_num(ctx: *const EVP_CIPHER_CTX) -> c_int { EVP_CIPHER_CTX_get_num(ctx) } } else { pub unsafe fn EVP_MD_CTX_size(ctx: *const EVP_MD_CTX) -> c_int { EVP_MD_size(EVP_MD_CTX_md(ctx)) Loading openssl-sys/src/handwritten/evp.rs +3 −0 Original line number Diff line number Diff line Loading @@ -26,6 +26,7 @@ cfg_if! { pub fn EVP_CIPHER_CTX_get_key_length(ctx: *const EVP_CIPHER_CTX) -> c_int; pub fn EVP_CIPHER_CTX_get_iv_length(ctx: *const EVP_CIPHER_CTX) -> c_int; pub fn EVP_CIPHER_CTX_get_tag_length(ctx: *const EVP_CIPHER_CTX) -> c_int; pub fn EVP_CIPHER_CTX_get_num(ctx: *const EVP_CIPHER_CTX) -> c_int; } } else { extern "C" { Loading @@ -44,6 +45,8 @@ cfg_if! { pub fn EVP_CIPHER_CTX_block_size(ctx: *const EVP_CIPHER_CTX) -> c_int; pub fn EVP_CIPHER_CTX_key_length(ctx: *const EVP_CIPHER_CTX) -> c_int; pub fn EVP_CIPHER_CTX_iv_length(ctx: *const EVP_CIPHER_CTX) -> c_int; #[cfg(ossl110)] pub fn EVP_CIPHER_CTX_num(ctx: *const EVP_CIPHER_CTX) -> c_int; } } } Loading openssl/src/cipher_ctx.rs +16 −0 Original line number Diff line number Diff line Loading @@ -363,6 +363,22 @@ impl CipherCtxRef { unsafe { ffi::EVP_CIPHER_CTX_iv_length(self.as_ptr()) as usize } } /// Returns the `num` parameter of the cipher. /// /// Built-in ciphers typically use this to track how much of the /// current underlying block has been "used" already. /// /// # Panics /// /// Panics if the context has not been initialized with a cipher. #[corresponds(EVP_CIPHER_CTX_num)] #[cfg(ossl110)] pub fn num(&self) -> usize { self.assert_cipher(); unsafe { ffi::EVP_CIPHER_CTX_num(self.as_ptr()) as usize } } /// Sets the length of the IV expected by this context. /// /// Only some ciphers support configurable IV lengths. Loading Loading
openssl-sys/src/evp.rs +5 −0 Original line number Diff line number Diff line Loading @@ -97,6 +97,11 @@ cfg_if! { pub unsafe fn EVP_CIPHER_CTX_iv_length(ctx: *const EVP_CIPHER_CTX) -> c_int { EVP_CIPHER_CTX_get_iv_length(ctx) } #[inline] pub unsafe fn EVP_CIPHER_CTX_num(ctx: *const EVP_CIPHER_CTX) -> c_int { EVP_CIPHER_CTX_get_num(ctx) } } else { pub unsafe fn EVP_MD_CTX_size(ctx: *const EVP_MD_CTX) -> c_int { EVP_MD_size(EVP_MD_CTX_md(ctx)) Loading
openssl-sys/src/handwritten/evp.rs +3 −0 Original line number Diff line number Diff line Loading @@ -26,6 +26,7 @@ cfg_if! { pub fn EVP_CIPHER_CTX_get_key_length(ctx: *const EVP_CIPHER_CTX) -> c_int; pub fn EVP_CIPHER_CTX_get_iv_length(ctx: *const EVP_CIPHER_CTX) -> c_int; pub fn EVP_CIPHER_CTX_get_tag_length(ctx: *const EVP_CIPHER_CTX) -> c_int; pub fn EVP_CIPHER_CTX_get_num(ctx: *const EVP_CIPHER_CTX) -> c_int; } } else { extern "C" { Loading @@ -44,6 +45,8 @@ cfg_if! { pub fn EVP_CIPHER_CTX_block_size(ctx: *const EVP_CIPHER_CTX) -> c_int; pub fn EVP_CIPHER_CTX_key_length(ctx: *const EVP_CIPHER_CTX) -> c_int; pub fn EVP_CIPHER_CTX_iv_length(ctx: *const EVP_CIPHER_CTX) -> c_int; #[cfg(ossl110)] pub fn EVP_CIPHER_CTX_num(ctx: *const EVP_CIPHER_CTX) -> c_int; } } } Loading
openssl/src/cipher_ctx.rs +16 −0 Original line number Diff line number Diff line Loading @@ -363,6 +363,22 @@ impl CipherCtxRef { unsafe { ffi::EVP_CIPHER_CTX_iv_length(self.as_ptr()) as usize } } /// Returns the `num` parameter of the cipher. /// /// Built-in ciphers typically use this to track how much of the /// current underlying block has been "used" already. /// /// # Panics /// /// Panics if the context has not been initialized with a cipher. #[corresponds(EVP_CIPHER_CTX_num)] #[cfg(ossl110)] pub fn num(&self) -> usize { self.assert_cipher(); unsafe { ffi::EVP_CIPHER_CTX_num(self.as_ptr()) as usize } } /// Sets the length of the IV expected by this context. /// /// Only some ciphers support configurable IV lengths. Loading