aboutsummaryrefslogtreecommitdiffstats
path: root/src/tweetpipe_p.h
blob: 06fc5232080afb5e547be02b7e83ca4acbabb7f7 (plain) (blame)
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
41
#ifndef encpipe_p_H
#define encpipe_p_H 1

#include <stdlib.h>
#include <sys/types.h>
#include <sys/uio.h>

#include <assert.h>
#include <errno.h>
#include <fcntl.h>
#include <getopt.h>
#include <inttypes.h>
#include <stdarg.h>
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>

#include <tweetnacl.h>

#include "common.h"
#include "safe_rw.h"

#define MIN_BUFFER_SIZE 512
#define MAX_BUFFER_SIZE 0x7fffffff
#define DEFAULT_BUFFER_SIZE (1 * 1024 * 1024)
#define PWHASH_OPSLIMIT 1000000

typedef struct Context_ {
    char *         in;
    char *         out;
    unsigned char  key[crypto_secretbox_KEYBYTES];
    unsigned char *buf;
    size_t         sizeof_buf;
    int            fd_in;
    int            fd_out;
    int            encrypt;
    int            has_key;
} Context;

#endif