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
e67e883d
Commit
e67e883d
authored
Jan 05, 1999
by
Niels Möller
Browse files
* cascade.c (do_make_cascade): Make sure keys are applied in the
right (i.e. reversed) order when decrypting. Rev: src/cascade.c:1.2
parent
a857ba1d
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/cascade.c
View file @
e67e883d
...
...
@@ -76,20 +76,20 @@ do_make_cascade(struct crypto_algorithm *s,
CAST
(
crypto_cascade_algorithm
,
algorithm
,
s
);
NEW
(
crypto_cascade_instance
,
instance
);
unsigned
i
;
unsigned
l
=
LIST_LENGTH
(
algorithm
->
cascade
);
instance
->
super
.
block_size
=
algorithm
->
super
.
block_size
;
instance
->
cascade
=
alloc_object_list
(
LIST_LENGTH
(
algorithm
->
cascade
)
);
instance
->
cascade
=
alloc_object_list
(
l
);
for
(
i
=
0
;
i
<
LIST_LENGTH
(
algorithm
->
cascade
)
;
i
++
)
for
(
i
=
0
;
i
<
l
;
i
++
)
{
/* When decrypting, the crypto algorithms should be used in
* reverse order! */
unsigned
j
=
(
(
mode
==
CRYPTO_ENCRYPT
)
?
i
:
LIST_LENGTH
(
algorithm
->
cascade
)
-
i
-
1
);
?
i
:
l
-
i
-
1
);
CAST_SUBTYPE
(
crypto_algorithm
,
a
,
LIST
(
algorithm
->
cascade
)[
j
]);
CAST_SUBTYPE
(
crypto_algorithm
,
a
,
LIST
(
algorithm
->
cascade
)[
i
]);
struct
crypto_instance
*
o
=
MAKE_CRYPT
(
a
,
mode
,
key
,
iv
);
if
(
!
o
)
...
...
@@ -98,7 +98,7 @@ do_make_cascade(struct crypto_algorithm *s,
return
NULL
;
}
LIST
(
instance
->
cascade
)[
i
]
=
(
struct
lsh_object
*
)
o
;
LIST
(
instance
->
cascade
)[
j
]
=
(
struct
lsh_object
*
)
o
;
key
+=
a
->
key_size
;
iv
+=
a
->
iv_size
;
}
...
...
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