xref: /dflybsd-src/crypto/libressl/include/openssl/poly1305.h (revision 72c3367655e64985522b7a48ddfab613e869dc68)
1*72c33676SMaxim Ag /* $OpenBSD: poly1305.h,v 1.3 2014/07/25 14:04:51 jsing Exp $ */
2f5b1c8a1SJohn Marino /*
3f5b1c8a1SJohn Marino  * Copyright (c) 2014 Joel Sing <jsing@openbsd.org>
4f5b1c8a1SJohn Marino  *
5f5b1c8a1SJohn Marino  * Permission to use, copy, modify, and distribute this software for any
6f5b1c8a1SJohn Marino  * purpose with or without fee is hereby granted, provided that the above
7f5b1c8a1SJohn Marino  * copyright notice and this permission notice appear in all copies.
8f5b1c8a1SJohn Marino  *
9f5b1c8a1SJohn Marino  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10f5b1c8a1SJohn Marino  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11f5b1c8a1SJohn Marino  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12f5b1c8a1SJohn Marino  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13f5b1c8a1SJohn Marino  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14f5b1c8a1SJohn Marino  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15f5b1c8a1SJohn Marino  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16f5b1c8a1SJohn Marino  */
17f5b1c8a1SJohn Marino 
18f5b1c8a1SJohn Marino #ifndef HEADER_POLY1305_H
19f5b1c8a1SJohn Marino #define HEADER_POLY1305_H
20f5b1c8a1SJohn Marino 
21f5b1c8a1SJohn Marino #include <openssl/opensslconf.h>
22f5b1c8a1SJohn Marino 
23f5b1c8a1SJohn Marino #if defined(OPENSSL_NO_POLY1305)
24f5b1c8a1SJohn Marino #error Poly1305 is disabled.
25f5b1c8a1SJohn Marino #endif
26f5b1c8a1SJohn Marino 
27f5b1c8a1SJohn Marino #include <stddef.h>
28f5b1c8a1SJohn Marino 
29f5b1c8a1SJohn Marino #ifdef  __cplusplus
30f5b1c8a1SJohn Marino extern "C" {
31f5b1c8a1SJohn Marino #endif
32f5b1c8a1SJohn Marino 
33f5b1c8a1SJohn Marino typedef struct poly1305_context {
34f5b1c8a1SJohn Marino 	size_t aligner;
35f5b1c8a1SJohn Marino 	unsigned char opaque[136];
36f5b1c8a1SJohn Marino } poly1305_context;
37f5b1c8a1SJohn Marino 
38f5b1c8a1SJohn Marino typedef struct poly1305_context poly1305_state;
39f5b1c8a1SJohn Marino 
40f5b1c8a1SJohn Marino void CRYPTO_poly1305_init(poly1305_context *ctx, const unsigned char key[32]);
41f5b1c8a1SJohn Marino void CRYPTO_poly1305_update(poly1305_context *ctx, const unsigned char *in,
42f5b1c8a1SJohn Marino     size_t len);
43f5b1c8a1SJohn Marino void CRYPTO_poly1305_finish(poly1305_context *ctx, unsigned char mac[16]);
44f5b1c8a1SJohn Marino 
45f5b1c8a1SJohn Marino #ifdef  __cplusplus
46f5b1c8a1SJohn Marino }
47f5b1c8a1SJohn Marino #endif
48f5b1c8a1SJohn Marino 
49f5b1c8a1SJohn Marino #endif /* HEADER_POLY1305_H */
50