Skip to content

Commit eac02f6

Browse files
authored
crypto.cipher: copy to next only after encryption in OFB mode (#26765)
1 parent 5ac913b commit eac02f6

1 file changed

Lines changed: 1 addition & 3 deletions

File tree

‎vlib/crypto/cipher/ofb.v‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,8 @@ pub fn (mut x Ofb) xor_key_stream(mut dst []u8, src []u8) {
5252
if x.out_used == x.out.len {
5353
x.b.encrypt(mut x.out, x.next)
5454
x.out_used = 0
55+
copy(mut x.next, x.out)
5556
}
56-
57-
copy(mut x.next, x.out)
58-
5957
n := xor_bytes(mut local_dst, local_src, x.out[x.out_used..])
6058
local_dst = local_dst[n..]
6159
local_src = local_src[n..]

0 commit comments

Comments
 (0)