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
Dmitry Baryshkov
nettle
Commits
8d831e14
Commit
8d831e14
authored
Sep 10, 2001
by
Niels Möller
Browse files
*** empty log message ***
Rev: src/nettle/des-compat.c:1.1 Rev: src/nettle/des-compat.h:1.4
parent
bde52850
Changes
2
Hide whitespace changes
Inline
Side-by-side
des-compat.c
0 → 100644
View file @
8d831e14
/* des-compat.h
*
* The des block cipher, libdes/openssl-style interface.
*/
/* nettle, low-level cryptographics library
*
* Copyright (C) 2001 Niels Möller
*
* The nettle library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2.1 of the License, or (at your
* option) any later version.
*
* The nettle library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
* License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with the nettle library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* MA 02111-1307, USA.
*/
#include
"des-compat.h"
#include
"cbc.h"
void
des_ecb3_encrypt
(
const
uint8_t
*
src
,
uint8_t
*
dst
,
struct
des_ctx
*
k1
,
struct
des_ctx
*
k2
,
struct
des_ctx
*
k3
,
int
enc
)
{
switch
(
enc
)
{
case
DES_ENCRYPT
:
des_encrypt
(
k1
,
dst
,
src
,
DES_BLOCK_SIZE
);
des_decrypt
(
k2
,
dst
,
dst
,
DES_BLOCK_SIZE
);
des_encrypt
(
k3
,
dst
,
dst
,
DES_BLOCK_SIZE
);
break
;
case
DES_DECRYPT
:
des_decrypt
(
k3
,
dst
,
src
,
DES_BLOCK_SIZE
);
des_encrypt
(
k2
,
dst
,
dst
,
DES_BLOCK_SIZE
);
des_decrypt
(
k1
,
dst
,
dst
,
DES_BLOCK_SIZE
);
break
;
default:
abort
();
}
}
uint32_t
des_cbc_cksum
(
const
uint8_t
*
src
,
uint8_t
dst
,
long
length
,
struct
des_ctx
*
ctx
,
uint8_t
*
iv
);
void
des_cbc_encrypt
(
const
uint8_t
*
src
,
uint8_t
*
dst
,
long
length
,
struct
des_ctx
*
ctx
,
uint8_t
*
iv
,
int
enc
)
{
cbc_encrypt
(
ctx
,
(
enc
==
DES_ENCRYPT
)
?
des_encrypt
:
des_decrypt
,
DES_BLOCK_SIZE
,
iv
,
length
,
dst
,
src
);
}
void
des_3cbc_encrypt
(
const
uint8_t
*
src
,
uint8_t
*
dst
,
long
length
,
struct
des_ctx
*
k1
,
struct
des_ctx
*
k2
,
struct
des_ctx
*
k3
,
/* What mode is this, two iv:s? */
uint8_t
*
iv1
,
uint8_t
*
iv2
,
int
enc
);
void
des_ecb_encrypt
(
const
uint8_t
*
src
,
uint8_t
*
dst
,
long
length
,
struct
des_ctx
*
ctx
,
uint8_t
*
iv
,
int
enc
)
{
)(
enc
==
DES_ENCRYPT
)
?
des_encrypt
:
des_decrypt
)(
}
void
des_ede3_cbc_encrypt
(
const
uint8_t
*
src
,
uint8_t
*
dst
,
long
length
,
struct
des_ctx
*
k1
,
struct
des_ctx
*
k2
,
struct
des_ctx
*
k3
,
uint8_t
*
iv
,
int
enc
);
int
des_set_odd_parity
(
uint8_t
*
key
);
int
des_set_key
(
const
uint8_t
*
key
,
struct
des_ctx
*
ctx
);
int
des_key_sched
(
const
uint8_t
*
key
,
struct
des_ctx
*
ctx
);
int
des_is_weak_key
(
const
uint8_t
key
);
des-compat.h
View file @
8d831e14
...
...
@@ -35,7 +35,7 @@
#include
"des.h"
/* FIXME:
N
ames collides with nettle, so we'll need some ugly symbol
/* FIXME:
Some n
ames collides with nettle, so we'll need some ugly symbol
* munging */
void
des_ecb3_encrypt
(
const
uint8_t
*
src
,
uint8_t
*
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