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
31a51477
Commit
31a51477
authored
Aug 07, 2013
by
Niels Möller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adapted umac code to use new aes128 interface.
parent
ffbcdcb9
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
26 additions
and
17 deletions
+26
-17
ChangeLog
ChangeLog
+9
-0
umac-set-key.c
umac-set-key.c
+6
-6
umac.h
umac.h
+3
-3
umac128.c
umac128.c
+2
-2
umac32.c
umac32.c
+2
-2
umac64.c
umac64.c
+2
-2
umac96.c
umac96.c
+2
-2
No files found.
ChangeLog
View file @
31a51477
2013-08-07 Niels Möller <nisse@lysator.liu.se>
* umac.h (_UMAC_STATE): Use struct aes128_ctx, not aes_ctx.
* umac-set-key.c (umac_kdf, _umac_set_key): Use aes128 interface.
* umac32.c (umac32_digest): Likewise.
* umac64.c (umac64_digest): Likewise.
* umac96.c (umac96_digest): Likewise.
* umac128.c (umac128_digest): Likewise.
2013-06-25 Niels Möller <nisse@lysator.liu.se>
* aes-meta.c: Deleted file.
...
...
umac-set-key.c
View file @
31a51477
...
...
@@ -32,7 +32,7 @@
#include "macros.h"
static
void
umac_kdf
(
struct
aes_ctx
*
aes
,
unsigned
index
,
unsigned
length
,
uint8_t
*
dst
)
umac_kdf
(
struct
aes
128
_ctx
*
aes
,
unsigned
index
,
unsigned
length
,
uint8_t
*
dst
)
{
uint8_t
block
[
AES_BLOCK_SIZE
];
uint64_t
count
;
...
...
@@ -41,12 +41,12 @@ umac_kdf (struct aes_ctx *aes, unsigned index, unsigned length, uint8_t *dst)
length
-=
AES_BLOCK_SIZE
,
dst
+=
AES_BLOCK_SIZE
,
count
++
)
{
WRITE_UINT64
(
block
+
8
,
count
);
aes_encrypt
(
aes
,
AES_BLOCK_SIZE
,
dst
,
block
);
aes
128
_encrypt
(
aes
,
AES_BLOCK_SIZE
,
dst
,
block
);
}
if
(
length
>
0
)
{
WRITE_UINT64
(
block
+
8
,
count
);
aes_encrypt
(
aes
,
AES_BLOCK_SIZE
,
block
,
block
);
aes
128
_encrypt
(
aes
,
AES_BLOCK_SIZE
,
block
,
block
);
memcpy
(
dst
,
block
,
length
);
}
}
...
...
@@ -71,12 +71,12 @@ umac_kdf (struct aes_ctx *aes, unsigned index, unsigned length, uint8_t *dst)
void
_umac_set_key
(
uint32_t
*
l1_key
,
uint32_t
*
l2_key
,
uint64_t
*
l3_key1
,
uint32_t
*
l3_key2
,
struct
aes_ctx
*
aes
,
const
uint8_t
*
key
,
unsigned
n
)
struct
aes
128
_ctx
*
aes
,
const
uint8_t
*
key
,
unsigned
n
)
{
unsigned
size
;
uint8_t
buffer
[
UMAC_KEY_SIZE
];
aes
_set_encrypt_key
(
aes
,
UMAC_KEY_SIZE
,
key
);
aes
128_set_encrypt_key
(
aes
,
key
);
size
=
UMAC_DATA_SIZE
/
4
+
4
*
(
n
-
1
);
umac_kdf
(
aes
,
1
,
size
*
sizeof
(
uint32_t
),
(
uint8_t
*
)
l1_key
);
...
...
@@ -94,5 +94,5 @@ _umac_set_key (uint32_t *l1_key, uint32_t *l2_key,
umac_kdf
(
aes
,
4
,
n
*
sizeof
(
uint32_t
),
(
uint8_t
*
)
l3_key2
);
umac_kdf
(
aes
,
0
,
UMAC_KEY_SIZE
,
buffer
);
aes
_set_encrypt_key
(
aes
,
UMAC_KEY_SIZE
,
buffer
);
aes
128_set_encrypt_key
(
aes
,
buffer
);
}
umac.h
View file @
31a51477
...
...
@@ -61,7 +61,7 @@ extern "C" {
#include "nettle-types.h"
#include "aes.h"
#define UMAC_KEY_SIZE
16
#define UMAC_KEY_SIZE
AES128_KEY_SIZE
#define UMAC32_DIGEST_SIZE 4
#define UMAC64_DIGEST_SIZE 8
#define UMAC96_DIGEST_SIZE 12
...
...
@@ -76,7 +76,7 @@ extern "C" {
uint64_t l3_key1[8*(n)]; \
uint32_t l3_key2[(n)]; \
/* AES cipher for encrypting the nonce */
\
struct aes_ctx pdf_key; \
struct aes
128
_ctx pdf_key; \
/* The l2_state consists of 2*n uint64_t, for poly64 \
and poly128 hashing, followed by n additional \
uint64_t used as an input buffer. */
\
...
...
@@ -192,7 +192,7 @@ umac128_digest (struct umac128_ctx *ctx,
void
_umac_set_key
(
uint32_t
*
l1_key
,
uint32_t
*
l2_key
,
uint64_t
*
l3_key1
,
uint32_t
*
l3_key2
,
struct
aes_ctx
*
pad
,
const
uint8_t
*
key
,
unsigned
n
);
struct
aes
128
_ctx
*
pad
,
const
uint8_t
*
key
,
unsigned
n
);
uint64_t
_umac_nh
(
const
uint32_t
*
key
,
unsigned
length
,
const
uint8_t
*
msg
);
...
...
umac128.c
View file @
31a51477
...
...
@@ -103,8 +103,8 @@ umac128_digest (struct umac128_ctx *ctx,
}
assert
(
ctx
->
count
>
0
);
aes_encrypt
(
&
ctx
->
pdf_key
,
AES_BLOCK_SIZE
,
(
uint8_t
*
)
tag
,
ctx
->
nonce
);
aes
128
_encrypt
(
&
ctx
->
pdf_key
,
AES_BLOCK_SIZE
,
(
uint8_t
*
)
tag
,
ctx
->
nonce
);
INCREMENT
(
ctx
->
nonce_length
,
ctx
->
nonce
);
...
...
umac32.c
View file @
31a51477
...
...
@@ -100,8 +100,8 @@ umac32_digest (struct umac32_ctx *ctx,
assert
(
ctx
->
count
>
0
);
if
(
!
(
ctx
->
nonce_low
&
_UMAC_NONCE_CACHED
))
{
aes_encrypt
(
&
ctx
->
pdf_key
,
AES_BLOCK_SIZE
,
(
uint8_t
*
)
ctx
->
pad_cache
,
ctx
->
nonce
);
aes
128
_encrypt
(
&
ctx
->
pdf_key
,
AES_BLOCK_SIZE
,
(
uint8_t
*
)
ctx
->
pad_cache
,
ctx
->
nonce
);
ctx
->
nonce_low
|=
_UMAC_NONCE_CACHED
;
}
...
...
umac64.c
View file @
31a51477
...
...
@@ -103,8 +103,8 @@ umac64_digest (struct umac64_ctx *ctx,
assert
(
ctx
->
count
>
0
);
if
(
!
(
ctx
->
nonce_low
&
_UMAC_NONCE_CACHED
))
{
aes_encrypt
(
&
ctx
->
pdf_key
,
AES_BLOCK_SIZE
,
(
uint8_t
*
)
ctx
->
pad_cache
,
ctx
->
nonce
);
aes
128
_encrypt
(
&
ctx
->
pdf_key
,
AES_BLOCK_SIZE
,
(
uint8_t
*
)
ctx
->
pad_cache
,
ctx
->
nonce
);
ctx
->
nonce_low
|=
_UMAC_NONCE_CACHED
;
}
pad
=
ctx
->
pad_cache
+
2
*
(
ctx
->
nonce_low
&
1
);
...
...
umac96.c
View file @
31a51477
...
...
@@ -101,8 +101,8 @@ umac96_digest (struct umac96_ctx *ctx,
}
assert
(
ctx
->
count
>
0
);
aes_encrypt
(
&
ctx
->
pdf_key
,
AES_BLOCK_SIZE
,
(
uint8_t
*
)
tag
,
ctx
->
nonce
);
aes
128
_encrypt
(
&
ctx
->
pdf_key
,
AES_BLOCK_SIZE
,
(
uint8_t
*
)
tag
,
ctx
->
nonce
);
INCREMENT
(
ctx
->
nonce_length
,
ctx
->
nonce
);
...
...
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