]> git.ipfire.org Git - thirdparty/chrony.git/blame - siv.h
test: use env shebang in all bash scripts
[thirdparty/chrony.git] / siv.h
CommitLineData
c5306bed
ML
1/*
2 chronyd/chronyc - Programs for keeping computer clocks accurate.
3
4 **********************************************************************
5 * Copyright (C) Miroslav Lichvar 2019
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of version 2 of the GNU General Public License as
9 * published by the Free Software Foundation.
10 *
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 *
20 **********************************************************************
21
22 =======================================================================
23
24 Header file for Synthetic Initialization Vector (SIV) ciphers.
25
26 */
27
28#ifndef GOT_SIV_H
29#define GOT_SIV_H
30
31/* Maximum key length of all supported SIVs */
32#define SIV_MAX_KEY_LENGTH 32
33
34/* Maximum difference between lengths of ciphertext and plaintext */
35#define SIV_MAX_TAG_LENGTH 16
36
37/* Identifiers of SIV algorithms following the IANA AEAD registry */
38typedef enum {
39 AEAD_AES_SIV_CMAC_256 = 15,
40 AEAD_AES_SIV_CMAC_384 = 16,
41 AEAD_AES_SIV_CMAC_512 = 17,
42 AEAD_AES_128_GCM_SIV = 30,
43 AEAD_AES_256_GCM_SIV = 31,
44} SIV_Algorithm;
45
46typedef struct SIV_Instance_Record *SIV_Instance;
47
48extern SIV_Instance SIV_CreateInstance(SIV_Algorithm algorithm);
49
50extern void SIV_DestroyInstance(SIV_Instance instance);
51
52extern int SIV_GetKeyLength(SIV_Algorithm algorithm);
53
54extern int SIV_SetKey(SIV_Instance instance, const unsigned char *key, int length);
55
56extern int SIV_GetTagLength(SIV_Instance instance);
57
58extern int SIV_Encrypt(SIV_Instance instance,
59 const unsigned char *nonce, int nonce_length,
60 const void *assoc, int assoc_length,
61 const void *plaintext, int plaintext_length,
62 unsigned char *ciphertext, int ciphertext_length);
63
64extern int SIV_Decrypt(SIV_Instance instance,
65 const unsigned char *nonce, int nonce_length,
66 const void *assoc, int assoc_length,
67 const unsigned char *ciphertext, int ciphertext_length,
68 void *plaintext, int plaintext_length);
69
70#endif