Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
N
nettle
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
David Carlier
nettle
Commits
7e12e96e
Commit
7e12e96e
authored
23 years ago
by
Niels Möller
Browse files
Options
Downloads
Patches
Plain Diff
* des.c (des_fix_parity): New function.
Rev: src/nettle/des.c:1.4 Rev: src/nettle/des.h:1.6
parent
3a75965e
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
des.c
+9
-0
9 additions, 0 deletions
des.c
des.h
+29
-1
29 additions, 1 deletion
des.h
with
38 additions
and
1 deletion
des.c
+
9
−
0
View file @
7e12e96e
...
@@ -52,6 +52,15 @@ static char parity[] = {
...
@@ -52,6 +52,15 @@ static char parity[] = {
#include
"parity.h"
#include
"parity.h"
};
};
void
des_fix_parity
(
unsigned
length
,
uint8_t
*
dst
,
const
uint8_t
*
src
)
{
unsigned
i
;
for
(
i
=
0
;
i
<
length
;
i
++
)
dst
[
i
]
=
src
[
i
]
^
(
parity
[
src
[
i
]]
==
8
);
}
int
int
des_set_key
(
struct
des_ctx
*
ctx
,
const
uint8_t
*
key
)
des_set_key
(
struct
des_ctx
*
ctx
,
const
uint8_t
*
key
)
{
{
...
...
This diff is collapsed.
Click to expand it.
des.h
+
29
−
1
View file @
7e12e96e
/* des.h
/* des.h
*
*
* The des block cipher.
* The des block cipher.
And triple des.
*/
*/
/* nettle, low-level cryptographics library
/* nettle, low-level cryptographics library
...
@@ -65,4 +65,32 @@ des_decrypt(struct des_ctx *ctx,
...
@@ -65,4 +65,32 @@ des_decrypt(struct des_ctx *ctx,
unsigned
length
,
uint8_t
*
dst
,
unsigned
length
,
uint8_t
*
dst
,
const
uint8_t
*
src
);
const
uint8_t
*
src
);
void
des_fix_parity
(
unsigned
length
,
uint8_t
*
dst
,
const
uint8_t
*
src
);
#define DES3_KEY_SIZE 24
#define DES3_BLOCK_SIZE DES_BLOCK_SIZE
struct
des3_ctx
{
struct
des_ctx
des
[
3
];
enum
des_error
status
;
};
/* On success, returns 1 and sets ctx->status to DES_OK (zero). On
* error, returns 0 and sets ctx->status accordingly. */
int
des3_set_key
(
struct
des3_ctx
*
ctx
,
const
uint8_t
*
key
);
void
des3_encrypt
(
struct
des3_ctx
*
ctx
,
unsigned
length
,
uint8_t
*
dst
,
const
uint8_t
*
src
);
void
des3_decrypt
(
struct
des3_ctx
*
ctx
,
unsigned
length
,
uint8_t
*
dst
,
const
uint8_t
*
src
);
#endif
/* NETTLE_DES_H_INCLUDED */
#endif
/* NETTLE_DES_H_INCLUDED */
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment