From: Daniel Salzman Date: Wed, 22 Oct 2025 06:27:07 +0000 (+0200) Subject: libknot: remove dnssec/error.{c,h} X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4b54add0f7406529332707583d2c2b7907a85753;p=thirdparty%2Fknot-dns.git libknot: remove dnssec/error.{c,h} --- diff --git a/Knot.files b/Knot.files index 540603b748..48b587d9eb 100644 --- a/Knot.files +++ b/Knot.files @@ -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 diff --git a/src/libknot/Makefile.inc b/src/libknot/Makefile.inc index 3ab5a8b1f2..6ecda90467 100755 --- a/src/libknot/Makefile.inc +++ b/src/libknot/Makefile.inc @@ -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 index 240792f535..0000000000 --- a/src/libknot/dnssec/error.c +++ /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 - */ - -#include - -#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 index 684c066f10..0000000000 --- a/src/libknot/dnssec/error.h +++ /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 - */ - -/*! - * \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 - -/*! - * 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; -} - -/*! @} */ diff --git a/src/libknot/error.c b/src/libknot/error.c index 5a7237866c..1e454d4a8d 100644 --- a/src/libknot/error.c +++ b/src/libknot/error.c @@ -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: