dnscrypto-proxy: Update to release 1.3.0
[tomato.git] / release / src / router / dnscrypt / src / proxy / dnscrypt.h
blobc6d758d75b39893a279ce4785e728056d946e243
2 #ifndef __DNSCRYPT_H__
3 #define __DNSCRYPT_H__ 1
5 #include <sys/types.h>
6 #include <stdint.h>
8 #include "sodium.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_HALF_NONCEBYTES (crypto_box_NONCEBYTES / 2U)
24 size_t dnscrypt_response_header_size(void);
25 size_t dnscrypt_query_header_size(void);
27 int dnscrypt_cmp_client_nonce(const uint8_t
28 client_nonce[crypto_box_HALF_NONCEBYTES],
29 const uint8_t * const buf, const size_t len);
31 size_t dnscrypt_pad(uint8_t *buf, const size_t len, const size_t max_len);
33 void dnscrypt_key_to_fingerprint(char fingerprint[80U],
34 const uint8_t * const key);
36 int dnscrypt_fingerprint_to_key(const char * const fingerprint,
37 uint8_t key[crypto_box_PUBLICKEYBYTES]);
39 #endif