Skip to content

Commit

Permalink
crypto: aegis128 - Move simd prototypes into aegis.h
Browse files Browse the repository at this point in the history
This patch fixes missing prototype warnings in crypto/aegis128-neon.c.

Fixes: a439763 ("crypto: aegis128 - provide a SIMD...")
Reported-by: kernel test robot <[email protected]>
Signed-off-by: Herbert Xu <[email protected]>
Acked-by: Ard Biesheuvel <[email protected]>
Signed-off-by: Herbert Xu <[email protected]>
  • Loading branch information
herbertx committed Mar 19, 2021
1 parent aa31e55 commit 0914999
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 20 deletions.
19 changes: 19 additions & 0 deletions crypto/aegis.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,28 @@ union aegis_block {
u8 bytes[AEGIS_BLOCK_SIZE];
};

struct aegis_state;

extern int aegis128_have_aes_insn;

#define AEGIS_BLOCK_ALIGN (__alignof__(union aegis_block))
#define AEGIS_ALIGNED(p) IS_ALIGNED((uintptr_t)p, AEGIS_BLOCK_ALIGN)

bool crypto_aegis128_have_simd(void);
void crypto_aegis128_update_simd(struct aegis_state *state, const void *msg);
void crypto_aegis128_init_simd(struct aegis_state *state,
const union aegis_block *key,
const u8 *iv);
void crypto_aegis128_encrypt_chunk_simd(struct aegis_state *state, u8 *dst,
const u8 *src, unsigned int size);
void crypto_aegis128_decrypt_chunk_simd(struct aegis_state *state, u8 *dst,
const u8 *src, unsigned int size);
int crypto_aegis128_final_simd(struct aegis_state *state,
union aegis_block *tag_xor,
unsigned int assoclen,
unsigned int cryptlen,
unsigned int authsize);

static __always_inline void crypto_aegis_block_xor(union aegis_block *dst,
const union aegis_block *src)
{
Expand Down
15 changes: 0 additions & 15 deletions crypto/aegis128-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,21 +58,6 @@ static bool aegis128_do_simd(void)
return false;
}

bool crypto_aegis128_have_simd(void);
void crypto_aegis128_update_simd(struct aegis_state *state, const void *msg);
void crypto_aegis128_init_simd(struct aegis_state *state,
const union aegis_block *key,
const u8 *iv);
void crypto_aegis128_encrypt_chunk_simd(struct aegis_state *state, u8 *dst,
const u8 *src, unsigned int size);
void crypto_aegis128_decrypt_chunk_simd(struct aegis_state *state, u8 *dst,
const u8 *src, unsigned int size);
int crypto_aegis128_final_simd(struct aegis_state *state,
union aegis_block *tag_xor,
unsigned int assoclen,
unsigned int cryptlen,
unsigned int authsize);

static void crypto_aegis128_update(struct aegis_state *state)
{
union aegis_block tmp;
Expand Down
10 changes: 5 additions & 5 deletions crypto/aegis128-neon.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ bool crypto_aegis128_have_simd(void)
return IS_ENABLED(CONFIG_ARM64);
}

void crypto_aegis128_init_simd(union aegis_block *state,
void crypto_aegis128_init_simd(struct aegis_state *state,
const union aegis_block *key,
const u8 *iv)
{
Expand All @@ -39,30 +39,30 @@ void crypto_aegis128_init_simd(union aegis_block *state,
kernel_neon_end();
}

void crypto_aegis128_update_simd(union aegis_block *state, const void *msg)
void crypto_aegis128_update_simd(struct aegis_state *state, const void *msg)
{
kernel_neon_begin();
crypto_aegis128_update_neon(state, msg);
kernel_neon_end();
}

void crypto_aegis128_encrypt_chunk_simd(union aegis_block *state, u8 *dst,
void crypto_aegis128_encrypt_chunk_simd(struct aegis_state *state, u8 *dst,
const u8 *src, unsigned int size)
{
kernel_neon_begin();
crypto_aegis128_encrypt_chunk_neon(state, dst, src, size);
kernel_neon_end();
}

void crypto_aegis128_decrypt_chunk_simd(union aegis_block *state, u8 *dst,
void crypto_aegis128_decrypt_chunk_simd(struct aegis_state *state, u8 *dst,
const u8 *src, unsigned int size)
{
kernel_neon_begin();
crypto_aegis128_decrypt_chunk_neon(state, dst, src, size);
kernel_neon_end();
}

int crypto_aegis128_final_simd(union aegis_block *state,
int crypto_aegis128_final_simd(struct aegis_state *state,
union aegis_block *tag_xor,
unsigned int assoclen,
unsigned int cryptlen,
Expand Down

0 comments on commit 0914999

Please sign in to comment.