]> git.ipfire.org Git - thirdparty/knot-dns.git/commitdiff
libknot: remove dnssec/error.{c,h}
authorDaniel Salzman <daniel.salzman@nic.cz>
Wed, 22 Oct 2025 06:27:07 +0000 (08:27 +0200)
committerLibor Peltan <libor.peltan@nic.cz>
Fri, 24 Oct 2025 07:17:08 +0000 (09:17 +0200)
Knot.files
src/libknot/Makefile.inc
src/libknot/dnssec/error.c [deleted file]
src/libknot/dnssec/error.h [deleted file]
src/libknot/error.c

index 540603b748dfd35d77fc7e7da1a83390840c1f98..48b587d9eb70ade4e346befc6f5965e9c7f6eec6 100644 (file)
@@ -443,8 +443,6 @@ src/libknot/dnssec/crypto.h
 src/libknot/dnssec/digest.c
 src/libknot/dnssec/digest.h
 src/libknot/dnssec/dnssec.h
-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/algorithm.h
index 3ab5a8b1f293cf2d2886b3e0a9759fef7fd33a0a..6ecda90467d0637a9f85e1a25ac56e5cde09e778 100755 (executable)
@@ -42,7 +42,6 @@ nobase_include_libknot_HEADERS = \
        libknot/dnssec/crypto.h                 \
        libknot/dnssec/digest.h                 \
        libknot/dnssec/dnssec.h                 \
-       libknot/dnssec/error.h                  \
        libknot/dnssec/key.h                    \
        libknot/dnssec/keyid.h                  \
        libknot/dnssec/keystore.h               \
@@ -100,7 +99,6 @@ libknot_la_SOURCES = \
        libknot/dnssec/binary.c                 \
        libknot/dnssec/crypto.c                 \
        libknot/dnssec/digest.c                 \
-       libknot/dnssec/error.c                  \
        libknot/dnssec/key/algorithm.c          \
        libknot/dnssec/key/algorithm.h          \
        libknot/dnssec/key/convert.c            \
