Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Wim Lewis
nettle
Commits
3eb603d0
Commit
3eb603d0
authored
Apr 26, 2013
by
Niels Möller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use size_t rather than unsigned for all cipher-related functions.
parent
2b49c179
Changes
50
Show whitespace changes
Inline
Side-by-side
Showing
50 changed files
with
153 additions
and
147 deletions
+153
-147
ChangeLog
ChangeLog
+6
-0
aes-decrypt-internal.c
aes-decrypt-internal.c
+1
-1
aes-decrypt.c
aes-decrypt.c
+1
-1
aes-encrypt-internal.c
aes-encrypt-internal.c
+1
-1
aes-encrypt.c
aes-encrypt.c
+1
-1
aes-internal.h
aes-internal.h
+2
-2
aes-set-decrypt-key.c
aes-set-decrypt-key.c
+1
-1
aes-set-encrypt-key.c
aes-set-encrypt-key.c
+1
-1
aes.h
aes.h
+4
-4
arcfour-crypt.c
arcfour-crypt.c
+1
-1
arcfour.c
arcfour.c
+1
-1
arcfour.h
arcfour.h
+2
-2
arctwo.c
arctwo.c
+6
-6
arctwo.h
arctwo.h
+5
-5
blowfish.c
blowfish.c
+3
-3
blowfish.h
blowfish.h
+3
-3
camellia-crypt-internal.c
camellia-crypt-internal.c
+1
-1
camellia-crypt.c
camellia-crypt.c
+2
-2
camellia-internal.h
camellia-internal.h
+1
-1
camellia-set-decrypt-key.c
camellia-set-decrypt-key.c
+1
-1
camellia-set-encrypt-key.c
camellia-set-encrypt-key.c
+1
-1
camellia.h
camellia.h
+3
-3
cast128.c
cast128.c
+3
-3
cast128.h
cast128.h
+3
-3
cbc.c
cbc.c
+5
-5
cbc.h
cbc.h
+4
-4
ctr.c
ctr.c
+4
-4
ctr.h
ctr.h
+2
-2
des.c
des.c
+6
-6
des.h
des.h
+6
-6
des3.c
des3.c
+2
-2
examples/nettle-openssl.c
examples/nettle-openssl.c
+15
-15
gcm-aes.c
gcm-aes.c
+4
-4
gcm.c
gcm.c
+4
-4
gcm.h
gcm.h
+7
-7
nettle-internal.c
nettle-internal.c
+3
-3
nettle-meta.h
nettle-meta.h
+3
-3
nettle-types.h
nettle-types.h
+2
-2
salsa20-crypt.c
salsa20-crypt.c
+1
-1
salsa20-set-key.c
salsa20-set-key.c
+1
-1
salsa20.h
salsa20.h
+3
-3
salsa20r12-crypt.c
salsa20r12-crypt.c
+3
-3
serpent-decrypt.c
serpent-decrypt.c
+1
-1
serpent-encrypt.c
serpent-encrypt.c
+1
-1
serpent-set-key.c
serpent-set-key.c
+1
-1
serpent.h
serpent.h
+3
-3
twofish.c
twofish.c
+3
-3
twofish.h
twofish.h
+3
-3
x86_64/aes-decrypt-internal.asm
x86_64/aes-decrypt-internal.asm
+6
-6
x86_64/aes-encrypt-internal.asm
x86_64/aes-encrypt-internal.asm
+6
-6
No files found.
ChangeLog
View file @
3eb603d0
2013-04-26 Niels Möller <nisse@lysator.liu.se>
* Many files: Use size_t rather than unsigned for data sizes.
* x86_64/aes-encrypt-internal.asm: Accept 64-bit length.
* x86_64/aes-decrypt-internal.asm: Likewise.
2013-04-25 Niels Möller <nisse@lysator.liu.se>
2013-04-25 Niels Möller <nisse@lysator.liu.se>
* configure.ac: Changed version number, to 2.8.
* configure.ac: Changed version number, to 2.8.
...
...
aes-decrypt-internal.c
View file @
3eb603d0
...
@@ -35,7 +35,7 @@
...
@@ -35,7 +35,7 @@
void
void
_nettle_aes_decrypt
(
const
struct
aes_ctx
*
ctx
,
_nettle_aes_decrypt
(
const
struct
aes_ctx
*
ctx
,
const
struct
aes_table
*
T
,
const
struct
aes_table
*
T
,
unsigned
length
,
uint8_t
*
dst
,
size_t
length
,
uint8_t
*
dst
,
const
uint8_t
*
src
)
const
uint8_t
*
src
)
{
{
FOR_BLOCKS
(
length
,
dst
,
src
,
AES_BLOCK_SIZE
)
FOR_BLOCKS
(
length
,
dst
,
src
,
AES_BLOCK_SIZE
)
...
...
aes-decrypt.c
View file @
3eb603d0
...
@@ -338,7 +338,7 @@ _aes_decrypt_table =
...
@@ -338,7 +338,7 @@ _aes_decrypt_table =
void
void
aes_decrypt
(
const
struct
aes_ctx
*
ctx
,
aes_decrypt
(
const
struct
aes_ctx
*
ctx
,
unsigned
length
,
uint8_t
*
dst
,
size_t
length
,
uint8_t
*
dst
,
const
uint8_t
*
src
)
const
uint8_t
*
src
)
{
{
assert
(
!
(
length
%
AES_BLOCK_SIZE
)
);
assert
(
!
(
length
%
AES_BLOCK_SIZE
)
);
...
...
aes-encrypt-internal.c
View file @
3eb603d0
...
@@ -35,7 +35,7 @@
...
@@ -35,7 +35,7 @@
void
void
_nettle_aes_encrypt
(
const
struct
aes_ctx
*
ctx
,
_nettle_aes_encrypt
(
const
struct
aes_ctx
*
ctx
,
const
struct
aes_table
*
T
,
const
struct
aes_table
*
T
,
unsigned
length
,
uint8_t
*
dst
,
size_t
length
,
uint8_t
*
dst
,
const
uint8_t
*
src
)
const
uint8_t
*
src
)
{
{
FOR_BLOCKS
(
length
,
dst
,
src
,
AES_BLOCK_SIZE
)
FOR_BLOCKS
(
length
,
dst
,
src
,
AES_BLOCK_SIZE
)
...
...
aes-encrypt.c
View file @
3eb603d0
...
@@ -36,7 +36,7 @@
...
@@ -36,7 +36,7 @@
For PIC code, the details can be complex and system dependent. */
For PIC code, the details can be complex and system dependent. */
void
void
aes_encrypt
(
const
struct
aes_ctx
*
ctx
,
aes_encrypt
(
const
struct
aes_ctx
*
ctx
,
unsigned
length
,
uint8_t
*
dst
,
size_t
length
,
uint8_t
*
dst
,
const
uint8_t
*
src
)
const
uint8_t
*
src
)
{
{
assert
(
!
(
length
%
AES_BLOCK_SIZE
)
);
assert
(
!
(
length
%
AES_BLOCK_SIZE
)
);
...
...
aes-internal.h
View file @
3eb603d0
...
@@ -53,13 +53,13 @@ struct aes_table
...
@@ -53,13 +53,13 @@ struct aes_table
void
void
_aes_encrypt
(
const
struct
aes_ctx
*
ctx
,
_aes_encrypt
(
const
struct
aes_ctx
*
ctx
,
const
struct
aes_table
*
T
,
const
struct
aes_table
*
T
,
unsigned
length
,
uint8_t
*
dst
,
size_t
length
,
uint8_t
*
dst
,
const
uint8_t
*
src
);
const
uint8_t
*
src
);
void
void
_aes_decrypt
(
const
struct
aes_ctx
*
ctx
,
_aes_decrypt
(
const
struct
aes_ctx
*
ctx
,
const
struct
aes_table
*
T
,
const
struct
aes_table
*
T
,
unsigned
length
,
uint8_t
*
dst
,
size_t
length
,
uint8_t
*
dst
,
const
uint8_t
*
src
);
const
uint8_t
*
src
);
/* Macros */
/* Macros */
...
...
aes-set-decrypt-key.c
View file @
3eb603d0
...
@@ -161,7 +161,7 @@ aes_invert_key(struct aes_ctx *dst,
...
@@ -161,7 +161,7 @@ aes_invert_key(struct aes_ctx *dst,
void
void
aes_set_decrypt_key
(
struct
aes_ctx
*
ctx
,
aes_set_decrypt_key
(
struct
aes_ctx
*
ctx
,
unsigned
keysize
,
const
uint8_t
*
key
)
size_t
keysize
,
const
uint8_t
*
key
)
{
{
/* We first create subkeys for encryption,
/* We first create subkeys for encryption,
* then modify the subkeys for decryption. */
* then modify the subkeys for decryption. */
...
...
aes-set-encrypt-key.c
View file @
3eb603d0
...
@@ -36,7 +36,7 @@
...
@@ -36,7 +36,7 @@
void
void
aes_set_encrypt_key
(
struct
aes_ctx
*
ctx
,
aes_set_encrypt_key
(
struct
aes_ctx
*
ctx
,
unsigned
keysize
,
const
uint8_t
*
key
)
size_t
keysize
,
const
uint8_t
*
key
)
{
{
static
const
uint8_t
rcon
[
10
]
=
{
static
const
uint8_t
rcon
[
10
]
=
{
0x01
,
0x02
,
0x04
,
0x08
,
0x10
,
0x20
,
0x40
,
0x80
,
0x1b
,
0x36
,
0x01
,
0x02
,
0x04
,
0x08
,
0x10
,
0x20
,
0x40
,
0x80
,
0x1b
,
0x36
,
...
...
aes.h
View file @
3eb603d0
...
@@ -59,11 +59,11 @@ struct aes_ctx
...
@@ -59,11 +59,11 @@ struct aes_ctx
void
void
aes_set_encrypt_key
(
struct
aes_ctx
*
ctx
,
aes_set_encrypt_key
(
struct
aes_ctx
*
ctx
,
unsigned
length
,
const
uint8_t
*
key
);
size_t
length
,
const
uint8_t
*
key
);
void
void
aes_set_decrypt_key
(
struct
aes_ctx
*
ctx
,
aes_set_decrypt_key
(
struct
aes_ctx
*
ctx
,
unsigned
length
,
const
uint8_t
*
key
);
size_t
length
,
const
uint8_t
*
key
);
void
void
aes_invert_key
(
struct
aes_ctx
*
dst
,
aes_invert_key
(
struct
aes_ctx
*
dst
,
...
@@ -71,11 +71,11 @@ aes_invert_key(struct aes_ctx *dst,
...
@@ -71,11 +71,11 @@ aes_invert_key(struct aes_ctx *dst,
void
void
aes_encrypt
(
const
struct
aes_ctx
*
ctx
,
aes_encrypt
(
const
struct
aes_ctx
*
ctx
,
unsigned
length
,
uint8_t
*
dst
,
size_t
length
,
uint8_t
*
dst
,
const
uint8_t
*
src
);
const
uint8_t
*
src
);
void
void
aes_decrypt
(
const
struct
aes_ctx
*
ctx
,
aes_decrypt
(
const
struct
aes_ctx
*
ctx
,
unsigned
length
,
uint8_t
*
dst
,
size_t
length
,
uint8_t
*
dst
,
const
uint8_t
*
src
);
const
uint8_t
*
src
);
#ifdef __cplusplus
#ifdef __cplusplus
...
...
arcfour-crypt.c
View file @
3eb603d0
...
@@ -33,7 +33,7 @@
...
@@ -33,7 +33,7 @@
void
void
arcfour_crypt
(
struct
arcfour_ctx
*
ctx
,
arcfour_crypt
(
struct
arcfour_ctx
*
ctx
,
unsigned
length
,
uint8_t
*
dst
,
size_t
length
,
uint8_t
*
dst
,
const
uint8_t
*
src
)
const
uint8_t
*
src
)
{
{
register
uint8_t
i
,
j
;
register
uint8_t
i
,
j
;
...
...
arcfour.c
View file @
3eb603d0
...
@@ -35,7 +35,7 @@
...
@@ -35,7 +35,7 @@
void
void
arcfour_set_key
(
struct
arcfour_ctx
*
ctx
,
arcfour_set_key
(
struct
arcfour_ctx
*
ctx
,
unsigned
length
,
const
uint8_t
*
key
)
size_t
length
,
const
uint8_t
*
key
)
{
{
unsigned
i
,
j
,
k
;
unsigned
i
,
j
,
k
;
...
...
arcfour.h
View file @
3eb603d0
...
@@ -51,11 +51,11 @@ struct arcfour_ctx
...
@@ -51,11 +51,11 @@ struct arcfour_ctx
void
void
arcfour_set_key
(
struct
arcfour_ctx
*
ctx
,
arcfour_set_key
(
struct
arcfour_ctx
*
ctx
,
unsigned
length
,
const
uint8_t
*
key
);
size_t
length
,
const
uint8_t
*
key
);
void
void
arcfour_crypt
(
struct
arcfour_ctx
*
ctx
,
arcfour_crypt
(
struct
arcfour_ctx
*
ctx
,
unsigned
length
,
uint8_t
*
dst
,
size_t
length
,
uint8_t
*
dst
,
const
uint8_t
*
src
);
const
uint8_t
*
src
);
#ifdef __cplusplus
#ifdef __cplusplus
...
...
arctwo.c
View file @
3eb603d0
...
@@ -85,7 +85,7 @@ static const uint8_t arctwo_sbox[] = {
...
@@ -85,7 +85,7 @@ static const uint8_t arctwo_sbox[] = {
void
void
arctwo_encrypt
(
struct
arctwo_ctx
*
ctx
,
arctwo_encrypt
(
struct
arctwo_ctx
*
ctx
,
unsigned
length
,
uint8_t
*
dst
,
const
uint8_t
*
src
)
size_t
length
,
uint8_t
*
dst
,
const
uint8_t
*
src
)
{
{
FOR_BLOCKS
(
length
,
dst
,
src
,
ARCTWO_BLOCK_SIZE
)
FOR_BLOCKS
(
length
,
dst
,
src
,
ARCTWO_BLOCK_SIZE
)
{
{
...
@@ -130,7 +130,7 @@ arctwo_encrypt (struct arctwo_ctx *ctx,
...
@@ -130,7 +130,7 @@ arctwo_encrypt (struct arctwo_ctx *ctx,
void
void
arctwo_decrypt
(
struct
arctwo_ctx
*
ctx
,
arctwo_decrypt
(
struct
arctwo_ctx
*
ctx
,
unsigned
length
,
uint8_t
*
dst
,
const
uint8_t
*
src
)
size_t
length
,
uint8_t
*
dst
,
const
uint8_t
*
src
)
{
{
FOR_BLOCKS
(
length
,
dst
,
src
,
ARCTWO_BLOCK_SIZE
)
FOR_BLOCKS
(
length
,
dst
,
src
,
ARCTWO_BLOCK_SIZE
)
{
{
...
@@ -176,9 +176,9 @@ arctwo_decrypt (struct arctwo_ctx *ctx,
...
@@ -176,9 +176,9 @@ arctwo_decrypt (struct arctwo_ctx *ctx,
void
void
arctwo_set_key_ekb
(
struct
arctwo_ctx
*
ctx
,
arctwo_set_key_ekb
(
struct
arctwo_ctx
*
ctx
,
unsigned
length
,
const
uint8_t
*
key
,
unsigned
ekb
)
size_t
length
,
const
uint8_t
*
key
,
unsigned
ekb
)
{
{
unsigned
i
;
size_t
i
;
/* Expanded key, treated as octets */
/* Expanded key, treated as octets */
uint8_t
S
[
128
];
uint8_t
S
[
128
];
uint8_t
x
;
uint8_t
x
;
...
@@ -217,14 +217,14 @@ arctwo_set_key_ekb (struct arctwo_ctx *ctx,
...
@@ -217,14 +217,14 @@ arctwo_set_key_ekb (struct arctwo_ctx *ctx,
}
}
void
void
arctwo_set_key
(
struct
arctwo_ctx
*
ctx
,
unsigned
length
,
const
uint8_t
*
key
)
arctwo_set_key
(
struct
arctwo_ctx
*
ctx
,
size_t
length
,
const
uint8_t
*
key
)
{
{
arctwo_set_key_ekb
(
ctx
,
length
,
key
,
8
*
length
);
arctwo_set_key_ekb
(
ctx
,
length
,
key
,
8
*
length
);
}
}
void
void
arctwo_set_key_gutmann
(
struct
arctwo_ctx
*
ctx
,
arctwo_set_key_gutmann
(
struct
arctwo_ctx
*
ctx
,
unsigned
length
,
const
uint8_t
*
key
)
size_t
length
,
const
uint8_t
*
key
)
{
{
arctwo_set_key_ekb
(
ctx
,
length
,
key
,
0
);
arctwo_set_key_ekb
(
ctx
,
length
,
key
,
0
);
}
}
arctwo.h
View file @
3eb603d0
...
@@ -57,23 +57,23 @@ struct arctwo_ctx
...
@@ -57,23 +57,23 @@ struct arctwo_ctx
as an explicit argument. 0 means maximum key bits. */
as an explicit argument. 0 means maximum key bits. */
void
void
arctwo_set_key_ekb
(
struct
arctwo_ctx
*
ctx
,
arctwo_set_key_ekb
(
struct
arctwo_ctx
*
ctx
,
unsigned
length
,
const
uint8_t
*
key
,
unsigned
ekb
);
size_t
length
,
const
uint8_t
*
key
,
unsigned
ekb
);
/* Equvivalent to arctwo_set_key_ekb, with ekb = 8 * length */
/* Equvivalent to arctwo_set_key_ekb, with ekb = 8 * length */
void
void
arctwo_set_key
(
struct
arctwo_ctx
*
ctx
,
unsigned
length
,
const
uint8_t
*
key
);
arctwo_set_key
(
struct
arctwo_ctx
*
ctx
,
size_t
length
,
const
uint8_t
*
key
);
/* Equvivalent to arctwo_set_key_ekb, with ekb = 1024 */
/* Equvivalent to arctwo_set_key_ekb, with ekb = 1024 */
void
void
arctwo_set_key_gutmann
(
struct
arctwo_ctx
*
ctx
,
arctwo_set_key_gutmann
(
struct
arctwo_ctx
*
ctx
,
unsigned
length
,
const
uint8_t
*
key
);
size_t
length
,
const
uint8_t
*
key
);
void
void
arctwo_encrypt
(
struct
arctwo_ctx
*
ctx
,
arctwo_encrypt
(
struct
arctwo_ctx
*
ctx
,
unsigned
length
,
uint8_t
*
dst
,
const
uint8_t
*
src
);
size_t
length
,
uint8_t
*
dst
,
const
uint8_t
*
src
);
void
void
arctwo_decrypt
(
struct
arctwo_ctx
*
ctx
,
arctwo_decrypt
(
struct
arctwo_ctx
*
ctx
,
unsigned
length
,
uint8_t
*
dst
,
const
uint8_t
*
src
);
size_t
length
,
uint8_t
*
dst
,
const
uint8_t
*
src
);
#ifdef __cplusplus
#ifdef __cplusplus
}
}
...
...
blowfish.c
View file @
3eb603d0
...
@@ -321,7 +321,7 @@ decrypt (const struct blowfish_ctx *ctx, uint32_t * ret_xl, uint32_t * ret_xr)
...
@@ -321,7 +321,7 @@ decrypt (const struct blowfish_ctx *ctx, uint32_t * ret_xl, uint32_t * ret_xr)
void
void
blowfish_encrypt
(
const
struct
blowfish_ctx
*
ctx
,
blowfish_encrypt
(
const
struct
blowfish_ctx
*
ctx
,
unsigned
length
,
uint8_t
*
dst
,
const
uint8_t
*
src
)
size_t
length
,
uint8_t
*
dst
,
const
uint8_t
*
src
)
{
{
FOR_BLOCKS
(
length
,
dst
,
src
,
BLOWFISH_BLOCK_SIZE
)
FOR_BLOCKS
(
length
,
dst
,
src
,
BLOWFISH_BLOCK_SIZE
)
{
{
...
@@ -343,7 +343,7 @@ blowfish_encrypt (const struct blowfish_ctx *ctx,
...
@@ -343,7 +343,7 @@ blowfish_encrypt (const struct blowfish_ctx *ctx,
void
void
blowfish_decrypt
(
const
struct
blowfish_ctx
*
ctx
,
blowfish_decrypt
(
const
struct
blowfish_ctx
*
ctx
,
unsigned
length
,
uint8_t
*
dst
,
const
uint8_t
*
src
)
size_t
length
,
uint8_t
*
dst
,
const
uint8_t
*
src
)
{
{
FOR_BLOCKS
(
length
,
dst
,
src
,
BLOWFISH_BLOCK_SIZE
)
FOR_BLOCKS
(
length
,
dst
,
src
,
BLOWFISH_BLOCK_SIZE
)
{
{
...
@@ -365,7 +365,7 @@ blowfish_decrypt (const struct blowfish_ctx *ctx,
...
@@ -365,7 +365,7 @@ blowfish_decrypt (const struct blowfish_ctx *ctx,
int
int
blowfish_set_key
(
struct
blowfish_ctx
*
ctx
,
blowfish_set_key
(
struct
blowfish_ctx
*
ctx
,
unsigned
length
,
const
uint8_t
*
key
)
size_t
length
,
const
uint8_t
*
key
)
{
{
int
i
,
j
;
int
i
,
j
;
uint32_t
data
,
datal
,
datar
;
uint32_t
data
,
datal
,
datar
;
...
...
blowfish.h
View file @
3eb603d0
...
@@ -58,15 +58,15 @@ struct blowfish_ctx
...
@@ -58,15 +58,15 @@ struct blowfish_ctx
* On error, returns 0 and sets ctx->status to BLOWFISH_WEAK_KEY. */
* On error, returns 0 and sets ctx->status to BLOWFISH_WEAK_KEY. */
int
int
blowfish_set_key
(
struct
blowfish_ctx
*
ctx
,
blowfish_set_key
(
struct
blowfish_ctx
*
ctx
,
unsigned
length
,
const
uint8_t
*
key
);
size_t
length
,
const
uint8_t
*
key
);
void
void
blowfish_encrypt
(
const
struct
blowfish_ctx
*
ctx
,
blowfish_encrypt
(
const
struct
blowfish_ctx
*
ctx
,
unsigned
length
,
uint8_t
*
dst
,
size_t
length
,
uint8_t
*
dst
,
const
uint8_t
*
src
);
const
uint8_t
*
src
);
void
void
blowfish_decrypt
(
const
struct
blowfish_ctx
*
ctx
,
blowfish_decrypt
(
const
struct
blowfish_ctx
*
ctx
,
unsigned
length
,
uint8_t
*
dst
,
size_t
length
,
uint8_t
*
dst
,
const
uint8_t
*
src
);
const
uint8_t
*
src
);
#ifdef __cplusplus
#ifdef __cplusplus
...
...
camellia-crypt-internal.c
View file @
3eb603d0
...
@@ -125,7 +125,7 @@
...
@@ -125,7 +125,7 @@
void
void
_camellia_crypt
(
const
struct
camellia_ctx
*
ctx
,
_camellia_crypt
(
const
struct
camellia_ctx
*
ctx
,
const
struct
camellia_table
*
T
,
const
struct
camellia_table
*
T
,
unsigned
length
,
uint8_t
*
dst
,
size_t
length
,
uint8_t
*
dst
,
const
uint8_t
*
src
)
const
uint8_t
*
src
)
{
{
FOR_BLOCKS
(
length
,
dst
,
src
,
CAMELLIA_BLOCK_SIZE
)
FOR_BLOCKS
(
length
,
dst
,
src
,
CAMELLIA_BLOCK_SIZE
)
...
...
camellia-crypt.c
View file @
3eb603d0
...
@@ -36,7 +36,7 @@
...
@@ -36,7 +36,7 @@
For PIC code, the details can be complex and system dependent. */
For PIC code, the details can be complex and system dependent. */
void
void
camellia_crypt
(
const
struct
camellia_ctx
*
ctx
,
camellia_crypt
(
const
struct
camellia_ctx
*
ctx
,
unsigned
length
,
uint8_t
*
dst
,
size_t
length
,
uint8_t
*
dst
,
const
uint8_t
*
src
)
const
uint8_t
*
src
)
{
{
assert
(
!
(
length
%
CAMELLIA_BLOCK_SIZE
)
);
assert
(
!
(
length
%
CAMELLIA_BLOCK_SIZE
)
);
...
...
camellia-internal.h
View file @
3eb603d0
...
@@ -63,7 +63,7 @@ struct camellia_table
...
@@ -63,7 +63,7 @@ struct camellia_table
void
void
_camellia_crypt
(
const
struct
camellia_ctx
*
ctx
,
_camellia_crypt
(
const
struct
camellia_ctx
*
ctx
,
const
struct
camellia_table
*
T
,
const
struct
camellia_table
*
T
,
unsigned
length
,
uint8_t
*
dst
,
size_t
length
,
uint8_t
*
dst
,
const
uint8_t
*
src
);
const
uint8_t
*
src
);
extern
const
struct
camellia_table
_camellia_table
;
extern
const
struct
camellia_table
_camellia_table
;
...
...
camellia-set-decrypt-key.c
View file @
3eb603d0
...
@@ -54,7 +54,7 @@ camellia_invert_key(struct camellia_ctx *dst,
...
@@ -54,7 +54,7 @@ camellia_invert_key(struct camellia_ctx *dst,
void
void
camellia_set_decrypt_key
(
struct
camellia_ctx
*
ctx
,
camellia_set_decrypt_key
(
struct
camellia_ctx
*
ctx
,
unsigned
length
,
const
uint8_t
*
key
)
size_t
length
,
const
uint8_t
*
key
)
{
{
camellia_set_encrypt_key
(
ctx
,
length
,
key
);
camellia_set_encrypt_key
(
ctx
,
length
,
key
);
camellia_invert_key
(
ctx
,
ctx
);
camellia_invert_key
(
ctx
,
ctx
);
...
...
camellia-set-encrypt-key.c
View file @
3eb603d0
...
@@ -87,7 +87,7 @@
...
@@ -87,7 +87,7 @@
void
void
camellia_set_encrypt_key
(
struct
camellia_ctx
*
ctx
,
camellia_set_encrypt_key
(
struct
camellia_ctx
*
ctx
,
unsigned
length
,
const
uint8_t
*
key
)
size_t
length
,
const
uint8_t
*
key
)
{
{
uint64_t
k0
,
k1
;
uint64_t
k0
,
k1
;
...
...
camellia.h
View file @
3eb603d0
...
@@ -61,11 +61,11 @@ struct camellia_ctx
...
@@ -61,11 +61,11 @@ struct camellia_ctx
void
void
camellia_set_encrypt_key
(
struct
camellia_ctx
*
ctx
,
camellia_set_encrypt_key
(
struct
camellia_ctx
*
ctx
,
unsigned
length
,
const
uint8_t
*
key
);
size_t
length
,
const
uint8_t
*
key
);
void
void
camellia_set_decrypt_key
(
struct
camellia_ctx
*
ctx
,
camellia_set_decrypt_key
(
struct
camellia_ctx
*
ctx
,
unsigned
length
,
const
uint8_t
*
key
);
size_t
length
,
const
uint8_t
*
key
);
void
void
camellia_invert_key
(
struct
camellia_ctx
*
dst
,
camellia_invert_key
(
struct
camellia_ctx
*
dst
,
...
@@ -73,7 +73,7 @@ camellia_invert_key(struct camellia_ctx *dst,
...
@@ -73,7 +73,7 @@ camellia_invert_key(struct camellia_ctx *dst,
void
void
camellia_crypt
(
const
struct
camellia_ctx
*
ctx
,
camellia_crypt
(
const
struct
camellia_ctx
*
ctx
,
unsigned
length
,
uint8_t
*
dst
,
size_t
length
,
uint8_t
*
dst
,
const
uint8_t
*
src
);
const
uint8_t
*
src
);
#ifdef __cplusplus
#ifdef __cplusplus
}
}
...
...
cast128.c
View file @
3eb603d0
...
@@ -72,7 +72,7 @@
...
@@ -72,7 +72,7 @@
void
void
cast128_encrypt
(
const
struct
cast128_ctx
*
ctx
,
cast128_encrypt
(
const
struct
cast128_ctx
*
ctx
,
unsigned
length
,
uint8_t
*
dst
,
size_t
length
,
uint8_t
*
dst
,
const
uint8_t
*
src
)
const
uint8_t
*
src
)
{
{
FOR_BLOCKS
(
length
,
dst
,
src
,
CAST128_BLOCK_SIZE
)
FOR_BLOCKS
(
length
,
dst
,
src
,
CAST128_BLOCK_SIZE
)
...
@@ -116,7 +116,7 @@ cast128_encrypt(const struct cast128_ctx *ctx,
...
@@ -116,7 +116,7 @@ cast128_encrypt(const struct cast128_ctx *ctx,
void
void
cast128_decrypt
(
const
struct
cast128_ctx
*
ctx
,
cast128_decrypt
(
const
struct
cast128_ctx
*
ctx
,
unsigned
length
,
uint8_t
*
dst
,
size_t
length
,
uint8_t
*
dst
,
const
uint8_t
*
src
)
const
uint8_t
*
src
)
{
{
FOR_BLOCKS
(
length
,
dst
,
src
,
CAST128_BLOCK_SIZE
)
FOR_BLOCKS
(
length
,
dst
,
src
,
CAST128_BLOCK_SIZE
)
...
@@ -161,7 +161,7 @@ cast128_decrypt(const struct cast128_ctx *ctx,
...
@@ -161,7 +161,7 @@ cast128_decrypt(const struct cast128_ctx *ctx,
void
void
cast128_set_key
(
struct
cast128_ctx
*
ctx
,
cast128_set_key
(
struct
cast128_ctx
*
ctx
,
unsigned
keybytes
,
const
uint8_t
*
rawkey
)
size_t
keybytes
,
const
uint8_t
*
rawkey
)
{
{
uint32_t
t
[
4
],
z
[
4
],
x
[
4
];
uint32_t
t
[
4
],
z
[
4
],
x
[
4
];
unsigned
i
;
unsigned
i
;
...
...
cast128.h
View file @
3eb603d0
...
@@ -59,15 +59,15 @@ struct cast128_ctx
...
@@ -59,15 +59,15 @@ struct cast128_ctx
void
void
cast128_set_key
(
struct
cast128_ctx
*
ctx
,
cast128_set_key
(
struct
cast128_ctx
*
ctx
,
unsigned
length
,
const
uint8_t
*
key
);
size_t
length
,
const
uint8_t
*
key
);
void
void
cast128_encrypt
(
const
struct
cast128_ctx
*
ctx
,
cast128_encrypt
(
const
struct
cast128_ctx
*
ctx
,
unsigned
length
,
uint8_t
*
dst
,
size_t
length
,
uint8_t
*
dst
,
const
uint8_t
*
src
);
const
uint8_t
*
src
);
void
void
cast128_decrypt
(
const
struct
cast128_ctx
*
ctx
,
cast128_decrypt
(
const
struct
cast128_ctx
*
ctx
,
unsigned
length
,
uint8_t
*
dst
,
size_t
length
,
uint8_t
*
dst
,
const
uint8_t
*
src
);
const
uint8_t
*
src
);
#ifdef __cplusplus
#ifdef __cplusplus
...
...
cbc.c
View file @
3eb603d0
...
@@ -38,8 +38,8 @@
...
@@ -38,8 +38,8 @@
void
void
cbc_encrypt
(
void
*
ctx
,
nettle_crypt_func
*
f
,
cbc_encrypt
(
void
*
ctx
,
nettle_crypt_func
*
f
,
unsigned
block_size
,
uint8_t
*
iv
,
size_t
block_size
,
uint8_t
*
iv
,
unsigned
length
,
uint8_t
*
dst
,
size_t
length
,
uint8_t
*
dst
,
const
uint8_t
*
src
)
const
uint8_t
*
src
)
{
{
assert
(
!
(
length
%
block_size
));
assert
(
!
(
length
%
block_size
));
...
@@ -57,8 +57,8 @@ cbc_encrypt(void *ctx, nettle_crypt_func *f,
...
@@ -57,8 +57,8 @@ cbc_encrypt(void *ctx, nettle_crypt_func *f,
void
void
cbc_decrypt
(
void
*
ctx
,
nettle_crypt_func
*
f
,
cbc_decrypt
(
void
*
ctx
,
nettle_crypt_func
*
f
,
unsigned
block_size
,
uint8_t
*
iv
,
size_t
block_size
,
uint8_t
*
iv
,
unsigned
length
,
uint8_t
*
dst
,
size_t
length
,
uint8_t
*
dst
,
const
uint8_t
*
src
)
const
uint8_t
*
src
)
{
{
assert
(
!
(
length
%
block_size
));
assert
(
!
(
length
%
block_size
));
...
@@ -90,7 +90,7 @@ cbc_decrypt(void *ctx, nettle_crypt_func *f,
...
@@ -90,7 +90,7 @@ cbc_decrypt(void *ctx, nettle_crypt_func *f,
TMP_DECL
(
buffer
,
uint8_t
,
CBC_BUFFER_LIMIT
);
TMP_DECL
(
buffer
,
uint8_t
,
CBC_BUFFER_LIMIT
);
TMP_DECL
(
initial_iv
,
uint8_t
,
NETTLE_MAX_CIPHER_BLOCK_SIZE
);