* ctr-internal.h: Likewise.
* dsa-internal.h: Likewise.
* gost28147-internal.h: Likewise.
+ * poly1305-internal.h: Likewise.
2020-11-26 Niels Möller <nisse@lysator.liu.se>
chacha_set_nonce96 (&ctx->chacha, nonce);
/* Generate authentication key */
_nettle_chacha_core (u.x, ctx->chacha.state, CHACHA_ROUNDS);
- _poly1305_set_key (&ctx->poly1305, u.subkey);
+ _nettle_poly1305_set_key (&ctx->poly1305, u.subkey);
/* For final poly1305 processing */
memcpy (ctx->s.b, u.subkey + 16, 16);
/* Increment block count */
}
/* FIXME: Duplicated in poly1305-aes128.c */
-#define COMPRESS(ctx, data) _poly1305_block(&(ctx)->poly1305, (data), 1)
+#define COMPRESS(ctx, data) _nettle_poly1305_block(&(ctx)->poly1305, (data), 1)
static void
poly1305_update (struct chacha_poly1305_ctx *ctx,
{
memset (ctx->block + ctx->index, 0,
POLY1305_BLOCK_SIZE - ctx->index);
- _poly1305_block(&ctx->poly1305, ctx->block, 1);
+ _nettle_poly1305_block(&ctx->poly1305, ctx->block, 1);
ctx->index = 0;
}
}
LE_WRITE_UINT64 (buf, ctx->auth_size);
LE_WRITE_UINT64 (buf + 8, ctx->data_size);
- _poly1305_block (&ctx->poly1305, buf, 1);
+ _nettle_poly1305_block (&ctx->poly1305, buf, 1);
- _poly1305_digest (&ctx->poly1305, &ctx->s);
+ _nettle_poly1305_digest (&ctx->poly1305, &ctx->s);
memcpy (digest, &ctx->s.b, length);
}
poly1305_aes_set_key (struct poly1305_aes_ctx *ctx, const uint8_t * key)
{
aes128_set_encrypt_key(&ctx->aes, (key));
- _poly1305_set_key(&ctx->pctx, (key+16));
+ _nettle_poly1305_set_key(&ctx->pctx, (key+16));
ctx->index = 0;
}
memcpy (ctx->nonce, nonce, POLY1305_AES_NONCE_SIZE);
}
-#define COMPRESS(ctx, data) _poly1305_block(&(ctx)->pctx, (data), 1)
+#define COMPRESS(ctx, data) _nettle_poly1305_block(&(ctx)->pctx, (data), 1)
void
poly1305_aes_update (struct poly1305_aes_ctx *ctx,
memset (ctx->block + ctx->index + 1,
0, POLY1305_BLOCK_SIZE - 1 - ctx->index);
- _poly1305_block (&ctx->pctx, ctx->block, 0);
+ _nettle_poly1305_block (&ctx->pctx, ctx->block, 0);
}
aes128_encrypt(&ctx->aes, POLY1305_BLOCK_SIZE, s.b, ctx->nonce);
- _poly1305_digest (&ctx->pctx, &s);
+ _nettle_poly1305_digest (&ctx->pctx, &s);
memcpy (digest, s.b, length);
INCREMENT (16, ctx->nonce);
#define h4 hh
void
-_poly1305_set_key(struct poly1305_ctx *ctx, const uint8_t key[16])
+_nettle_poly1305_set_key(struct poly1305_ctx *ctx, const uint8_t key[16])
{
uint32_t t0,t1,t2,t3;
}
void
-_poly1305_block (struct poly1305_ctx *ctx, const uint8_t *m, unsigned t4)
+_nettle_poly1305_block (struct poly1305_ctx *ctx, const uint8_t *m, unsigned t4)
{
uint32_t t0,t1,t2,t3;
uint32_t b;
/* Adds digest to the nonce */
void
-_poly1305_digest (struct poly1305_ctx *ctx, union nettle_block16 *s)
+_nettle_poly1305_digest (struct poly1305_ctx *ctx, union nettle_block16 *s)
{
uint32_t b, nb;
uint64_t f0,f1,f2,f3;
extern "C" {
#endif
-/* Name mangling */
-#define _poly1305_set_key _nettle_poly1305_set_key
-#define _poly1305_digest _nettle_poly1305_digest
-#define _poly1305_block _nettle_poly1305_block
-
/* Low level functions/macros for the poly1305 construction. */
#define POLY1305_DIGEST_SIZE 16
#define POLY1305_KEY_SIZE 16
/* Low-level internal interface. */
-void _poly1305_set_key(struct poly1305_ctx *ctx, const uint8_t key[POLY1305_KEY_SIZE]);
+void _nettle_poly1305_set_key(struct poly1305_ctx *ctx, const uint8_t key[POLY1305_KEY_SIZE]);
/* Extracts digest, and adds it to s, the encrypted nonce. */
-void _poly1305_digest (struct poly1305_ctx *ctx, union nettle_block16 *s);
-/* Internal function. Process one block. */
-void _poly1305_block (struct poly1305_ctx *ctx, const uint8_t *m,
- unsigned high);
+void _nettle_poly1305_digest (struct poly1305_ctx *ctx, union nettle_block16 *s);
+/* Process one block. */
+void _nettle_poly1305_block (struct poly1305_ctx *ctx, const uint8_t *m,
+ unsigned high);
#ifdef __cplusplus
}