tomcrypt/src/headers/tomcrypt_argchk.h

39 lines
890 B
C
Raw Normal View History

2004-12-30 23:55:53 +00:00
/* Defines the LTC_ARGCHK macro used within the library */
2003-03-03 00:59:24 +00:00
/* ARGTYPE is defined in mycrypt_cfg.h */
#if ARGTYPE == 0
#include <signal.h>
2003-03-03 01:02:10 +00:00
/* this is the default LibTomCrypt macro */
2004-10-30 03:00:26 +00:00
void crypt_argchk(char *v, char *s, int d);
2004-12-30 23:55:53 +00:00
#define LTC_ARGCHK(x) if (!(x)) { crypt_argchk(#x, __FILE__, __LINE__); }
2006-06-18 01:37:50 +00:00
#define LTC_ARGCHKVD(x) LTC_ARGCHK(x)
2003-03-03 00:59:24 +00:00
#elif ARGTYPE == 1
/* fatal type of error */
2004-12-30 23:55:53 +00:00
#define LTC_ARGCHK(x) assert((x))
2006-06-18 01:37:50 +00:00
#define LTC_ARGCHKVD(x) LTC_ARGCHK(x)
2003-03-03 00:59:24 +00:00
#elif ARGTYPE == 2
2005-08-01 16:36:47 +00:00
#define LTC_ARGCHK(x) if (!(x)) { fprintf(stderr, "\nwarning: ARGCHK failed at %s:%d\n", __FILE__, __LINE__); }
2006-06-18 01:37:50 +00:00
#define LTC_ARGCHKVD(x) LTC_ARGCHK(x)
2005-08-01 16:36:47 +00:00
#elif ARGTYPE == 3
2012-07-26 14:43:15 +02:00
#define LTC_ARGCHK(x)
2006-06-18 01:37:50 +00:00
#define LTC_ARGCHKVD(x) LTC_ARGCHK(x)
#elif ARGTYPE == 4
2006-08-30 23:30:00 +00:00
#define LTC_ARGCHK(x) if (!(x)) return CRYPT_INVALID_ARG;
#define LTC_ARGCHKVD(x) if (!(x)) return;
2003-03-03 00:59:24 +00:00
#endif
2005-06-09 00:08:13 +00:00
/* $Source$ */
/* $Revision$ */
/* $Date$ */