1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-01-18 12:52:44 +01:00

crypto/chacha20poly1305: make internal functions static

This commit is contained in:
Benjamin Valentin 2020-10-20 17:13:48 +02:00
parent d4f576f677
commit 97fdfba3f3

View File

@ -52,14 +52,14 @@ static uint32_t u8to32(const uint8_t *p)
}
/* Single round */
void _r(uint32_t *a, uint32_t *b, uint32_t *d, unsigned c)
static void _r(uint32_t *a, uint32_t *b, uint32_t *d, unsigned c)
{
*a += *b;
uint32_t tmp = *a ^ *d;
*d = (tmp << c) | (tmp >> (32 - c));
}
void _add_initial(chacha20poly1305_ctx_t *ctx, const uint8_t *key,
static void _add_initial(chacha20poly1305_ctx_t *ctx, const uint8_t *key,
const uint8_t *nonce, uint32_t blk)
{
for (unsigned i = 0; i < 4; i++) {
@ -74,7 +74,7 @@ void _add_initial(chacha20poly1305_ctx_t *ctx, const uint8_t *key,
ctx->state[15] += u8to32(nonce+8);
}
void _keystream(chacha20poly1305_ctx_t *ctx, const uint8_t *key,
static void _keystream(chacha20poly1305_ctx_t *ctx, const uint8_t *key,
const uint8_t *nonce, uint32_t blk)
{
/* Initialize block state */
@ -96,7 +96,7 @@ void _keystream(chacha20poly1305_ctx_t *ctx, const uint8_t *key,
_add_initial(ctx, key, nonce, blk);
}
void _xcrypt(chacha20poly1305_ctx_t *ctx, const uint8_t *key,
static void _xcrypt(chacha20poly1305_ctx_t *ctx, const uint8_t *key,
const uint8_t *nonce, const uint8_t *in, uint8_t *out, size_t len)
{
/* Number of full 64 byte blocks */
@ -118,7 +118,7 @@ void _xcrypt(chacha20poly1305_ctx_t *ctx, const uint8_t *key,
}
}
void _poly1305_padded(poly1305_ctx_t *pctx, const uint8_t *data, size_t len)
static void _poly1305_padded(poly1305_ctx_t *pctx, const uint8_t *data, size_t len)
{
poly1305_update(pctx, data, len);
const size_t padlen = (16 - len) & 0xF;
@ -126,7 +126,7 @@ void _poly1305_padded(poly1305_ctx_t *pctx, const uint8_t *data, size_t len)
}
/* Generate a poly1305 tag */
void _poly1305_gentag(uint8_t *mac, const uint8_t *key, const uint8_t *nonce,
static void _poly1305_gentag(uint8_t *mac, const uint8_t *key, const uint8_t *nonce,
const uint8_t *cipher, size_t cipherlen,
const uint8_t *aad, size_t aadlen)
{