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
Dmitry Baryshkov
nettle
Commits
71f68cc4
Commit
71f68cc4
authored
6 years ago
by
Niels Möller
Browse files
Options
Downloads
Patches
Plain Diff
Avoid cast between incompatible function types.
parent
f3bbc422
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
ChangeLog
+5
-0
5 additions, 0 deletions
ChangeLog
nettle-internal.c
+26
-10
26 additions, 10 deletions
nettle-internal.c
with
31 additions
and
10 deletions
ChangeLog
+
5
−
0
View file @
71f68cc4
2018-08-09 Niels Möller <nisse@lysator.liu.se>
2018-08-09 Niels Möller <nisse@lysator.liu.se>
* 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.c (des_compat_des3_encrypt)
(des_compat_des3_decrypt): Change length argument type to size_t.
(des_compat_des3_decrypt): Change length argument type to size_t.
...
...
This diff is collapsed.
Click to expand it.
nettle-internal.c
+
26
−
10
View file @
71f68cc4
...
@@ -46,14 +46,32 @@
...
@@ -46,14 +46,32 @@
#include
"chacha.h"
#include
"chacha.h"
#include
"salsa20.h"
#include
"salsa20.h"
/* NOTE: A bit ugly. Ignores weak keys, and pretends the set_key
/* Wrapper functions discarding the return value. Needed for the
functions have no return value. */
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
const
struct
nettle_cipher
nettle_des
=
{
nettle_des
=
{
"des"
,
sizeof
(
struct
des_ctx
),
"des"
,
sizeof
(
struct
des_ctx
),
DES_BLOCK_SIZE
,
DES_KEY_SIZE
,
DES_BLOCK_SIZE
,
DES_KEY_SIZE
,
(
nettle_set_key_func
*
)
des_set_key
,
des_set_key
_wrapper
,
(
nettle_set_key_func
*
)
des_set_key
,
des_set_key
_wrapper
,
(
nettle_cipher_func
*
)
des_encrypt
,
(
nettle_cipher_func
*
)
des_encrypt
,
(
nettle_cipher_func
*
)
des_decrypt
(
nettle_cipher_func
*
)
des_decrypt
};
};
...
@@ -62,20 +80,18 @@ const struct nettle_cipher
...
@@ -62,20 +80,18 @@ const struct nettle_cipher
nettle_des3
=
{
nettle_des3
=
{
"des3"
,
sizeof
(
struct
des3_ctx
),
"des3"
,
sizeof
(
struct
des3_ctx
),
DES3_BLOCK_SIZE
,
DES3_KEY_SIZE
,
DES3_BLOCK_SIZE
,
DES3_KEY_SIZE
,
(
nettle_set_key_func
*
)
des3_set_key
,
des3_set_key
_wrapper
,
(
nettle_set_key_func
*
)
des3_set_key
,
des3_set_key
_wrapper
,
(
nettle_cipher_func
*
)
des3_encrypt
,
(
nettle_cipher_func
*
)
des3_encrypt
,
(
nettle_cipher_func
*
)
des3_decrypt
(
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
const
struct
nettle_cipher
nettle_blowfish128
=
nettle_blowfish128
=
{
"blowfish128"
,
sizeof
(
struct
blowfish_ctx
),
{
"blowfish128"
,
sizeof
(
struct
blowfish_ctx
),
BLOWFISH_BLOCK_SIZE
,
BLOWFISH128_KEY_SIZE
,
BLOWFISH_BLOCK_SIZE
,
BLOWFISH128_KEY_SIZE
,
(
nettle_set_key_func
*
)
blowfish128_set_key
,
blowfish128_set_key
_wrapper
,
(
nettle_set_key_func
*
)
blowfish128_set_key
,
blowfish128_set_key
_wrapper
,
(
nettle_cipher_func
*
)
blowfish_encrypt
,
(
nettle_cipher_func
*
)
blowfish_encrypt
,
(
nettle_cipher_func
*
)
blowfish_decrypt
(
nettle_cipher_func
*
)
blowfish_decrypt
};
};
...
...
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