Revert "sq h2"
[metze/wireshark/wip.git] / wsutil / eax.h
1 /* eax.h
2  * Encryption and decryption routines implementing the EAX' encryption mode
3  * Copyright 2010, Edward J. Beroset, edward.j.beroset@us.elster.com
4  *
5  * Wireshark - Network traffic analyzer
6  * By Gerald Combs <gerald@wireshark.org>
7  * Copyright 1998 Gerald Combs
8  *
9  * SPDX-License-Identifier: GPL-2.0-or-later
10  */
11
12 #ifndef _EAX_H
13 #define _EAX_H
14
15 #include <glib.h>
16 #include "ws_symbol_export.h"
17
18 typedef struct tagMAC_T
19 {
20     guint8 Mac[4];
21 } MAC_T;
22
23 #define EAX_MODE_CLEARTEXT_AUTH     1
24 #define EAX_MODE_CIPHERTEXT_AUTH    2
25
26 #define EAX_SIZEOF_KEY              16
27
28 /*!
29  Decrypts cleartext data using EAX' mode (see ANSI Standard C12.22-2008).
30
31  @param[in]     pN      pointer to cleartext (canonified form)
32  @param[in]     pK      pointer to secret key
33  @param[in,out] pC      pointer to ciphertext
34  @param[in]     SizeN   byte length of cleartext (pN) buffer
35  @param[in]     SizeK   byte length of secret key (pK)
36  @param[in]     SizeC   byte length of ciphertext (pC) buffer
37  @param[in]     pMac    four-byte Message Authentication Code
38  @param[in]     Mode    EAX_MODE_CLEARTEXT_AUTH or EAX_MODE_CIPHERTEXT_AUTH
39  @return                TRUE if message has been authenticated; FALSE if not
40                         authenticated, invalid Mode or error
41  */
42 WS_DLL_PUBLIC
43 gboolean Eax_Decrypt(guint8 *pN, guint8 *pK, guint8 *pC,
44                  guint32 SizeN, guint32 SizeK, guint32 SizeC, MAC_T *pMac,
45                  guint8 Mode);
46
47 #endif