Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
nettle
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
5
Merge Requests
5
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
Nettle
nettle
Commits
94b83a3c
Commit
94b83a3c
authored
Jul 05, 2010
by
Niels Möller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(des_key_sched): Rewrote error checking logic for
the case of non-zero des_check_key. Rev: nettle/des-compat.c:1.3
parent
05a0279a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
32 deletions
+8
-32
des-compat.c
des-compat.c
+8
-32
No files found.
des-compat.c
View file @
94b83a3c
...
...
@@ -202,39 +202,15 @@ int des_check_key = 0;
int
des_key_sched
(
const_des_cblock
*
key
,
des_key_schedule
ctx
)
{
des_cblock
nkey
;
const
uint8_t
*
pkey
;
if
(
des_check_key
&&
!
des_check_parity
(
DES_KEY_SIZE
,
*
key
))
/* Bad parity */
return
-
1
;
if
(
des_check_key
)
pkey
=
*
key
;
else
{
/* Fix the parity */
nettle_des_fix_parity
(
DES_KEY_SIZE
,
nkey
,
*
key
);
pkey
=
nkey
;
}
if
(
nettle_des_set_key
(
ctx
,
pkey
))
return
0
;
else
switch
(
ctx
->
status
)
{
case
DES_BAD_PARITY
:
if
(
des_check_key
)
return
-
1
;
else
/* We fixed the parity above */
abort
();
case
DES_WEAK_KEY
:
if
(
des_check_key
)
return
-
2
;
/* Pretend the key was good */
ctx
->
status
=
DES_OK
;
return
0
;
default:
abort
();
}
if
(
!
nettle_des_set_key
(
ctx
,
*
key
)
&&
des_check_key
)
/* Weak key */
return
-
2
;
return
0
;
}
int
...
...
Write
Preview
Markdown
is supported
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