nqerr(3)
NAME
nqerr, nqver
— error messages and the library version
LIBRARY
libnoqtis, -lnoqtis
SYNOPSIS
#include
<noqtis.h>
const char *
nqerr(int
err);
const char *
nqver(void);
#define NQVMAJ
#define NQVMIN
#define NQVPAT
DESCRIPTION
Every function of
noqtis(3) that can
fail returns NQOK (0) or one of these negative
codes:
| code | value | nqerr text |
NQOK |
0 | success |
NQEARG |
-1 | invalid argument |
NQEBUF |
-2 | output buffer too small |
NQEVRFY |
-3 | verification failed |
NQEDEC |
-4 | input is not in the encoding the standard defines |
NQERNG |
-5 | the operating system's random source failed |
NQEMEM |
-6 | out of memory |
NQEIO |
-7 | file could not be read or written |
NQENOSUP |
-8 | algorithm or option not supported |
NQELIM |
-9 | input exceeds a size or depth limit |
NQESTATE |
-10 | context used out of order |
nqerr()
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.
nqver()
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.
RETURN VALUES
Both functions return a pointer to a static string, never
NULL.
EXAMPLES
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());