Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
error.c File Reference
#include <yubihsm.h>
#include <stddef.h>
Include dependency graph for error.c:

Go to the source code of this file.

Classes

struct  err_t
 

Macros

#define ERR(name, desc)
 

Functions

const char * yh_strerror (yh_rc err)
 

Macro Definition Documentation

◆ ERR

#define ERR ( name,
desc )
Value:
{ name, desc }
std::string name

Definition at line 21 of file error.c.

21#define ERR(name, desc) \
22 { name, desc }

Function Documentation

◆ yh_strerror()

const char * yh_strerror ( yh_rc err)

Return a string describing an error condition

Parameters
erryh_rc error code
Returns
String with descriptive error

Definition at line 65 of file error.c.

65 {
66 static const char *unknown = "Unknown yubihsm error";
67 const char *p;
68
69 if (-err < 0 || -err >= (int) (sizeof(errors) / sizeof(errors[0]))) {
70 return unknown;
71 }
72
73 p = errors[-err].description;
74 if (!p) {
75 p = unknown;
76 }
77
78 return p;
79}
const mie::Vuint & p
Definition bn.cpp:27
const char * description
Definition error.c:26
bool unknown