Skip to content

nqerr(3)

nqerr, nqver — error messages and the library version

libnoqtis, -lnoqtis

#include <noqtis.h>

const char *
nqerr(int err);

const char *
nqver(void);

#define NQVMAJ
#define NQVMIN
#define NQVPAT

Every function of noqtis(3) that can fail returns NQOK (0) or one of these negative codes:

nqerr text
0 success
-1 invalid argument
-2 output buffer too small
-3 verification failed
-4 input is not in the encoding the standard defines
-5 the operating system's random source failed
-6 out of memory
-7 file could not be read or written
-8 algorithm or option not supported
-9 input exceeds a size or depth limit
-10 context used out of order

() returns the English text of err from the table, or “unknown error” for any other value. The strings are static; do not free them.

A failed verification is always NQEVRFY (or another negative code), never NQOK. Test for success with ‘rc == NQOK’, never with ‘rc >= 0’ or by truth value alone.

() returns the version of the library as linked, “major.minor.patch”. NQVMAJ, NQVMIN and NQVPAT give the version of the header a program was compiled with. The library follows semantic versioning; its shared-library ABI version is the major version.

Both functions return a pointer to a static string, never NULL.

int rc = nqvrfy(alg, pk, pklen, msg, msglen, NULL, 0, 0, sig, siglen);
if (rc != NQOK)
  fprintf(stderr, "verify: %s\n", nqerr(rc));
printf("built with %d.%d.%d, running %s\n", NQVMAJ, NQVMIN, NQVPAT,
       nqver());

noqtis(3)