summaryrefslogtreecommitdiffstats
path: root/libtomcrypt/headers/tomcrypt_argchk.h
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@gnutls.org>2010-07-06 13:00:59 +0200
committerNikos Mavrogiannopoulos <nmav@gnutls.org>2010-07-06 13:00:59 +0200
commitd12ecf68276ab0e57ea578d763f23b2143e57ed8 (patch)
tree9ddf4b21c9a918e4d97679a259ea6dcd9de742c7 /libtomcrypt/headers/tomcrypt_argchk.h
parentb6d0f4da862e17344fca35db8d9ed0dce39e757f (diff)
downloadcryptodev-linux-d12ecf68276ab0e57ea578d763f23b2143e57ed8.tar.gz
cryptodev-linux-d12ecf68276ab0e57ea578d763f23b2143e57ed8.tar.xz
cryptodev-linux-d12ecf68276ab0e57ea578d763f23b2143e57ed8.zip
Added libtomcrypt
Diffstat (limited to 'libtomcrypt/headers/tomcrypt_argchk.h')
-rw-r--r--libtomcrypt/headers/tomcrypt_argchk.h36
1 files changed, 36 insertions, 0 deletions
diff --git a/libtomcrypt/headers/tomcrypt_argchk.h b/libtomcrypt/headers/tomcrypt_argchk.h
new file mode 100644
index 0000000..1b94434
--- /dev/null
+++ b/libtomcrypt/headers/tomcrypt_argchk.h
@@ -0,0 +1,36 @@
+/* Defines the LTC_ARGCHK macro used within the library */
+/* ARGTYPE is defined in mycrypt_cfg.h */
+#if ARGTYPE == 0
+
+/* this is the default LibTomCrypt macro */
+void crypt_argchk(char *v, char *s, int d);
+#define LTC_ARGCHK(x) if (!(x)) { crypt_argchk(#x, __FILE__, __LINE__); }
+#define LTC_ARGCHKVD(x) LTC_ARGCHK(x)
+
+#elif ARGTYPE == 1
+
+/* fatal type of error */
+#define LTC_ARGCHK(x) assert((x))
+#define LTC_ARGCHKVD(x) LTC_ARGCHK(x)
+
+#elif ARGTYPE == 2
+
+#define LTC_ARGCHK(x) if (!(x)) { fprintf(stderr, "\nwarning: ARGCHK failed at %s:%d\n", __FILE__, __LINE__); }
+#define LTC_ARGCHKVD(x) LTC_ARGCHK(x)
+
+#elif ARGTYPE == 3
+
+#define LTC_ARGCHK(x)
+#define LTC_ARGCHKVD(x) LTC_ARGCHK(x)
+
+#elif ARGTYPE == 4
+
+#define LTC_ARGCHK(x) if (!(x)) return CRYPT_INVALID_ARG;
+#define LTC_ARGCHKVD(x) if (!(x)) return;
+
+#endif
+
+
+/* $Source: /cvs/libtom/libtomcrypt/src/headers/tomcrypt_argchk.h,v $ */
+/* $Revision: 1.5 $ */
+/* $Date: 2006/08/27 20:50:21 $ */