Lines Matching defs:cipher
89 pub fn exec_crypt(&self, cipher: &Vec<u8>, aad: &Vec<u8>, auth_token: &Vec<u8>) -> Result<Vec<u8>> {
90 if cipher.len() <= (TAG_SIZE + NONCE_SIZE) {
91 return log_throw_error!(ErrCode::InvalidArgument, "[FATAL]The cipher length is too short.");
97 let in_data = HksBlob { size: cipher.len() as u32, data: cipher.as_ptr() };
98 let mut msg: Vec<u8> = vec![0; cipher.len() - TAG_SIZE - NONCE_SIZE];
118 let mut cipher: Vec<u8> = vec![0; msg.len() + TAG_SIZE + NONCE_SIZE];
122 let mut out_data = OutBlob { size: cipher.len() as u32, data: cipher.as_mut_ptr() };
134 SUCCESS => Ok(cipher),
140 pub fn decrypt(key: &SecretKey, cipher: &Vec<u8>, aad: &Vec<u8>) -> Result<Vec<u8>> {
141 if cipher.len() <= (TAG_SIZE + NONCE_SIZE) {
142 return log_throw_error!(ErrCode::InvalidArgument, "[FATAL]The cipher length is too short.");
145 let mut plain: Vec<u8> = vec![0; cipher.len() - TAG_SIZE - NONCE_SIZE];
148 let in_data = HksBlob { size: cipher.len() as u32, data: cipher.as_ptr() };