2 * Copyright (c) 2022 Rubicon Communications, LLC.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at:
7 * http://www.apache.org/licenses/LICENSE-2.0
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
16 #ifndef __included_wg_chachapoly_h__
17 #define __included_wg_chachapoly_h__
19 #include <vlib/vlib.h>
20 #include <vnet/crypto/crypto.h>
22 #define XCHACHA20POLY1305_NONCE_SIZE 24
23 #define CHACHA20POLY1305_KEY_SIZE 32
25 bool wg_chacha20poly1305_calc (vlib_main_t *vm, u8 *src, u32 src_len, u8 *dst,
26 u8 *aad, u32 aad_len, u64 nonce,
27 vnet_crypto_op_id_t op_id,
28 vnet_crypto_key_index_t key_index);
30 bool wg_xchacha20poly1305_decrypt (vlib_main_t *vm, u8 *src, u32 src_len,
31 u8 *dst, u8 *aad, u32 aad_len,
32 u8 nonce[XCHACHA20POLY1305_NONCE_SIZE],
33 u8 key[CHACHA20POLY1305_KEY_SIZE]);
35 #endif /* __included_wg_chachapoly_h__ */
38 * fd.io coding-style-patch-verification: ON
41 * eval: (c-set-style "gnu")