1/*
2 * Copyright (c) 2017 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
14 *
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
17 *
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
25 *
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27 */
28
29#ifndef _CHACHA20POLY1305_H
30#define _CHACHA20POLY1305_H
31
32#if defined(__cplusplus)
33extern "C"
34{
35#endif
36
37#include <corecrypto/ccchacha20poly1305.h>
38
39typedef ccchacha20poly1305_ctx chacha20poly1305_ctx;
40
41int chacha20poly1305_init(chacha20poly1305_ctx *ctx, const uint8_t *key);
42int chacha20poly1305_reset(chacha20poly1305_ctx *ctx);
43int chacha20poly1305_setnonce(chacha20poly1305_ctx *ctx, const uint8_t *nonce);
44int chacha20poly1305_incnonce(chacha20poly1305_ctx *ctx, uint8_t *nonce);
45int chacha20poly1305_aad(chacha20poly1305_ctx *ctx, size_t nbytes, const void *aad);
46int chacha20poly1305_encrypt(chacha20poly1305_ctx *ctx, size_t nbytes, const void *ptext, void *ctext);
47int chacha20poly1305_finalize(chacha20poly1305_ctx *ctx, uint8_t *tag);
48int chacha20poly1305_decrypt(chacha20poly1305_ctx *ctx, size_t nbytes, const void *ctext, void *ptext);
49int chacha20poly1305_verify(chacha20poly1305_ctx *ctx, const uint8_t *tag);
50
51#if defined(__cplusplus)
52}
53#endif
54
55#endif
56