Skip to content
GitLab
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
3df5ec89
Commit
3df5ec89
authored
Aug 09, 2018
by
Niels Möller
Browse files
Avoid cast between incompatible function types.
(cherry picked from commit
71f68cc4
)
parent
c2fa92f5
Changes
2
Hide whitespace changes
Inline
Side-by-side
ChangeLog
View file @
3df5ec89
...
...
@@ -7,6 +7,11 @@
2018-08-09 Niels Möller <nisse@lysator.liu.se>
Backported from master branch.
* nettle-internal.c (des_set_key_wrapper, des3_set_key_wrapper)
(blowfish128_set_key_wrapper): Wrapper functions, to avoid cast
between incompatible function types (which gcc-8 warns about).
Wrappers are expected to compile to a single jmp instruction.
* des-compat.c (des_compat_des3_encrypt)
(des_compat_des3_decrypt): Change length argument type to size_t.
...
...
nettle-internal.c
View file @
3df5ec89
...
...
@@ -46,14 +46,32 @@
#include
"chacha.h"
#include
"salsa20.h"
/* NOTE: A bit ugly. Ignores weak keys, and pretends the set_key
functions have no return value. */
/* Wrapper functions discarding the return value. Needed for the
ciphers with weak keys. */
static
void
des_set_key_wrapper
(
void
*
ctx
,
const
uint8_t
*
key
)
{
des_set_key
(
ctx
,
key
);
}
static
void
des3_set_key_wrapper
(
void
*
ctx
,
const
uint8_t
*
key
)
{
des3_set_key
(
ctx
,
key
);
}
static
void
blowfish128_set_key_wrapper
(
void
*
ctx
,
const
uint8_t
*
key
)
{
blowfish128_set_key
(
ctx
,
key
);
}
const
struct
nettle_cipher
nettle_des
=
{
"des"
,
sizeof
(
struct
des_ctx
),
DES_BLOCK_SIZE
,
DES_KEY_SIZE
,
(
nettle_set_key_func
*
)
des_set_key
,
(
nettle_set_key_func
*
)
des_set_key
,
des_set_key
_wrapper
,
des_set_key
_wrapper
,
(
nettle_cipher_func
*
)
des_encrypt
,
(
nettle_cipher_func
*
)
des_decrypt
};
...
...
@@ -62,20 +80,18 @@ const struct nettle_cipher
nettle_des3
=
{
"des3"
,
sizeof
(
struct
des3_ctx
),
DES3_BLOCK_SIZE
,
DES3_KEY_SIZE
,
(
nettle_set_key_func
*
)
des3_set_key
,
(
nettle_set_key_func
*
)
des3_set_key
,
des3_set_key
_wrapper
,
des3_set_key
_wrapper
,
(
nettle_cipher_func
*
)
des3_encrypt
,
(
nettle_cipher_func
*
)
des3_decrypt
};
/* NOTE: This is not as nice as one might think, as we pretend
blowfish_set_key has no return value. */
const
struct
nettle_cipher
nettle_blowfish128
=
{
"blowfish128"
,
sizeof
(
struct
blowfish_ctx
),
BLOWFISH_BLOCK_SIZE
,
BLOWFISH128_KEY_SIZE
,
(
nettle_set_key_func
*
)
blowfish128_set_key
,
(
nettle_set_key_func
*
)
blowfish128_set_key
,
blowfish128_set_key
_wrapper
,
blowfish128_set_key
_wrapper
,
(
nettle_cipher_func
*
)
blowfish_encrypt
,
(
nettle_cipher_func
*
)
blowfish_decrypt
};
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment