Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
LSH
lsh
Commits
a9e60f04
Commit
a9e60f04
authored
Jan 05, 1999
by
Niels Möller
Browse files
* cbc.c (do_cbc_encrypt): Bug fix.
(do_cbc_decrypt): Handle the case src == dst correctly. Rev: src/cbc.c:1.2
parent
e67e883d
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/cbc.c
View file @
a9e60f04
...
...
@@ -56,9 +56,9 @@ static void do_cbc_encrypt(struct crypto_instance *s,
{
memxor
(
self
->
iv
,
src
,
self
->
super
.
block_size
);
CRYPT
(
self
->
inner
,
self
->
super
.
block_size
,
src
,
self
->
iv
);
CRYPT
(
self
->
inner
,
self
->
super
.
block_size
,
self
->
iv
,
dst
);
memcpy
(
dst
,
self
->
iv
,
self
->
super
.
block_size
);
memcpy
(
self
->
iv
,
dst
,
self
->
super
.
block_size
);
}
}
...
...
@@ -73,6 +73,14 @@ static void do_cbc_decrypt(struct crypto_instance *s,
if
(
!
length
)
return
;
if
(
src
==
dst
)
{
/* Keep a copy of the ciphertext. */
UINT8
*
tmp
=
alloca
(
length
);
memcpy
(
tmp
,
src
,
length
);
src
=
tmp
;
}
/* Decrypt in ECB mode */
CRYPT
(
self
->
inner
,
length
,
src
,
dst
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment