File tree 1 file changed +6
-6
lines changed
1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -395,7 +395,7 @@ pub(crate) fn encrypt_object<T: TSerializable, W: Write>(
395
395
Ok ( ( ) )
396
396
}
397
397
398
- pub ( crate ) fn sign_and_write_object < T : TSerializable , W : Write > (
398
+ pub ( crate ) fn write_signed_plaintext_object < T : TSerializable , W : Write > (
399
399
object : & T ,
400
400
encryptor : & mut Box < dyn BlockEncryptor > ,
401
401
sink : & mut W ,
@@ -413,11 +413,11 @@ pub(crate) fn sign_and_write_object<T: TSerializable, W: Write>(
413
413
. try_into ( )
414
414
. map_err ( |err| general_err ! ( "Plaintext data too long. {:?}" , err) ) ?;
415
415
416
- // Format is: [ciphertext size, nonce, ciphertext, authentication tag]
417
- let nonce = buffer[ SIZE_LEN ..SIZE_LEN + NONCE_LEN ] . to_vec ( ) ;
418
- let tag = buffer[ ( ciphertext_length - TAG_LEN as u32 ) as usize ..] . to_vec ( ) ;
419
- sink. write_all ( & nonce) ?;
420
- sink. write_all ( & tag) ?;
416
+ // Format of encrypted buffer is: [ciphertext size, nonce, ciphertext, authentication tag]
417
+ let nonce = & buffer[ SIZE_LEN ..SIZE_LEN + NONCE_LEN ] ;
418
+ let tag = & buffer[ ( buffer . len ( ) - TAG_LEN ) ..] ;
419
+ sink. write_all ( nonce) ?;
420
+ sink. write_all ( tag) ?;
421
421
422
422
Ok ( ( ) )
423
423
}
You can’t perform that action at this time.
0 commit comments