Electroneum
val_nsec3.h
Go to the documentation of this file.
1 /*
2  * validator/val_nsec3.h - validator NSEC3 denial of existence functions.
3  *
4  * Copyright (c) 2007, NLnet Labs. All rights reserved.
5  *
6  * This software is open source.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions
10  * are met:
11  *
12  * Redistributions of source code must retain the above copyright notice,
13  * this list of conditions and the following disclaimer.
14  *
15  * Redistributions in binary form must reproduce the above copyright notice,
16  * this list of conditions and the following disclaimer in the documentation
17  * and/or other materials provided with the distribution.
18  *
19  * Neither the name of the NLNET LABS nor the names of its contributors may
20  * be used to endorse or promote products derived from this software without
21  * specific prior written permission.
22  *
23  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
25  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
26  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
27  * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
28  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
29  * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
30  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
31  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
32  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
33  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34  */
35 
67 #ifndef VALIDATOR_VAL_NSEC3_H
68 #define VALIDATOR_VAL_NSEC3_H
69 #include "util/rbtree.h"
70 #include "util/data/packed_rrset.h"
71 struct val_env;
72 struct regional;
73 struct module_env;
74 struct module_qstate;
75 struct ub_packed_rrset_key;
76 struct reply_info;
77 struct query_info;
78 struct key_entry_key;
79 struct sldns_buffer;
80 
90 #define NSEC3_OPTOUT 0x01
91 
95 #define NSEC3_UNKNOWN_FLAGS 0xFE
96 
98 #define NSEC3_HASH_SHA1 0x01
99 
116 enum sec_status
117 nsec3_prove_nameerror(struct module_env* env, struct val_env* ve,
118  struct ub_packed_rrset_key** list, size_t num,
119  struct query_info* qinfo, struct key_entry_key* kkey);
120 
150 enum sec_status
151 nsec3_prove_nodata(struct module_env* env, struct val_env* ve,
152  struct ub_packed_rrset_key** list, size_t num,
153  struct query_info* qinfo, struct key_entry_key* kkey);
154 
155 
172 enum sec_status
173 nsec3_prove_wildcard(struct module_env* env, struct val_env* ve,
174  struct ub_packed_rrset_key** list, size_t num,
175  struct query_info* qinfo, struct key_entry_key* kkey, uint8_t* wc);
176 
196 enum sec_status
197 nsec3_prove_nods(struct module_env* env, struct val_env* ve,
198  struct ub_packed_rrset_key** list, size_t num,
199  struct query_info* qinfo, struct key_entry_key* kkey, char** reason,
200  struct module_qstate* qstate);
201 
217 enum sec_status
218 nsec3_prove_nxornodata(struct module_env* env, struct val_env* ve,
219  struct ub_packed_rrset_key** list, size_t num,
220  struct query_info* qinfo, struct key_entry_key* kkey, int* nodata);
221 
234  int rr;
238  size_t dname_len;
242  size_t hash_len;
246  size_t b32_len;
247 };
248 
255 int nsec3_hash_cmp(const void* c1, const void* c2);
256 
277 int nsec3_hash_name(rbtree_type* table, struct regional* region,
278  struct sldns_buffer* buf, struct ub_packed_rrset_key* nsec3, int rr,
279  uint8_t* dname, size_t dname_len, struct nsec3_cached_hash** hash);
280 
291 size_t nsec3_get_nextowner_b32(struct ub_packed_rrset_key* rrset, int r,
292  uint8_t* buf, size_t max);
293 
306 size_t nsec3_hash_to_b32(uint8_t* hash, size_t hashlen, uint8_t* zone,
307  size_t zonelen, uint8_t* buf, size_t max);
308 
319 int nsec3_get_params(struct ub_packed_rrset_key* rrset, int r,
320  int* algo, size_t* iter, uint8_t** salt, size_t* saltlen);
321 
335 size_t nsec3_get_hashed(struct sldns_buffer* buf, uint8_t* nm, size_t nmlen,
336  int algo, size_t iter, uint8_t* salt, size_t saltlen, uint8_t* res,
337  size_t max);
338 
346 int nsec3_has_type(struct ub_packed_rrset_key* rrset, int r, uint16_t type);
347 
354 int nsec3_has_optout(struct ub_packed_rrset_key* rrset, int r);
355 
364 int nsec3_get_nextowner(struct ub_packed_rrset_key* rrset, int r,
365  uint8_t** next, size_t* nextlen);
366 
381  struct ub_packed_rrset_key* rrset, int rr, struct sldns_buffer* buf);
382 
383 #endif /* VALIDATOR_VAL_NSEC3_H */
const char * res
Definition: hmac_keccak.cpp:41
int nsec3_covers(uint8_t *zone, struct nsec3_cached_hash *hash, struct ub_packed_rrset_key *rrset, int rr, struct sldns_buffer *buf)
uint8_t * dname
Definition: val_nsec3.h:236
enum sec_status nsec3_prove_nods(struct module_env *env, struct val_env *ve, struct ub_packed_rrset_key **list, size_t num, struct query_info *qinfo, struct key_entry_key *kkey, char **reason, struct module_qstate *qstate)
std::vector< std::vector< _variant_t > > table
rbnode_type node
Definition: val_nsec3.h:230
unsigned short uint16_t
Definition: stdint.h:125
int nsec3_hash_name(rbtree_type *table, struct regional *region, struct sldns_buffer *buf, struct ub_packed_rrset_key *nsec3, int rr, uint8_t *dname, size_t dname_len, struct nsec3_cached_hash **hash)
unsigned char uint8_t
Definition: stdint.h:124
struct ub_packed_rrset_key * nsec3
Definition: val_nsec3.h:232
enum sec_status nsec3_prove_nxornodata(struct module_env *env, struct val_env *ve, struct ub_packed_rrset_key **list, size_t num, struct query_info *qinfo, struct key_entry_key *kkey, int *nodata)
uint8_t * hash
Definition: val_nsec3.h:240
int nsec3_get_params(struct ub_packed_rrset_key *rrset, int r, int *algo, size_t *iter, uint8_t **salt, size_t *saltlen)
int nsec3_get_nextowner(struct ub_packed_rrset_key *rrset, int r, uint8_t **next, size_t *nextlen)
enum sec_status nsec3_prove_nameerror(struct module_env *env, struct val_env *ve, struct ub_packed_rrset_key **list, size_t num, struct query_info *qinfo, struct key_entry_key *kkey)
int nsec3_has_optout(struct ub_packed_rrset_key *rrset, int r)
int nsec3_hash_cmp(const void *c1, const void *c2)
size_t nsec3_hash_to_b32(uint8_t *hash, size_t hashlen, uint8_t *zone, size_t zonelen, uint8_t *buf, size_t max)
sec_status
Definition: packed_rrset.h:176
int nsec3_has_type(struct ub_packed_rrset_key *rrset, int r, uint16_t type)
uint8_t * b32
Definition: val_nsec3.h:244
enum sec_status nsec3_prove_wildcard(struct module_env *env, struct val_env *ve, struct ub_packed_rrset_key **list, size_t num, struct query_info *qinfo, struct key_entry_key *kkey, uint8_t *wc)
const char * buf
Definition: slow_memmem.cpp:74
size_t nsec3_get_nextowner_b32(struct ub_packed_rrset_key *rrset, int r, uint8_t *buf, size_t max)
POD_CLASS hash
Definition: hash.h:50
size_t nsec3_get_hashed(struct sldns_buffer *buf, uint8_t *nm, size_t nmlen, int algo, size_t iter, uint8_t *salt, size_t saltlen, uint8_t *res, size_t max)
Definition: val_kentry.h:55
enum sec_status nsec3_prove_nodata(struct module_env *env, struct val_env *ve, struct ub_packed_rrset_key **list, size_t num, struct query_info *qinfo, struct key_entry_key *kkey)