dropbear 2015.71
[tomato.git] / release / src / router / dropbear / libtomcrypt / src / headers / tomcrypt_argchk.h
blob38e1bdd8de3071a3fc80ab7974a5074c45eb62c9
1 /* Defines the LTC_ARGCHK macro used within the library */
2 /* ARGTYPE is defined in mycrypt_cfg.h */
3 #if ARGTYPE == 0
5 #include <signal.h>
7 /* portability macros for compiler-specific code attributes */
8 #ifdef __GNUC__
9 #define ATTRIB_NORETURN __attribute__((noreturn))
10 #else
11 #define ATTRIB_NORETURN
12 #endif
15 /* this is the default LibTomCrypt macro */
16 void crypt_argchk(char *v, char *s, int d) ATTRIB_NORETURN;
17 #define LTC_ARGCHK(x) if (!(x)) { crypt_argchk(#x, __FILE__, __LINE__); }
18 #define LTC_ARGCHKVD(x) LTC_ARGCHK(x)
20 #elif ARGTYPE == 1
22 /* fatal type of error */
23 #define LTC_ARGCHK(x) assert((x))
24 #define LTC_ARGCHKVD(x) LTC_ARGCHK(x)
26 #elif ARGTYPE == 2
28 #define LTC_ARGCHK(x) if (!(x)) { fprintf(stderr, "\nwarning: ARGCHK failed at %s:%d\n", __FILE__, __LINE__); }
29 #define LTC_ARGCHKVD(x) LTC_ARGCHK(x)
31 #elif ARGTYPE == 3
33 #define LTC_ARGCHK(x)
34 #define LTC_ARGCHKVD(x) LTC_ARGCHK(x)
36 #elif ARGTYPE == 4
38 #define LTC_ARGCHK(x) if (!(x)) return CRYPT_INVALID_ARG;
39 #define LTC_ARGCHKVD(x) if (!(x)) return;
41 #endif
44 /* $Source: /cvs/libtom/libtomcrypt/src/headers/tomcrypt_argchk.h,v $ */
45 /* $Revision: 1.5 $ */
46 /* $Date: 2006/08/27 20:50:21 $ */