summaryrefslogtreecommitdiff
path: root/wsutil/eax.h
diff options
context:
space:
mode:
authorJeff Morriss <jeff.morriss.ws@gmail.com>2013-08-01 23:34:47 +0000
committerJeff Morriss <jeff.morriss.ws@gmail.com>2013-08-01 23:34:47 +0000
commit2df54da6e2b70777154d38ce3923093568358285 (patch)
tree4bdb887d40a0a5fee501c0bd30f31388019fbe32 /wsutil/eax.h
parent6ae3372687957dfbda6352598aee00e84f83f7da (diff)
downloadwireshark-2df54da6e2b70777154d38ce3923093568358285.tar.gz
Move a bunch of the crypt modules and pint.h into wsutil.
This means wsutil now links against libcrypt. Protect a bunch of the crypt header files from multiple inclusion. svn path=/trunk/; revision=51100
Diffstat (limited to 'wsutil/eax.h')
-rw-r--r--wsutil/eax.h61
1 files changed, 61 insertions, 0 deletions
diff --git a/wsutil/eax.h b/wsutil/eax.h
new file mode 100644
index 0000000000..f1f50e0f16
--- /dev/null
+++ b/wsutil/eax.h
@@ -0,0 +1,61 @@
+/* eax.h
+ * Encryption and decryption routines implementing the EAX' encryption mode
+ * Copyright 2010, Edward J. Beroset, edward.j.beroset@us.elster.com
+ *
+ * $Id$
+ *
+ * Wireshark - Network traffic analyzer
+ * By Gerald Combs <gerald@wireshark.org>
+ * Copyright 1998 Gerald Combs
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef _EAX_H
+#define _EAX_H
+
+#include <glib.h>
+#include "ws_symbol_export.h"
+
+typedef struct tagMAC_T
+{
+ guint8 Mac[4];
+} MAC_T;
+
+#define EAX_MODE_CLEARTEXT_AUTH 1
+#define EAX_MODE_CIPHERTEXT_AUTH 2
+
+#define EAX_SIZEOF_KEY 16
+
+/*!
+ Decrypts cleartext data using EAX' mode (see ANSI Standard C12.22-2008).
+
+ @param[in] pN pointer to cleartext (canonified form)
+ @param[in] pK pointer to secret key
+ @param[in,out] pC pointer to ciphertext
+ @param[in] SizeN byte length of cleartext (pN) buffer
+ @param[in] SizeK byte length of secret key (pK)
+ @param[in] SizeC byte length of ciphertext (pC) buffer
+ @param[in] pMac four-byte Message Authentication Code
+ @param[in] Mode EAX_MODE_CLEARTEXT_AUTH or EAX_MODE_CIPHERTEXT_AUTH
+ @return TRUE if message has been authenticated; FALSE if not
+ authenticated, invalid Mode or error
+ */
+WS_DLL_PUBLIC
+gboolean Eax_Decrypt(guint8 *pN, guint8 *pK, guint8 *pC,
+ guint32 SizeN, guint32 SizeK, guint32 SizeC, MAC_T *pMac,
+ guint8 Mode);
+
+#endif