aboutsummaryrefslogtreecommitdiffstats
path: root/src/inexact.h
blob: f5797045715baeb36a57f0fdcafd4878be8a1991 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
/* Inexact source code package.
 *
 * Written in 2019 by <ben@hackade.org>.
 *
 * To the extent possible under law, the author have dedicated all copyright
 * and related and neighboring rights to this software to the public domain
 * worldwide. This software is distributed without any warranty.
 *
 * You should have received a copy of the CC0 Public Domain Dedication along with
 * this software. If not, see <http://creativecommons.org/publicdomain/zero/1.0/>.
 */

#ifndef INEXACT_H
#define INEXACT_H

#include <stddef.h>

int generate_keys(const char *seckey_filename, const char *pubkey_filename,
                  int no_password);
int get_seckey(const char *keyfile, unsigned char *skey, unsigned char *pkey);
int get_pubkey(const char *keyfile, unsigned char *pkey);
int get_symmetrickeys(unsigned char *salt_out, unsigned char *seckey_out,
                      unsigned char *pubkey_out);
int check_get_symmetrickeys(const unsigned char *data, const size_t data_len,
                            unsigned char *seckey_out,
                            unsigned char *pubkey_out);
unsigned char *encrypt_data(const unsigned char *seckey,
                            const unsigned char *pubkey,
                            const unsigned char *salt,
                            const unsigned char *data, size_t data_len,
                            size_t nonce1_len, size_t tag1_len,
                            int base64_transformation, size_t *encrypted_len);

unsigned char *decrypt_data(const unsigned char *seckey,
                            const unsigned char *pubkey,
                            const unsigned char *data, size_t data_len,
                            int symmetric_flag, size_t *data_len_out);

#endif /* INEXACT_H */