Ensure all parameters have names in header files.
[oweals/tinc.git] / src / cipher.h
1 #ifndef TINC_CIPHER_H
2 #define TINC_CIPHER_H
3
4 /*
5     cipher.h -- header file cipher.c
6     Copyright (C) 2007-2016 Guus Sliepen <guus@tinc-vpn.org>
7
8     This program is free software; you can redistribute it and/or modify
9     it under the terms of the GNU General Public License as published by
10     the Free Software Foundation; either version 2 of the License, or
11     (at your option) any later version.
12
13     This program is distributed in the hope that it will be useful,
14     but WITHOUT ANY WARRANTY; without even the implied warranty of
15     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16     GNU General Public License for more details.
17
18     You should have received a copy of the GNU General Public License along
19     with this program; if not, write to the Free Software Foundation, Inc.,
20     51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21 */
22
23 #define CIPHER_MAX_BLOCK_SIZE 32
24 #define CIPHER_MAX_IV_SIZE 16
25 #define CIPHER_MAX_KEY_SIZE 32
26
27 #ifndef DISABLE_LEGACY
28
29 typedef struct cipher cipher_t;
30
31 extern cipher_t *cipher_open_by_name(const char *name) __attribute__((__malloc__));
32 extern cipher_t *cipher_open_by_nid(int nid) __attribute__((__malloc__));
33 extern void cipher_close(cipher_t *cipher);
34 extern size_t cipher_keylength(const cipher_t *cipher);
35 extern size_t cipher_blocksize(const cipher_t *cipher);
36 extern uint64_t cipher_budget(const cipher_t *cipher);
37 extern bool cipher_set_key(cipher_t *cipher, void *key, bool encrypt) __attribute__((__warn_unused_result__));
38 extern bool cipher_set_key_from_rsa(cipher_t *cipher, void *rsa, size_t len, bool encrypt) __attribute__((__warn_unused_result__));
39 extern bool cipher_encrypt(cipher_t *cipher, const void *indata, size_t inlen, void *outdata, size_t *outlen, bool oneshot) __attribute__((__warn_unused_result__));
40 extern bool cipher_decrypt(cipher_t *cipher, const void *indata, size_t inlen, void *outdata, size_t *outlen, bool oneshot) __attribute__((__warn_unused_result__));
41 extern int cipher_get_nid(const cipher_t *cipher);
42 extern bool cipher_active(const cipher_t *cipher);
43
44 #endif
45
46 #endif