Commit 16de44cc authored by Daniel Salzman's avatar Daniel Salzman

knot/dnssec: code cleanup

parent ee7db495
......@@ -16,8 +16,8 @@
#include <stdio.h>
#include <string.h>
#include <time.h>
#include "contrib/time.h"
#include "libknot/libknot.h"
#include "knot/dnssec/context.h"
#include "knot/dnssec/kasp/keystore.h"
......
......@@ -14,22 +14,14 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <assert.h>
#include <time.h>
#include <string.h>
#include "knot/dnssec/kasp/policy.h"
#include "knot/dnssec/kasp/keystate.h"
key_state_t get_key_state(const knot_kasp_key_t *key, knot_time_t moment)
{
if (!key || moment <= 0)
{
if (!key || moment <= 0) {
return DNSSEC_KEY_STATE_INVALID;
}
const knot_kasp_key_timing_t *t = &key->timing;
bool removed = (knot_time_cmp(t->remove, moment) <= 0);
......
......@@ -16,12 +16,10 @@
#pragma once
#include <time.h>
#include "contrib/time.h"
#include "knot/dnssec/kasp/policy.h"
enum key_state {
typedef enum {
DNSSEC_KEY_STATE_INVALID = 0,
DNSSEC_KEY_STATE_PRE_ACTIVE,
DNSSEC_KEY_STATE_PUBLISHED,
......@@ -31,8 +29,6 @@ enum key_state {
DNSSEC_KEY_STATE_RETIRED,
DNSSEC_KEY_STATE_POST_ACTIVE,
DNSSEC_KEY_STATE_REMOVED,
};
typedef enum key_state key_state_t;
} key_state_t;
key_state_t get_key_state(const knot_kasp_key_t *key, knot_time_t moment);
......@@ -16,12 +16,14 @@
#include <assert.h>
#include <stdio.h>
#include <string.h>
#include "knot/conf/schema.h"
#include "dnssec/error.h"
#include "knot/dnssec/kasp/keystore.h"
#include "knot/conf/schema.h"
#include "libknot/error.h"
char *fix_path(const char *config, const char *base_path)
static char *fix_path(const char *config, const char *base_path)
{
assert(config);
assert(base_path);
......@@ -42,7 +44,7 @@ char *fix_path(const char *config, const char *base_path)
int keystore_load(const char *config, unsigned backend,
const char *kasp_base_path, dnssec_keystore_t **keystore)
{
int ret = KNOT_EINVAL;
int ret = DNSSEC_EINVAL;
char *fixed_config = NULL;
switch (backend) {
......@@ -57,7 +59,7 @@ int keystore_load(const char *config, unsigned backend,
default:
assert(0);
}
if (ret != KNOT_EOK) {
if (ret != DNSSEC_EOK) {
free(fixed_config);
return knot_error_from_libdnssec(ret);
}
......@@ -68,7 +70,7 @@ int keystore_load(const char *config, unsigned backend,
}
ret = dnssec_keystore_init(*keystore, fixed_config);
if (ret != KNOT_EOK) {
if (ret != DNSSEC_EOK) {
free(fixed_config);
dnssec_keystore_deinit(*keystore);
*keystore = NULL;
......@@ -77,7 +79,7 @@ int keystore_load(const char *config, unsigned backend,
ret = dnssec_keystore_open(*keystore, fixed_config);
free(fixed_config);
if (ret != KNOT_EOK) {
if (ret != DNSSEC_EOK) {
dnssec_keystore_deinit(*keystore);
*keystore = NULL;
return knot_error_from_libdnssec(ret);
......
......@@ -17,7 +17,6 @@
#pragma once
#include <stdbool.h>
#include <time.h>
#include "contrib/time.h"
#include "dnssec/lib/dnssec/key.h"
......
/* Copyright (C) 2016 CZ.NIC, z.s.p.o. <knot-dns@labs.nic.cz>
/* Copyright (C) 2017 CZ.NIC, z.s.p.o. <knot-dns@labs.nic.cz>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
......@@ -16,10 +16,7 @@
#include <assert.h>
#include "knot/conf/conf.h"
#include "knot/dnssec/context.h"
#include "knot/dnssec/zone-nsec.h"
#include "knot/zone/contents.h"
#include "knot/dnssec/policy.h"
#include "libknot/rrtype/soa.h"
static uint32_t zone_soa_min_ttl(const zone_contents_t *zone)
......
/* Copyright (C) 2016 CZ.NIC, z.s.p.o. <knot-dns@labs.nic.cz>
/* Copyright (C) 2017 CZ.NIC, z.s.p.o. <knot-dns@labs.nic.cz>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
......@@ -16,7 +16,6 @@
#pragma once
#include "contrib/time.h"
#include "knot/dnssec/context.h"
#include "knot/zone/contents.h"
......
......@@ -18,11 +18,9 @@
#include "dnssec/error.h"
#include "dnssec/random.h"
#include "contrib/macros.h"
#include "libknot/libknot.h"
#include "knot/conf/conf.h"
#include "knot/common/log.h"
#include "knot/dnssec/context.h"
#include "knot/dnssec/key-events.h"
#include "knot/dnssec/policy.h"
#include "knot/dnssec/zone-events.h"
......
......@@ -26,7 +26,7 @@
/*!
* \brief Zone key context used during signing.
*/
struct zone_key {
typedef struct {
const char *id;
dnssec_key_t *key;
dnssec_sign_ctx_t *ctx;
......@@ -40,18 +40,14 @@ struct zone_key {
bool is_active;
bool is_public;
int cds_priority;
};
typedef struct zone_key zone_key_t;
} zone_key_t;
dynarray_declare(keyptr, zone_key_t *, DYNARRAY_VISIBILITY_PUBLIC, 1)
struct zone_keyset {
typedef struct {
size_t count;
zone_key_t *keys;
};
typedef struct zone_keyset zone_keyset_t;
} zone_keyset_t;
/*!
* \brief Flags determining key type
......
......@@ -15,37 +15,26 @@
*/
#include <assert.h>
#include <stdbool.h>
#include <stdint.h>
#include <sys/types.h>
#include <time.h>
#include "dnssec/error.h"
#include "dnssec/key.h"
#include "dnssec/keytag.h"
#include "dnssec/sign.h"
#include "knot/dnssec/context.h"
#include "knot/dnssec/key-events.h"
#include "knot/dnssec/rrset-sign.h"
#include "knot/dnssec/zone-keys.h"
#include "knot/dnssec/zone-sign.h"
#include "knot/updates/changesets.h"
#include "libknot/descriptor.h"
#include "libknot/dname.h"
#include "libknot/libknot.h"
#include "libknot/rrset.h"
#include "libknot/rrtype/rrsig.h"
#include "libknot/rrtype/soa.h"
#include "contrib/dynarray.h"
#include "contrib/macros.h"
#include "contrib/wire_ctx.h"
typedef struct type_node {
typedef struct {
node_t n;
uint16_t type;
} type_node_t;
typedef struct signed_info {
typedef struct {
knot_dname_t *dname;
knot_dname_t *hashed_dname;
list_t *type_list;
......
......@@ -18,10 +18,8 @@
#include "knot/updates/changesets.h"
#include "knot/updates/zone-update.h"
#include "knot/zone/zone.h"
#include "knot/zone/contents.h"
#include "knot/dnssec/context.h"
#include "knot/dnssec/zone-events.h"
#include "knot/dnssec/zone-keys.h"
/*!
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment