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
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Nettle
nettle
Commits
9b41e3b8
Commit
9b41e3b8
authored
Jun 1, 2019
by
Niels Möller
Browse files
Options
Downloads
Patches
Plain Diff
New struct cmac128_key.
parent
dc28cadb
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
ChangeLog
+6
-0
6 additions, 0 deletions
ChangeLog
cmac.c
+4
-4
4 additions, 4 deletions
cmac.c
cmac.h
+7
-3
7 additions, 3 deletions
cmac.h
with
17 additions
and
7 deletions
ChangeLog
+
6
−
0
View file @
9b41e3b8
2019-06-01 Niels Möller <nisse@lysator.liu.se>
* cmac.h (struct cmac128_key): New struct.
* cmac.h (struct cmac128_ctx): Use struct cmac128_key.
* cmac.c (cmac128_set_key, cmac128_digest): Update accordingly.
2019-05-12 Niels Möller <nisse@lysator.liu.se>
2019-05-12 Niels Möller <nisse@lysator.liu.se>
Delete old libdes/openssl compatibility interface.
Delete old libdes/openssl compatibility interface.
...
...
This diff is collapsed.
Click to expand it.
cmac.c
+
4
−
4
View file @
9b41e3b8
...
@@ -83,8 +83,8 @@ cmac128_set_key(struct cmac128_ctx *ctx, const void *cipher,
...
@@ -83,8 +83,8 @@ cmac128_set_key(struct cmac128_ctx *ctx, const void *cipher,
/* step 1 - generate subkeys k1 and k2 */
/* step 1 - generate subkeys k1 and k2 */
encrypt
(
cipher
,
16
,
L
->
b
,
const_zero
);
encrypt
(
cipher
,
16
,
L
->
b
,
const_zero
);
block_mulx
(
&
ctx
->
K1
,
L
);
block_mulx
(
&
ctx
->
key
.
K1
,
L
);
block_mulx
(
&
ctx
->
K2
,
&
ctx
->
K1
);
block_mulx
(
&
ctx
->
key
.
K2
,
&
ctx
->
key
.
K1
);
}
}
#define MIN(x,y) ((x)<(y)?(x):(y))
#define MIN(x,y) ((x)<(y)?(x):(y))
...
@@ -148,11 +148,11 @@ cmac128_digest(struct cmac128_ctx *ctx, const void *cipher,
...
@@ -148,11 +148,11 @@ cmac128_digest(struct cmac128_ctx *ctx, const void *cipher,
if
(
ctx
->
index
<
16
)
if
(
ctx
->
index
<
16
)
{
{
ctx
->
block
.
b
[
ctx
->
index
]
=
0x80
;
ctx
->
block
.
b
[
ctx
->
index
]
=
0x80
;
memxor
(
ctx
->
block
.
b
,
ctx
->
K2
.
b
,
16
);
memxor
(
ctx
->
block
.
b
,
ctx
->
key
.
K2
.
b
,
16
);
}
}
else
else
{
{
memxor
(
ctx
->
block
.
b
,
ctx
->
K1
.
b
,
16
);
memxor
(
ctx
->
block
.
b
,
ctx
->
key
.
K1
.
b
,
16
);
}
}
memxor3
(
Y
.
b
,
ctx
->
block
.
b
,
ctx
->
X
.
b
,
16
);
memxor3
(
Y
.
b
,
ctx
->
block
.
b
,
ctx
->
X
.
b
,
16
);
...
...
This diff is collapsed.
Click to expand it.
cmac.h
+
7
−
3
View file @
9b41e3b8
...
@@ -55,18 +55,22 @@ extern "C" {
...
@@ -55,18 +55,22 @@ extern "C" {
#define cmac_aes256_update nettle_cmac_aes256_update
#define cmac_aes256_update nettle_cmac_aes256_update
#define cmac_aes256_digest nettle_cmac_aes256_digest
#define cmac_aes256_digest nettle_cmac_aes256_digest
struct
cmac128_
ctx
struct
cmac128_
key
{
{
/* Key */
union
nettle_block16
K1
;
union
nettle_block16
K1
;
union
nettle_block16
K2
;
union
nettle_block16
K2
;
};
struct
cmac128_ctx
{
struct
cmac128_key
key
;
/* MAC state */
/* MAC state */
union
nettle_block16
X
;
union
nettle_block16
X
;
/* Block buffer */
/* Block buffer */
union
nettle_block16
block
;
size_t
index
;
size_t
index
;
union
nettle_block16
block
;
};
};
void
void
...
...
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