2014-04-25 Niels Möller <nisse@lysator.liu.se>
+ * All hash-related files: Renamed all _DATA_SIZE constants to
+ _BLOCK_SIZE, for consistency. Old names kept for backwards
+ compatibility.
+
* nettle.texinfo (CCM): Documentation for CCM mode, contributed by
Owen Kirby.
info.update = (nettle_hash_update_func *) umac32_update;
info.data = data;
- display("umac32", "update", UMAC_DATA_SIZE,
+ display("umac32", "update", UMAC_BLOCK_SIZE,
time_function(bench_hash, &info));
umac64_set_key (&ctx64, key);
info.update = (nettle_hash_update_func *) umac64_update;
info.data = data;
- display("umac64", "update", UMAC_DATA_SIZE,
+ display("umac64", "update", UMAC_BLOCK_SIZE,
time_function(bench_hash, &info));
umac96_set_key (&ctx96, key);
info.update = (nettle_hash_update_func *) umac96_update;
info.data = data;
- display("umac96", "update", UMAC_DATA_SIZE,
+ display("umac96", "update", UMAC_BLOCK_SIZE,
time_function(bench_hash, &info));
umac128_set_key (&ctx128, key);
info.update = (nettle_hash_update_func *) umac128_update;
info.data = data;
- display("umac128", "update", UMAC_DATA_SIZE,
+ display("umac128", "update", UMAC_BLOCK_SIZE,
time_function(bench_hash, &info));
}
bench_sha1_compress(void)
{
uint32_t state[_SHA1_DIGEST_LENGTH];
- uint8_t data[SHA1_DATA_SIZE];
+ uint8_t data[SHA1_BLOCK_SIZE];
double t;
TIME_CYCLES (t, _nettle_sha1_compress(state, data));
/* fill partial block */
if (index)
{
- unsigned left = GOSTHASH94_DATA_SIZE - index;
+ unsigned left = GOSTHASH94_BLOCK_SIZE - index;
memcpy (ctx->message + index, msg, (length < left ? length : left));
if (length < left)
return;
msg += left;
length -= left;
}
- while (length >= GOSTHASH94_DATA_SIZE)
+ while (length >= GOSTHASH94_BLOCK_SIZE)
{
gost_compute_sum_and_hash (ctx, msg);
- msg += GOSTHASH94_DATA_SIZE;
- length -= GOSTHASH94_DATA_SIZE;
+ msg += GOSTHASH94_BLOCK_SIZE;
+ length -= GOSTHASH94_BLOCK_SIZE;
}
if (length)
{
#define gosthash94_update nettle_gosthash94_update
#define gosthash94_digest nettle_gosthash94_digest
-#define GOSTHASH94_DATA_SIZE 32
+#define GOSTHASH94_BLOCK_SIZE 32
#define GOSTHASH94_DIGEST_SIZE 32
+/* For backwards compatibility */
+#define GOSTHASH94_DATA_SIZE GOSTHASH94_BLOCK_SIZE
struct gosthash94_ctx
{
uint32_t hash[8]; /* algorithm 256-bit state */
uint32_t sum[8]; /* sum of processed message blocks */
- uint8_t message[GOSTHASH94_DATA_SIZE]; /* 256-bit buffer for leftovers */
+ uint8_t message[GOSTHASH94_BLOCK_SIZE]; /* 256-bit buffer for leftovers */
uint64_t length; /* number of processed bytes */
};
unsigned i;
uint8_t t;
- memcpy(ctx->X + 16, data, MD2_DATA_SIZE);
+ memcpy(ctx->X + 16, data, MD2_BLOCK_SIZE);
for (i = 0, t = ctx->C[15];
- i<MD2_DATA_SIZE; i++)
+ i<MD2_BLOCK_SIZE; i++)
{
- ctx->X[2 * MD2_DATA_SIZE + i]
- = ctx->X[i] ^ ctx->X[MD2_DATA_SIZE + i];
+ ctx->X[2 * MD2_BLOCK_SIZE + i]
+ = ctx->X[i] ^ ctx->X[MD2_BLOCK_SIZE + i];
t = (ctx->C[i] ^= S[data[i]^t]);
}
for (i = t = 0;
- i< MD2_DATA_SIZE + 2;
+ i< MD2_BLOCK_SIZE + 2;
t = (t + i) & 0xff, i++)
{
unsigned j;
- for (j = 0; j < 3 * MD2_DATA_SIZE; j++)
+ for (j = 0; j < 3 * MD2_BLOCK_SIZE; j++)
t = (ctx->X[j] ^= S[t]);
}
}
assert(length <= MD2_DIGEST_SIZE);
- left = MD2_DATA_SIZE - ctx->index;
+ left = MD2_BLOCK_SIZE - ctx->index;
memset(ctx->block + ctx->index, left, left);
md2_transform(ctx, ctx->block);
#define md2_digest nettle_md2_digest
#define MD2_DIGEST_SIZE 16
-#define MD2_DATA_SIZE 16
+#define MD2_BLOCK_SIZE 16
+/* For backwards compatibility */
+#define MD2_DATA_SIZE MD2_BLOCK_SIZE
struct md2_ctx
{
- uint8_t C[MD2_DATA_SIZE];
- uint8_t X[3 * MD2_DATA_SIZE];
- uint8_t block[MD2_DATA_SIZE]; /* Block buffer */
+ uint8_t C[MD2_BLOCK_SIZE];
+ uint8_t X[3 * MD2_BLOCK_SIZE];
+ uint8_t block[MD2_BLOCK_SIZE]; /* Block buffer */
unsigned index; /* Into buffer */
};
#define md4_digest nettle_md4_digest
#define MD4_DIGEST_SIZE 16
-#define MD4_DATA_SIZE 64
+#define MD4_BLOCK_SIZE 64
+/* For backwards compatibility */
+#define MD4_DATA_SIZE MD4_BLOCK_SIZE
/* Digest is kept internally as 4 32-bit words. */
#define _MD4_DIGEST_LENGTH 4
{
uint32_t state[_MD4_DIGEST_LENGTH];
uint64_t count; /* Block count */
- uint8_t block[MD4_DATA_SIZE]; /* Block buffer */
+ uint8_t block[MD4_BLOCK_SIZE]; /* Block buffer */
unsigned index; /* Into buffer */
};
/* There are 512 = 2^9 bits in one block */
bit_count = (ctx->count << 9) | (ctx->index << 3);
- LE_WRITE_UINT64(ctx->block + (MD5_DATA_SIZE - 8), bit_count);
+ LE_WRITE_UINT64(ctx->block + (MD5_BLOCK_SIZE - 8), bit_count);
_nettle_md5_compress(ctx->state, ctx->block);
_nettle_write_le32(length, digest, ctx->state);
#define md5_digest nettle_md5_digest
#define MD5_DIGEST_SIZE 16
-#define MD5_DATA_SIZE 64
+#define MD5_BLOCK_SIZE 64
+/* For backwards compatibility */
+#define MD5_DATA_SIZE MD5_BLOCK_SIZE
/* Digest is kept internally as 4 32-bit words. */
#define _MD5_DIGEST_LENGTH 4
{
uint32_t state[_MD5_DIGEST_LENGTH];
uint64_t count; /* Block count */
- uint8_t block[MD5_DATA_SIZE]; /* Block buffer */
+ uint8_t block[MD5_BLOCK_SIZE]; /* Block buffer */
unsigned index; /* Into buffer */
};
#name, \
sizeof(struct name##_ctx), \
NAME##_DIGEST_SIZE, \
- NAME##_DATA_SIZE, \
+ NAME##_BLOCK_SIZE, \
(nettle_hash_init_func *) name##_init, \
(nettle_hash_update_func *) name##_update, \
(nettle_hash_digest_func *) name##_digest \
The size of a SHA256 digest, i.e. 32.
@end defvr
-@defvr Constant SHA256_DATA_SIZE
+@defvr Constant SHA256_BLOCK_SIZE
The internal block size of SHA256. Useful for some special constructions,
in particular HMAC-SHA256.
@end defvr
The size of a SHA224 digest, i.e. 28.
@end defvr
-@defvr Constant SHA224_DATA_SIZE
+@defvr Constant SHA224_BLOCK_SIZE
The internal block size of SHA224. Useful for some special constructions,
in particular HMAC-SHA224.
@end defvr
The size of a SHA512 digest, i.e. 64.
@end defvr
-@defvr Constant SHA512_DATA_SIZE
+@defvr Constant SHA512_BLOCK_SIZE
The internal block size of SHA512, 128. Useful for some special
constructions, in particular HMAC-SHA512.
@end defvr
The digest size for each variant, i.e., 28, 32, and 48, respectively.
@end defvr
-@defvr Constant SHA512_224_DATA_SIZE
-@defvrx Constant SHA512_256_DATA_SIZE
-@defvrx Constant SHA384_DATA_SIZE
-The internal block size, same as SHA512_DATA_SIZE, i.e., 128. Useful for
+@defvr Constant SHA512_224_BLOCK_SIZE
+@defvrx Constant SHA512_256_BLOCK_SIZE
+@defvrx Constant SHA384_BLOCK_SIZE
+The internal block size, same as SHA512_BLOCK_SIZE, i.e., 128. Useful for
some special constructions, in particular HMAC-SHA384.
@end defvr
The size of a SHA3_224 digest, i.e., 28.
@end defvr
-@defvr Constant SHA3_224_DATA_SIZE
+@defvr Constant SHA3_224_BLOCK_SIZE
The internal block size of SHA3_224.
@end defvr
The size of a SHA3_256 digest, i.e., 32.
@end defvr
-@defvr Constant SHA3_256_DATA_SIZE
+@defvr Constant SHA3_256_BLOCK_SIZE
The internal block size of SHA3_256.
@end defvr
The size of a SHA3_384 digest, i.e., 48.
@end defvr
-@defvr Constant SHA3_384_DATA_SIZE
+@defvr Constant SHA3_384_BLOCK_SIZE
The internal block size of SHA3_384.
@end defvr
The size of a SHA3_512 digest, i.e. 64.
@end defvr
-@defvr Constant SHA3_512_DATA_SIZE
+@defvr Constant SHA3_512_BLOCK_SIZE
The internal block size of SHA3_512.
@end defvr
The size of an MD5 digest, i.e. 16.
@end defvr
-@defvr Constant MD5_DATA_SIZE
+@defvr Constant MD5_BLOCK_SIZE
The internal block size of MD5. Useful for some special constructions,
in particular HMAC-MD5.
@end defvr
The size of an MD2 digest, i.e. 16.
@end defvr
-@defvr Constant MD2_DATA_SIZE
+@defvr Constant MD2_BLOCK_SIZE
The internal block size of MD2.
@end defvr
The size of an MD4 digest, i.e. 16.
@end defvr
-@defvr Constant MD4_DATA_SIZE
+@defvr Constant MD4_BLOCK_SIZE
The internal block size of MD4.
@end defvr
The size of a RIPEMD160 digest, i.e. 20.
@end defvr
-@defvr Constant RIPEMD160_DATA_SIZE
+@defvr Constant RIPEMD160_BLOCK_SIZE
The internal block size of RIPEMD160.
@end defvr
The size of a SHA1 digest, i.e. 20.
@end defvr
-@defvr Constant SHA1_DATA_SIZE
+@defvr Constant SHA1_BLOCK_SIZE
The internal block size of SHA1. Useful for some special constructions,
in particular HMAC-SHA1.
@end defvr
The size of a GOSTHASH94 digest, i.e. 32.
@end defvr
-@defvr Constant GOSTHASH94_DATA_SIZE
+@defvr Constant GOSTHASH94_BLOCK_SIZE
The internal block size of GOSTHASH94, i.e., 32.
@end defvr
@defvr Constant UMAC128_DIGEST_SIZE
The size of an UMAC128 digest, 16.
@end defvr
-@defvr Constant UMAC_DATA_SIZE
+@defvr Constant UMAC_BLOCK_SIZE
The internal block size of UMAC.
@end defvr
/* RIPEMD160 */
#define RIPEMD160_DIGEST_SIZE 20
-#define RIPEMD160_DATA_SIZE 64
+#define RIPEMD160_BLOCK_SIZE 64
+/* For backwards compatibility */
+#define RIPEMD160_DATA_SIZE RIPEMD160_BLOCK_SIZE
/* Digest is kept internally as 5 32-bit words. */
#define _RIPEMD160_DIGEST_LENGTH 5
{
uint32_t state[_RIPEMD160_DIGEST_LENGTH];
uint64_t count; /* 64-bit block count */
- uint8_t block[RIPEMD160_DATA_SIZE];
+ uint8_t block[RIPEMD160_BLOCK_SIZE];
unsigned int index;
};
bit_count = (ctx->count << 9) | (ctx->index << 3);
/* append the 64 bit count */
- WRITE_UINT64(ctx->block + (SHA1_DATA_SIZE - 8), bit_count);
+ WRITE_UINT64(ctx->block + (SHA1_BLOCK_SIZE - 8), bit_count);
_nettle_sha1_compress(ctx->state, ctx->block);
_nettle_write_be32(length, digest, ctx->state);
/* SHA1 */
#define SHA1_DIGEST_SIZE 20
-#define SHA1_DATA_SIZE 64
+#define SHA1_BLOCK_SIZE 64
+/* For backwards compatibility */
+#define SHA1_DATA_SIZE SHA1_BLOCK_SIZE
/* Digest is kept internally as 5 32-bit words. */
#define _SHA1_DIGEST_LENGTH 5
{
uint32_t state[_SHA1_DIGEST_LENGTH]; /* State variables */
uint64_t count; /* 64-bit block count */
- uint8_t block[SHA1_DATA_SIZE]; /* SHA1 data buffer */
+ uint8_t block[SHA1_BLOCK_SIZE]; /* SHA1 data buffer */
unsigned int index; /* index into buffer */
};
#define sha512_256_init nettle_sha512_256_init
#define sha512_256_digest nettle_sha512_256_digest
+/* For backwards compatibility */
+#define SHA224_DATA_SIZE SHA256_BLOCK_SIZE
+#define SHA256_DATA_SIZE SHA256_BLOCK_SIZE
+#define SHA512_DATA_SIZE SHA512_BLOCK_SIZE
+#define SHA384_DATA_SIZE SHA512_BLOCK_SIZE
+
/* SHA256 */
#define SHA256_DIGEST_SIZE 32
-#define SHA256_DATA_SIZE 64
+#define SHA256_BLOCK_SIZE 64
/* Digest is kept internally as 8 32-bit words. */
#define _SHA256_DIGEST_LENGTH 8
{
uint32_t state[_SHA256_DIGEST_LENGTH]; /* State variables */
uint64_t count; /* 64-bit block count */
- uint8_t block[SHA256_DATA_SIZE]; /* SHA256 data buffer */
+ uint8_t block[SHA256_BLOCK_SIZE]; /* SHA256 data buffer */
unsigned int index; /* index into buffer */
};
/* SHA224, a truncated SHA256 with different initial state. */
#define SHA224_DIGEST_SIZE 28
-#define SHA224_DATA_SIZE SHA256_DATA_SIZE
+#define SHA224_BLOCK_SIZE SHA256_BLOCK_SIZE
#define sha224_ctx sha256_ctx
void
/* SHA512 */
#define SHA512_DIGEST_SIZE 64
-#define SHA512_DATA_SIZE 128
+#define SHA512_BLOCK_SIZE 128
/* Digest is kept internally as 8 64-bit words. */
#define _SHA512_DIGEST_LENGTH 8
{
uint64_t state[_SHA512_DIGEST_LENGTH]; /* State variables */
uint64_t count_low, count_high; /* 128-bit block count */
- uint8_t block[SHA512_DATA_SIZE]; /* SHA512 data buffer */
+ uint8_t block[SHA512_BLOCK_SIZE]; /* SHA512 data buffer */
unsigned int index; /* index into buffer */
};
/* SHA384, a truncated SHA512 with different initial state. */
#define SHA384_DIGEST_SIZE 48
-#define SHA384_DATA_SIZE SHA512_DATA_SIZE
+#define SHA384_BLOCK_SIZE SHA512_BLOCK_SIZE
#define sha384_ctx sha512_ctx
void
with different initial states. */
#define SHA512_224_DIGEST_SIZE 28
-#define SHA512_224_DATA_SIZE SHA512_DATA_SIZE
+#define SHA512_224_BLOCK_SIZE SHA512_BLOCK_SIZE
#define sha512_224_ctx sha512_ctx
void
uint8_t *digest);
#define SHA512_256_DIGEST_SIZE 32
-#define SHA512_256_DATA_SIZE SHA512_DATA_SIZE
+#define SHA512_256_BLOCK_SIZE SHA512_BLOCK_SIZE
#define sha512_256_ctx sha512_ctx
void
/* This is slightly inefficient, as the numbers are converted to
big-endian format, and will be converted back by the compression
function. It's probably not worth the effort to fix this. */
- WRITE_UINT64(ctx->block + (SHA256_DATA_SIZE - 8), bit_count);
+ WRITE_UINT64(ctx->block + (SHA256_BLOCK_SIZE - 8), bit_count);
COMPRESS(ctx, ctx->block);
_nettle_write_be32(length, digest, ctx->state);
size_t length,
const uint8_t *data)
{
- ctx->index = _sha3_update (&ctx->state, SHA3_224_DATA_SIZE, ctx->block,
+ ctx->index = _sha3_update (&ctx->state, SHA3_224_BLOCK_SIZE, ctx->block,
ctx->index, length, data);
}
size_t length,
uint8_t *digest)
{
- _sha3_pad (&ctx->state, SHA3_224_DATA_SIZE, ctx->block, ctx->index);
+ _sha3_pad (&ctx->state, SHA3_224_BLOCK_SIZE, ctx->block, ctx->index);
_nettle_write_le64 (length, digest, ctx->state.a);
sha3_224_init (ctx);
}
size_t length,
const uint8_t *data)
{
- ctx->index = _sha3_update (&ctx->state, SHA3_256_DATA_SIZE, ctx->block,
+ ctx->index = _sha3_update (&ctx->state, SHA3_256_BLOCK_SIZE, ctx->block,
ctx->index, length, data);
}
size_t length,
uint8_t *digest)
{
- _sha3_pad (&ctx->state, SHA3_256_DATA_SIZE, ctx->block, ctx->index);
+ _sha3_pad (&ctx->state, SHA3_256_BLOCK_SIZE, ctx->block, ctx->index);
_nettle_write_le64 (length, digest, ctx->state.a);
sha3_256_init (ctx);
}
size_t length,
const uint8_t *data)
{
- ctx->index = _sha3_update (&ctx->state, SHA3_384_DATA_SIZE, ctx->block,
+ ctx->index = _sha3_update (&ctx->state, SHA3_384_BLOCK_SIZE, ctx->block,
ctx->index, length, data);
}
size_t length,
uint8_t *digest)
{
- _sha3_pad (&ctx->state, SHA3_384_DATA_SIZE, ctx->block, ctx->index);
+ _sha3_pad (&ctx->state, SHA3_384_BLOCK_SIZE, ctx->block, ctx->index);
_nettle_write_le64 (length, digest, ctx->state.a);
sha3_384_init (ctx);
}
size_t length,
const uint8_t *data)
{
- ctx->index = _sha3_update (&ctx->state, SHA3_512_DATA_SIZE, ctx->block,
+ ctx->index = _sha3_update (&ctx->state, SHA3_512_BLOCK_SIZE, ctx->block,
ctx->index, length, data);
}
size_t length,
uint8_t *digest)
{
- _sha3_pad (&ctx->state, SHA3_512_DATA_SIZE, ctx->block, ctx->index);
+ _sha3_pad (&ctx->state, SHA3_512_BLOCK_SIZE, ctx->block, ctx->index);
_nettle_write_le64 (length, digest, ctx->state.a);
sha3_512_init (ctx);
}
size). */
#define SHA3_224_DIGEST_SIZE 28
-#define SHA3_224_DATA_SIZE 144
+#define SHA3_224_BLOCK_SIZE 144
#define SHA3_256_DIGEST_SIZE 32
-#define SHA3_256_DATA_SIZE 136
+#define SHA3_256_BLOCK_SIZE 136
#define SHA3_384_DIGEST_SIZE 48
-#define SHA3_384_DATA_SIZE 104
+#define SHA3_384_BLOCK_SIZE 104
#define SHA3_512_DIGEST_SIZE 64
-#define SHA3_512_DATA_SIZE 72
+#define SHA3_512_BLOCK_SIZE 72
+/* For backwards compatibility */
+#define SHA3_224_DATA_SIZE SHA3_224_BLOCK_SIZE
+#define SHA3_256_DATA_SIZE SHA3_256_BLOCK_SIZE
+#define SHA3_384_DATA_SIZE SHA3_384_BLOCK_SIZE
+#define SHA3_512_DATA_SIZE SHA3_512_BLOCK_SIZE
struct sha3_224_ctx
{
struct sha3_state state;
unsigned index;
- uint8_t block[SHA3_224_DATA_SIZE];
+ uint8_t block[SHA3_224_BLOCK_SIZE];
};
void
{
struct sha3_state state;
unsigned index;
- uint8_t block[SHA3_256_DATA_SIZE];
+ uint8_t block[SHA3_256_BLOCK_SIZE];
};
void
{
struct sha3_state state;
unsigned index;
- uint8_t block[SHA3_384_DATA_SIZE];
+ uint8_t block[SHA3_384_BLOCK_SIZE];
};
void
{
struct sha3_state state;
unsigned index;
- uint8_t block[SHA3_512_DATA_SIZE];
+ uint8_t block[SHA3_512_BLOCK_SIZE];
};
void
{
"sha512-224", sizeof(struct sha512_ctx),
SHA512_224_DIGEST_SIZE,
- SHA512_224_DATA_SIZE,
+ SHA512_224_BLOCK_SIZE,
(nettle_hash_init_func *) sha512_224_init,
(nettle_hash_update_func *) sha512_224_update,
(nettle_hash_digest_func *) sha512_224_digest
{
"sha512-256", sizeof(struct sha512_ctx),
SHA512_256_DIGEST_SIZE,
- SHA512_256_DATA_SIZE,
+ SHA512_256_BLOCK_SIZE,
(nettle_hash_init_func *) sha512_256_init,
(nettle_hash_update_func *) sha512_256_update,
(nettle_hash_digest_func *) sha512_256_digest
/* This is slightly inefficient, as the numbers are converted to
big-endian format, and will be converted back by the compression
function. It's probably not worth the effort to fix this. */
- WRITE_UINT64(ctx->block + (SHA512_DATA_SIZE - 16), high);
- WRITE_UINT64(ctx->block + (SHA512_DATA_SIZE - 8), low);
+ WRITE_UINT64(ctx->block + (SHA512_BLOCK_SIZE - 16), high);
+ WRITE_UINT64(ctx->block + (SHA512_BLOCK_SIZE - 8), low);
COMPRESS(ctx, ctx->block);
words = length / 8;
aes128_set_encrypt_key (aes, key);
- size = UMAC_DATA_SIZE / 4 + 4*(n-1);
+ size = UMAC_BLOCK_SIZE / 4 + 4*(n-1);
umac_kdf (aes, 1, size * sizeof(uint32_t), (uint8_t *) l1_key);
BE_SWAP32_N (size, l1_key);
#define UMAC64_DIGEST_SIZE 8
#define UMAC96_DIGEST_SIZE 12
#define UMAC128_DIGEST_SIZE 16
-#define UMAC_DATA_SIZE 1024
+#define UMAC_BLOCK_SIZE 1024
+/* For backwards compatibility */
+#define UMAC_DATA_SIZE UMAC_BLOCK_SIZE
/* Subkeys and state for UMAC with tag size 32*n bits. */
#define _UMAC_STATE(n) \
- uint32_t l1_key[UMAC_DATA_SIZE/4 + 4*((n)-1)]; \
+ uint32_t l1_key[UMAC_BLOCK_SIZE/4 + 4*((n)-1)]; \
/* Keys in 32-bit pieces, high first */ \
uint32_t l2_key[6*(n)]; \
uint64_t l3_key1[8*(n)]; \
unsigned index; \
/* Complete blocks processed */ \
uint64_t count; \
- uint8_t block[UMAC_DATA_SIZE]
+ uint8_t block[UMAC_BLOCK_SIZE]
#define _UMAC_NONCE_CACHED 0x80
#define UMAC128_BLOCK(ctx, block) do { \
uint64_t __umac128_y[4]; \
- _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_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_l2 (ctx->l2_key, ctx->l2_state, 4, ctx->count++, __umac128_y); \
} while (0)
#define UMAC32_BLOCK(ctx, block) do { \
uint64_t __umac32_y \
- = _umac_nh (ctx->l1_key, UMAC_DATA_SIZE, block) \
- + 8*UMAC_DATA_SIZE ; \
+ = _umac_nh (ctx->l1_key, UMAC_BLOCK_SIZE, block) \
+ + 8*UMAC_BLOCK_SIZE ; \
_umac_l2 (ctx->l2_key, ctx->l2_state, 1, ctx->count++, &__umac32_y); \
} while (0)
#define UMAC64_BLOCK(ctx, block) do { \
uint64_t __umac64_y[2]; \
- _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_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_l2 (ctx->l2_key, ctx->l2_state, 2, ctx->count++, __umac64_y); \
} while (0)
#define UMAC96_BLOCK(ctx, block) do { \
uint64_t __umac96_y[3]; \
- _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_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_l2 (ctx->l2_key, ctx->l2_state, 3, ctx->count++, __umac96_y); \
} while (0)