]> git.ipfire.org Git - thirdparty/knot-dns.git/commitdiff
Replace DNSSEC_EINVAL with KNOT_EINVAL
authorDaniel Salzman <daniel.salzman@nic.cz>
Tue, 21 Oct 2025 07:52:41 +0000 (09:52 +0200)
committerLibor Peltan <libor.peltan@nic.cz>
Fri, 24 Oct 2025 07:17:08 +0000 (09:17 +0200)
22 files changed:
src/knot/dnssec/kasp/keystore.c
src/libknot/dnssec/binary.c
src/libknot/dnssec/digest.c
src/libknot/dnssec/error.c
src/libknot/dnssec/error.h
src/libknot/dnssec/key/algorithm.c
src/libknot/dnssec/key/ds.c
src/libknot/dnssec/key/key.c
src/libknot/dnssec/key/keytag.c
src/libknot/dnssec/key/simple.c
src/libknot/dnssec/keystore/keystore.c
src/libknot/dnssec/keystore/pkcs8.c
src/libknot/dnssec/nsec/hash.c
src/libknot/dnssec/nsec/nsec.c
src/libknot/dnssec/pem.c
src/libknot/dnssec/random.c
src/libknot/dnssec/sign/der.c
src/libknot/dnssec/sign/sign.c
src/libknot/dnssec/tsig.c
src/utils/knsec3hash/knsec3hash.c
tests/libknot/test_dnssec_key_algorithm.c
tests/libknot/test_dnssec_key_ds.c

index 4d67737a4c95fa6f419510cbdfb0de551553d621..98a255bfeb46e8f3b27f6a8373762d80dfdfd44c 100644 (file)
@@ -33,7 +33,7 @@ static 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 = DNSSEC_EINVAL;
+       int ret = KNOT_EINVAL;
        char *fixed_config = NULL;
 
        switch (backend) {
index c8ba5427d63967b045fcc17833c6a2a04678eb64..d153461b101eb6a067d1058be02089f6436587eb 100644 (file)
@@ -17,7 +17,7 @@ _public_
 int dnssec_binary_alloc(dnssec_binary_t *data, size_t size)
 {
        if (!data || size == 0) {
-               return DNSSEC_EINVAL;
+               return KNOT_EINVAL;
        }
 
        uint8_t *new_data = calloc(1, size);
@@ -46,7 +46,7 @@ _public_
 int dnssec_binary_dup(const dnssec_binary_t *from, dnssec_binary_t *to)
 {
        if (!from || !to) {
-               return DNSSEC_EINVAL;
+               return KNOT_EINVAL;
        }
 
        uint8_t *copy = malloc(from->size);
@@ -66,7 +66,7 @@ _public_
 int dnssec_binary_resize(dnssec_binary_t *data, size_t new_size)
 {
        if (!data) {
-               return DNSSEC_EINVAL;
+               return KNOT_EINVAL;
        }
 
        uint8_t *new_data = realloc(data->data, new_size);
@@ -116,13 +116,13 @@ int dnssec_binary_from_base64(const dnssec_binary_t *base64,
                              dnssec_binary_t *binary)
 {
        if (!base64 || !binary) {
-               return DNSSEC_EINVAL;
+               return KNOT_EINVAL;
        }
 
        uint8_t *data;
        int32_t size = knot_base64_decode_alloc(base64->data, base64->size, &data);
        if (size < 0) {
-               return DNSSEC_EINVAL;
+               return KNOT_EINVAL;
        }
 
        binary->data = data;
@@ -136,13 +136,13 @@ int dnssec_binary_to_base64(const dnssec_binary_t *binary,
                            dnssec_binary_t *base64)
 {
        if (!binary || !base64) {
-               return DNSSEC_EINVAL;
+               return KNOT_EINVAL;
        }
 
        uint8_t *data;
        int32_t size = knot_base64_encode_alloc(binary->data, binary->size, &data);
        if (size < 0) {
-               return DNSSEC_EINVAL;
+               return KNOT_EINVAL;
        }
 
        base64->data = data;
index 1d6e891bf28f471c1f422df4d49b5a7e479a201f..156dd96473d1847b11444103a3c611ec9b60419d 100644 (file)
@@ -29,7 +29,7 @@ _public_
 int dnssec_digest_init(dnssec_digest_t algorithm, dnssec_digest_ctx_t **out_ctx)
 {
        if (out_ctx == NULL) {
-               return DNSSEC_EINVAL;
+               return KNOT_EINVAL;
        }
 
        gnutls_digest_algorithm_t gtalg = lookup_algorithm(algorithm);
@@ -62,7 +62,7 @@ _public_
 int dnssec_digest(dnssec_digest_ctx_t *ctx, dnssec_binary_t *data)
 {
        if (ctx == NULL || data == NULL) {
-               return DNSSEC_EINVAL;
+               return KNOT_EINVAL;
        }
 
        int r = gnutls_hash(ctx->gtctx, data->data, data->size);
@@ -77,7 +77,7 @@ _public_
 int dnssec_digest_finish(dnssec_digest_ctx_t *ctx, dnssec_binary_t *out)
 {
        if (ctx == NULL || out == NULL) {
-               return DNSSEC_EINVAL;
+               return KNOT_EINVAL;
        }
 
        int r = dnssec_binary_resize(out, ctx->size);
index c76a6344b733e042c6fd7fb365ded835c5fabc71..5e74845ea02eb64576348d219ea456541dcb5058 100644 (file)
@@ -17,7 +17,7 @@ static const error_message_t ERROR_MESSAGES[] = {
        { KNOT_EOK,                     "no error" },
 
        { KNOT_ENOMEM,          "not enough memory" },
-       { DNSSEC_EINVAL,                "invalid argument" },
+       { KNOT_EINVAL,          "invalid argument" },
        { DNSSEC_ENOENT,                "no such file or directory" },
 
        { DNSSEC_ERROR,                 "unspecified error" },
index 4ab3ca88ffb9484817d9dc9d6a5def5e17065f6e..88f47848bf323388ee4f83e1b2df2dbb687c1377 100644 (file)
@@ -27,7 +27,7 @@ enum dnssec_error {
        KNOT_EOK = 0,
 
        KNOT_ENOMEM = -ENOMEM,
-       DNSSEC_EINVAL = -EINVAL,
+       KNOT_EINVAL = -EINVAL,
        DNSSEC_ENOENT = -ENOENT,
 
        DNSSEC_ERROR_MIN = -1500,
index a9d1be0058b08a57491521a81e70dfbcfac79111..9cc08e9890a2e4e9f35a7b841e9671fa1b4be3dd 100644 (file)
@@ -117,7 +117,7 @@ int dnssec_algorithm_key_size_range(dnssec_key_algorithm_t algorithm,
                                    unsigned *min_ptr, unsigned *max_ptr)
 {
        if (!min_ptr && !max_ptr) {
-               return DNSSEC_EINVAL;
+               return KNOT_EINVAL;
        }
 
        const struct limits *limits = get_limits(algorithm);
index 9f6fb0fb4abc33e9a25be57d9664aaffdee1f47a..ca215f20e1feac31590a979ab8a1ea00435842e6 100644 (file)
@@ -61,7 +61,7 @@ int dnssec_key_create_ds(const dnssec_key_t *key,
                         dnssec_binary_t *rdata_ptr)
 {
        if (!key || !rdata_ptr) {
-               return DNSSEC_EINVAL;
+               return KNOT_EINVAL;
        }
 
        if (!key->dname) {
index 072129f3a8d186e8527766bbce9e69c4eddb917f..633cdd0c87f4dd00917c337980f74957160b89f6 100644 (file)
@@ -43,7 +43,7 @@ _public_
 int dnssec_key_new(dnssec_key_t **key_ptr)
 {
        if (!key_ptr) {
-               return DNSSEC_EINVAL;
+               return KNOT_EINVAL;
        }
 
        dnssec_key_t *key = calloc(1, sizeof(*key));
@@ -172,7 +172,7 @@ _public_
 int dnssec_key_set_dname(dnssec_key_t *key, const uint8_t *dname)
 {
        if (!key) {
-               return DNSSEC_EINVAL;
+               return KNOT_EINVAL;
        }
 
        uint8_t *copy = NULL;
@@ -207,7 +207,7 @@ _public_
 int dnssec_key_set_flags(dnssec_key_t *key, uint16_t flags)
 {
        if (!key) {
-               return DNSSEC_EINVAL;
+               return KNOT_EINVAL;
        }
 
        wire_ctx_t wire = binary_init(&key->rdata);
@@ -233,7 +233,7 @@ _public_
 int dnssec_key_set_protocol(dnssec_key_t *key, uint8_t protocol)
 {
        if (!key) {
-               return DNSSEC_EINVAL;
+               return KNOT_EINVAL;
        }
 
        wire_ctx_t wire = binary_init(&key->rdata);
@@ -294,7 +294,7 @@ _public_
 int dnssec_key_set_algorithm(dnssec_key_t *key, uint8_t algorithm)
 {
        if (!key) {
-               return DNSSEC_EINVAL;
+               return KNOT_EINVAL;
        }
 
        if (!can_change_algorithm(key, algorithm)) {
@@ -312,7 +312,7 @@ _public_
 int dnssec_key_get_pubkey(const dnssec_key_t *key, dnssec_binary_t *pubkey)
 {
        if (!key || !pubkey) {
-               return DNSSEC_EINVAL;
+               return KNOT_EINVAL;
        }
 
        wire_ctx_t wire = binary_init(&key->rdata);
@@ -326,7 +326,7 @@ _public_
 int dnssec_key_set_pubkey(dnssec_key_t *key, const dnssec_binary_t *pubkey)
 {
        if (!key || !pubkey || !pubkey->data) {
-               return DNSSEC_EINVAL;
+               return KNOT_EINVAL;
        }
 
        if (key->public_key) {
@@ -384,7 +384,7 @@ _public_
 int dnssec_key_get_keyid(const dnssec_key_t *key, char **id)
 {
        if (!key || !id) {
-               return DNSSEC_EINVAL;
+               return KNOT_EINVAL;
        }
 
        return keyid_pubkey_hex(key->public_key, id);
@@ -394,7 +394,7 @@ _public_
 int dnssec_key_get_rdata(const dnssec_key_t *key, dnssec_binary_t *rdata)
 {
        if (!key || !rdata) {
-               return DNSSEC_EINVAL;
+               return KNOT_EINVAL;
        }
 
        *rdata = key->rdata;
@@ -406,7 +406,7 @@ _public_
 int dnssec_key_set_rdata(dnssec_key_t *key, const dnssec_binary_t *rdata)
 {
        if (!key || !rdata || !rdata->data) {
-               return DNSSEC_EINVAL;
+               return KNOT_EINVAL;
        }
 
        if (rdata->size < DNSKEY_RDATA_MIN_SIZE) {
index f1df0dd4d7d03b5e39661302e33c9dd9924ca1c8..653d30f48e2643b63043fe7d283db1b6cceb96dc 100644 (file)
@@ -59,7 +59,7 @@ _public_
 int dnssec_keytag(const dnssec_binary_t *rdata, uint16_t *keytag)
 {
        if (!rdata || !keytag) {
-               return DNSSEC_EINVAL;
+               return KNOT_EINVAL;
        }
 
        if (!rdata->data || rdata->size < DNSKEY_RDATA_OFFSET_PUBKEY) {
index ae07a59800e37a6f226b8e4f270cb4ef519e827a..f8efaa4a6a96dfc54117eb782f430d26366e445b 100644 (file)
@@ -21,7 +21,7 @@ _public_
 int dnssec_key_load_pkcs8(dnssec_key_t *key, const dnssec_binary_t *pem)
 {
        if (!key || !pem || !pem->data) {
-               return DNSSEC_EINVAL;
+               return KNOT_EINVAL;
        }
 
        if (dnssec_key_get_algorithm(key) == 0) {
index e19747d063de09e84d958a46d6f1f86a6f16d677..0b0b865240cfcefb213afe9d8aad9571e4a99c40 100644 (file)
@@ -48,7 +48,7 @@ _public_
 int dnssec_keystore_deinit(dnssec_keystore_t *store)
 {
        if (!store) {
-               return DNSSEC_EINVAL;
+               return KNOT_EINVAL;
        }
 
        dnssec_keystore_close(store);
@@ -63,7 +63,7 @@ _public_
 int dnssec_keystore_init(dnssec_keystore_t *store, const char *config)
 {
        if (!store) {
-               return DNSSEC_EINVAL;
+               return KNOT_EINVAL;
        }
 
        return store->functions->init(store->ctx, config);
@@ -73,7 +73,7 @@ _public_
 int dnssec_keystore_open(dnssec_keystore_t *store, const char *config)
 {
        if (!store) {
-               return DNSSEC_EINVAL;
+               return KNOT_EINVAL;
        }
 
        return store->functions->open(store->ctx, config);
@@ -83,7 +83,7 @@ _public_
 int dnssec_keystore_close(dnssec_keystore_t *store)
 {
        if (!store) {
-               return DNSSEC_EINVAL;
+               return KNOT_EINVAL;
        }
 
        return store->functions->close(store->ctx);
@@ -95,7 +95,7 @@ int dnssec_keystore_generate(dnssec_keystore_t *store,
                             unsigned bits, const char *label, char **id_ptr)
 {
        if (!store || !_algorithm || !id_ptr) {
-               return DNSSEC_EINVAL;
+               return KNOT_EINVAL;
        }
 
        // prepare parameters
@@ -117,7 +117,7 @@ int dnssec_keystore_import(dnssec_keystore_t *store, const dnssec_binary_t *pem,
                           char **id_ptr)
 {
        if (!store || !pem || !id_ptr) {
-               return DNSSEC_EINVAL;
+               return KNOT_EINVAL;
        }
 
        return store->functions->import_key(store->ctx, pem, id_ptr);
@@ -127,7 +127,7 @@ _public_
 int dnssec_keystore_remove(dnssec_keystore_t *store, const char *id)
 {
        if (!store || !id) {
-               return DNSSEC_EINVAL;
+               return KNOT_EINVAL;
        }
 
        return store->functions->remove_key(store->ctx, id);
@@ -138,7 +138,7 @@ int dnssec_keystore_get_private(dnssec_keystore_t *store, const char *id,
                                dnssec_key_t *key)
 {
        if (!store || !id || dnssec_key_get_algorithm(key) == 0 || !key) {
-               return DNSSEC_EINVAL;
+               return KNOT_EINVAL;
        }
 
        if (key->private_key) {
@@ -164,7 +164,7 @@ _public_
 int dnssec_keystore_set_private(dnssec_keystore_t *store, dnssec_key_t *key)
 {
        if (!store || !key) {
-               return DNSSEC_EINVAL;
+               return KNOT_EINVAL;
        }
 
        if (!key->private_key) {
index bb7149c2631824b812c2e445a37babeeaf58e79f..6b647a2779c1eebe9876157412a323a5f66b033f 100644 (file)
@@ -104,7 +104,7 @@ static int key_open_write(const char *dir_name, const char *id, int *fd_ptr)
 static int pkcs8_dir_read(pkcs8_dir_handle_t *handle, const char *id, dnssec_binary_t *pem)
 {
        if (!handle || !id || !pem) {
-               return DNSSEC_EINVAL;
+               return KNOT_EINVAL;
        }
 
        // open file and get it's size
@@ -212,7 +212,7 @@ static int pem_generate(gnutls_pk_algorithm_t algorithm, unsigned bits,
 static int pkcs8_ctx_new(void **ctx_ptr)
 {
        if (!ctx_ptr) {
-               return DNSSEC_EINVAL;
+               return KNOT_EINVAL;
        }
 
        pkcs8_dir_handle_t *ctx = calloc(1, sizeof(*ctx));
@@ -233,7 +233,7 @@ static void pkcs8_ctx_free(void *ctx)
 static int pkcs8_init(void *ctx, const char *config)
 {
        if (!ctx || !config) {
-               return DNSSEC_EINVAL;
+               return KNOT_EINVAL;
        }
 
        return make_dir(config, DIR_INIT_MODE, true);
@@ -242,7 +242,7 @@ static int pkcs8_init(void *ctx, const char *config)
 static int pkcs8_open(void *ctx, const char *config)
 {
        if (!ctx || !config) {
-               return DNSSEC_EINVAL;
+               return KNOT_EINVAL;
        }
 
        pkcs8_dir_handle_t *handle = ctx;
@@ -260,7 +260,7 @@ static int pkcs8_open(void *ctx, const char *config)
 static int pkcs8_close(void *ctx)
 {
        if (!ctx) {
-               return DNSSEC_EINVAL;
+               return KNOT_EINVAL;
        }
 
        pkcs8_dir_handle_t *handle = ctx;
@@ -275,7 +275,7 @@ static int pkcs8_generate_key(void *ctx, gnutls_pk_algorithm_t algorithm,
                              unsigned bits, const char *label, char **id_ptr)
 {
        if (!ctx || !id_ptr) {
-               return DNSSEC_EINVAL;
+               return KNOT_EINVAL;
        }
 
        (void)label;
@@ -321,7 +321,7 @@ static int pkcs8_generate_key(void *ctx, gnutls_pk_algorithm_t algorithm,
 static int pkcs8_import_key(void *ctx, const dnssec_binary_t *pem, char **id_ptr)
 {
        if (!ctx || !pem || !id_ptr) {
-               return DNSSEC_EINVAL;
+               return KNOT_EINVAL;
        }
 
        pkcs8_dir_handle_t *handle = ctx;
@@ -373,7 +373,7 @@ static int pkcs8_import_key(void *ctx, const dnssec_binary_t *pem, char **id_ptr
 static int pkcs8_remove_key(void *ctx, const char *id)
 {
        if (!ctx || !id) {
-               return DNSSEC_EINVAL;
+               return KNOT_EINVAL;
        }
 
        pkcs8_dir_handle_t *handle = ctx;
@@ -393,7 +393,7 @@ static int pkcs8_remove_key(void *ctx, const char *id)
 static int pkcs8_get_private(void *ctx, const char *id, gnutls_privkey_t *key_ptr)
 {
        if (!ctx || !id || !key_ptr) {
-               return DNSSEC_EINVAL;
+               return KNOT_EINVAL;
        }
 
        pkcs8_dir_handle_t *handle = ctx;
@@ -450,7 +450,7 @@ static int pkcs8_get_private(void *ctx, const char *id, gnutls_privkey_t *key_pt
 static int pkcs8_set_private(void *ctx, gnutls_privkey_t key)
 {
        if (!ctx) {
-               return DNSSEC_EINVAL;
+               return KNOT_EINVAL;
        }
 
        _cleanup_binary_ dnssec_binary_t pem = { 0 };
index b05ab59380045a886941204bb69f20137449ae71..087ff3422d29e430da9d6ca6e0c2541c292868a0 100644 (file)
@@ -88,7 +88,7 @@ int dnssec_nsec3_hash(const dnssec_binary_t *data,
                      dnssec_binary_t *hash)
 {
        if (!data || !params || !hash) {
-               return DNSSEC_EINVAL;
+               return KNOT_EINVAL;
        }
 
        gnutls_digest_algorithm_t algorithm = algorithm_d2g(params->algorithm);
index b104b42e543ce9651a43a2023ea9ab63ad99b1a2..1cb563905b99cb556180bb8db13011e62cc8a5f7 100644 (file)
@@ -34,7 +34,7 @@ int dnssec_nsec3_params_from_rdata(dnssec_nsec3_params_t *params,
                                    const dnssec_binary_t *rdata)
 {
        if (!params || !rdata || !rdata->data) {
-               return DNSSEC_EINVAL;
+               return KNOT_EINVAL;
        }
 
        dnssec_nsec3_params_t new_params = { 0 };
index 3aa565dfe87219f32a476c08093acebeb89adf4b..9a1b94f81c98e002d6db68f2d97182910034677b 100644 (file)
@@ -18,7 +18,7 @@ _public_
 int dnssec_pem_to_x509(const dnssec_binary_t *pem, gnutls_x509_privkey_t *key)
 {
        if (!pem || !key) {
-               return DNSSEC_EINVAL;
+               return KNOT_EINVAL;
        }
 
        gnutls_datum_t data = binary_to_datum(pem);
@@ -47,7 +47,7 @@ _public_
 int dnssec_pem_to_privkey(const dnssec_binary_t *pem, gnutls_privkey_t *key)
 {
        if (!pem || !key) {
-               return DNSSEC_EINVAL;
+               return KNOT_EINVAL;
        }
 
        gnutls_x509_privkey_t key_x509 = NULL;
@@ -92,7 +92,7 @@ _public_
 int dnssec_pem_from_x509(gnutls_x509_privkey_t key, dnssec_binary_t *pem)
 {
        if (!key || !pem) {
-               return DNSSEC_EINVAL;
+               return KNOT_EINVAL;
        }
 
        dnssec_binary_t _pem = { 0 };
@@ -130,7 +130,7 @@ _public_
 int dnssec_pem_from_privkey(gnutls_privkey_t key, dnssec_binary_t *pem)
 {
        if (!key || !pem) {
-               return DNSSEC_EINVAL;
+               return KNOT_EINVAL;
        }
 
        _cleanup_x509_privkey_ gnutls_x509_privkey_t _key = NULL;
index 4c50c194d4b11a99dd0056134fbe31222ba8477d..e25acd574383d501f2f173de1b33b053b53ece8b 100644 (file)
@@ -19,7 +19,7 @@ _public_
 int dnssec_random_buffer(uint8_t *data, size_t size)
 {
        if (!data) {
-               return DNSSEC_EINVAL;
+               return KNOT_EINVAL;
        }
 
        int result = gnutls_rnd(GNUTLS_RND_RANDOM, data, size);
@@ -35,7 +35,7 @@ _public_
 int dnssec_random_binary(dnssec_binary_t *binary)
 {
        if (!binary) {
-               return DNSSEC_EINVAL;
+               return KNOT_EINVAL;
        }
 
        return dnssec_random_buffer(binary->data, binary->size);
index 54c1ee095070af2050256effc4857e4f1a383b70..5f71f9aaeb0026295f235a0b71922ee1b360ab71 100644 (file)
@@ -126,7 +126,7 @@ int dss_sig_value_decode(const dnssec_binary_t *der,
                         dnssec_binary_t *r, dnssec_binary_t *s)
 {
        if (!der || !der->data || !r || !s) {
-               return DNSSEC_EINVAL;
+               return KNOT_EINVAL;
        }
 
        wire_ctx_t wire = binary_init(der);
@@ -180,7 +180,7 @@ int dss_sig_value_encode(const dnssec_binary_t *r, const dnssec_binary_t *s,
                         dnssec_binary_t *der)
 {
        if (!r || !r->data || !s || !s->data || !der) {
-               return DNSSEC_EINVAL;
+               return KNOT_EINVAL;
        }
 
        size_t r_size = bignum_size_s(r);
index b016fb923f8c8c23409ea99a4a7081e65f41f50b..a00f0c0df8c666e88a4a895e4797a4d917db6c3a 100644 (file)
@@ -229,7 +229,7 @@ _public_
 int dnssec_sign_new(dnssec_sign_ctx_t **ctx_ptr, const dnssec_key_t *key)
 {
        if (!ctx_ptr) {
-               return DNSSEC_EINVAL;
+               return KNOT_EINVAL;
        }
 
        dnssec_sign_ctx_t *ctx = calloc(1, sizeof(*ctx));
@@ -271,7 +271,7 @@ _public_
 int dnssec_sign_init(dnssec_sign_ctx_t *ctx)
 {
        if (!ctx) {
-               return DNSSEC_EINVAL;
+               return KNOT_EINVAL;
        }
 
        if (vpool_get_buf(&ctx->buffer) != NULL) {
@@ -287,7 +287,7 @@ _public_
 int dnssec_sign_add(dnssec_sign_ctx_t *ctx, const dnssec_binary_t *data)
 {
        if (!ctx || !data || !data->data) {
-               return DNSSEC_EINVAL;
+               return KNOT_EINVAL;
        }
 
        void *result = vpool_insert(&ctx->buffer, vpool_get_length(&ctx->buffer), data->data, data->size);
@@ -302,7 +302,7 @@ _public_
 int dnssec_sign_write(dnssec_sign_ctx_t *ctx, dnssec_sign_flags_t flags, dnssec_binary_t *signature)
 {
        if (!ctx || !signature) {
-               return DNSSEC_EINVAL;
+               return KNOT_EINVAL;
        }
 
        if (!dnssec_key_can_sign(ctx->key)) {
@@ -337,7 +337,7 @@ _public_
 int dnssec_sign_verify(dnssec_sign_ctx_t *ctx, bool sign_cmp, const dnssec_binary_t *signature)
 {
        if (!ctx || !signature) {
-               return DNSSEC_EINVAL;
+               return KNOT_EINVAL;
        }
 
        if (sign_cmp && dnssec_key_can_sign(ctx->key)) {
index 32fe15639e4701d62697007b13b191af77c7f576..115a1251d528360bfffebe28cc3d9d28e908d97c 100644 (file)
@@ -150,7 +150,7 @@ int dnssec_tsig_new(dnssec_tsig_ctx_t **ctx_ptr,
                    const dnssec_binary_t *key)
 {
        if (!ctx_ptr || !key) {
-               return DNSSEC_EINVAL;
+               return KNOT_EINVAL;
        }
 
        dnssec_tsig_ctx_t *ctx = calloc(1, sizeof(*ctx));
@@ -190,7 +190,7 @@ _public_
 int dnssec_tsig_add(dnssec_tsig_ctx_t *ctx, const dnssec_binary_t *data)
 {
        if (!ctx || !data) {
-               return DNSSEC_EINVAL;
+               return KNOT_EINVAL;
        }
 
        int result = gnutls_hmac(ctx->hash, data->data, data->size);
@@ -222,7 +222,7 @@ _public_
 int dnssec_tsig_write(dnssec_tsig_ctx_t *ctx, uint8_t *mac)
 {
        if (!ctx || !mac) {
-               return DNSSEC_EINVAL;
+               return KNOT_EINVAL;
        }
 
        gnutls_hmac_output(ctx->hash, mac);
index 8704286b52fef5c1544ec45132e03c6dc2ac63df..ed9aeb2f15beb013548094bb491df98b7827b951 100644 (file)
@@ -41,7 +41,7 @@ static int str_to_salt(const char *str, dnssec_binary_t *salt)
                return KNOT_EOK;
        } else {
                salt->data = hex_to_bin(str, &salt->size);
-               return (salt->data != NULL ? KNOT_EOK : DNSSEC_EINVAL);
+               return (salt->data != NULL ? KNOT_EOK : KNOT_EINVAL);
        }
 }
 
index 6891b790ac5b182d7b5045c0d5713aa2073eb73b..855b9d0873c4050977c37486ad0f8d41ccb31c73 100644 (file)
@@ -25,7 +25,7 @@ static void null_range(void)
        int r;
 
        r = dnssec_algorithm_key_size_range(algo, NULL, NULL);
-       ok(r == DNSSEC_EINVAL, "dnssec_algorithm_key_size_range() all null");
+       ok(r == KNOT_EINVAL, "dnssec_algorithm_key_size_range() all null");
        r = dnssec_algorithm_key_size_range(algo, &val, NULL);
        ok(r == KNOT_EOK && val == 1024, "dnssec_algorithm_key_size_range() min only");
        r = dnssec_algorithm_key_size_range(algo, NULL, &val);
index cca5f9a7b902a2d5e910b847df5c11088ff2c45b..dc4a55fd70378b36642518b6b5c53b454e13287c 100644 (file)
@@ -57,7 +57,7 @@ static void test_errors(const struct key_parameters *params)
        dnssec_binary_t ds = { 0 };
 
        int r = dnssec_key_create_ds(key, DNSSEC_KEY_DIGEST_SHA1, &ds);
-       is_int(DNSSEC_EINVAL, r, "dnssec_key_create_ds() no key");
+       is_int(KNOT_EINVAL, r, "dnssec_key_create_ds() no key");
        dnssec_binary_free(&ds);
 
        dnssec_key_new(&key);
@@ -70,7 +70,7 @@ static void test_errors(const struct key_parameters *params)
 
        dnssec_key_set_rdata(key, &params->rdata);
        r = dnssec_key_create_ds(key, DNSSEC_KEY_DIGEST_SHA1, NULL);
-       is_int(DNSSEC_EINVAL, r, "dnssec_key_create_ds() no RDATA buffer");
+       is_int(KNOT_EINVAL, r, "dnssec_key_create_ds() no RDATA buffer");
 
        r = dnssec_key_create_ds(key, 3, &ds);
        is_int(DNSSEC_INVALID_DS_ALGORITHM, r, "dnssec_key_create_ds() unsupported algorithm");