Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
nettle
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
5
Merge Requests
5
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
Nettle
nettle
Commits
9adb998c
Commit
9adb998c
authored
May 01, 2019
by
Niels Möller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
New header file cmac-internal.h
Move and rename block_mulx --> _cmac128_block_mulx.
parent
d4847b52
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
72 additions
and
9 deletions
+72
-9
ChangeLog
ChangeLog
+8
-0
Makefile.in
Makefile.in
+1
-1
cmac-internal.h
cmac-internal.h
+54
-0
cmac.c
cmac.c
+9
-8
No files found.
ChangeLog
View file @
9adb998c
2019-04-30 Niels Möller <nisse@lysator.liu.se>
Based on a patch contributed by Nikos Mavrogiannopoulos.
* cmac.c (_cmac128_block_mulx): Renamed function...
(block_mulx): ... from old name.
* cmac-internal.h (_cmac128_block_mulx): New file, declare function.
* Makefile.in (DISTFILES): Added cmac-internal.h.
2019-04-27 Niels Möller <nisse@lysator.liu.se>
From Simo Sorce:
...
...
Makefile.in
View file @
9adb998c
...
...
@@ -229,7 +229,7 @@ DISTFILES = $(SOURCES) $(HEADERS) getopt.h getopt_int.h \
INSTALL NEWS ChangeLog
\
nettle.pc.in hogweed.pc.in
\
$(des_headers)
descore.README desdata.stamp
\
aes-internal.h camellia-internal.h serpent-internal.h
\
aes-internal.h camellia-internal.h
cmac-internal.h
serpent-internal.h
\
cast128_sboxes.h desinfo.h desCode.h
\
ripemd160-internal.h sha2-internal.h
\
memxor-internal.h nettle-internal.h nettle-write.h
\
...
...
cmac-internal.h
0 → 100644
View file @
9adb998c
/* cmac-internal.h
CMAC mode internal functions
Copyright (C) 2017 Red Hat, Inc.
Contributed by Nikos Mavrogiannopoulos
This file is part of GNU Nettle.
GNU Nettle is free software: you can redistribute it and/or
modify it under the terms of either:
* the GNU Lesser General Public License as published by the Free
Software Foundation; either version 3 of the License, or (at your
option) any later version.
or
* the GNU General Public License as published by the Free
Software Foundation; either version 2 of the License, or (at your
option) any later version.
or both in parallel, as here.
GNU Nettle 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
General Public License for more details.
You should have received copies of the GNU General Public License and
the GNU Lesser General Public License along with this program. If
not, see http://www.gnu.org/licenses/.
*/
#ifndef NETTLE_CMAC_INTERNAL_H_INCLUDED
#define NETTLE_CMAC_INTERNAL_H_INCLUDED
#include "cmac.h"
#ifdef __cplusplus
extern
"C"
{
#endif
#define _cmac128_block_mulx _nettle_cmac128_block_mulx
void
_cmac128_block_mulx
(
union
nettle_block16
*
out
,
const
union
nettle_block16
*
in
);
#ifdef __cplusplus
}
#endif
#endif
/* CMAC_INTERNAL_H_INCLUDED */
cmac.c
View file @
9adb998c
...
...
@@ -44,13 +44,14 @@
#include "memxor.h"
#include "nettle-internal.h"
#include "cmac-internal.h"
#include "macros.h"
/* shift one and XOR with 0x87. */
#if WORDS_BIGENDIAN
static
void
block_mulx
(
union
nettle_block16
*
dst
,
const
union
nettle_block16
*
src
)
void
_cmac128_
block_mulx
(
union
nettle_block16
*
dst
,
const
union
nettle_block16
*
src
)
{
uint64_t
carry
=
src
->
u64
[
0
]
>>
63
;
dst
->
u64
[
0
]
=
(
src
->
u64
[
0
]
<<
1
)
|
(
src
->
u64
[
1
]
>>
63
);
...
...
@@ -59,9 +60,9 @@ block_mulx(union nettle_block16 *dst,
#else
/* !WORDS_BIGENDIAN */
#define LE_SHIFT(x) ((((x) & 0x7f7f7f7f7f7f7f7f) << 1) | \
(((x) & 0x8080808080808080) >> 15))
static
void
block_mulx
(
union
nettle_block16
*
dst
,
const
union
nettle_block16
*
src
)
void
_cmac128_
block_mulx
(
union
nettle_block16
*
dst
,
const
union
nettle_block16
*
src
)
{
uint64_t
carry
=
(
src
->
u64
[
0
]
&
0x80
)
>>
7
;
dst
->
u64
[
0
]
=
LE_SHIFT
(
src
->
u64
[
0
])
|
((
src
->
u64
[
1
]
&
0x80
)
<<
49
);
...
...
@@ -83,8 +84,8 @@ cmac128_set_key(struct cmac128_ctx *ctx, const void *cipher,
/* step 1 - generate subkeys k1 and k2 */
encrypt
(
cipher
,
16
,
L
->
b
,
const_zero
);
block_mulx
(
&
ctx
->
K1
,
L
);
block_mulx
(
&
ctx
->
K2
,
&
ctx
->
K1
);
_cmac128_
block_mulx
(
&
ctx
->
K1
,
L
);
_cmac128_
block_mulx
(
&
ctx
->
K2
,
&
ctx
->
K1
);
}
#define MIN(x,y) ((x)<(y)?(x):(y))
...
...
Write
Preview
Markdown
is supported
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