Changes to update Tomato RAF.
[tomato.git] / release / src / router / dnscrypt / src / proxy / dnscrypt.h
blob42f80d121ae66abf47ba3ca019cdad2dc20fc574
2 #ifndef __DNSCRYPT_H__
3 #define __DNSCRYPT_H__ 1
5 #include <sys/types.h>
6 #include <stdint.h>
8 #include "crypto_box.h"
10 #define DNSCRYPT_MAGIC_QUERY_LEN 8U
11 #define DNSCRYPT_MAGIC_RESPONSE "r6fnvWj8"
13 #ifndef DNSCRYPT_MAX_PADDING
14 # define DNSCRYPT_MAX_PADDING 256U
15 #endif
16 #ifndef DNSCRYPT_BLOCK_SIZE
17 # define DNSCRYPT_BLOCK_SIZE 64U
18 #endif
19 #ifndef DNSCRYPT_MIN_PAD_LEN
20 # define DNSCRYPT_MIN_PAD_LEN 8U
21 #endif
22 #define crypto_box_MACBYTES (crypto_box_ZEROBYTES - crypto_box_BOXZEROBYTES)
23 #define crypto_box_HALF_NONCEBYTES (crypto_box_NONCEBYTES / 2U)
25 size_t dnscrypt_response_header_size(void);
26 size_t dnscrypt_query_header_size(void);
28 int dnscrypt_cmp_client_nonce(const uint8_t
29 client_nonce[crypto_box_HALF_NONCEBYTES],
30 const uint8_t * const buf, const size_t len);
32 size_t dnscrypt_pad(uint8_t *buf, const size_t len, const size_t max_len);
34 void dnscrypt_key_to_fingerprint(char fingerprint[80U],
35 const uint8_t * const key);
37 int dnscrypt_fingerprint_to_key(const char * const fingerprint,
38 uint8_t key[crypto_box_PUBLICKEYBYTES]);
40 #endif