]> git.ipfire.org Git - thirdparty/knot-dns.git/commitdiff
Replace DNSSEC_EOK with KNOT_EOK
authorDaniel Salzman <daniel.salzman@nic.cz>
Tue, 21 Oct 2025 07:27:55 +0000 (09:27 +0200)
committerLibor Peltan <libor.peltan@nic.cz>
Fri, 24 Oct 2025 07:17:08 +0000 (09:17 +0200)
66 files changed:
src/knot/dnssec/kasp/keystore.c
src/knot/dnssec/key_records.c
src/knot/dnssec/rrset-sign.c
src/knot/dnssec/zone-keys.c
src/knot/dnssec/zone-nsec.c
src/knot/modules/onlinesign/onlinesign.c
src/knot/modules/rrl/kru.inc.c
src/knot/zone/backup.c
src/knot/zone/contents.c
src/knot/zone/digest.c
src/libknot/dnssec/binary.c
src/libknot/dnssec/binary.h
src/libknot/dnssec/digest.c
src/libknot/dnssec/error.c
src/libknot/dnssec/error.h
src/libknot/dnssec/key.h
src/libknot/dnssec/key/algorithm.c
src/libknot/dnssec/key/convert.c
src/libknot/dnssec/key/convert.h
src/libknot/dnssec/key/dnskey.c
src/libknot/dnssec/key/ds.c
src/libknot/dnssec/key/key.c
src/libknot/dnssec/key/keytag.c
src/libknot/dnssec/key/privkey.c
src/libknot/dnssec/key/privkey.h
src/libknot/dnssec/key/simple.c
src/libknot/dnssec/keystore.h
src/libknot/dnssec/keystore/keystore.c
src/libknot/dnssec/keystore/pkcs11.c
src/libknot/dnssec/keystore/pkcs8.c
src/libknot/dnssec/keytag.h
src/libknot/dnssec/nsec.h
src/libknot/dnssec/nsec/hash.c
src/libknot/dnssec/nsec/nsec.c
src/libknot/dnssec/p11/p11.c
src/libknot/dnssec/pem.c
src/libknot/dnssec/pem.h
src/libknot/dnssec/random.c
src/libknot/dnssec/random.h
src/libknot/dnssec/shared/keyid_gnutls.c
src/libknot/dnssec/sign.h
src/libknot/dnssec/sign/der.c
src/libknot/dnssec/sign/der.h
src/libknot/dnssec/sign/sign.c
src/libknot/dnssec/tsig.c
src/libknot/dnssec/tsig.h
src/libknot/quic/quic.c
src/libknot/tsig-op.c
src/libknot/tsig.c
src/utils/common/quic.c
src/utils/kdig/kdig_params.c
src/utils/keymgr/bind_privkey.c
src/utils/keymgr/functions.c
src/utils/keymgr/keystore.c
src/utils/knsec3hash/knsec3hash.c
tests/libknot/test_dnssec_binary.c
tests/libknot/test_dnssec_key.c
tests/libknot/test_dnssec_key_algorithm.c
tests/libknot/test_dnssec_key_ds.c
tests/libknot/test_dnssec_keystore_pkcs11.c
tests/libknot/test_dnssec_keystore_pkcs8.c
tests/libknot/test_dnssec_keytag.c
tests/libknot/test_dnssec_nsec_hash.c
tests/libknot/test_dnssec_random.c
tests/libknot/test_dnssec_sign.c
tests/libknot/test_dnssec_sign_der.c

index 6ef3ec7c6b2d79026d4669bbd634cba10e486c81..4d67737a4c95fa6f419510cbdfb0de551553d621 100644 (file)
@@ -48,7 +48,7 @@ int keystore_load(const char *config, unsigned backend,
        default:
                assert(0);
        }
