Commit 3eb603d0 authored by Niels Möller's avatar Niels Möller
Browse files

Use size_t rather than unsigned for all cipher-related functions.

parent 2b49c179
......@@ -68,19 +68,19 @@ struct salsa20_ctx
void
salsa20_set_key(struct salsa20_ctx *ctx,
unsigned length, const uint8_t *key);
size_t length, const uint8_t *key);
void
salsa20_set_iv(struct salsa20_ctx *ctx, const uint8_t *iv);
void
salsa20_crypt(struct salsa20_ctx *ctx,
unsigned length, uint8_t *dst,
size_t length, uint8_t *dst,
const uint8_t *src);
void
salsa20r12_crypt(struct salsa20_ctx *ctx,
unsigned length, uint8_t *dst,
size_t length, uint8_t *dst,
const uint8_t *src);
void
......
......@@ -42,9 +42,9 @@
void
salsa20r12_crypt(struct salsa20_ctx *ctx,
unsigned length,
uint8_t *c,
const uint8_t *m)
size_t length,
uint8_t *c,
const uint8_t *m)
{
uint32_t x[_SALSA20_INPUT_LENGTH];
......
......@@ -461,7 +461,7 @@
void
serpent_decrypt (const struct serpent_ctx *ctx,
unsigned length, uint8_t * dst, const uint8_t * src)
size_t length, uint8_t * dst, const uint8_t * src)
{
assert( !(length % SERPENT_BLOCK_SIZE));
......
......@@ -434,7 +434,7 @@
void
serpent_encrypt (const struct serpent_ctx *ctx,
unsigned length, uint8_t * dst, const uint8_t * src)
size_t length, uint8_t * dst, const uint8_t * src)
{
assert( !(length % SERPENT_BLOCK_SIZE));
......
......@@ -316,7 +316,7 @@ serpent_key_pad (const uint8_t *key, unsigned int key_length,
/* Initialize CONTEXT with the key KEY of KEY_LENGTH bits. */
void
serpent_set_key (struct serpent_ctx *ctx,
unsigned length, const uint8_t * key)
size_t length, const uint8_t * key)
{
uint32_t w[8];
uint32_t (*keys)[4];
......
......@@ -63,15 +63,15 @@ struct serpent_ctx
void
serpent_set_key(struct serpent_ctx *ctx,
unsigned length, const uint8_t *key);
size_t length, const uint8_t *key);
void
serpent_encrypt(const struct serpent_ctx *ctx,
unsigned length, uint8_t *dst,
size_t length, uint8_t *dst,
const uint8_t *src);
void
serpent_decrypt(const struct serpent_ctx *ctx,
unsigned length, uint8_t *dst,
size_t length, uint8_t *dst,
const uint8_t *src);
#ifdef __cplusplus
......
......@@ -275,7 +275,7 @@ h(int k, uint8_t x, uint32_t l0, uint32_t l1, uint32_t l2, uint32_t l3)
void
twofish_set_key(struct twofish_ctx *context,
unsigned keysize, const uint8_t *key)
size_t keysize, const uint8_t *key)
{
uint8_t key_copy[32];
uint32_t m[8], s[4], t;
......@@ -338,7 +338,7 @@ twofish_set_key(struct twofish_ctx *context,
void
twofish_encrypt(const struct twofish_ctx *context,
unsigned length,
size_t length,
uint8_t *ciphertext,
const uint8_t *plaintext)
{
......@@ -408,7 +408,7 @@ twofish_encrypt(const struct twofish_ctx *context,
void
twofish_decrypt(const struct twofish_ctx *context,
unsigned length,
size_t length,
uint8_t *plaintext,
const uint8_t *ciphertext)
......
......@@ -60,15 +60,15 @@ struct twofish_ctx
void
twofish_set_key(struct twofish_ctx *ctx,
unsigned length, const uint8_t *key);
size_t length, const uint8_t *key);
void
twofish_encrypt(const struct twofish_ctx *ctx,
unsigned length, uint8_t *dst,
size_t length, uint8_t *dst,
const uint8_t *src);
void
twofish_decrypt(const struct twofish_ctx *ctx,
unsigned length, uint8_t *dst,
size_t length, uint8_t *dst,
const uint8_t *src);
#ifdef __cplusplus
......
......@@ -33,14 +33,14 @@ define(<TC>,<%r12d>)
define(<CTX>, <%rdi>)
define(<TABLE>, <%rsi>)
define(<PARAM_LENGTH>,<%edx>) C Length is only 32 bits
define(<PARAM_LENGTH>,<%rdx>)
define(<PARAM_DST>, <%rcx>)
define(<SRC>, <%r8>)
define(<DST>, <%r9>)
define(<KEY>,<%r14>)
define(<COUNT>, <%r15d>)
define(<BLOCK_COUNT>, <%r13d>)
define(<BLOCK_COUNT>, <%r13>)
C Must correspond to an old-style register, for movzb from %ah--%dh to
C work.
......@@ -50,7 +50,7 @@ define(<TMP>,<%rbp>)
C _aes_decrypt(struct aes_context *ctx,
C const struct aes_table *T,
C unsigned length, uint8_t *dst,
C size_t length, uint8_t *dst,
C uint8_t *src)
.text
ALIGN(16)
......@@ -68,8 +68,8 @@ PROLOGUE(_nettle_aes_decrypt)
push %r15
mov PARAM_DST, DST
movl PARAM_LENGTH, BLOCK_COUNT
shrl $4, BLOCK_COUNT
mov PARAM_LENGTH, BLOCK_COUNT
shr $4, BLOCK_COUNT
.Lblock_loop:
mov CTX,KEY
......@@ -119,7 +119,7 @@ PROLOGUE(_nettle_aes_decrypt)
AES_STORE(TA,TB,TC,SD, KEY, DST)
add $16, DST
decl BLOCK_COUNT
dec BLOCK_COUNT
jnz .Lblock_loop
......
......@@ -33,14 +33,14 @@ define(<TC>,<%r12d>)
define(<CTX>, <%rdi>)
define(<TABLE>, <%rsi>)
define(<PARAM_LENGTH>,<%edx>) C Length is only 32 bits
define(<PARAM_LENGTH>,<%rdx>)
define(<PARAM_DST>, <%rcx>)
define(<SRC>, <%r8>)
define(<DST>, <%r9>)
define(<KEY>,<%r14>)
define(<COUNT>, <%r15d>)
define(<BLOCK_COUNT>, <%r13d>)
define(<BLOCK_COUNT>, <%r13>)
C Must correspond to an old-style register, for movzb from %ah--%dh to
C work.
......@@ -50,7 +50,7 @@ define(<TMP>,<%rbp>)
C _aes_encrypt(struct aes_context *ctx,
C const struct aes_table *T,
C unsigned length, uint8_t *dst,
C size_t length, uint8_t *dst,
C uint8_t *src)
.text
ALIGN(16)
......@@ -68,8 +68,8 @@ PROLOGUE(_nettle_aes_encrypt)
push %r15
mov PARAM_DST, DST
movl PARAM_LENGTH, BLOCK_COUNT
shrl $4, BLOCK_COUNT
mov PARAM_LENGTH, BLOCK_COUNT
shr $4, BLOCK_COUNT
.Lblock_loop:
mov CTX,KEY
......@@ -119,7 +119,7 @@ PROLOGUE(_nettle_aes_encrypt)
AES_STORE(TA,TB,TC,SD, KEY, DST)
add $16, DST
decl BLOCK_COUNT
dec BLOCK_COUNT
jnz .Lblock_loop
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment