Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Wim Lewis
nettle
Commits
ba517ac5
Commit
ba517ac5
authored
Apr 18, 2013
by
Niels Möller
Browse files
Rename UMAC_BLOCK_SIZE to UMAC_DATA_SIZE.
parent
f5987616
Changes
8
Hide whitespace changes
Inline
Side-by-side
ChangeLog
View file @
ba517ac5
...
...
@@ -2,6 +2,9 @@
* umac.h (UMAC32_DIGEST_SIZE, UMAC64_DIGEST_SIZE)
(UMAC96_DIGEST_SIZE, UMAC128_DIGEST_SIZE): New constants.
(UMAC_DATA_SIZE): New name, for consistency with hash functions.
Updated all uses.
(UMAC_BLOCK_SIZE): ... old name.
2013-04-17 Niels Möller <nisse@lysator.liu.se>
...
...
examples/nettle-benchmark.c
View file @
ba517ac5
...
...
@@ -370,7 +370,7 @@ time_umac(void)
info
.
update
=
(
nettle_hash_update_func
*
)
umac32_update
;
info
.
data
=
data
;
display
(
"umac32"
,
"update"
,
UMAC_
BLOCK
_SIZE
,
display
(
"umac32"
,
"update"
,
UMAC_
DATA
_SIZE
,
time_function
(
bench_hash
,
&
info
));
umac64_set_key
(
&
ctx64
,
key
);
...
...
@@ -378,7 +378,7 @@ time_umac(void)
info
.
update
=
(
nettle_hash_update_func
*
)
umac64_update
;
info
.
data
=
data
;
display
(
"umac64"
,
"update"
,
UMAC_
BLOCK
_SIZE
,
display
(
"umac64"
,
"update"
,
UMAC_
DATA
_SIZE
,
time_function
(
bench_hash
,
&
info
));
umac96_set_key
(
&
ctx96
,
key
);
...
...
@@ -386,7 +386,7 @@ time_umac(void)
info
.
update
=
(
nettle_hash_update_func
*
)
umac96_update
;
info
.
data
=
data
;
display
(
"umac96"
,
"update"
,
UMAC_
BLOCK
_SIZE
,
display
(
"umac96"
,
"update"
,
UMAC_
DATA
_SIZE
,
time_function
(
bench_hash
,
&
info
));
umac128_set_key
(
&
ctx128
,
key
);
...
...
@@ -394,7 +394,7 @@ time_umac(void)
info
.
update
=
(
nettle_hash_update_func
*
)
umac128_update
;
info
.
data
=
data
;
display
(
"umac128"
,
"update"
,
UMAC_
BLOCK
_SIZE
,
display
(
"umac128"
,
"update"
,
UMAC_
DATA
_SIZE
,
time_function
(
bench_hash
,
&
info
));
}
...
...
umac-set-key.c
View file @
ba517ac5
...
...
@@ -78,7 +78,7 @@ _umac_set_key (uint32_t *l1_key, uint32_t *l2_key,
aes_set_encrypt_key
(
aes
,
UMAC_KEY_SIZE
,
key
);
size
=
UMAC_
BLOCK
_SIZE
/
4
+
4
*
(
n
-
1
);
size
=
UMAC_
DATA
_SIZE
/
4
+
4
*
(
n
-
1
);
umac_kdf
(
aes
,
1
,
size
*
sizeof
(
uint32_t
),
(
uint8_t
*
)
l1_key
);
BE_SWAP32_N
(
size
,
l1_key
);
...
...
umac.h
View file @
ba517ac5
...
...
@@ -66,11 +66,11 @@ extern "C" {
#define UMAC64_DIGEST_SIZE 8
#define UMAC96_DIGEST_SIZE 12
#define UMAC128_DIGEST_SIZE 16
#define UMAC_
BLOCK
_SIZE 1024
#define UMAC_
DATA
_SIZE 1024
/* Subkeys and state for UMAC with tag size 32*n bits. */
#define _UMAC_STATE(n) \
uint32_t l1_key[UMAC_
BLOCK
_SIZE/4 + 4*((n)-1)]; \
uint32_t l1_key[UMAC_
DATA
_SIZE/4 + 4*((n)-1)]; \
/* Keys in 32-bit pieces, high first */
\
uint32_t l2_key[6*(n)]; \
uint64_t l3_key1[8*(n)]; \
...
...
@@ -91,7 +91,7 @@ extern "C" {
unsigned index; \
/* Complete blocks processed */
\
uint64_t count; \
uint8_t block[UMAC_
BLOCK
_SIZE]
uint8_t block[UMAC_
DATA
_SIZE]
#define _UMAC_NONCE_CACHED 0x80
...
...
umac128.c
View file @
ba517ac5
...
...
@@ -61,11 +61,11 @@ umac128_set_nonce (struct umac128_ctx *ctx,
#define UMAC128_BLOCK(ctx, block) do { \
uint64_t __umac128_y[4]; \
_umac_nh_n (__umac128_y, 4, ctx->l1_key, UMAC_
BLOCK
_SIZE, block); \
__umac128_y[0] += 8*UMAC_
BLOCK
_SIZE; \
__umac128_y[1] += 8*UMAC_
BLOCK
_SIZE; \
__umac128_y[2] += 8*UMAC_
BLOCK
_SIZE; \
__umac128_y[3] += 8*UMAC_
BLOCK
_SIZE; \
_umac_nh_n (__umac128_y, 4, ctx->l1_key, UMAC_
DATA
_SIZE, block); \
__umac128_y[0] += 8*UMAC_
DATA
_SIZE;
\
__umac128_y[1] += 8*UMAC_
DATA
_SIZE;
\
__umac128_y[2] += 8*UMAC_
DATA
_SIZE;
\
__umac128_y[3] += 8*UMAC_
DATA
_SIZE;
\
_umac_l2 (ctx->l2_key, ctx->l2_state, 4, ctx->count++, __umac128_y); \
} while (0)
...
...
umac32.c
View file @
ba517ac5
...
...
@@ -64,8 +64,8 @@ umac32_set_nonce (struct umac32_ctx *ctx,
#define UMAC32_BLOCK(ctx, block) do { \
uint64_t __umac32_y \
= _umac_nh (ctx->l1_key, UMAC_
BLOCK
_SIZE, block) \
+ 8*UMAC_
BLOCK
_SIZE ; \
= _umac_nh (ctx->l1_key, UMAC_
DATA
_SIZE, block) \
+ 8*UMAC_
DATA
_SIZE ; \
_umac_l2 (ctx->l2_key, ctx->l2_state, 1, ctx->count++, &__umac32_y); \
} while (0)
...
...
umac64.c
View file @
ba517ac5
...
...
@@ -64,9 +64,9 @@ umac64_set_nonce (struct umac64_ctx *ctx,
#define UMAC64_BLOCK(ctx, block) do { \
uint64_t __umac64_y[2]; \
_umac_nh_n (__umac64_y, 2, ctx->l1_key, UMAC_
BLOCK
_SIZE, block); \
__umac64_y[0] += 8*UMAC_
BLOCK
_SIZE; \
__umac64_y[1] += 8*UMAC_
BLOCK
_SIZE; \
_umac_nh_n (__umac64_y, 2, ctx->l1_key, UMAC_
DATA
_SIZE, block); \
__umac64_y[0] += 8*UMAC_
DATA
_SIZE; \
__umac64_y[1] += 8*UMAC_
DATA
_SIZE; \
_umac_l2 (ctx->l2_key, ctx->l2_state, 2, ctx->count++, __umac64_y); \
} while (0)
...
...
umac96.c
View file @
ba517ac5
...
...
@@ -61,10 +61,10 @@ umac96_set_nonce (struct umac96_ctx *ctx,
#define UMAC96_BLOCK(ctx, block) do { \
uint64_t __umac96_y[3]; \
_umac_nh_n (__umac96_y, 3, ctx->l1_key, UMAC_
BLOCK
_SIZE, block); \
__umac96_y[0] += 8*UMAC_
BLOCK
_SIZE; \
__umac96_y[1] += 8*UMAC_
BLOCK
_SIZE; \
__umac96_y[2] += 8*UMAC_
BLOCK
_SIZE; \
_umac_nh_n (__umac96_y, 3, ctx->l1_key, UMAC_
DATA
_SIZE, block); \
__umac96_y[0] += 8*UMAC_
DATA
_SIZE; \
__umac96_y[1] += 8*UMAC_
DATA
_SIZE; \
__umac96_y[2] += 8*UMAC_
DATA
_SIZE; \
_umac_l2 (ctx->l2_key, ctx->l2_state, 3, ctx->count++, __umac96_y); \
} while (0)
...
...
Write
Preview
Supports
Markdown
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