-       if (ret != DNSSEC_EOK) {
+       if (ret != KNOT_EOK) {
                free(fixed_config);
                return knot_error_from_libdnssec(ret);
        }
@@ -59,7 +59,7 @@ int keystore_load(const char *config, unsigned backend,
        }
 
        ret = dnssec_keystore_init(*keystore, fixed_config);
-       if (ret != DNSSEC_EOK) {
+       if (ret != KNOT_EOK) {
                free(fixed_config);
                dnssec_keystore_deinit(*keystore);
                *keystore = NULL;
@@ -68,7 +68,7 @@ int keystore_load(const char *config, unsigned backend,
 
        ret = dnssec_keystore_open(*keystore, fixed_config);
        free(fixed_config);
-       if (ret != DNSSEC_EOK) {
+       if (ret != KNOT_EOK) {
                dnssec_keystore_deinit(*keystore);
                *keystore = NULL;
                return knot_error_from_libdnssec(ret);
index 547c80e36c514030342e65145d73c06ed7df29ee..2d354937767775aa040ab075b1e0d98dbe0c0899 100644 (file)
@@ -182,7 +182,7 @@ int key_records_sign(const zone_key_t *key, key_records_t *r, const kdnssec_ctx_
 {
        dnssec_sign_ctx_t *sign_ctx;
        int ret = dnssec_sign_new(&sign_ctx, key->key);
-       if (ret != DNSSEC_EOK) {
+       if (ret != KNOT_EOK) {
                ret = knot_error_from_libdnssec(ret);
        }
 
index 1a470ae882984c7da821251aa7a8211f3d5c6d37..ff5a24c42221fe212d662e1845827be90b970c1b 100644 (file)
@@ -117,7 +117,7 @@ static int sign_ctx_add_self(dnssec_sign_ctx_t *ctx, const uint8_t *rdata)
        header.size = RRSIG_RDATA_SIGNER_OFFSET;
 
        result = dnssec_sign_add(ctx, &header);
-       if (result != DNSSEC_EOK) {
+       if (result != KNOT_EOK) {
                return result;
        }
 
@@ -235,7 +235,7 @@ static int rrsigs_create_rdata(knot_rrset_t *rrsigs, dnssec_sign_ctx_t *ctx,
 
        dnssec_binary_t signature = { 0 };
        res = dnssec_sign_write(ctx, sign_flags, &signature);
-       if (res != DNSSEC_EOK) {
+       if (res != KNOT_EOK) {
                return res;
        }
        assert(signature.size > 0);
index e13e74b8de550a06156269d0e16cfca48e103725..234a8ac9c2d91c801be5b79f15afef9cc548f07a 100644 (file)
@@ -521,7 +521,7 @@ static int load_private_keys(kdnssec_ctx_t *ctx, zone_keyset_t *keyset)
                }
                int ret = kdnssec_load_private(ctx->keystores, key->id, key->key, NULL, NULL);
                switch (ret) {
-               case DNSSEC_EOK:
+               case KNOT_EOK:
                case DNSSEC_KEY_ALREADY_PRESENT:
                        break;
                default:
@@ -734,7 +734,7 @@ zone_sign_ctx_t *zone_sign_ctx(const zone_keyset_t *keyset, const kdnssec_ctx_t
                }
 
                ret = dnssec_sign_new(&ctx->sign_ctxs[i], ctx->keys[i].key);
-               if (ret != DNSSEC_EOK) {
+               if (ret != KNOT_EOK) {
                        zone_sign_ctx_free(ctx);
                        return NULL;
                }
@@ -757,7 +757,7 @@ zone_sign_ctx_t *zone_validation_ctx(const kdnssec_ctx_t *dnssec_ctx)
        ctx->dnssec_ctx = dnssec_ctx;
        for (size_t i = 0; i < ctx->count; i++) {
                int ret = dnssec_sign_new(&ctx->sign_ctxs[i], dnssec_ctx->zone->keys[i].key);
-               if (ret != DNSSEC_EOK) {
+               if (ret != KNOT_EOK) {
                        zone_sign_ctx_free(ctx);
                        return NULL;
                }
@@ -794,17 +794,17 @@ int dnssec_key_from_rdata(dnssec_key_t **key, const knot_dname_t *owner,
 
        dnssec_key_t *new_key = NULL;
        int ret = dnssec_key_new(&new_key);
-       if (ret != DNSSEC_EOK) {
+       if (ret != KNOT_EOK) {
                return knot_error_from_libdnssec(ret);
        }
        ret = dnssec_key_set_rdata(new_key, &binary_key);
-       if (ret != DNSSEC_EOK) {
+       if (ret != KNOT_EOK) {
                dnssec_key_free(new_key);
                return knot_error_from_libdnssec(ret);
        }
        if (owner != NULL) {
                ret = dnssec_key_set_dname(new_key, owner);
-               if (ret != DNSSEC_EOK) {
+               if (ret != KNOT_EOK) {
                        dnssec_key_free(new_key);
                        return knot_error_from_libdnssec(ret);
                }
index e2ea91b528b000217f0927caca8b34702d4dd518..daaea5a3e18870ee1b8e306267e4a150741a38db 100644 (file)
@@ -61,7 +61,7 @@ int knot_create_nsec3_owner(uint8_t *out, size_t out_size,
        dnssec_binary_t hash = { 0 };
 
        int ret = dnssec_nsec3_hash(&data, params, &hash);
-       if (ret != DNSSEC_EOK) {
+       if (ret != KNOT_EOK) {
                return knot_error_from_libdnssec(ret);
        }
 
@@ -163,7 +163,7 @@ static bool nsec3param_valid(const knot_rdataset_t *rrs,
 
        dnssec_nsec3_params_t parsed = { 0 };
        int r = dnssec_nsec3_params_from_rdata(&parsed, &rdata);
-       if (r != DNSSEC_EOK) {
+       if (r != KNOT_EOK) {
                return false;
        }
 
index b5d13863cb256a0db503c9683e7f9640fe1125ab..e56328011a74982a24a1fb9a18dd2d6fb6cb39e3 100644 (file)
@@ -351,7 +351,7 @@ static knotd_in_state_t synth_authority(knotd_in_state_t state, knot_pkt_t *pkt,
        if (want_dnssec(qdata)) {
                knot_rrset_t *nsec = synth_nsec(pkt, qdata, mod, &pkt->mm);
                int r = knot_pkt_put(pkt, KNOT_COMPR_HINT_NONE, nsec, KNOT_PF_FREE);
-               if (r != DNSSEC_EOK) {
+               if (r != KNOT_EOK) {
                        knot_rrset_free(nsec, &pkt->mm);
                        return KNOTD_IN_STATE_ERROR;
                }
@@ -536,7 +536,7 @@ static knotd_in_state_t synth_answer(knotd_in_state_t state, knot_pkt_t *pkt,
                }
 
                int r = knot_pkt_put(pkt, KNOT_COMPR_HINT_QNAME, dnskey, KNOT_PF_FREE);
-               if (r != DNSSEC_EOK) {
+               if (r != KNOT_EOK) {
                        knot_rrset_free(dnskey, &pkt->mm);
                        return KNOTD_IN_STATE_ERROR;
                }
@@ -550,7 +550,7 @@ static knotd_in_state_t synth_answer(knotd_in_state_t state, knot_pkt_t *pkt,
                }
 
                int r = knot_pkt_put(pkt, KNOT_COMPR_HINT_QNAME, dnskey, KNOT_PF_FREE);
-               if (r != DNSSEC_EOK) {
+               if (r != KNOT_EOK) {
                        knot_rrset_free(dnskey, &pkt->mm);
                        return KNOTD_IN_STATE_ERROR;
                }
@@ -564,7 +564,7 @@ static knotd_in_state_t synth_answer(knotd_in_state_t state, knot_pkt_t *pkt,
                }
 
                int r = knot_pkt_put(pkt, KNOT_COMPR_HINT_QNAME, ds, KNOT_PF_FREE);
-               if (r != DNSSEC_EOK) {
+               if (r != KNOT_EOK) {
                        knot_rrset_free(ds, &pkt->mm);
                        return KNOTD_IN_STATE_ERROR;
                }
@@ -578,7 +578,7 @@ static knotd_in_state_t synth_answer(knotd_in_state_t state, knot_pkt_t *pkt,
                }
 
                int r = knot_pkt_put(pkt, KNOT_COMPR_HINT_QNAME, nsec, KNOT_PF_FREE);
-               if (r != DNSSEC_EOK) {
+               if (r != KNOT_EOK) {
                        knot_rrset_free(nsec, &pkt->mm);
                        return KNOTD_IN_STATE_ERROR;
                }
index e93704e4639cd2bd5ffd69c66bfd90eaa09f91c4..63aff6435f5795ccddd3106b36b27ba2e679610e 100644 (file)
@@ -206,7 +206,7 @@ static bool kru_initialize(struct kru *kru, int capacity_log, kru_price_t max_de
 
        kru->loads_bits = loads_bits;
 
-       if (dnssec_random_buffer((uint8_t *)&kru->hash_key, sizeof(kru->hash_key)) != DNSSEC_EOK) {
+       if (dnssec_random_buffer((uint8_t *)&kru->hash_key, sizeof(kru->hash_key)) != KNOT_EOK) {
                return false;
        }
 
index 8b08f9a498038377a10df2f48d5258425c0e8184..b27e850067829feccdfb9efcae7428e10d8ac8e6 100644 (file)
@@ -221,27 +221,27 @@ static int backup_key(key_params_t *parm, const knot_dname_t *zname, bool restor
 {
        dnssec_key_t *key = NULL;
        int ret = dnssec_key_new(&key);
-       if (ret != DNSSEC_EOK) {
+       if (ret != KNOT_EOK) {
                return knot_error_from_libdnssec(ret);
        }
        dnssec_key_set_algorithm(key, parm->algorithm);
 
        unsigned backend;
        ret = kdnssec_load_private(from, parm->id, key, NULL, &backend);
-       if (ret == DNSSEC_EOK) {
+       if (ret == KNOT_EOK) {
                // If restore, consider only the first configured keystore.
                assert(to->count > 0);
                ret = dnssec_keystore_set_private(to[0].keystore, key);
                backend = restore ? to->backend : backend;
-               if (ret != DNSSEC_EOK && backend == KEYSTORE_BACKEND_PKCS11) {
+               if (ret != KNOT_EOK && backend == KEYSTORE_BACKEND_PKCS11) {
                        log_zone_notice(zname,
                                        "%s of private key id %s via PKCS #11 not possible, ignoring",
                                        restore ? "restore" : "backup", parm->id);
-                       ret = DNSSEC_EOK;
+                       ret = KNOT_EOK;
                }
        } else if (ret == DNSSEC_ENOENT) {
                log_zone_notice(zname, "private key id %s not available, ignoring", parm->id);
-               ret = DNSSEC_EOK;
+               ret = KNOT_EOK;
        }
 
        dnssec_key_free(key);
index 65ef61a98a2c41e7a0ac17c955a1e9b520b0c760..dbd1fc4838147da6579d738161bc427dff74c216 100644 (file)
@@ -591,9 +591,9 @@ int zone_contents_load_nsec3param(zone_contents_t *contents)
        };
 
        dnssec_nsec3_params_t new_params = { 0 };
-       int r = dnssec_nsec3_params_from_rdata(&new_params, &rdata);
-       if (r != DNSSEC_EOK) {
-               return KNOT_EMALF;
+       int ret = dnssec_nsec3_params_from_rdata(&new_params, &rdata);
+       if (ret != KNOT_EOK) {
+               return ret;
        }
 
        dnssec_nsec3_params_free(&contents->nsec3_params);
index 9dc2a133af4e40fbd77a5b918891dfc6177da17b..6813bca61f04400df7c18c7b108a6da2ba771d5e 100644 (file)
@@ -107,7 +107,7 @@ int zone_contents_digest(const zone_contents_t *contents, int algorithm,
        }
 
        int ret = dnssec_digest_init(algorithm, &ctx.digest_ctx);
-       if (ret != DNSSEC_EOK) {
+       if (ret != KNOT_EOK) {
                free(ctx.buf);
                return knot_error_from_libdnssec(ret);
        }
index 27c8008bad7a70b81b757c000208c1c59b12c60a..17862ccebb7c7ff09c388bdeab5d439482e004cf 100644 (file)
@@ -28,7 +28,7 @@ int dnssec_binary_alloc(dnssec_binary_t *data, size_t size)
        data->data = new_data;
        data->size = size;
 
-       return DNSSEC_EOK;
+       return KNOT_EOK;
 }
 
 _public_
@@ -59,7 +59,7 @@ int dnssec_binary_dup(const dnssec_binary_t *from, dnssec_binary_t *to)
        to->size = from->size;
        to->data = copy;
 
-       return DNSSEC_EOK;
+       return KNOT_EOK;
 }
 
 _public_
@@ -77,7 +77,7 @@ int dnssec_binary_resize(dnssec_binary_t *data, size_t new_size)
        data->data = new_data;
        data->size = new_size;
 
-       return DNSSEC_EOK;
+       return KNOT_EOK;
 }
 
 _public_
@@ -128,7 +128,7 @@ int dnssec_binary_from_base64(const dnssec_binary_t *base64,
        binary->data = data;
        binary->size = size;
 
-       return DNSSEC_EOK;
+       return KNOT_EOK;
 }
 
 _public_
@@ -148,5 +148,5 @@ int dnssec_binary_to_base64(const dnssec_binary_t *binary,
        base64->data = data;
        base64->size = size;
 
-       return DNSSEC_EOK;
+       return KNOT_EOK;
 }
index 22519145f86e3d66a7b6942b4c9a6f10886e9e1c..1878231e624904a0460164c602b70c181bedb85e 100644 (file)
@@ -35,7 +35,7 @@ typedef struct dnssec_binary {
  * \param[out] data  Binary to be allocated.
  * \param[in]  size  Requested size of the binary.
  *
- * \return Error code, DNSSEC_EOK if successful.
+ * \return Error code, KNOT_EOK if successful.
  */
 int dnssec_binary_alloc(dnssec_binary_t *data, size_t size);
 
@@ -52,7 +52,7 @@ void dnssec_binary_free(dnssec_binary_t *binary);
  * \param[in]  from  Source of the copy.
  * \param[out] to    Target of the copy.
  *
- * \return Error code, DNSSEC_EOK if successful.
+ * \return Error code, KNOT_EOK if successful.
  */
 int dnssec_binary_dup(const dnssec_binary_t *from, dnssec_binary_t *to);
 
@@ -65,7 +65,7 @@ int dnssec_binary_dup(const dnssec_binary_t *from, dnssec_binary_t *to);
  * \param data      Binary to be resized.
  * \param new_size  New size.
  *
- * \return Error code, DNSSEC_EOK if successful.
+ * \return Error code, KNOT_EOK if successful.
  */
 int dnssec_binary_resize(dnssec_binary_t *data, size_t new_size);
 
@@ -87,7 +87,7 @@ int dnssec_binary_cmp(const dnssec_binary_t *one, const dnssec_binary_t *two);
  * \param[in]  base64  Base64 encoded data.
  * \param[out] binary  Decoded binary data.
  *
- * \return Error code, DNSSEC_EOK if successful.
+ * \return Error code, KNOT_EOK if successful.
  */
 int dnssec_binary_from_base64(const dnssec_binary_t *base64,
                              dnssec_binary_t *binary);
@@ -98,7 +98,7 @@ int dnssec_binary_from_base64(const dnssec_binary_t *base64,
  * \param[in]  binary  Binary data.
  * \param[out] base64  Base64 encode data.
  *
- * \return Error code, DNSSEC_EOK if successful.
+ * \return Error code, KNOT_EOK if successful.
  */
 int dnssec_binary_to_base64(const dnssec_binary_t *binary,
                            dnssec_binary_t *base64);
index 0271e79b24c82ef337b6af7d373c3f7dac035ece..97edf00e511d91122b072c719918fae19e7a77eb 100644 (file)
@@ -49,7 +49,7 @@ int dnssec_digest_init(dnssec_digest_t algorithm, dnssec_digest_ctx_t **out_ctx)
        }
 
        *out_ctx = res;
-       return DNSSEC_EOK;
+       return KNOT_EOK;
 }
 
 static void digest_ctx_free(dnssec_digest_ctx_t *ctx)
@@ -70,7 +70,7 @@ int dnssec_digest(dnssec_digest_ctx_t *ctx, dnssec_binary_t *data)
                digest_ctx_free(ctx);
                return DNSSEC_DIGEST_ERROR;
        }
-       return DNSSEC_EOK;
+       return KNOT_EOK;
 }
 
 _public_
@@ -90,5 +90,5 @@ int dnssec_digest_finish(dnssec_digest_ctx_t *ctx, dnssec_binary_t *out)
        gnutls_hash_output(ctx->gtctx, out->data);
 
        digest_ctx_free(ctx);
-       return DNSSEC_EOK;
+       return KNOT_EOK;
 }
index 0b418290e0a01ffde091dec0df666292f58f232f..fe8a4d8958f689bf7d1c5d2b0b88f3e2dabdce60 100644 (file)
@@ -14,7 +14,7 @@ typedef struct error_message_t {
 } error_message_t;
 
 static const error_message_t ERROR_MESSAGES[] = {
-       { DNSSEC_EOK,                   "no error" },
+       { KNOT_EOK,                     "no error" },
 
        { DNSSEC_ENOMEM,                "not enough memory" },
        { DNSSEC_EINVAL,                "invalid argument" },
index cb9791343936cb558a156bfaaa5514f385fb9513..90a9bbb371667f556d27fdb4104327c6e5ff243e 100644 (file)
@@ -24,7 +24,7 @@
  * Library error codes.
  */
 enum dnssec_error {
-       DNSSEC_EOK = 0,
+       KNOT_EOK = 0,
 
        DNSSEC_ENOMEM = -ENOMEM,
        DNSSEC_EINVAL = -EINVAL,
index d01343cef1d2558771cdffcd4403a76e548a4e29..e20e4459a581511ef46f149138b06ba678f74a89 100644 (file)
@@ -104,7 +104,7 @@ bool dnssec_algorithm_reproducible(dnssec_key_algorithm_t algorithm, bool enable
  * The protocol field of the key is set to 3 (DNSSEC).
  * The flags field of the key is set to 256 (zone key, no SEP).
  *
- * \return Error code, DNSSEC_EOK if successful.
+ * \return Error code, KNOT_EOK if successful.
  */
 int dnssec_key_new(dnssec_key_t **key);
 
@@ -252,7 +252,7 @@ bool dnssec_key_can_verify(const dnssec_key_t *key);
  * \param[out] min        Minimal size of the private key (can be NULL).
  * \param[out] max        Maximal size of the private key (can be NULL).
  *
- * \return DNSSEC_EOK for valid parameters.
+ * \return KNOT_EOK for valid parameters.
  */
 int dnssec_algorithm_key_size_range(dnssec_key_algorithm_t algorithm,
                                    unsigned *min, unsigned *max);
@@ -290,7 +290,7 @@ bool dnssec_algorithm_digest_support(dnssec_key_digest_t algorithm);
  * \param[in]  digest  Digest algorithm to be used.
  * \param[out] rdata   Allocated DS RDATA.
  *
- * \return Error code, DNSSEC_EOK if successful.
+ * \return Error code, KNOT_EOK if successful.
  */
 int dnssec_key_create_ds(const dnssec_key_t *key, dnssec_key_digest_t digest,
                         dnssec_binary_t *rdata);
index f0a1379f9f09938375f6d5b3cd415ba837f27c4c..a9d1be0058b08a57491521a81e70dfbcfac79111 100644 (file)
@@ -132,7 +132,7 @@ int dnssec_algorithm_key_size_range(dnssec_key_algorithm_t algorithm,
                *max_ptr = limits->max;
        }
 
-       return DNSSEC_EOK;
+       return KNOT_EOK;
 }
 
 _public_
index 12c185b86c36f56790e5e5a684202024455631dc..7978c3c3c06f5e1e2ccd69ba465243d52ec53c01 100644 (file)
@@ -68,7 +68,7 @@ static int rsa_pubkey_to_rdata(gnutls_pubkey_t key, dnssec_binary_t *rdata)
        size_t modulus_size = bignum_size_u_datum(&modulus);
 
        result = dnssec_binary_alloc(rdata, 1 + exponent_size + modulus_size);
-       if (result != DNSSEC_EOK) {
+       if (result != KNOT_EOK) {
                return result;
        }
 
@@ -78,7 +78,7 @@ static int rsa_pubkey_to_rdata(gnutls_pubkey_t key, dnssec_binary_t *rdata)
        wire_write_bignum_datum(&wire, modulus_size, &modulus);
        assert(wire_ctx_offset(&wire) == rdata->size);
 
-       return DNSSEC_EOK;
+       return KNOT_EOK;
 }
 
 /*!
@@ -127,7 +127,7 @@ static int ecdsa_pubkey_to_rdata(gnutls_pubkey_t key, dnssec_binary_t *rdata)
        }
 
        result = dnssec_binary_alloc(rdata, 2 * point_size);
-       if (result != DNSSEC_EOK) {
+       if (result != KNOT_EOK) {
                return result;
        }
 
@@ -136,7 +136,7 @@ static int ecdsa_pubkey_to_rdata(gnutls_pubkey_t key, dnssec_binary_t *rdata)
        wire_write_bignum_datum(&wire, point_size, &point_y);
        assert(wire_ctx_offset(&wire) == rdata->size);
 
-       return DNSSEC_EOK;
+       return KNOT_EOK;
 }
 
 /*!
@@ -161,7 +161,7 @@ static int eddsa_pubkey_to_rdata(gnutls_pubkey_t key, dnssec_binary_t *rdata)
        }
 
        result = dnssec_binary_alloc(rdata, point_size);
-       if (result != DNSSEC_EOK) {
+       if (result != KNOT_EOK) {
                return result;
        }
 
@@ -169,7 +169,7 @@ static int eddsa_pubkey_to_rdata(gnutls_pubkey_t key, dnssec_binary_t *rdata)
        wire_write_bignum_datum(&wire, point_size, &point_x);
        assert(wire_ctx_offset(&wire) == rdata->size);
 
-       return DNSSEC_EOK;
+       return KNOT_EOK;
 }
 
 /* -- crypto to DNSSEC ------------------------------------------------------*/
@@ -213,7 +213,7 @@ static int rsa_rdata_to_pubkey(const dnssec_binary_t *rdata, gnutls_pubkey_t key
                return DNSSEC_KEY_IMPORT_ERROR;
        }
 
-       return DNSSEC_EOK;
+       return KNOT_EOK;
 }
 
 /*!
@@ -269,7 +269,7 @@ static int ecdsa_rdata_to_pubkey(const dnssec_binary_t *rdata, gnutls_pubkey_t k
                return DNSSEC_KEY_IMPORT_ERROR;
        }
 
-       return DNSSEC_EOK;
+       return KNOT_EOK;
 }
 
 /*!
@@ -296,7 +296,7 @@ static int eddsa_rdata_to_pubkey(const dnssec_binary_t *rdata, gnutls_pubkey_t k
                return DNSSEC_KEY_IMPORT_ERROR;
        }
 
-       return DNSSEC_EOK;
+       return KNOT_EOK;
 }
 
 /* -- internal API --------------------------------------------------------- */
index 60e7feac396e1a9ed884b14e5cdc0acb5db6a40d..2e68579695fbe51a24712e088148a31d4fb13f61 100644 (file)
@@ -16,7 +16,7 @@
  * \param[in]  key    Public key to be encoded.
  * \param[out] rdata  Encoded key (allocated).
  *
- * \return Error code, DNSSEC_EOK if successful.
+ * \return Error code, KNOT_EOK if successful.
  */
 int convert_pubkey_to_dnskey(gnutls_pubkey_t key, dnssec_binary_t *rdata);
 
@@ -27,7 +27,7 @@ int convert_pubkey_to_dnskey(gnutls_pubkey_t key, dnssec_binary_t *rdata);
  * \param[in]  rdata      Public key in DNSKEY RDATA format.
  * \param[out] key        GnuTLS public key (initialized).
  *
- * \return Error code, DNSSEC_EOK if successful.
+ * \return Error code, KNOT_EOK if successful.
  */
 int convert_dnskey_to_pubkey(uint8_t algorithm, const dnssec_binary_t *rdata,
                             gnutls_pubkey_t key);
index dd712764772c1e091477ac3af0a1c2d055fe30d7..52d9cf0825198be2ab651e81de69e91b4d88d360 100644 (file)
@@ -21,7 +21,7 @@ int dnskey_rdata_set_pubkey(dnssec_binary_t *rdata, const dnssec_binary_t *pubke
 
        size_t new_size = DNSKEY_RDATA_OFFSET_PUBKEY + pubkey->size;
        int result = dnssec_binary_resize(rdata, new_size);
-       if (result != DNSSEC_EOK) {
+       if (result != KNOT_EOK) {
                return result;
        }
 
@@ -30,7 +30,7 @@ int dnskey_rdata_set_pubkey(dnssec_binary_t *rdata, const dnssec_binary_t *pubke
        binary_write(&wire, pubkey);
        assert(wire_ctx_offset(&wire) == rdata->size);
 
-       return DNSSEC_EOK;
+       return KNOT_EOK;
 }
 
 /*!
@@ -69,12 +69,12 @@ int dnskey_rdata_to_crypto_key(const dnssec_binary_t *rdata, gnutls_pubkey_t *ke
        }
 
        result = convert_dnskey_to_pubkey(algorithm, &rdata_pubkey, key);
-       if (result != DNSSEC_EOK) {
+       if (result != KNOT_EOK) {
                gnutls_pubkey_deinit(key);
                return result;
        }
 
        *key_ptr = key;
 
-       return DNSSEC_EOK;
+       return KNOT_EOK;
 }
index 098bbfa3f57b7c5fb408fc0e507222a49f6dda89..9f6fb0fb4abc33e9a25be57d9664aaffdee1f47a 100644 (file)
@@ -100,7 +100,7 @@ int dnssec_key_create_ds(const dnssec_key_t *key,
 
        dnssec_binary_t rdata = { 0 };
        r = dnssec_binary_alloc(&rdata, 4 + digest_size);
-       if (r != DNSSEC_EOK) {
+       if (r != KNOT_EOK) {
                return r;
        }
 
@@ -113,5 +113,5 @@ int dnssec_key_create_ds(const dnssec_key_t *key,
 
        *rdata_ptr = rdata;
 
-       return DNSSEC_EOK;
+       return KNOT_EOK;
 }
index 7ea3c05a689eb0f5261684cebfca59aa5752ef98..46e948b7c9a2ec8d44cb346fff39b057f98b2e99 100644 (file)
@@ -52,14 +52,14 @@ int dnssec_key_new(dnssec_key_t **key_ptr)
        }
 
        int r = dnssec_binary_dup(&DNSKEY_RDATA_TEMPLATE, &key->rdata);
-       if (r != DNSSEC_EOK) {
+       if (r != KNOT_EOK) {
                free(key);
                return DNSSEC_ENOMEM;
        }
 
        *key_ptr = key;
 
-       return DNSSEC_EOK;
+       return KNOT_EOK;
 }
 
 /*!
@@ -123,9 +123,9 @@ dnssec_key_t *dnssec_key_dup(const dnssec_key_t *key)
 
        dnssec_key_t *dup = NULL;
 
-       if (dnssec_key_new(&dup) != DNSSEC_EOK ||
-           dnssec_key_set_dname(dup, key->dname) != DNSSEC_EOK ||
-           dnssec_key_set_rdata(dup, &key->rdata) != DNSSEC_EOK
+       if (dnssec_key_new(&dup) != KNOT_EOK ||
+           dnssec_key_set_dname(dup, key->dname) != KNOT_EOK ||
+           dnssec_key_set_rdata(dup, &key->rdata) != KNOT_EOK
        ) {
                dnssec_key_free(dup);
                return NULL;
@@ -188,7 +188,7 @@ int dnssec_key_set_dname(dnssec_key_t *key, const uint8_t *dname)
        free(key->dname);
        key->dname = copy;
 
-       return DNSSEC_EOK;
+       return KNOT_EOK;
 }
 
 _public_
@@ -214,7 +214,7 @@ int dnssec_key_set_flags(dnssec_key_t *key, uint16_t flags)
        wire_ctx_set_offset(&wire, DNSKEY_RDATA_OFFSET_FLAGS);
        wire_ctx_write_u16(&wire, flags);
 
-       return DNSSEC_EOK;
+       return KNOT_EOK;
 }
 
 _public_
@@ -240,7 +240,7 @@ int dnssec_key_set_protocol(dnssec_key_t *key, uint8_t protocol)
        wire_ctx_set_offset(&wire, DNSKEY_RDATA_OFFSET_PROTOCOL);
        wire_ctx_write_u8(&wire, protocol);
 
-       return DNSSEC_EOK;
+       return KNOT_EOK;
 }
 
 /* -- restricted attributes ------------------------------------------------ */
@@ -305,7 +305,7 @@ int dnssec_key_set_algorithm(dnssec_key_t *key, uint8_t algorithm)
        wire_ctx_set_offset(&wire, DNSKEY_RDATA_OFFSET_ALGORITHM);
        wire_ctx_write_u8(&wire, algorithm);
 
-       return DNSSEC_EOK;
+       return KNOT_EOK;
 }
 
 _public_
@@ -319,7 +319,7 @@ int dnssec_key_get_pubkey(const dnssec_key_t *key, dnssec_binary_t *pubkey)
        wire_ctx_set_offset(&wire, DNSKEY_RDATA_OFFSET_PUBKEY);
        binary_available(&wire, pubkey);
 
-       return DNSSEC_EOK;
+       return KNOT_EOK;
 }
 
 _public_
@@ -338,17 +338,17 @@ int dnssec_key_set_pubkey(dnssec_key_t *key, const dnssec_binary_t *pubkey)
        }
 
        int result = dnskey_rdata_set_pubkey(&key->rdata, pubkey);
-       if (result != DNSSEC_EOK) {
+       if (result != KNOT_EOK) {
                return result;
        }
 
        result = dnskey_rdata_to_crypto_key(&key->rdata, &key->public_key);
-       if (result != DNSSEC_EOK) {
+       if (result != KNOT_EOK) {
                key->rdata.size = DNSKEY_RDATA_OFFSET_PUBKEY; // downsize
                return result;
        }
 
-       return DNSSEC_EOK;
+       return KNOT_EOK;
 }
 
 _public_
@@ -399,7 +399,7 @@ int dnssec_key_get_rdata(const dnssec_key_t *key, dnssec_binary_t *rdata)
 
        *rdata = key->rdata;
 
-       return DNSSEC_EOK;
+       return KNOT_EOK;
 }
 
 _public_
@@ -419,12 +419,12 @@ int dnssec_key_set_rdata(dnssec_key_t *key, const dnssec_binary_t *rdata)
 
        gnutls_pubkey_t new_pubkey = NULL;
        int result = dnskey_rdata_to_crypto_key(rdata, &new_pubkey);
-       if (result != DNSSEC_EOK) {
+       if (result != KNOT_EOK) {
                return result;
        }
 
        result = dnssec_binary_resize(&key->rdata, rdata->size);
-       if (result != DNSSEC_EOK) {
+       if (result != KNOT_EOK) {
                gnutls_pubkey_deinit(new_pubkey);
                return result;
        }
@@ -433,7 +433,7 @@ int dnssec_key_set_rdata(dnssec_key_t *key, const dnssec_binary_t *rdata)
        memmove(key->rdata.data, rdata->data, rdata->size);
        key->public_key = new_pubkey;
 
-       return DNSSEC_EOK;
+       return KNOT_EOK;
 }
 
 /* -- key presence checking ------------------------------------------------ */
index aea768264431e078208471e6ee963fcd0880b6c8..f1df0dd4d7d03b5e39661302e33c9dd9924ca1c8 100644 (file)
@@ -73,5 +73,5 @@ int dnssec_keytag(const dnssec_binary_t *rdata, uint16_t *keytag)
                *keytag = keytag_current(rdata);
        }
 
-       return DNSSEC_EOK;
+       return KNOT_EOK;
 }
index a8af82321455fb93fd3c1952021a9a2c192050c8..71db505fa93763fe2c1bb1fbeea9201d754f4688 100644 (file)
@@ -51,7 +51,7 @@ static int public_from_private(gnutls_privkey_t privkey, gnutls_pubkey_t *pubkey
 
        *pubkey = new_key;
 
-       return DNSSEC_EOK;
+       return KNOT_EOK;
 }
 
 /*!
@@ -69,7 +69,7 @@ static int create_public_key(gnutls_privkey_t privkey,
 
        gnutls_pubkey_t pubkey = NULL;
        int result = public_from_private(privkey, &pubkey);
-       if (result != DNSSEC_EOK) {
+       if (result != KNOT_EOK) {
                return result;
        }
 
@@ -77,14 +77,14 @@ static int create_public_key(gnutls_privkey_t privkey,
 
        _cleanup_binary_ dnssec_binary_t rdata_pubkey = { 0 };
        result = convert_pubkey_to_dnskey(pubkey, &rdata_pubkey);
-       if (result != DNSSEC_EOK) {
+       if (result != KNOT_EOK) {
                gnutls_pubkey_deinit(pubkey);
                return result;
        }
 
        size_t rdata_size = DNSKEY_RDATA_OFFSET_PUBKEY + rdata_pubkey.size;
        result = dnssec_binary_resize(rdata, rdata_size);
-       if (result != DNSSEC_EOK) {
+       if (result != KNOT_EOK) {
                gnutls_pubkey_deinit(pubkey);
                return result;
        }
@@ -98,7 +98,7 @@ static int create_public_key(gnutls_privkey_t privkey,
 
        *pubkey_ptr = pubkey;
 
-       return DNSSEC_EOK;
+       return KNOT_EOK;
 }
 
 /* -- internal API --------------------------------------------------------- */
@@ -118,12 +118,12 @@ int key_set_private_key(dnssec_key_t *key, gnutls_privkey_t privkey)
 
        if (!key->public_key) {
                int r = create_public_key(privkey, &key->public_key, &key->rdata);
-               if (r != DNSSEC_EOK) {
+               if (r != KNOT_EOK) {
                        return r;
                }
        }
 
        key->private_key = privkey;
 
-       return DNSSEC_EOK;
+       return KNOT_EOK;
 }
index 64d8b6ba7d17b8fa9e17bc80115fd1954dccd8f4..77d4faa6f3bc2824aa2cbe2203ab3b857e10d859 100644 (file)
@@ -19,6 +19,6 @@
  * \param key      DNSSEC key to be updated.
  * \param privkey  Private key to be set.
  *
- * \return Error code, DNSSEC_EOK if successful.
+ * \return Error code, KNOT_EOK if successful.
  */
 int key_set_private_key(dnssec_key_t *key, gnutls_privkey_t privkey);
index 4307280b710cbbd41c12d75cc09fc136cdd5e9cf..ae07a59800e37a6f226b8e4f270cb4ef519e827a 100644 (file)
@@ -30,15 +30,15 @@ int dnssec_key_load_pkcs8(dnssec_key_t *key, const dnssec_binary_t *pem)
 
        gnutls_privkey_t privkey = NULL;
        int r = dnssec_pem_to_privkey(pem, &privkey);
-       if (r != DNSSEC_EOK) {
+       if (r != KNOT_EOK) {
                return r;
        }
 
        r = key_set_private_key(key, privkey);
-       if (r != DNSSEC_EOK) {
+       if (r != KNOT_EOK) {
                gnutls_privkey_deinit(privkey);
                return r;
        }
 
-       return DNSSEC_EOK;
+       return KNOT_EOK;
 }
index aaca91c5dc5a8c76544cfaff83bb5e7757205c06..afa31432d3ac5faf35f93143ca600134e2c87bf2 100644 (file)
@@ -41,7 +41,7 @@ typedef struct dnssec_keystore dnssec_keystore_t;
  *
  * \param[out] store  Opened key store.
  *
- * \return Error code, DNSSEC_EOK if successful.
+ * \return Error code, KNOT_EOK if successful.
  */
 int dnssec_keystore_init_pkcs8(dnssec_keystore_t **store);
 
@@ -50,7 +50,7 @@ int dnssec_keystore_init_pkcs8(dnssec_keystore_t **store);
  *
  * \param[out]  store   Opened key store.
  *
- * \return Error code, DNSSEC_EOK if successful.
+ * \return Error code, KNOT_EOK if successful.
  */
 int dnssec_keystore_init_pkcs11(dnssec_keystore_t **store);
 
@@ -76,7 +76,7 @@ int dnssec_keystore_open(dnssec_keystore_t *store, const char *config);
  *
  * \param store  Key store to be closed.
  *
- * \return Error code, DNSSEC_EOK if successful.
+ * \return Error code, KNOT_EOK if successful.
  */
 int dnssec_keystore_close(dnssec_keystore_t *store);
 
@@ -89,7 +89,7 @@ int dnssec_keystore_close(dnssec_keystore_t *store);
  * \param[in]  label      Optional key label for PKCS #11.
  * \param[out] id_ptr     ID of the generated key. Must be freed by the caller.
  *
- * \return Error code, DNSSEC_EOK if successful.
+ * \return Error code, KNOT_EOK if successful.
  */
 int dnssec_keystore_generate(dnssec_keystore_t *store,
                             dnssec_key_algorithm_t algorithm,
@@ -102,7 +102,7 @@ int dnssec_keystore_generate(dnssec_keystore_t *store,
  * \param[in]  pem     Private key material in PEM format.
  * \param[out] id_ptr  ID of the imported key. Must be freed by the caller.
  *
- * \return Error code, DNSSEC_EOK if successful.
+ * \return Error code, KNOT_EOK if successful.
  */
 int dnssec_keystore_import(dnssec_keystore_t *store, const dnssec_binary_t *pem,
                           char **id_ptr);
@@ -113,7 +113,7 @@ int dnssec_keystore_import(dnssec_keystore_t *store, const dnssec_binary_t *pem,
  * \param store  Key store.
  * \param id     ID of the private key to be deleted.
  *
- * \return Error code, DNSSEC_EOK if successful.
+ * \return Error code, KNOT_EOK if successful.
  */
 int dnssec_keystore_remove(dnssec_keystore_t *store, const char *id);
 
@@ -126,7 +126,7 @@ int dnssec_keystore_remove(dnssec_keystore_t *store, const char *id);
  * \param id     ID of the key.
  * \param key    DNSSEC key to be initialized.
  *
- * \return Error code, DNSSEC_EOK if successful.
+ * \return Error code, KNOT_EOK if successful.
  */
 int dnssec_keystore_get_private(dnssec_keystore_t *store, const char *id,
                                dnssec_key_t *key);
@@ -137,7 +137,7 @@ int dnssec_keystore_get_private(dnssec_keystore_t *store, const char *id,
  * \param store  Key store.
  * \param key    DNSSEC key with a private key.
  *
- * \return Error code, DNSSEC_EOK if successful.
+ * \return Error code, KNOT_EOK if successful.
  */
 int dnssec_keystore_set_private(dnssec_keystore_t *store, dnssec_key_t *key);
 
index 24b6307639c1d33b2c4e35334eafaf3d80d5c6f0..4c64b8f936a1385df40f8d36720c861a3417931a 100644 (file)
@@ -33,13 +33,13 @@ int keystore_create(dnssec_keystore_t **store_ptr,
        store->functions = functions;
 
        int result = functions->ctx_new(&store->ctx);
-       if (result != DNSSEC_EOK) {
+       if (result != KNOT_EOK) {
                free(store);
                return DNSSEC_ENOMEM;
        }
 
        *store_ptr = store;
-       return DNSSEC_EOK;
+       return KNOT_EOK;
 }
 
 /* -- public API ----------------------------------------------------------- */
@@ -56,7 +56,7 @@ int dnssec_keystore_deinit(dnssec_keystore_t *store)
 
        free(store);
 
-       return DNSSEC_EOK;
+       return KNOT_EOK;
 }
 
 _public_
@@ -147,17 +147,17 @@ int dnssec_keystore_get_private(dnssec_keystore_t *store, const char *id,
 
        gnutls_privkey_t privkey = NULL;
        int r = store->functions->get_private(store->ctx, id, &privkey);
-       if (r != DNSSEC_EOK) {
+       if (r != KNOT_EOK) {
                return r;
        }
 
        r = key_set_private_key(key, privkey);
-       if (r != DNSSEC_EOK) {
+       if (r != KNOT_EOK) {
                gnutls_privkey_deinit(privkey);
                return r;
        }
 
-       return DNSSEC_EOK;
+       return KNOT_EOK;
 }
 
 _public_
index 4c6bcc7f044b14756371e922637e887000ff5ab0..52002720d0a5c97614135dd6820f132412c45fec 100644 (file)
@@ -68,7 +68,7 @@ static int key_url(const char *token_uri, const char *key_id, char **url_ptr)
        url[len] = '\0';
 
        *url_ptr = url;
-       return DNSSEC_EOK;
+       return KNOT_EOK;
 }
 
 /*!
@@ -93,7 +93,7 @@ static int parse_config(const char *config, char **uri_ptr, char **module_ptr)
        *uri_ptr = url;
        *module_ptr = module;
 
-       return DNSSEC_EOK;
+       return KNOT_EOK;
 }
 
 /*!
@@ -105,7 +105,7 @@ static int safe_open(const char *config, char **url_ptr)
        char *module = NULL;
 
        int r = parse_config(config, &url, &module);
-       if (r != DNSSEC_EOK) {
+       if (r != KNOT_EOK) {
                return r;
        }
 
@@ -125,7 +125,7 @@ static int safe_open(const char *config, char **url_ptr)
 
        *url_ptr = url;
 
-       return DNSSEC_EOK;
+       return KNOT_EOK;
 }
 
 /* -- internal API --------------------------------------------------------- */
@@ -148,7 +148,7 @@ static int pkcs11_ctx_new(void **ctx_ptr)
 
        *ctx_ptr = ctx;
 
-       return DNSSEC_EOK;
+       return KNOT_EOK;
 }
 
 static void pkcs11_ctx_free(void *ctx)
@@ -183,7 +183,7 @@ static int pkcs11_close(void *_ctx)
        free(ctx->url);
        clear_struct(ctx);
 
-       return DNSSEC_EOK;
+       return KNOT_EOK;
 }
 
 static int pkcs11_generate_key(void *_ctx, gnutls_pk_algorithm_t algorithm,
@@ -210,7 +210,7 @@ static int pkcs11_generate_key(void *_ctx, gnutls_pk_algorithm_t algorithm,
 
        *id_ptr = id;
 
-       return DNSSEC_EOK;
+       return KNOT_EOK;
 }
 
 static int import_pem(const dnssec_binary_t *pem,
@@ -222,7 +222,7 @@ static int import_pem(const dnssec_binary_t *pem,
        gnutls_pubkey_t pubkey = NULL;
 
        int r = dnssec_pem_to_x509(pem, &x509_key);
-       if (r != DNSSEC_EOK) {
+       if (r != KNOT_EOK) {
                goto fail;
        }
 
@@ -243,7 +243,7 @@ static int import_pem(const dnssec_binary_t *pem,
 fail:
        gnutls_privkey_deinit(key);
 
-       if (r == DNSSEC_EOK) {
+       if (r == KNOT_EOK) {
                *key_ptr = x509_key;
                *pubkey_ptr = pubkey;
        } else {
@@ -262,13 +262,13 @@ static int pkcs11_import_key(void *_ctx, const dnssec_binary_t *pem, char **id_p
        _cleanup_pubkey_ gnutls_pubkey_t pubkey = NULL;
 
        int r = import_pem(pem, &key, &pubkey);
-       if (r != DNSSEC_EOK) {
+       if (r != KNOT_EOK) {
                return r;
        }
 
        _cleanup_binary_ dnssec_binary_t id = { 0 };
        r = keyid_x509(key, &id);
-       if (r != DNSSEC_EOK) {
+       if (r != KNOT_EOK) {
                return r;
        }
 
@@ -291,7 +291,7 @@ static int pkcs11_import_key(void *_ctx, const dnssec_binary_t *pem, char **id_p
                return DNSSEC_ENOMEM;
        }
 
-       return DNSSEC_EOK;
+       return KNOT_EOK;
 }
 
 static int pkcs11_remove_key(void *_ctx, const char *id)
@@ -300,7 +300,7 @@ static int pkcs11_remove_key(void *_ctx, const char *id)
 
        _cleanup_free_ char *url = NULL;
        int r = key_url(ctx->url, id, &url);
-       if (r != DNSSEC_EOK) {
+       if (r != KNOT_EOK) {
                return r;
        }
 
@@ -311,7 +311,7 @@ static int pkcs11_remove_key(void *_ctx, const char *id)
                return DNSSEC_ENOENT;
        }
 
-       return DNSSEC_EOK;
+       return KNOT_EOK;
 }
 
 static int pkcs11_get_private(void *_ctx, const char *id, gnutls_privkey_t *key_ptr)
@@ -320,7 +320,7 @@ static int pkcs11_get_private(void *_ctx, const char *id, gnutls_privkey_t *key_
 
        _cleanup_free_ char *url = NULL;
        int r = key_url(ctx->url, id, &url);
-       if (r != DNSSEC_EOK) {
+       if (r != KNOT_EOK) {
                return r;
        }
 
@@ -338,14 +338,14 @@ static int pkcs11_get_private(void *_ctx, const char *id, gnutls_privkey_t *key_
 
        *key_ptr = key;
 
-       return DNSSEC_EOK;
+       return KNOT_EOK;
 }
 
 static int pkcs11_set_private(void *ctx, gnutls_privkey_t key)
 {
        _cleanup_binary_ dnssec_binary_t pem = { 0 };
        int r = dnssec_pem_from_privkey(key, &pem);
-       if (r != DNSSEC_EOK) {
+       if (r != KNOT_EOK) {
                return r;
        }
 
index d7e885f0a13032516328e2cd352f704277d187fe..986dd9b094c95688c4bc421e03511b499dc10423 100644 (file)
@@ -62,7 +62,7 @@ static int file_size(int fd, size_t *size)
        assert(offset >= 0);
        *size = offset;
 
-       return DNSSEC_EOK;
+       return KNOT_EOK;
 }
 
 /*!
@@ -87,7 +87,7 @@ static int key_open(const char *dir_name, const char *id, int flags,
 
        *fd_ptr = fd;
 
-       return DNSSEC_EOK;
+       return KNOT_EOK;
 }
 
 static int key_open_read(const char *dir_name, const char *id, int *fd_ptr)
@@ -111,13 +111,13 @@ static int pkcs8_dir_read(pkcs8_dir_handle_t *handle, const char *id, dnssec_bin
 
        _cleanup_close_ int file = -1;
        int result = key_open_read(handle->dir_name, id, &file);
-       if (result != DNSSEC_EOK) {
+       if (result != KNOT_EOK) {
                return result;
        }
 
        size_t size = 0;
        result = file_size(file, &size);
-       if (result != DNSSEC_EOK) {
+       if (result != KNOT_EOK) {
                return result;
        }
 
@@ -129,7 +129,7 @@ static int pkcs8_dir_read(pkcs8_dir_handle_t *handle, const char *id, dnssec_bin
 
        dnssec_binary_t read_pem = { 0 };
        result = dnssec_binary_alloc(&read_pem, size);
-       if (result != DNSSEC_EOK) {
+       if (result != KNOT_EOK) {
                return result;
        }
 
@@ -142,7 +142,7 @@ static int pkcs8_dir_read(pkcs8_dir_handle_t *handle, const char *id, dnssec_bin
        assert(read_count == read_pem.size);
        *pem = read_pem;
 
-       return DNSSEC_EOK;
+       return KNOT_EOK;
 }
 
 static bool key_is_duplicate(int open_error, pkcs8_dir_handle_t *handle,
@@ -158,7 +158,7 @@ static bool key_is_duplicate(int open_error, pkcs8_dir_handle_t *handle,
 
        _cleanup_binary_ dnssec_binary_t old = { 0 };
        int r = pkcs8_dir_read(handle, id, &old);
-       if (r != DNSSEC_EOK) {
+       if (r != KNOT_EOK) {
                return false;
        }
 
@@ -188,7 +188,7 @@ static int pem_generate(gnutls_pk_algorithm_t algorithm, unsigned bits,
 
        dnssec_binary_t _pem = { 0 };
        r = dnssec_pem_from_x509(key, &_pem);
-       if (r != DNSSEC_EOK) {
+       if (r != KNOT_EOK) {
                return r;
        }
 
@@ -196,7 +196,7 @@ static int pem_generate(gnutls_pk_algorithm_t algorithm, unsigned bits,
 
        char *_id = NULL;
        r = keyid_x509_hex(key, &_id);
-       if (r != DNSSEC_EOK) {
+       if (r != KNOT_EOK) {
                dnssec_binary_free(&_pem);
                return r;
        }
@@ -204,7 +204,7 @@ static int pem_generate(gnutls_pk_algorithm_t algorithm, unsigned bits,
        *id = _id;
        *pem = _pem;
 
-       return DNSSEC_EOK;
+       return KNOT_EOK;
 }
 
 /* -- internal API --------------------------------------------------------- */
@@ -222,7 +222,7 @@ static int pkcs8_ctx_new(void **ctx_ptr)
 
        *ctx_ptr = ctx;
 
-       return DNSSEC_EOK;
+       return KNOT_EOK;
 }
 
 static void pkcs8_ctx_free(void *ctx)
@@ -254,7 +254,7 @@ static int pkcs8_open(void *ctx, const char *config)
 
        handle->dir_name = path;
 
-       return DNSSEC_EOK;
+       return KNOT_EOK;
 }
 
 static int pkcs8_close(void *ctx)
@@ -268,7 +268,7 @@ static int pkcs8_close(void *ctx)
        free(handle->dir_name);
        memset(handle, 0, sizeof(*handle));
 
-       return DNSSEC_EOK;
+       return KNOT_EOK;
 }
 
 static int pkcs8_generate_key(void *ctx, gnutls_pk_algorithm_t algorithm,
@@ -287,7 +287,7 @@ static int pkcs8_generate_key(void *ctx, gnutls_pk_algorithm_t algorithm,
        char *id = NULL;
        _cleanup_binary_ dnssec_binary_t pem = { 0 };
        int r = pem_generate(algorithm, bits, &pem, &id);
-       if (r != DNSSEC_EOK) {
+       if (r != KNOT_EOK) {
                return r;
        }
 
@@ -295,9 +295,9 @@ static int pkcs8_generate_key(void *ctx, gnutls_pk_algorithm_t algorithm,
 
        _cleanup_close_ int file = -1;
        r = key_open_write(handle->dir_name, id, &file);
-       if (r != DNSSEC_EOK) {
+       if (r != KNOT_EOK) {
                if (key_is_duplicate(r, handle, id, &pem)) {
-                       return DNSSEC_EOK;
+                       return KNOT_EOK;
                }
                return r;
        }
@@ -315,7 +315,7 @@ static int pkcs8_generate_key(void *ctx, gnutls_pk_algorithm_t algorithm,
 
        *id_ptr = id;
 
-       return DNSSEC_EOK;
+       return KNOT_EOK;
 }
 
 static int pkcs8_import_key(void *ctx, const dnssec_binary_t *pem, char **id_ptr)
@@ -331,12 +331,12 @@ static int pkcs8_import_key(void *ctx, const dnssec_binary_t *pem, char **id_ptr
        char *id = NULL;
        _cleanup_x509_privkey_ gnutls_x509_privkey_t key = NULL;
        int r = dnssec_pem_to_x509(pem, &key);
-       if (r != DNSSEC_EOK) {
+       if (r != KNOT_EOK) {
                return r;
        }
 
        r = keyid_x509_hex(key, &id);
-       if (r != DNSSEC_EOK) {
+       if (r != KNOT_EOK) {
                return r;
        }
 
@@ -344,10 +344,10 @@ static int pkcs8_import_key(void *ctx, const dnssec_binary_t *pem, char **id_ptr
 
        _cleanup_close_ int file = -1;
        r = key_open_write(handle->dir_name, id, &file);
-       if (r != DNSSEC_EOK) {
+       if (r != KNOT_EOK) {
                if (key_is_duplicate(r, handle, id, pem)) {
                        *id_ptr = id;
-                       return DNSSEC_EOK;
+                       return KNOT_EOK;
                }
                free(id);
                return r;
@@ -367,7 +367,7 @@ static int pkcs8_import_key(void *ctx, const dnssec_binary_t *pem, char **id_ptr
 
        *id_ptr = id;
 
-       return DNSSEC_EOK;
+       return KNOT_EOK;
 }
 
 static int pkcs8_remove_key(void *ctx, const char *id)
@@ -387,7 +387,7 @@ static int pkcs8_remove_key(void *ctx, const char *id)
                return dnssec_errno_to_error(errno);
        }
 
-       return DNSSEC_EOK;
+       return KNOT_EOK;
 }
 
 static int pkcs8_get_private(void *ctx, const char *id, gnutls_privkey_t *key_ptr)
@@ -402,13 +402,13 @@ static int pkcs8_get_private(void *ctx, const char *id, gnutls_privkey_t *key_pt
 
        _cleanup_close_ int file = -1;
        int r = key_open_read(handle->dir_name, id, &file);
-       if (r != DNSSEC_EOK) {
+       if (r != KNOT_EOK) {
                return r;
        }
 
        size_t size = 0;
        r = file_size(file, &size);
-       if (r != DNSSEC_EOK) {
+       if (r != KNOT_EOK) {
                return r;
        }
 
@@ -420,7 +420,7 @@ static int pkcs8_get_private(void *ctx, const char *id, gnutls_privkey_t *key_pt
 
        _cleanup_binary_ dnssec_binary_t pem = { 0 };
        r = dnssec_binary_alloc(&pem, size);
-       if (r != DNSSEC_EOK) {
+       if (r != KNOT_EOK) {
                return r;
        }
 
@@ -436,7 +436,7 @@ static int pkcs8_get_private(void *ctx, const char *id, gnutls_privkey_t *key_pt
 
        gnutls_privkey_t key = NULL;
        r = dnssec_pem_to_privkey(&pem, &key);
-       if (r != DNSSEC_EOK) {
+       if (r != KNOT_EOK) {
                return r;
        }
 
@@ -444,7 +444,7 @@ static int pkcs8_get_private(void *ctx, const char *id, gnutls_privkey_t *key_pt
 
        *key_ptr = key;
 
-       return DNSSEC_EOK;
+       return KNOT_EOK;
 }
 
 static int pkcs8_set_private(void *ctx, gnutls_privkey_t key)
@@ -455,7 +455,7 @@ static int pkcs8_set_private(void *ctx, gnutls_privkey_t key)
 
        _cleanup_binary_ dnssec_binary_t pem = { 0 };
        int r = dnssec_pem_from_privkey(key, &pem);
-       if (r != DNSSEC_EOK) {
+       if (r != KNOT_EOK) {
                return r;
        }
 
index 5cd565f17a90bc52441788c5874dcd192c5c8575..ca9731b1bc7e7a9d6aecf6c3cb19bf18fe6d7790 100644 (file)
@@ -26,7 +26,7 @@
  * \param[in]  rdata   DNSKEY RDATA.
  * \param[out] keytag  Computed keytag.
  *
- * \return Error code, DNSSEC_EOK of successful.
+ * \return Error code, KNOT_EOK of successful.
  */
 int dnssec_keytag(const dnssec_binary_t *rdata, uint16_t *keytag);
 
index f50b42992faaccb02bf6f386d403a677391aa8bd..f4414c65d321d508a985c28e644c03dcab596795 100644 (file)
@@ -53,7 +53,7 @@ void dnssec_nsec3_params_free(dnssec_nsec3_params_t *params);
  * \param params  Output parameters.
  * \param rdata   NSEC3PARAM RDATA.
  *
- * \return Error code, DNSSEC_EOK if successful.
+ * \return Error code, KNOT_EOK if successful.
  */
 int dnssec_nsec3_params_from_rdata(dnssec_nsec3_params_t *params,
                                   const dnssec_binary_t *rdata);
@@ -89,7 +89,7 @@ bool dnssec_nsec_bitmap_contains(const uint8_t *bitmap, uint16_t size, uint16_t
  * \param[in]  params  NSEC3 parameters.
  * \param[out] hash    Computed hash (will be allocated or resized).
  *
- * \return Error code, DNSSEC_EOK if successful.
+ * \return Error code, KNOT_EOK if successful.
  */
 int dnssec_nsec3_hash(const dnssec_binary_t *data,
                      const dnssec_nsec3_params_t *params,
index a21e8d083744c60d5cfdeb575fac59b69abd9da7..b05ab59380045a886941204bb69f20137449ae71 100644 (file)
@@ -33,7 +33,7 @@ static int nsec3_hash(gnutls_digest_algorithm_t algorithm, int iterations,
        }
 
        int result = dnssec_binary_resize(hash, hash_size);
-       if (result != DNSSEC_EOK) {
+       if (result != KNOT_EOK) {
                return result;
        }
 
@@ -63,7 +63,7 @@ static int nsec3_hash(gnutls_digest_algorithm_t algorithm, int iterations,
                in_size = hash->size;
        }
 
-       return DNSSEC_EOK;
+       return KNOT_EOK;
 }
 
 /*!
index 21a9a3757891ae0b4f0a6b1f5a0ebbe227e39f88..5debf382b62883ac68272232126ce00beb621873 100644 (file)
@@ -64,7 +64,7 @@ int dnssec_nsec3_params_from_rdata(dnssec_nsec3_params_t *params,
 
        *params = new_params;
 
-       return DNSSEC_EOK;
+       return KNOT_EOK;
 }
 
 _public_
index 75a20ec1f3f6a304c7248f51808a4b5c1f8b7e15..c0571fd38f2ae0cf54dd481a82afc875915d2e60 100644 (file)
@@ -20,7 +20,7 @@ static int pkcs11_modules_count = 0;
 
 static int map_result(int gnutls_result)
 {
-       return gnutls_result == GNUTLS_E_SUCCESS ? DNSSEC_EOK : DNSSEC_ERROR;
+       return gnutls_result == GNUTLS_E_SUCCESS ? KNOT_EOK : DNSSEC_ERROR;
 }
 
 int p11_init(void)
@@ -39,7 +39,7 @@ int p11_load_module(const char *module)
 {
        for (int i = 0; i < pkcs11_modules_count; i++) {
                if (strcmp(pkcs11_modules[i], module) == 0) {
-                       return DNSSEC_EOK;
+                       return KNOT_EOK;
                }
        }
 
@@ -62,7 +62,7 @@ int p11_load_module(const char *module)
        pkcs11_modules[pkcs11_modules_count] = copy;
        pkcs11_modules_count += 1;
 
-       return DNSSEC_EOK;
+       return KNOT_EOK;
 }
 
 void p11_cleanup(void)
@@ -81,12 +81,12 @@ void p11_cleanup(void)
 
 int p11_init(void)
 {
-       return DNSSEC_EOK;
+       return KNOT_EOK;
 }
 
 int p11_reinit(void)
 {
-       return DNSSEC_EOK;
+       return KNOT_EOK;
 }
 
 int p11_load_module(const char *module)
index f273b7306af44322caa719afaa38efed67e69f7d..2c95539cffd89e6df0265f8cf6195005182310fd 100644 (file)
@@ -40,7 +40,7 @@ int dnssec_pem_to_x509(const dnssec_binary_t *pem, gnutls_x509_privkey_t *key)
 
        *key = _key;
 
-       return DNSSEC_EOK;
+       return KNOT_EOK;
 }
 
 _public_
@@ -52,7 +52,7 @@ int dnssec_pem_to_privkey(const dnssec_binary_t *pem, gnutls_privkey_t *key)
 
        gnutls_x509_privkey_t key_x509 = NULL;
        int r = dnssec_pem_to_x509(pem, &key_x509);
-       if (r != DNSSEC_EOK) {
+       if (r != KNOT_EOK) {
                return r;
        }
 
@@ -73,7 +73,7 @@ int dnssec_pem_to_privkey(const dnssec_binary_t *pem, gnutls_privkey_t *key)
 
        *key = key_abs;
 
-       return DNSSEC_EOK;
+       return KNOT_EOK;
 }
 
 static int try_export_pem(gnutls_x509_privkey_t key, dnssec_binary_t *pem)
@@ -102,7 +102,7 @@ int dnssec_pem_from_x509(gnutls_x509_privkey_t key, dnssec_binary_t *pem)
        }
 
        r = dnssec_binary_alloc(&_pem, _pem.size);
-       if (r != DNSSEC_EOK) {
+       if (r != KNOT_EOK) {
                return r;
        }
 
@@ -114,7 +114,7 @@ int dnssec_pem_from_x509(gnutls_x509_privkey_t key, dnssec_binary_t *pem)
 
        *pem = _pem;
 
-       return DNSSEC_EOK;
+       return KNOT_EOK;
 }
 
 static int privkey_export_x509(gnutls_privkey_t key, gnutls_x509_privkey_t *_key)
@@ -123,7 +123,7 @@ static int privkey_export_x509(gnutls_privkey_t key, gnutls_x509_privkey_t *_key
                return DNSSEC_KEY_EXPORT_ERROR;
        }
 
-       return DNSSEC_EOK;
+       return KNOT_EOK;
 }
 
 _public_
@@ -136,17 +136,17 @@ int dnssec_pem_from_privkey(gnutls_privkey_t key, dnssec_binary_t *pem)
        _cleanup_x509_privkey_ gnutls_x509_privkey_t _key = NULL;
 
        int r = privkey_export_x509(key, &_key);
-       if (r != DNSSEC_EOK) {
+       if (r != KNOT_EOK) {
                return r;
        }
 
        dnssec_binary_t _pem = { 0 };
        r = dnssec_pem_from_x509(_key, &_pem);
-       if (r != DNSSEC_EOK) {
+       if (r != KNOT_EOK) {
                return r;
        }
 
        *pem = _pem;
 
-       return DNSSEC_EOK;
+       return KNOT_EOK;
 }
index 3cb0cc32821976cb1a5a8bfd62c36d9e70373afb..94ba63f0ffa70b3759e1b633446c1aff993c2c05 100644 (file)
@@ -25,7 +25,7 @@
  * \param[in]  pem  PEM binary data.
  * \param[out] key  Resulting private key.
  *
- * \return Error code, DNSSEC_EOK if successful.
+ * \return Error code, KNOT_EOK if successful.
  */
 int dnssec_pem_to_x509(const dnssec_binary_t *pem, gnutls_x509_privkey_t *key);
 
@@ -35,7 +35,7 @@ int dnssec_pem_to_x509(const dnssec_binary_t *pem, gnutls_x509_privkey_t *key);
  * \param[in]  pem  PEM binary data.
  * \param[out] key  Resulting private key.
  *
- * \return Error code, DNSSEC_EOK if successful.
+ * \return Error code, KNOT_EOK if successful.
  */
 int dnssec_pem_to_privkey(const dnssec_binary_t *pem, gnutls_privkey_t *key);
 
@@ -45,7 +45,7 @@ int dnssec_pem_to_privkey(const dnssec_binary_t *pem, gnutls_privkey_t *key);
  * \param[in]  key  Key to be exported.
  * \param[out] pem  Generated key in unencrypted PEM format.
  *
- * \return Error code, DNSSEC_EOK if successful.
+ * \return Error code, KNOT_EOK if successful.
  */
 int dnssec_pem_from_x509(gnutls_x509_privkey_t key, dnssec_binary_t *pem);
 
@@ -55,7 +55,7 @@ int dnssec_pem_from_x509(gnutls_x509_privkey_t key, dnssec_binary_t *pem);
  * \param[in]  key  Key to be exported.
  * \param[out] pem  Generated key in unencrypted PEM format.
  *
- * \return Error code, DNSSEC_EOK if successful.
+ * \return Error code, KNOT_EOK if successful.
  */
 int dnssec_pem_from_privkey(gnutls_privkey_t key, dnssec_binary_t *pem);
 
index 82f752d677c3261c52531ad3a2746230784620f2..4c50c194d4b11a99dd0056134fbe31222ba8477d 100644 (file)
@@ -28,7 +28,7 @@ int dnssec_random_buffer(uint8_t *data, size_t size)
                return DNSSEC_ERROR;
        }
 
-       return DNSSEC_EOK;
+       return KNOT_EOK;
 }
 
 _public_
index 632ce878023621de76b285f84e89eb6b34babc82..3809d29fb52ac9858965db5428a02675054bf209 100644 (file)
@@ -26,7 +26,7 @@
  * \param data  Pointer to the output buffer.
  * \param size  Size of the output buffer.
  *
- * \return Error code, DNSSEC_EOK if successful.
+ * \return Error code, KNOT_EOK if successful.
  */
 int dnssec_random_buffer(uint8_t *data, size_t size);
 
@@ -35,7 +35,7 @@ int dnssec_random_buffer(uint8_t *data, size_t size);
  *
  * \param data  Preallocated binary structure to be filled.
  *
- * \return Error code, DNSSEC_EOK if successful.
+ * \return Error code, KNOT_EOK if successful.
  */
 int dnssec_random_binary(dnssec_binary_t *data);
 
index 563989bc67d122ea15ef474fb812d108a67257ca..42ea122d5f9f589934cf50e5c68ce49e131e406f 100644 (file)
@@ -39,13 +39,13 @@ static int keyid_bin(gnutls_x509_privkey_t key, gnutls_pubkey_t pubkey, dnssec_b
 
        assert(size == DNSSEC_KEYID_BINARY_SIZE);
        r = dnssec_binary_resize(id, size);
-       if (r != DNSSEC_EOK) {
+       if (r != KNOT_EOK) {
                return r;
        }
 
        memcpy(id->data, buffer, size);
 
-       return DNSSEC_EOK;
+       return KNOT_EOK;
 }
 
 /*!
@@ -55,7 +55,7 @@ static int keyid_hex(gnutls_x509_privkey_t key, gnutls_pubkey_t pubkey, char **i
 {
        _cleanup_binary_ dnssec_binary_t bin = { 0 };
        int r = keyid_bin(key, pubkey, &bin);
-       if (r != DNSSEC_EOK) {
+       if (r != KNOT_EOK) {
                return r;
        }
 
@@ -64,7 +64,7 @@ static int keyid_hex(gnutls_x509_privkey_t key, gnutls_pubkey_t pubkey, char **i
                return DNSSEC_ENOMEM;
        }
 
-       return DNSSEC_EOK;
+       return KNOT_EOK;
 }
 
 int keyid_x509(gnutls_x509_privkey_t key, dnssec_binary_t *id)
index f7d7279aeaf43b5b57fd544df9b107f8c911fc5c..f1f4f001b40636cec474286cd2d69039aa7de7e1 100644 (file)
@@ -43,7 +43,7 @@ typedef struct dnssec_sign_ctx dnssec_sign_ctx_t;
  * \param ctx_ptr  Pointer to context to be allocated.
  * \param key      DNSSEC key to be used.
  *
- * \return Error code, DNSSEC_EOK if successful.
+ * \return Error code, KNOT_EOK if successful.
  */
 int dnssec_sign_new(dnssec_sign_ctx_t **ctx_ptr, const dnssec_key_t *key);
 
@@ -59,7 +59,7 @@ void dnssec_sign_free(dnssec_sign_ctx_t *ctx);
  *
  * \param ctx  Signing context.
  *
- * \return Error code, DNSSEC_EOK if successful.
+ * \return Error code, KNOT_EOK if successful.
  */
 int dnssec_sign_init(dnssec_sign_ctx_t *ctx);
 
@@ -69,7 +69,7 @@ int dnssec_sign_init(dnssec_sign_ctx_t *ctx);
  * \param ctx   Signing context.
  * \param data  Data to be signed.
  *
- * \return Error code, DNSSEC_EOK if successful.
+ * \return Error code, KNOT_EOK if successful.
  */
 int dnssec_sign_add(dnssec_sign_ctx_t *ctx, const dnssec_binary_t *data);
 
@@ -80,7 +80,7 @@ int dnssec_sign_add(dnssec_sign_ctx_t *ctx, const dnssec_binary_t *data);
  * \param flags      Additional flags to be used for signing.
  * \param signature  Signature to be allocated and written.
  *
- * \return Error code, DNSSEC_EOK if successful.
+ * \return Error code, KNOT_EOK if successful.
  */
 int dnssec_sign_write(dnssec_sign_ctx_t *ctx, dnssec_sign_flags_t flags,
                       dnssec_binary_t *signature);
@@ -94,7 +94,7 @@ int dnssec_sign_write(dnssec_sign_ctx_t *ctx, dnssec_sign_flags_t flags,
  * \param signature  Signature to be verified.
  *
  * \return Error code.
- * \retval DNSSEC_EOK                Validation successful, valid signature.
+ * \retval KNOT_EOK                Validation successful, valid signature.
  * \retval DNSSEC_INVALID_SIGNATURE  Validation successful, invalid signature.
  */
 int dnssec_sign_verify(dnssec_sign_ctx_t *ctx, bool sign_cmp,
index 4c00742edec723750e17546a756072964ed37fd7..11ef0647bff3a4b61f990f8f7f7000f3d578a07e 100644 (file)
@@ -54,7 +54,7 @@ static int asn1_decode_size(wire_ctx_t *wire, size_t *size)
 
        *size = byte;
 
-       return DNSSEC_EOK;
+       return KNOT_EOK;
 }
 
 /*!
@@ -71,7 +71,7 @@ static int asn1_decode_integer(wire_ctx_t *wire, dnssec_binary_t *_value)
 
        size_t size;
        int result = asn1_decode_size(wire, &size);
-       if (result != DNSSEC_EOK) {
+       if (result != KNOT_EOK) {
                return result;
        }
 
@@ -90,7 +90,7 @@ static int asn1_decode_integer(wire_ctx_t *wire, dnssec_binary_t *_value)
 
        *_value = value;
 
-       return DNSSEC_EOK;
+       return KNOT_EOK;
 }
 
 /*!
@@ -141,7 +141,7 @@ int dss_sig_value_decode(const dnssec_binary_t *der,
        }
 
        result = asn1_decode_size(&wire, &size);
-       if (result != DNSSEC_EOK) {
+       if (result != KNOT_EOK) {
                return result;
        }
 
@@ -153,13 +153,13 @@ int dss_sig_value_decode(const dnssec_binary_t *der,
 
        dnssec_binary_t der_r;
        result = asn1_decode_integer(&wire, &der_r);
-       if (result != DNSSEC_EOK) {
+       if (result != KNOT_EOK) {
                return result;
        }
 
        dnssec_binary_t der_s;
        result = asn1_decode_integer(&wire, &der_s);
-       if (result != DNSSEC_EOK) {
+       if (result != KNOT_EOK) {
                return result;
        }
 
@@ -170,7 +170,7 @@ int dss_sig_value_decode(const dnssec_binary_t *der,
        *r = der_r;
        *s = der_s;
 
-       return DNSSEC_EOK;
+       return KNOT_EOK;
 }
 
 /*!
@@ -214,5 +214,5 @@ int dss_sig_value_encode(const dnssec_binary_t *r, const dnssec_binary_t *s,
 
        *der = _der;
 
-       return DNSSEC_EOK;
+       return KNOT_EOK;
 }
index 6adb566f31d44468ebf7421664add3d8d8e2fd54..73473eedc61efab9fcc7bfe92aaa5e054b1472bd 100644 (file)
@@ -27,7 +27,7 @@
  * \param[out] s    Value 's' of the signature, will point to the data in DER.
  * \param[out] r    Value 'r' of the signature, will point to the data in DER.
  *
- * \return Error code, DNSSEC_EOK if successful.
+ * \return Error code, KNOT_EOK if successful.
  */
 int dss_sig_value_decode(const dnssec_binary_t *der,
                         dnssec_binary_t *r, dnssec_binary_t *s);
@@ -39,7 +39,7 @@ int dss_sig_value_decode(const dnssec_binary_t *der,
  * \param[in]  r    Value 'r' of the signature.
  * \param[out] der  X.509 signature, the content will be allocated.
  *
- * \return Error code, DNSSEC_EOK if successful.
+ * \return Error code, KNOT_EOK if successful.
  */
 int dss_sig_value_encode(const dnssec_binary_t *r, const dnssec_binary_t *s,
                         dnssec_binary_t *der);
index 0c33233cda4cae7a4418d4ca013fbd5c61216106..b016fb923f8c8c23409ea99a4a7081e65f41f50b 100644 (file)
@@ -27,7 +27,7 @@
  * \param from  Data in source format.
  * \param to    Allocated data in target format.
  *
- * \return Error code, DNSSEC_EOK if successful.
+ * \return Error code, KNOT_EOK if successful.
  */
 typedef int (*signature_convert_cb)(dnssec_sign_ctx_t *ctx,
                                    const dnssec_binary_t *from,
@@ -112,7 +112,7 @@ static int ecdsa_x509_to_dnssec(dnssec_sign_ctx_t *ctx,
        dnssec_binary_t value_s = { 0 };
 
        int result = dss_sig_value_decode(x509, &value_r, &value_s);
-       if (result != DNSSEC_EOK) {
+       if (result != KNOT_EOK) {
                return result;
        }
 
@@ -125,7 +125,7 @@ static int ecdsa_x509_to_dnssec(dnssec_sign_ctx_t *ctx,
        }
 
        result = dnssec_binary_alloc(dnssec, 2 * int_size);
-       if (result != DNSSEC_EOK) {
+       if (result != KNOT_EOK) {
                return result;
        }
 
@@ -134,7 +134,7 @@ static int ecdsa_x509_to_dnssec(dnssec_sign_ctx_t *ctx,
        bignum_write(&wire, int_size, &value_s);
        assert(wire_ctx_offset(&wire) == dnssec->size);
 
-       return DNSSEC_EOK;
+       return KNOT_EOK;
 }
 
 static int ecdsa_dnssec_to_x509(dnssec_sign_ctx_t *ctx,
@@ -245,14 +245,14 @@ int dnssec_sign_new(dnssec_sign_ctx_t **ctx_ptr, const dnssec_key_t *key)
        const uint8_t algo_raw = dnssec_key_get_algorithm(key);
        ctx->sign_algorithm = algo_dnssec2gnutls((dnssec_key_algorithm_t)algo_raw);
        int result = dnssec_sign_init(ctx);
-       if (result != DNSSEC_EOK) {
+       if (result != KNOT_EOK) {
                free(ctx);
                return result;
        }
 
        *ctx_ptr = ctx;
 
-       return DNSSEC_EOK;
+       return KNOT_EOK;
 }
 
 _public_
@@ -280,7 +280,7 @@ int dnssec_sign_init(dnssec_sign_ctx_t *ctx)
                vpool_init(&ctx->buffer, 1024, 0);
        }
 
-       return DNSSEC_EOK;
+       return KNOT_EOK;
 }
 
 _public_
@@ -295,7 +295,7 @@ int dnssec_sign_add(dnssec_sign_ctx_t *ctx, const dnssec_binary_t *data)
                return DNSSEC_SIGN_ERROR;
        }
 
-       return DNSSEC_EOK;
+       return KNOT_EOK;
 }
 
 _public_
@@ -346,7 +346,7 @@ int dnssec_sign_verify(dnssec_sign_ctx_t *ctx, bool sign_cmp, const dnssec_binar
                if (ret == KNOT_EOK) {
                        ret = dnssec_binary_cmp(&sign, signature)
                              ? DNSSEC_INVALID_SIGNATURE
-                             : DNSSEC_EOK;
+                             : KNOT_EOK;
                }
                dnssec_binary_free(&sign);
                return ret;
@@ -363,7 +363,7 @@ int dnssec_sign_verify(dnssec_sign_ctx_t *ctx, bool sign_cmp, const dnssec_binar
 
        _cleanup_binary_ dnssec_binary_t bin_raw = { 0 };
        int result = ctx->functions->dnssec_to_x509(ctx, signature, &bin_raw);
-       if (result != DNSSEC_EOK) {
+       if (result != KNOT_EOK) {
                return result;
        }
 
@@ -379,5 +379,5 @@ int dnssec_sign_verify(dnssec_sign_ctx_t *ctx, bool sign_cmp, const dnssec_binar
                return DNSSEC_ERROR;
        }
 
-       return DNSSEC_EOK;
+       return KNOT_EOK;
 }
index dc246d73f0175ed5ddccc40ae69eed2084f7a349..af70d91e234509839f70c8df250b06baee9c96b6 100644 (file)
@@ -172,7 +172,7 @@ int dnssec_tsig_new(dnssec_tsig_ctx_t **ctx_ptr,
 
        *ctx_ptr = ctx;
 
-       return DNSSEC_EOK;
+       return KNOT_EOK;
 }
 
 _public_
@@ -198,7 +198,7 @@ int dnssec_tsig_add(dnssec_tsig_ctx_t *ctx, const dnssec_binary_t *data)
                return DNSSEC_SIGN_ERROR;
        }
 
-       return DNSSEC_EOK;
+       return KNOT_EOK;
 }
 
 _public_
@@ -227,5 +227,5 @@ int dnssec_tsig_write(dnssec_tsig_ctx_t *ctx, uint8_t *mac)
 
        gnutls_hmac_output(ctx->hash, mac);
 
-       return DNSSEC_EOK;
+       return KNOT_EOK;
 }
index debf62268f5c7af4663b1decf3b5d5cd7e3a597e..7f24c1800d981953d1ff709bae78166685721448 100644 (file)
@@ -91,7 +91,7 @@ typedef struct dnssec_tsig_ctx dnssec_tsig_ctx_t;
  * \param[in]  algorithm  TSIG algorithm.
  * \param[in]  key        Shared key to be used for signing.
  *
- * \return Error code, DNSSEC_EOK if successful.
+ * \return Error code, KNOT_EOK if successful.
  */
 int dnssec_tsig_new(dnssec_tsig_ctx_t **ctx, dnssec_tsig_algorithm_t algorithm,
                    const dnssec_binary_t *key);
@@ -109,7 +109,7 @@ void dnssec_tsig_free(dnssec_tsig_ctx_t *ctx);
  * \param ctx   TSIG signing context.
  * \param data  Data to be signed.
  *
- * \return Error code, DNSSEC_EOK if successful.
+ * \return Error code, KNOT_EOK if successful.
  */
 int dnssec_tsig_add(dnssec_tsig_ctx_t *ctx, const dnssec_binary_t *data);
 
@@ -137,7 +137,7 @@ size_t dnssec_tsig_algorithm_size(dnssec_tsig_algorithm_t algorithm);
  * \param[in]  ctx  TSIG signing context.
  * \param[out] mac  Resulting TSIG signature.
  *
- * \return Error code, DNSSEC_EOK if successful.
+ * \return Error code, KNOT_EOK if successful.
  */
 int dnssec_tsig_write(dnssec_tsig_ctx_t *ctx, uint8_t *mac);
 
index 3a6a6635d4e98df42f79094a4e6fb32bd3dcf04b..a7ec83c3722d792b63d25f96eff642f7a52bdc88 100644 (file)
@@ -224,7 +224,7 @@ static void init_random_cid(ngtcp2_cid *cid, size_t len)
                len = SERVER_DEFAULT_SCIDLEN;
        }
 
-       if (dnssec_random_buffer(cid->data, len) != DNSSEC_EOK) {
+       if (dnssec_random_buffer(cid->data, len) != KNOT_EOK) {
                cid->datalen = 0;
        } else {
                cid->datalen = len;
@@ -530,7 +530,7 @@ static int conn_new(ngtcp2_conn **pconn, const ngtcp2_path *path, const ngtcp2_c
                params.retry_scid_present = 1;
                params.retry_scid = *scid;
        }
-       if (dnssec_random_buffer(params.stateless_reset_token, NGTCP2_STATELESS_RESET_TOKENLEN) != DNSSEC_EOK) {
+       if (dnssec_random_buffer(params.stateless_reset_token, NGTCP2_STATELESS_RESET_TOKENLEN) != KNOT_EOK) {
                return KNOT_ERROR;
        }
 
index cdd0c5c55fbe0e0650b39da89303ae4738f63318..491b1996f5b298e032b5744f836e0f8e2a6332a4 100644 (file)
@@ -74,8 +74,8 @@ static int compute_digest(const uint8_t *wire, size_t wire_len,
        }
 
        dnssec_tsig_ctx_t *ctx = NULL;
-       int result = dnssec_tsig_new(&ctx, key->algorithm, &key->secret);
-       if (result != DNSSEC_EOK) {
+       int ret = dnssec_tsig_new(&ctx, key->algorithm, &key->secret);
+       if (ret != KNOT_EOK) {
                return KNOT_TSIG_EBADSIG;
        }
 
index f8d3ddfe44b1bdf1f5723d97d4909d9f3dcaa44f..7d9798995fe59a89242767cbd89a55c7a12b6adf 100644 (file)
@@ -166,7 +166,7 @@ int knot_tsig_key_copy(knot_tsig_key_t *dst, const knot_tsig_key_t *src)
                return KNOT_ENOMEM;
        }
 
-       if (dnssec_binary_dup(&src->secret, &copy.secret) != DNSSEC_EOK) {
+       if (dnssec_binary_dup(&src->secret, &copy.secret) != KNOT_EOK) {
                knot_tsig_key_deinit(&copy);
                return KNOT_ENOMEM;
        }
index 487f0b0c5ef3bc11afd82f9bb47d5b6b2cba344b..31294612ccb54c711f78b0a31513b0c633e44a80 100644 (file)
@@ -162,7 +162,7 @@ static int get_new_connection_id_cb(ngtcp2_conn *conn, ngtcp2_cid *cid,
 
        quic_ctx_t *ctx = (quic_ctx_t *)user_data;
 
-       if (dnssec_random_buffer(cid->data, cidlen) != DNSSEC_EOK) {
+       if (dnssec_random_buffer(cid->data, cidlen) != KNOT_EOK) {
                return NGTCP2_ERR_CALLBACK_FAILURE;
        }
        cid->datalen = cidlen;
@@ -403,7 +403,7 @@ int quic_generate_secret(uint8_t *buf, size_t buflen)
        assert(buf != NULL && buflen > 0 && buflen <= 32);
        uint8_t rand[16], hash[32];
        int ret = dnssec_random_buffer(rand, sizeof(rand));
-       if (ret != DNSSEC_EOK) {
+       if (ret != KNOT_EOK) {
                return KNOT_ERROR;
        }
        ret = gnutls_hash_fast(GNUTLS_DIG_SHA256, rand, sizeof(rand), hash);
@@ -475,12 +475,12 @@ int quic_ctx_connect(quic_ctx_t *ctx, int sockfd, struct addrinfo *dst_addr)
        ngtcp2_cid dcid, scid;
        scid.datalen = NGTCP2_MAX_CIDLEN;
        int ret = dnssec_random_buffer(scid.data, scid.datalen);
-       if (ret != DNSSEC_EOK) {
+       if (ret != KNOT_EOK) {
                return ret;
        }
        dcid.datalen = 18;
        ret = dnssec_random_buffer(dcid.data, dcid.datalen);
-       if (ret != DNSSEC_EOK) {
+       if (ret != KNOT_EOK) {
                return ret;
        }
 
index 5b7b83e53a54cc3c7f78c85ab4357287d122079b..89de75fe5df55452e65e94b9c2aa44516e3e34a5 100644 (file)
@@ -1077,7 +1077,7 @@ static int opt_cookie(const char *arg, void *query)
                q->cc.len = KNOT_EDNS_COOKIE_CLNT_SIZE;
 
                int ret = dnssec_random_buffer(q->cc.data, q->cc.len);
-               if (ret != DNSSEC_EOK) {
+               if (ret != KNOT_EOK) {
                        return knot_error_from_libdnssec(ret);
                }
        }
index 104cf7b81bf4b72502d41fd980c7cf1699ca53bc..05e1a2d962d491069f7dbef545926799bdbb2dc3 100644 (file)
@@ -80,7 +80,7 @@ static int parse_algorithm(char *string, void *_algorithm)
        uint8_t *algorithm = _algorithm;
        int r = str_to_u8(string, algorithm);
 
-       return (r == KNOT_EOK ? DNSSEC_EOK : DNSSEC_INVALID_KEY_ALGORITHM);
+       return (r == KNOT_EOK ? KNOT_EOK : DNSSEC_INVALID_KEY_ALGORITHM);
 }
 
 /*!
@@ -118,7 +118,7 @@ static int parse_time(char *string, void *_time)
        time_t *time = _time;
        *time = timegm(&tm);
 
-       return DNSSEC_EOK;
+       return KNOT_EOK;
 }
 
 /* -- key parsing ---------------------------------------------------------- */
@@ -191,7 +191,7 @@ static int parse_line(bind_privkey_t *params, char *line, size_t length)
 
        // ignore unknown attributes
 
-       return DNSSEC_EOK;
+       return KNOT_EOK;
 }
 
 int bind_privkey_parse(const char *filename, bind_privkey_t *params_ptr)
@@ -208,7 +208,7 @@ int bind_privkey_parse(const char *filename, bind_privkey_t *params_ptr)
        ssize_t read = 0;
        while ((read = getline(&line, &size, file)) != -1) {
                int r = parse_line(&params, line, read);
-               if (r != DNSSEC_EOK) {
+               if (r != KNOT_EOK) {
                        bind_privkey_free(&params);
                        return r;
                }
@@ -216,7 +216,7 @@ int bind_privkey_parse(const char *filename, bind_privkey_t *params_ptr)
 
        *params_ptr = params;
 
-       return DNSSEC_EOK;
+       return KNOT_EOK;
 }
 
 /* -- freeing -------------------------------------------------------------- */
@@ -312,7 +312,7 @@ static int ecdsa_params_to_pem(dnssec_key_t *dnskey, const bind_privkey_t *param
        gnutls_datum_t k = binary_to_datum(&params->private_key);
 
        result = gnutls_x509_privkey_import_ecc_raw(key, curve, &x, &y, &k);
-       if (result != DNSSEC_EOK) {
+       if (result != KNOT_EOK) {
                return DNSSEC_KEY_IMPORT_ERROR;
        }
 
@@ -349,7 +349,7 @@ static int eddsa_params_to_pem(dnssec_key_t *dnskey, const bind_privkey_t *param
        gnutls_datum_t k = binary_to_datum(&params->private_key);
 
        result = gnutls_x509_privkey_import_ecc_raw(key, curve, &x, NULL, &k);
-       if (result != DNSSEC_EOK) {
+       if (result != KNOT_EOK) {
                return DNSSEC_KEY_IMPORT_ERROR;
        }
 
index cc3600050a0e7fb9d983d4e06540f28ecebb1345..479aba4187b6c0b3d607a2a3f0b437e922d9d937 100644 (file)
@@ -342,7 +342,7 @@ int bind_pubkey_parse(const char *filename, dnssec_key_t **key_ptr)
 {
        dnssec_key_t *key = NULL;
        int result = dnssec_key_new(&key);
-       if (result != DNSSEC_EOK) {
+       if (result != KNOT_EOK) {
                return KNOT_ENOMEM;
        }
 
@@ -440,13 +440,13 @@ int keymgr_import_bind(kdnssec_ctx_t *ctx, const char *import_file, bool pub_onl
 
                ret = bind_privkey_parse(privname, &bpriv);
                free(privname);
-               if (ret != DNSSEC_EOK) {
+               if (ret != KNOT_EOK) {
                        goto fail;
                }
 
                dnssec_binary_t pem = { 0 };
                ret = bind_privkey_to_pem(key, &bpriv, &pem);
-               if (ret != DNSSEC_EOK) {
+               if (ret != KNOT_EOK) {
                        bind_privkey_free(&bpriv);
                        goto fail;
                }
@@ -457,14 +457,14 @@ int keymgr_import_bind(kdnssec_ctx_t *ctx, const char *import_file, bool pub_onl
 
                ret = dnssec_keystore_import(keystore->keystore, &pem, &keyid);
                dnssec_binary_free(&pem);
-               if (ret != DNSSEC_EOK) {
+               if (ret != KNOT_EOK) {
                        goto fail;
                }
        } else {
                timing.publish = ctx->now;
 
                ret = dnssec_key_get_keyid(key, &keyid);
-               if (ret != DNSSEC_EOK) {
+               if (ret != KNOT_EOK) {
                        goto fail;
                }
        }
@@ -564,7 +564,7 @@ static int import_key(kdnssec_ctx_t *ctx, unsigned backend, const char *param,
                // alloc memory
                dnssec_binary_t pem = { 0 };
                ret = dnssec_binary_alloc(&pem, fsize);
-               if (ret != DNSSEC_EOK) {
+               if (ret != KNOT_EOK) {
                        close(fd);
                        err_import_key("", param);
                        goto fail;
@@ -583,7 +583,7 @@ static int import_key(kdnssec_ctx_t *ctx, unsigned backend, const char *param,
                // put pem to keystore
                ret = dnssec_keystore_import(keystore->keystore, &pem, &keyid);
                dnssec_binary_free(&pem);
-               if (ret != DNSSEC_EOK) {
+               if (ret != KNOT_EOK) {
                        err_import_key(keyid, param);
                        goto fail;
                }
@@ -594,11 +594,11 @@ static int import_key(kdnssec_ctx_t *ctx, unsigned backend, const char *param,
 
        // create dnssec key
        ret = dnssec_key_new(&key);
-       if (ret != DNSSEC_EOK) {
+       if (ret != KNOT_EOK) {
                goto fail;
        }
        ret = dnssec_key_set_dname(key, ctx->zone->dname);
-       if (ret != DNSSEC_EOK) {
+       if (ret != KNOT_EOK) {
                goto fail;
        }
        dnssec_key_set_flags(key, dnskey_flags(flags & DNSKEY_GENERATE_SEP_ON));
@@ -606,7 +606,7 @@ static int import_key(kdnssec_ctx_t *ctx, unsigned backend, const char *param,
 
        // fill key structure from keystore (incl. pubkey from privkey computation)
        ret = kdnssec_load_private(ctx->keystores, keyid, key, NULL, NULL);
-       if (ret != DNSSEC_EOK) {
+       if (ret != KNOT_EOK) {
                err_import_key(keyid, "");
                goto fail;
        }
@@ -779,7 +779,7 @@ int keymgr_generate_tsig(const char *tsig_name, const char *alg_name, int bits)
 
        _cleanup_binary_ dnssec_binary_t key = { 0 };
        int r = dnssec_binary_alloc(&key, bits / CHAR_BIT);
-       if (r != DNSSEC_EOK) {
+       if (r != KNOT_EOK) {
                ERR2("failed to allocate memory");
                return knot_error_from_libdnssec(r);
        }
@@ -792,7 +792,7 @@ int keymgr_generate_tsig(const char *tsig_name, const char *alg_name, int bits)
 
        _cleanup_binary_ dnssec_binary_t key_b64 = { 0 };
        r = dnssec_binary_to_base64(&key, &key_b64);
-       if (r != DNSSEC_EOK) {
+       if (r != KNOT_EOK) {
                ERR2("failed to convert the key to Base64");
                return knot_error_from_libdnssec(r);
        }
@@ -1081,8 +1081,8 @@ static key_info_t key_missing(kdnssec_ctx_t *ctx, const knot_kasp_key_t *key)
 {
        key_info_t out = { .ks_count = ctx->keystores[0].count };
        out.missing = !key->is_pub_only &&
-                     DNSSEC_EOK != kdnssec_load_private(ctx->keystores, key->id,
-                                                        key->key, &out.ks_name, &out.backend);
+                     KNOT_EOK != kdnssec_load_private(ctx->keystores, key->id,
+                                                      key->key, &out.ks_name, &out.backend);
        return out;
 }
 
@@ -1171,7 +1171,7 @@ static int create_and_print_ds(const knot_dname_t *zone_name,
 {
        _cleanup_binary_ dnssec_binary_t rdata = { 0 };
        int r = dnssec_key_create_ds(key, digest, &rdata);
-       if (r != DNSSEC_EOK) {
+       if (r != KNOT_EOK) {
                return knot_error_from_libdnssec(r);
        }
 
@@ -1208,7 +1208,7 @@ int keymgr_generate_dnskey(const knot_dname_t *dname, const knot_kasp_key_t *key
 
        dnssec_binary_t pubkey = { 0 };
        int ret = dnssec_key_get_pubkey(dnskey, &pubkey);
-       if (ret != DNSSEC_EOK) {
+       if (ret != KNOT_EOK) {
                free(name);
                return knot_error_from_libdnssec(ret);
        }
index d283ec4c955202ac8ab12be4a4a68cca4d08579b..43ecfcd941b3bb0952aed01f4b6fbdff3fa29ffe 100644 (file)
@@ -41,18 +41,18 @@ static int create_dnskeys(dnssec_keystore_t *keystore, const char *id,
                           dnssec_key_t **test_key_ptr, dnssec_key_t **ref_key_ptr)
 {
        dnssec_key_t *test_key = NULL;
-       if (dnssec_key_new(&test_key) != DNSSEC_EOK ||
-           dnssec_key_set_algorithm(test_key, algorithm) != DNSSEC_EOK ||
-           dnssec_keystore_get_private(keystore, id, test_key) != DNSSEC_EOK) {
+       if (dnssec_key_new(&test_key) != KNOT_EOK ||
+           dnssec_key_set_algorithm(test_key, algorithm) != KNOT_EOK ||
+           dnssec_keystore_get_private(keystore, id, test_key) != KNOT_EOK) {
                dnssec_key_free(test_key);
                return KNOT_ERROR;
        }
 
        dnssec_binary_t rdata;
        dnssec_key_t *ref_key = NULL;
-       if (dnssec_key_new(&ref_key) != DNSSEC_EOK ||
-           dnssec_key_get_rdata(test_key, &rdata) != DNSSEC_EOK ||
-           dnssec_key_set_rdata(ref_key, &rdata) != DNSSEC_EOK) {
+       if (dnssec_key_new(&ref_key) != KNOT_EOK ||
+           dnssec_key_get_rdata(test_key, &rdata) != KNOT_EOK ||
+           dnssec_key_set_rdata(ref_key, &rdata) != KNOT_EOK) {
                dnssec_key_free(test_key);
                dnssec_key_free(ref_key);
                return KNOT_ERROR;
@@ -74,17 +74,17 @@ static int test_sign(dnssec_key_t *test_key, dnssec_key_t *ref_key)
        dnssec_binary_t sign = { 0 };
 
        dnssec_sign_ctx_t *ctx = NULL;
-       if (dnssec_sign_new(&ctx, test_key) != DNSSEC_EOK ||
-           dnssec_sign_add(ctx, &input) != DNSSEC_EOK ||
-           dnssec_sign_write(ctx, DNSSEC_SIGN_NORMAL, &sign) != DNSSEC_EOK) {
+       if (dnssec_sign_new(&ctx, test_key) != KNOT_EOK ||
+           dnssec_sign_add(ctx, &input) != KNOT_EOK ||
+           dnssec_sign_write(ctx, DNSSEC_SIGN_NORMAL, &sign) != KNOT_EOK) {
                dnssec_binary_free(&sign);
                dnssec_sign_free(ctx);
                return KNOT_ERROR;
        }
 
-       if (dnssec_sign_init(ctx) != DNSSEC_EOK ||
-           dnssec_sign_add(ctx, &input) != DNSSEC_EOK ||
-           dnssec_sign_verify(ctx, false, &sign) != DNSSEC_EOK) {
+       if (dnssec_sign_init(ctx) != KNOT_EOK ||
+           dnssec_sign_add(ctx, &input) != KNOT_EOK ||
+           dnssec_sign_verify(ctx, false, &sign) != KNOT_EOK) {
                dnssec_binary_free(&sign);
                dnssec_sign_free(ctx);
                return KNOT_ERROR;
@@ -93,9 +93,9 @@ static int test_sign(dnssec_key_t *test_key, dnssec_key_t *ref_key)
        dnssec_sign_free(ctx);
        ctx = NULL;
 
-       if (dnssec_sign_new(&ctx, ref_key) != DNSSEC_EOK ||
-           dnssec_sign_add(ctx, &input) != DNSSEC_EOK ||
-           dnssec_sign_verify(ctx, false, &sign) != DNSSEC_EOK) {
+       if (dnssec_sign_new(&ctx, ref_key) != KNOT_EOK ||
+           dnssec_sign_add(ctx, &input) != KNOT_EOK ||
+           dnssec_sign_verify(ctx, false, &sign) != KNOT_EOK) {
                dnssec_binary_free(&sign);
                dnssec_sign_free(ctx);
                return KNOT_ERROR;
@@ -142,19 +142,19 @@ static void test_algorithm(dnssec_keystore_t *store,
        char *id = NULL;
        int ret = dnssec_keystore_generate(store, params->algorithm,
                                           params->bit_size, NULL, &id);
-       if (ret == DNSSEC_EOK) {
+       if (ret == KNOT_EOK) {
                res.generate = true;
 
                ret = test_key_use(store, id, params->algorithm);
                res.use = (ret == KNOT_EOK);
 
                ret = dnssec_keystore_remove(store, id);
-               res.remove = (ret == DNSSEC_EOK);
+               res.remove = (ret == KNOT_EOK);
                free(id);
        }
 
        ret = dnssec_keystore_import(store, &params->pem, &id);
-       if (ret == DNSSEC_EOK) {
+       if (ret == KNOT_EOK) {
                res.import = true;
 
                ret = test_key_use(store, id, params->algorithm);
@@ -166,9 +166,9 @@ static void test_algorithm(dnssec_keystore_t *store,
 
                ret = dnssec_keystore_remove(store, id);
                if (res.generate) {
-                       res.remove &= (ret == DNSSEC_EOK);
+                       res.remove &= (ret == KNOT_EOK);
                } else {
-                       res.remove = (ret == DNSSEC_EOK);
+                       res.remove = (ret == KNOT_EOK);
                }
                free(id);
        }
@@ -275,10 +275,10 @@ static int bench(dthread_t *dt)
        knot_spin_lock(&data->lock);
        int ret = dnssec_keystore_generate(store, params->algorithm,
                                           params->bit_size, NULL, &id);
-       if (ret != DNSSEC_EOK ||
-           dnssec_key_new(&test_key) != DNSSEC_EOK ||
-           dnssec_key_set_algorithm(test_key, params->algorithm) != DNSSEC_EOK ||
-           dnssec_keystore_get_private(store, id, test_key) != DNSSEC_EOK) {
+       if (ret != KNOT_EOK ||
+           dnssec_key_new(&test_key) != KNOT_EOK ||
+           dnssec_key_set_algorithm(test_key, params->algorithm) != KNOT_EOK ||
+           dnssec_keystore_get_private(store, id, test_key) != KNOT_EOK) {
                goto finish;
        }
        knot_spin_unlock(&data->lock);
@@ -296,9 +296,9 @@ static int bench(dthread_t *dt)
        while (result->time < BENCH_TIME) {
                dnssec_binary_t sign = { 0 };
                dnssec_sign_ctx_t *ctx = NULL;
-               if (dnssec_sign_new(&ctx, test_key) != DNSSEC_EOK ||
-                   dnssec_sign_add(ctx, &input) != DNSSEC_EOK ||
-                   dnssec_sign_write(ctx, DNSSEC_SIGN_NORMAL, &sign) != DNSSEC_EOK) {
+               if (dnssec_sign_new(&ctx, test_key) != KNOT_EOK ||
+                   dnssec_sign_add(ctx, &input) != KNOT_EOK ||
+                   dnssec_sign_write(ctx, DNSSEC_SIGN_NORMAL, &sign) != KNOT_EOK) {
                        dnssec_binary_free(&sign);
                        dnssec_sign_free(ctx);
                        result->time = 0;
index 9fa0abc5a7fc67963bfb0dc7b79be78e30802a73..8704286b52fef5c1544ec45132e03c6dc2ac63df 100644 (file)
@@ -38,10 +38,10 @@ static int str_to_salt(const char *str, dnssec_binary_t *salt)
 {
        if (strcmp(str, "-") == 0) {
                salt->size = 0;
-               return DNSSEC_EOK;
+               return KNOT_EOK;
        } else {
                salt->data = hex_to_bin(str, &salt->size);
-               return (salt->data != NULL ? DNSSEC_EOK : DNSSEC_EINVAL);
+               return (salt->data != NULL ? KNOT_EOK : DNSSEC_EINVAL);
        }
 }
 
@@ -67,7 +67,7 @@ static bool parse_nsec3_params(dnssec_nsec3_params_t *params, const char *salt_s
 
        dnssec_binary_t salt = { 0 };
        r = str_to_salt(salt_str, &salt);
-       if (r != DNSSEC_EOK) {
+       if (r != KNOT_EOK) {
                ERR2("invalid salt (%s)", knot_strerror(r));
                return false;
        }
@@ -148,7 +148,7 @@ int main(int argc, char *argv[])
        dname.size = knot_dname_size(dname.data);
 
        int r = dnssec_nsec3_hash(&dname, &nsec3_params, &digest);
-       if (r != DNSSEC_EOK) {
+       if (r != KNOT_EOK) {
                ERR2("cannot compute NSEC3 hash (%s)", knot_strerror(r));
                goto fail;
        }
index 9a88d3d6c5d3bf313aa6340f18c9db139b4cbd2b..70d378b4855eff2b41c965295ec56cb79de93a0e 100644 (file)
@@ -41,14 +41,14 @@ static void test_base64(void)
                dnssec_binary_t binary = { 0 };
 
                int r = dnssec_binary_from_base64(&base64, &binary);
-               ok(r == DNSSEC_EOK &&
+               ok(r == KNOT_EOK &&
                   binary.size == ts->decoded_size &&
                   (binary.size == 0 || memcmp(binary.data, ts->decoded, binary.size) == 0),
                   "dnssec_binary_from_base64() for '%s'", ts->encoded);
 
                dnssec_binary_t encoded = { 0 };
                r = dnssec_binary_to_base64(&binary, &encoded);
-               ok(r == DNSSEC_EOK &&
+               ok(r == KNOT_EOK &&
                   encoded.size == ts->encoded_size &&
                   memcmp(encoded.data, ts->encoded, encoded.size) == 0,
                   "dnssec_binary_to_base64() for '%s'", ts->encoded);
@@ -64,7 +64,7 @@ static void test_dup(void)
        dnssec_binary_t dst = { 0 };
 
        int r = dnssec_binary_dup(&src, &dst);
-       ok(r == DNSSEC_EOK &&
+       ok(r == KNOT_EOK &&
           src.size == dst.size && memcmp(src.data, dst.data, src.size) == 0,
           "dnssec_binary_dup()");
 
index 6e0d9a8b244f2600b003fd01d39295ca5a81b818..fb9a3336e2c43d6120e8b086c3a1aac8270cda23 100644 (file)
@@ -16,7 +16,7 @@
        type value = dnssec_key_get_##name(key); \
        ok(value == def_val, #name " default"); \
        r = dnssec_key_set_##name(key, set_val); \
-       ok(r == DNSSEC_EOK, #name " set"); \
+       ok(r == KNOT_EOK, #name " set"); \
        value = dnssec_key_get_##name(key); \
        ok(value == set_val, #name " get"); \
 }
@@ -45,7 +45,7 @@ static void test_public_key(const key_parameters_t *params)
 {
        dnssec_key_t *key = NULL;
        int r = dnssec_key_new(&key);
-       ok(r == DNSSEC_EOK && key != NULL, "create key");
+       ok(r == KNOT_EOK && key != NULL, "create key");
 
        // create from parameters
 
@@ -58,7 +58,7 @@ static void test_public_key(const key_parameters_t *params)
        check_attr_scalar(key, uint8_t,  algorithm, 0,   params->algorithm);
 
        r = dnssec_key_set_pubkey(key, &params->public_key);
-       ok(r == DNSSEC_EOK, "set public key (succeeds)");
+       ok(r == KNOT_EOK, "set public key (succeeds)");
 
        r = dnssec_key_set_pubkey(key, &params->public_key);
        ok(r == DNSSEC_KEY_ALREADY_PRESENT,
@@ -66,7 +66,7 @@ static void test_public_key(const key_parameters_t *params)
 
        dnssec_binary_t rdata = { 0 };
        r = dnssec_key_get_rdata(key, &rdata);
-       ok(r == DNSSEC_EOK && dnssec_binary_cmp(&rdata, &params->rdata) == 0,
+       ok(r == KNOT_EOK && dnssec_binary_cmp(&rdata, &params->rdata) == 0,
           "get RDATA");
 
        check_key_tag(key, params);
@@ -75,7 +75,7 @@ static void test_public_key(const key_parameters_t *params)
 
        dnssec_key_clear(key);
        r = dnssec_key_set_rdata(key, &params->rdata);
-       ok(r == DNSSEC_EOK, "set RDATA");
+       ok(r == KNOT_EOK, "set RDATA");
 
        check_key_tag(key, params);
        check_key_size(key, params);
@@ -98,15 +98,15 @@ static void test_private_key(const key_parameters_t *params)
 {
        dnssec_key_t *key = NULL;
        int r = dnssec_key_new(&key);
-       ok(r == DNSSEC_EOK && key != NULL, "create key");
+       ok(r == KNOT_EOK && key != NULL, "create key");
 
        // import to public
 
        r = dnssec_key_set_rdata(key, &params->rdata);
-       ok(r == DNSSEC_EOK, "set RDATA");
+       ok(r == KNOT_EOK, "set RDATA");
 
        r = dnssec_key_load_pkcs8(key, &params->pem);
-       ok(r == DNSSEC_EOK, "load private key (1)");
+       ok(r == KNOT_EOK, "load private key (1)");
 
        ok(dnssec_key_can_verify(key), "can verify");
        ok(dnssec_key_can_sign(key), "can sign");
@@ -118,11 +118,11 @@ static void test_private_key(const key_parameters_t *params)
        dnssec_key_set_algorithm(key, params->algorithm);
        dnssec_key_set_flags(key, params->flags);
        r = dnssec_key_load_pkcs8(key, &params->pem);
-       ok(r == DNSSEC_EOK, "load private key (2)");
+       ok(r == KNOT_EOK, "load private key (2)");
 
        dnssec_binary_t rdata = { 0 };
        r = dnssec_key_get_rdata(key, &rdata);
-       ok(r == DNSSEC_EOK && dnssec_binary_cmp(&rdata, &params->rdata) == 0,
+       ok(r == KNOT_EOK && dnssec_binary_cmp(&rdata, &params->rdata) == 0,
           "get RDATA");
 
        check_key_tag(key, params);
index 53cd81bdf8d922df5d57efdf5a989cc938868578..6891b790ac5b182d7b5045c0d5713aa2073eb73b 100644 (file)
@@ -14,7 +14,7 @@ static void ok_range(dnssec_key_algorithm_t algo,
 {
        unsigned min = 0, max = 0;
        int r = dnssec_algorithm_key_size_range(algo, &min, &max);
-       ok(r == DNSSEC_EOK && min == exp_min && max == exp_max,
+       ok(r == KNOT_EOK && min == exp_min && max == exp_max,
           "dnssec_algorithm_key_size_range() for %s", name);
 }
 
@@ -27,9 +27,9 @@ static void null_range(void)
        r = dnssec_algorithm_key_size_range(algo, NULL, NULL);
        ok(r == DNSSEC_EINVAL, "dnssec_algorithm_key_size_range() all null");
        r = dnssec_algorithm_key_size_range(algo, &val, NULL);
-       ok(r == DNSSEC_EOK && val == 1024, "dnssec_algorithm_key_size_range() min only");
+       ok(r == KNOT_EOK && val == 1024, "dnssec_algorithm_key_size_range() min only");
        r = dnssec_algorithm_key_size_range(algo, NULL, &val);
-       ok(r == DNSSEC_EOK && val == 4096, "dnssec_algorithm_key_size_range() max only");
+       ok(r == KNOT_EOK && val == 4096, "dnssec_algorithm_key_size_range() max only");
 }
 
 static void check_borders(void)
index 15df6f094b14b833bd10e100822e5716f0da22f4..cca5f9a7b902a2d5e910b847df5c11088ff2c45b 100644 (file)
@@ -40,7 +40,7 @@ static void test_key(const char *name, const struct key_parameters *params)
 
                const dnssec_binary_t *expect = (void *)params + dt->params_offset;
 
-               ok(r == DNSSEC_EOK &&
+               ok(r == KNOT_EOK &&
                   ds.size == expect->size &&
                   memcmp(ds.data, expect->data, ds.size) == 0,
                   "dnssec_key_create_ds() for %s/%s", name, dt->name);
@@ -76,7 +76,7 @@ static void test_errors(const struct key_parameters *params)
        is_int(DNSSEC_INVALID_DS_ALGORITHM, r, "dnssec_key_create_ds() unsupported algorithm");
 
        r = dnssec_key_create_ds(key, DNSSEC_KEY_DIGEST_SHA1, &ds);
-       is_int(DNSSEC_EOK, r, "dnssec_key_create_ds() valid parameters");
+       is_int(KNOT_EOK, r, "dnssec_key_create_ds() valid parameters");
 
        dnssec_binary_free(&ds);
        dnssec_key_free(key);
index 21245f4e8d9178dfbc325f0910e8b8fa5c85b8a9..d132742403a0598728cc9c47d9d04a86116662f1 100644 (file)
@@ -218,24 +218,24 @@ static void create_dnskeys(dnssec_keystore_t *keystore,
 
        dnssec_key_t *p11_key = NULL;
        r = dnssec_key_new(&p11_key);
-       ok(r == DNSSEC_EOK && p11_key != NULL, MSG_PKCS11 " dnssec_key_new()");
+       ok(r == KNOT_EOK && p11_key != NULL, MSG_PKCS11 " dnssec_key_new()");
 
        r = dnssec_key_set_algorithm(p11_key, algorithm);
-       ok(r == DNSSEC_EOK, MSG_PKCS11 " dnssec_key_set_algorithm()");
+       ok(r == KNOT_EOK, MSG_PKCS11 " dnssec_key_set_algorithm()");
 
        r = dnssec_keystore_get_private(keystore, id, p11_key);
-       ok(r == DNSSEC_EOK, MSG_PKCS11 " dnssec_keystore_get_private()");
+       ok(r == KNOT_EOK, MSG_PKCS11 " dnssec_keystore_get_private()");
 
        // construct software public key
 
        dnssec_key_t *soft_key = NULL;
        r = dnssec_key_new(&soft_key);
-       ok(r == DNSSEC_EOK && soft_key != NULL, MSG_SOFTWARE " dnssec_key_new()");
+       ok(r == KNOT_EOK && soft_key != NULL, MSG_SOFTWARE " dnssec_key_new()");
 
        dnssec_binary_t rdata = { 0 };
        dnssec_key_get_rdata(p11_key, &rdata);
        r = dnssec_key_set_rdata(soft_key, &rdata);
-       ok(r == DNSSEC_EOK, MSG_SOFTWARE " dnssec_key_set_rdata()");
+       ok(r == KNOT_EOK, MSG_SOFTWARE " dnssec_key_set_rdata()");
 
        *p11_key_ptr = p11_key;
        *soft_key_ptr = soft_key;
@@ -264,24 +264,24 @@ static void test_sign(dnssec_key_t *p11_key, dnssec_key_t *soft_key)
 
        dnssec_sign_ctx_t *ctx = NULL;
        r = dnssec_sign_new(&ctx, p11_key);
-       ok(r == DNSSEC_EOK, MSG_PKCS11 " dnssec_sign_init() ");
+       ok(r == KNOT_EOK, MSG_PKCS11 " dnssec_sign_init() ");
 
        r = dnssec_sign_add(ctx, &input);
-       ok(r == DNSSEC_EOK, MSG_PKCS11 " dnssec_sign_add()");
+       ok(r == KNOT_EOK, MSG_PKCS11 " dnssec_sign_add()");
 
        r = dnssec_sign_write(ctx, DNSSEC_SIGN_NORMAL, &sign);
-       ok(r == DNSSEC_EOK, MSG_PKCS11 " dnssec_sign_write()");
+       ok(r == KNOT_EOK, MSG_PKCS11 " dnssec_sign_write()");
 
        // PKCS #11 key verification
 
        r = dnssec_sign_init(ctx);
-       ok(r == DNSSEC_EOK, MSG_PKCS11 " dnssec_sign_init()");
+       ok(r == KNOT_EOK, MSG_PKCS11 " dnssec_sign_init()");
 
        r = dnssec_sign_add(ctx, &input);
-       ok(r == DNSSEC_EOK, MSG_PKCS11 " dnssec_sign_add()");
+       ok(r == KNOT_EOK, MSG_PKCS11 " dnssec_sign_add()");
 
        r = dnssec_sign_verify(ctx, false, &sign);
-       ok(r == DNSSEC_EOK, MSG_PKCS11 " dnssec_sign_verify()");
+       ok(r == KNOT_EOK, MSG_PKCS11 " dnssec_sign_verify()");
 
        // software verification
 
@@ -289,13 +289,13 @@ static void test_sign(dnssec_key_t *p11_key, dnssec_key_t *soft_key)
        ctx = NULL;
 
        r = dnssec_sign_new(&ctx, soft_key);
-       ok(r == DNSSEC_EOK, MSG_SOFTWARE " dnssec_sign_init()");
+       ok(r == KNOT_EOK, MSG_SOFTWARE " dnssec_sign_init()");
 
        r = dnssec_sign_add(ctx, &input);
-       ok(r == DNSSEC_EOK, MSG_SOFTWARE " dnssec_sign_add()");
+       ok(r == KNOT_EOK, MSG_SOFTWARE " dnssec_sign_add()");
 
        r = dnssec_sign_verify(ctx, false, &sign);
-       ok(r == DNSSEC_EOK, MSG_SOFTWARE " dnssec_sign_verify()");
+       ok(r == KNOT_EOK, MSG_SOFTWARE " dnssec_sign_verify()");
 
        dnssec_binary_free(&sign);
        dnssec_sign_free(ctx);
@@ -327,13 +327,13 @@ static void test_algorithm(dnssec_keystore_t *store,
 
        r = dnssec_keystore_generate(store, params->algorithm, params->bit_size,
                                     NULL, &id_generate);
-       ok(r == DNSSEC_EOK && id_generate != NULL, "dnssec_keystore_generate()");
+       ok(r == KNOT_EOK && id_generate != NULL, "dnssec_keystore_generate()");
        test_key_use(store, params->algorithm, id_generate);
 
        diag("algorithm %d, imported key", params->algorithm);
 
        r = dnssec_keystore_import(store, &params->pem, &id_import);
-       ok(r == DNSSEC_EOK && id_import != NULL, "dnssec_keystore_import()");
+       ok(r == KNOT_EOK && id_import != NULL, "dnssec_keystore_import()");
        test_key_use(store, params->algorithm, id_import);
 
        free(id_generate);
@@ -354,7 +354,7 @@ int main(int argc, char *argv[])
                skip_all("not supported");
                goto done;
        }
-       ok(r == DNSSEC_EOK && store, "dnssec_keystore_init_pkcs11()");
+       ok(r == KNOT_EOK && store, "dnssec_keystore_init_pkcs11()");
 
        char *dso_name = libsofthsm_dso();
        if (!dso_name) {
@@ -380,10 +380,10 @@ int main(int argc, char *argv[])
        // key store access
 
        r = dnssec_keystore_init(store, config);
-       ok(r == DNSSEC_EOK, "dnssec_keystore_init()");
+       ok(r == KNOT_EOK, "dnssec_keystore_init()");
 
        r = dnssec_keystore_open(store, config);
-       ok(r == DNSSEC_EOK, "dnssec_keystore_open()");
+       ok(r == KNOT_EOK, "dnssec_keystore_open()");
 
        // key manipulation
 
@@ -399,7 +399,7 @@ int main(int argc, char *argv[])
        }
 
        r = dnssec_keystore_close(store);
-       ok(r == DNSSEC_EOK, "dnssec_keystore_close()");
+       ok(r == KNOT_EOK, "dnssec_keystore_close()");
 done:
        dnssec_keystore_deinit(store);
        dnssec_crypto_cleanup();
index 066b22062d62c1ebaad56282a8e90e4272f65db8..561bd42b123af1d291f1336015cdf37c02cf9dea 100644 (file)
@@ -23,25 +23,25 @@ int main(void)
 
        dnssec_keystore_t *store = NULL;
        int r = dnssec_keystore_init_pkcs8(&store);
-       ok(r == DNSSEC_EOK, "dnssec_keystore_init_pkcs8()");
+       ok(r == KNOT_EOK, "dnssec_keystore_init_pkcs8()");
 
        r = dnssec_keystore_init(store, dir);
-       ok(r == DNSSEC_EOK, "init");
+       ok(r == KNOT_EOK, "init");
 
        r = dnssec_keystore_open(store, dir);
-       ok(r == DNSSEC_EOK, "open");
+       ok(r == KNOT_EOK, "open");
 
        // writing new content
 
        char *id_A = NULL;
        r = dnssec_keystore_generate(store, DNSSEC_KEY_ALGORITHM_RSA_SHA256,
                                     1024, NULL, &id_A);
-       ok(r == DNSSEC_EOK, "generate A");
+       ok(r == KNOT_EOK, "generate A");
 
        char *id_B = NULL;
        r = dnssec_keystore_generate(store, DNSSEC_KEY_ALGORITHM_RSA_SHA256,
                                     1024, NULL, &id_B);
-       ok(r == DNSSEC_EOK, "generate B");
+       ok(r == KNOT_EOK, "generate B");
 
        // reading existing content
 
@@ -49,19 +49,19 @@ int main(void)
        dnssec_key_new(&key);
        dnssec_key_set_algorithm(key, DNSSEC_KEY_ALGORITHM_RSA_SHA256);
        r = dnssec_keystore_get_private(store, id_A, key);
-       ok(r == DNSSEC_EOK, "read A");
+       ok(r == KNOT_EOK, "read A");
        dnssec_key_free(key);
 
        dnssec_key_new(&key);
        dnssec_key_set_algorithm(key, DNSSEC_KEY_ALGORITHM_RSA_SHA256);
        r = dnssec_keystore_get_private(store, id_B, key);
-       ok(r == DNSSEC_EOK, "read B");
+       ok(r == KNOT_EOK, "read B");
        dnssec_key_free(key);
 
        // content removal
 
        r = dnssec_keystore_remove(store, id_A);
-       ok(r == DNSSEC_EOK, "remove A");
+       ok(r == KNOT_EOK, "remove A");
 
        dnssec_key_new(&key);
        dnssec_key_set_algorithm(key, DNSSEC_KEY_ALGORITHM_RSA_SHA256);
@@ -75,10 +75,10 @@ int main(void)
        free(id_B);
 
        r = dnssec_keystore_close(store);
-       ok(r == DNSSEC_EOK, "close");
+       ok(r == KNOT_EOK, "close");
 
        r = dnssec_keystore_deinit(store);
-       ok(r == DNSSEC_EOK, "deinit");
+       ok(r == KNOT_EOK, "deinit");
 
        test_rm_rf(dir);
        free(dir);
index 494fa8139986efb40cc5577954625f5f3be80b8a..a794f3fd25b130c9bf4eec1acf68462e8ff941cc 100644 (file)
@@ -26,7 +26,7 @@ int main(void)
        }};
 
        uint16_t tag = 0;
-       ok(dnssec_keytag(&rsa_md5_rdata, &tag) == DNSSEC_EOK && tag == 40866,
+       ok(dnssec_keytag(&rsa_md5_rdata, &tag) == KNOT_EOK && tag == 40866,
           "keytag for RSA/MD5");
 
        const dnssec_binary_t ecdsa_rdata = { .size = 100, .data = (uint8_t []) {
@@ -43,7 +43,7 @@ int main(void)
                0xf4, 0xfc, 0xe2, 0x10, 0xd4, 0x26
        }};
 
-       ok(dnssec_keytag(&ecdsa_rdata, &tag) == DNSSEC_EOK && tag == 61768,
+       ok(dnssec_keytag(&ecdsa_rdata, &tag) == KNOT_EOK && tag == 61768,
           "keytag for ECDSA/SHA384");
 
        return 0;
index a784dea2bf9793b99ac0de8b9b6a739483a1e044..99a5f0c9f7b0b3216f16d0320e8a531648badbc4 100644 (file)
@@ -29,7 +29,7 @@ static void test_parsing(void)
 
        dnssec_nsec3_params_t params = { 0 };
        int result = dnssec_nsec3_params_from_rdata(&params, &RDATA);
-       ok(result == DNSSEC_EOK, "dnssec_nsec3_params_from_rdata()");
+       ok(result == KNOT_EOK, "dnssec_nsec3_params_from_rdata()");
 
        ok(params.algorithm == 1, "algorithm");
        ok(params.flags == 0, "flags");
@@ -64,7 +64,7 @@ static void test_hashing(void)
        dnssec_binary_t hash = { 0 };
 
        int result = dnssec_nsec3_hash(&dname, &params, &hash);
-       ok(result == DNSSEC_EOK, "dnssec_nsec3_hash()");
+       ok(result == KNOT_EOK, "dnssec_nsec3_hash()");
 
        ok(hash.size == expected.size && hash.data != NULL &&
           memcmp(hash.data, expected.data, expected.size) == 0,
@@ -79,7 +79,7 @@ static void test_clear(void)
        dnssec_nsec3_params_t params = { 0 };
 
        int result = dnssec_nsec3_params_from_rdata(&params, &RDATA);
-       ok(result == DNSSEC_EOK, "dnssec_nsec3_params_from_rdata()");
+       ok(result == KNOT_EOK, "dnssec_nsec3_params_from_rdata()");
 
        ok(memcmp(&params, &empty, sizeof(dnssec_nsec3_params_t)) != 0,
           "non-empty after dnssec_nsec3_params_from_rdata()");
index 6b6d6f7c6dafd5e7cb82f97cd45c9815c9cba123..b36a84bc2ac866e54b3cccf749cf448432e7c3cb 100644 (file)
@@ -21,7 +21,7 @@ int check_buffer(void)
 
        for (int i = 0; i < 10; i++) {
                int result = dnssec_random_buffer(buffer, buffer_size);
-               if (result != DNSSEC_EOK) {
+               if (result != KNOT_EOK) {
                        return 1;
                }
 
index dccd016cc6c91cd02c06d36ba34fea1e92abb5d9..dbd5a52bea14ec78d4d4c9f163ad75d2b5a753b3 100644 (file)
@@ -87,37 +87,37 @@ static void check_key(const key_parameters_t *key_data, const dnssec_binary_t *d
 
        dnssec_key_t *key = NULL;
        r = dnssec_key_new(&key);
-       ok(r == DNSSEC_EOK && key != NULL, "create key");
+       ok(r == KNOT_EOK && key != NULL, "create key");
        r = dnssec_key_set_rdata(key, &key_data->rdata);
-       ok(r == DNSSEC_EOK, "set RDATA");
+       ok(r == KNOT_EOK, "set RDATA");
 
        // check validation on static signature
 
        dnssec_sign_ctx_t *ctx = NULL;
        r = dnssec_sign_new(&ctx, key);
-       ok(r == DNSSEC_EOK, "create signing context");
+       ok(r == KNOT_EOK, "create signing context");
        r = dnssec_sign_add(ctx, data);
-       ok(r == DNSSEC_EOK, "add data to be signed");
+       ok(r == KNOT_EOK, "add data to be signed");
        r = dnssec_sign_verify(ctx, false, signature);
-       ok(r == DNSSEC_EOK, "signature verified");
+       ok(r == KNOT_EOK, "signature verified");
 
        // create new signature and self-validate
 
        r = dnssec_key_load_pkcs8(key, &key_data->pem);
-       ok(r == DNSSEC_EOK, "load private key");
+       ok(r == KNOT_EOK, "load private key");
 
        if (signature_match) {
                r = dnssec_sign_init(ctx);
-               ok(r == DNSSEC_EOK, "reinitialize context");
+               ok(r == KNOT_EOK, "reinitialize context");
                r = dnssec_sign_add(ctx, data);
-               ok(r == DNSSEC_EOK, "add data to be signed");
+               ok(r == KNOT_EOK, "add data to be signed");
                dnssec_binary_t new_signature = { 0 };
                r = dnssec_sign_write(ctx, DNSSEC_SIGN_NORMAL, &new_signature);
-               ok(r == DNSSEC_EOK, "write the signature");
+               ok(r == KNOT_EOK, "write the signature");
                ok(dnssec_binary_cmp(signature, &new_signature) == 0,
                   "signature exact match");
                r = dnssec_sign_verify(ctx, false, &new_signature);
-               ok(r == DNSSEC_EOK, "reverify the new signature");
+               ok(r == KNOT_EOK, "reverify the new signature");
                dnssec_binary_free(&new_signature);
        }
 
@@ -126,36 +126,36 @@ static void check_key(const key_parameters_t *key_data, const dnssec_binary_t *d
        dnssec_binary_t tmp = { 0 };
 
        r = dnssec_sign_init(ctx);
-       ok(r == DNSSEC_EOK, "reinitialize context");
+       ok(r == KNOT_EOK, "reinitialize context");
 
        tmp = binary_set_string("bind");
        r = dnssec_sign_add(ctx, &tmp);
-       ok(r == DNSSEC_EOK, "add data (1)");
+       ok(r == KNOT_EOK, "add data (1)");
 
        r = dnssec_sign_init(ctx);
-       ok(r == DNSSEC_EOK, "reinitialize context");
+       ok(r == KNOT_EOK, "reinitialize context");
 
        tmp = binary_set_string("knot");
        r = dnssec_sign_add(ctx, &tmp);
-       ok(r == DNSSEC_EOK, "add data (2)");
+       ok(r == KNOT_EOK, "add data (2)");
 
        tmp = binary_set_string(" is the best");
        r = dnssec_sign_add(ctx, &tmp);
-       ok(r == DNSSEC_EOK, "add data (3)");
+       ok(r == KNOT_EOK, "add data (3)");
 
        dnssec_binary_t new_signature = { 0 };
        r = dnssec_sign_write(ctx, DNSSEC_SIGN_NORMAL, &new_signature);
-       ok(r == DNSSEC_EOK, "write signature");
+       ok(r == KNOT_EOK, "write signature");
 
        r = dnssec_sign_init(ctx);
-       ok(r == DNSSEC_EOK, "reinitialize context");
+       ok(r == KNOT_EOK, "reinitialize context");
 
        tmp = binary_set_string("knot is the best");
        r = dnssec_sign_add(ctx, &tmp);
-       ok(r == DNSSEC_EOK, "add data (4)");
+       ok(r == KNOT_EOK, "add data (4)");
 
        r = dnssec_sign_verify(ctx, false, &new_signature);
-       ok(r == DNSSEC_EOK, "verify signature");
+       ok(r == KNOT_EOK, "verify signature");
 
        dnssec_binary_free(&new_signature);
 
index b1755552ee46ba755c8c31c1fa80966e1d27dc5b..6df533df552503997e60e3b6d0dc4d232343a4f9 100644 (file)
@@ -27,7 +27,7 @@ static int binary_eq(const dnssec_binary_t *a, const dnssec_binary_t *b)
        dnssec_binary_t __out_s = { 0 }; \
        dnssec_binary_t __out_r = { 0 }; \
        int _result = dss_sig_value_decode(&__der, &__out_r, &__out_s); \
-       ok(_result == DNSSEC_EOK && \
+       ok(_result == KNOT_EOK && \
           binary_eq(&__r, &__out_r) && \
           binary_eq(&__s, &__out_s), \
           "decode ok, " message)
@@ -37,7 +37,7 @@ static int binary_eq(const dnssec_binary_t *a, const dnssec_binary_t *b)
        dnssec_binary_t __out_r = { 0 }; \
        dnssec_binary_t __out_s = { 0 }; \
        int _result = dss_sig_value_decode(&__der, &__out_r, &__out_s); \
-       ok(_result != DNSSEC_EOK, \
+       ok(_result != KNOT_EOK, \
           "decode fail, " message)
 
 #define ENCODE_OK(r, s, der, message) \
@@ -46,7 +46,7 @@ static int binary_eq(const dnssec_binary_t *a, const dnssec_binary_t *b)
        dnssec_binary_t __der = { .data = der, .size = sizeof(der) }; \
        dnssec_binary_t __out_der = { 0 }; \
        int _result = dss_sig_value_encode(&__r, &__s, &__out_der); \
-       ok(_result == DNSSEC_EOK && \
+       ok(_result == KNOT_EOK && \
           binary_eq(&__der, &__out_der), \
           "encode ok, " message); \
        dnssec_binary_free(&__out_der)
@@ -56,7 +56,7 @@ static int binary_eq(const dnssec_binary_t *a, const dnssec_binary_t *b)
        dnssec_binary_t __s = { .data = s, .size = sizeof(s) }; \
        dnssec_binary_t __out_der = { 0 }; \
        int _result = dss_sig_value_encode(&__r, &__s, &__out_der); \
-       ok(_result != DNSSEC_EOK, \
+       ok(_result != KNOT_EOK, \
           "encode fail, " message); \
        dnssec_binary_free(&__out_der)