diff --git a/src/libknot/dnssec/error.c b/src/libknot/dnssec/error.c
deleted file mode 100644 (file)
index 240792f..0000000
+++ /dev/null
@@ -1,76 +0,0 @@
-/*  Copyright (C) CZ.NIC, z.s.p.o. and contributors
- *  SPDX-License-Identifier: GPL-2.0-or-later
- *  For more information, see <https://www.knot-dns.cz/>
- */
-
-#include <string.h>
-
-#include "libknot/dnssec/error.h"
-#include "libknot/dnssec/shared/shared.h"
-
-typedef struct error_message_t {
-       int code;
-       const char *text;
-} error_message_t;
-
-static const error_message_t ERROR_MESSAGES[] = {
-       { KNOT_EOK,                     "no error" },
-
-       { KNOT_ENOMEM,          "not enough memory" },
-       { KNOT_EINVAL,          "invalid argument" },
-       { KNOT_ENOENT,          "no such file or directory" },
-
-       { KNOT_ERROR,                   "unspecified error" },
-       { KNOT_ENOTSUP, "not implemented" },
-       { KNOT_EMALF,   "malformed data" },
-       { KNOT_ENOENT,          "not found" },
-
-       { KNOT_KEY_EIMPORT,     "PKCS #8 import error" },
-       { KNOT_KEY_EEXPORT,     "key export error" },
-       { KNOT_KEY_EIMPORT,     "key import error" },
-       { KNOT_KEY_EGENERATE,   "key generation error" },
-
-       { KNOT_INVALID_PUBLIC_KEY,      "invalid public key" },
-       { DNSSEC_INVALID_PRIVATE_KEY,   "invalid private key" },
-       { KNOT_INVALID_KEY_ALGORITHM,   "invalid key algorithm" },
-       { KNOT_INVALID_KEY_SIZE,        "invalid key size" },
-       { KNOT_INVALID_KEY_ID,  "invalid key ID" },
-       { KNOT_INVALID_KEY_NAME,        "invalid key name" },
-
-       { KNOT_NO_PUBLIC_KEY,           "no public key" },
-       { KNOT_NO_PRIVATE_KEY,  "no private key" },
-       { KNOT_EEXIST,  "key already present" },
-
-       { KNOT_ECRYPTO, "signing initialization error" },
-       { KNOT_ECRYPTO,         "signing error" },
-       { KNOT_INVALID_SIGNATURE,       "invalid signature" },
-
-       { DNSSEC_INVALID_NSEC3_ALGORITHM, "invalid NSEC3 algorithm" },
-       { KNOT_ECRYPTO, "NSEC3 hashing error" },
-
-       { DNSSEC_INVALID_DS_ALGORITHM,  "invalid DS algorithm" },
-       { KNOT_ECRYPTO, "DS hashing error" },
-
-       { KNOT_EINVAL,  "invalid KASP keystore configuration" },
-
-       { KNOT_P11_ELOAD, "failed to load PKCS #11 module" },
-       { KNOT_ERANGE,      "too many PKCS #11 modules loaded" },
-       { KNOT_P11_ETOKEN,   "PKCS #11 token not available" },
-
-       { DNSSEC_INVALID_DIGEST_ALGORITHM,  "invalid digest algorithm" },
-       { KNOT_ECRYPTO,              "digest error" },
-
-       { 0 }
-};
-
-_public_
-const char *dnssec_strerror(int error)
-{
-       for (const error_message_t *m = ERROR_MESSAGES; m->text; m++) {
-               if (m->code == error) {
-                       return m->text;
-               }
-       }
-
-       return NULL;
-}
diff --git a/src/libknot/dnssec/error.h b/src/libknot/dnssec/error.h
deleted file mode 100644 (file)
index 684c066..0000000
+++ /dev/null
@@ -1,95 +0,0 @@
-/*  Copyright (C) CZ.NIC, z.s.p.o. and contributors
- *  SPDX-License-Identifier: GPL-2.0-or-later
- *  For more information, see <https://www.knot-dns.cz/>
- */
-
-/*!
- * \file
- *
- * \addtogroup error
- *
- * \brief Error codes and error reporting.
- *
- * The module defines all error codes used in the library, and functions
- * to convert the error codes to sensible error strings.
- *
- * @{
- */
-
-#pragma once
-
-#include <errno.h>
-
-/*!
- * Library error codes.
- */
-enum dnssec_error {
-       KNOT_EOK = 0,
-
-       KNOT_ENOMEM = -ENOMEM,
-       KNOT_EINVAL = -EINVAL,
-       KNOT_ENOENT = -ENOENT,
-
-       DNSSEC_ERROR_MIN = -1500,
-
-       KNOT_ERROR = DNSSEC_ERROR_MIN,
-       KNOT_ENOTSUP,
-       KNOT_EMALF,
-       KNOT_ENOENT,
-
-       KNOT_KEY_EIMPORT,
-       KNOT_KEY_EEXPORT,
-       KNOT_KEY_EIMPORT,
-       KNOT_KEY_EGENERATE,
-
-       KNOT_INVALID_PUBLIC_KEY,
-       DNSSEC_INVALID_PRIVATE_KEY,
-       KNOT_INVALID_KEY_ALGORITHM,
-       KNOT_INVALID_KEY_SIZE,
-       KNOT_INVALID_KEY_ID,
-       KNOT_INVALID_KEY_NAME,
-
-       KNOT_NO_PUBLIC_KEY,
-       KNOT_NO_PRIVATE_KEY,
-       KNOT_EEXIST,
-
-       KNOT_ECRYPTO,
-       KNOT_ECRYPTO,
-       KNOT_INVALID_SIGNATURE,
-
-       KNOT_EALGORITHM,
-       KNOT_ECRYPTO,
-
-       KNOT_EALGORITHM,
-       KNOT_ECRYPTO,
-
-       KNOT_EINVAL,
-
-       KNOT_P11_ELOAD,
-       KNOT_ERANGE,
-       KNOT_P11_ETOKEN,
-
-       KNOT_EALGORITHM,
-       KNOT_ECRYPTO,
-
-       DNSSEC_ERROR_MAX = -1001
-};
-
-/*!
- * Translate error code to error message.
- *
- * \param error  Error code.
- *
- * \return Statically allocated error message string or NULL if unknown.
- */
-const char *dnssec_strerror(int error);
-
-/*!
- * Convert errno value to DNSSEC error code.
- */
-static inline int dnssec_errno_to_error(int ecode)
-{
-       return -ecode;
-}
-
-/*! @} */
index 5a7237866c7482c79d009c8934f2059e45d802df..1e454d4a8d9bd3b1373bce81529d85ca6abda6aa 100644 (file)
@@ -235,8 +235,6 @@ const char *knot_strerror(int code)
                // FALLTHROUGH
        case KNOT_ERROR_MIN ... KNOT_EOK:
                msg = lookup_message(code); break;
-       case DNSSEC_ERROR_MIN ... DNSSEC_ERROR_MAX:
-               msg = dnssec_strerror(code); break;
        case MDB_KEYEXIST ... MDB_LAST_ERRCODE:
                msg = mdb_strerror(code); break;
        default: