summaryrefslogtreecommitdiff
path: root/ext/node/ops/crypto/mod.rs
diff options
context:
space:
mode:
Diffstat (limited to 'ext/node/ops/crypto/mod.rs')
-rw-r--r--ext/node/ops/crypto/mod.rs21
1 files changed, 17 insertions, 4 deletions
diff --git a/ext/node/ops/crypto/mod.rs b/ext/node/ops/crypto/mod.rs
index 567affd52..8780495a4 100644
--- a/ext/node/ops/crypto/mod.rs
+++ b/ext/node/ops/crypto/mod.rs
@@ -262,13 +262,14 @@ pub fn op_node_cipheriv_encrypt(
pub fn op_node_cipheriv_final(
state: &mut OpState,
#[smi] rid: u32,
+ auto_pad: bool,
#[buffer] input: &[u8],
- #[buffer] output: &mut [u8],
+ #[anybuffer] output: &mut [u8],
) -> Result<Option<Vec<u8>>, AnyError> {
let context = state.resource_table.take::<cipher::CipherContext>(rid)?;
let context = Rc::try_unwrap(context)
.map_err(|_| type_error("Cipher context is already in use"))?;
- context.r#final(input, output)
+ context.r#final(auto_pad, input, output)
}
#[op2(fast)]
@@ -317,17 +318,29 @@ pub fn op_node_decipheriv_decrypt(
}
#[op2(fast)]
+pub fn op_node_decipheriv_take(
+ state: &mut OpState,
+ #[smi] rid: u32,
+) -> Result<(), AnyError> {
+ let context = state.resource_table.take::<cipher::DecipherContext>(rid)?;
+ Rc::try_unwrap(context)
+ .map_err(|_| type_error("Cipher context is already in use"))?;
+ Ok(())
+}
+
+#[op2]
pub fn op_node_decipheriv_final(
state: &mut OpState,
#[smi] rid: u32,
+ auto_pad: bool,
#[buffer] input: &[u8],
- #[buffer] output: &mut [u8],
+ #[anybuffer] output: &mut [u8],
#[buffer] auth_tag: &[u8],
) -> Result<(), AnyError> {
let context = state.resource_table.take::<cipher::DecipherContext>(rid)?;
let context = Rc::try_unwrap(context)
.map_err(|_| type_error("Cipher context is already in use"))?;
- context.r#final(input, output, auth_tag)
+ context.r#final(auto_pad, input, output, auth_tag)
}
#[op2]