Coverage Report

Created: 2025-04-03 08:46

/src/wireshark/wsutil/eax.h
Line
Count
Source (jump to first uncovered line)
1
/** @file
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 <wireshark.h>
16
17
typedef struct tagMAC_T
18
{
19
    uint8_t Mac[4];
20
} MAC_T;
21
22
0
#define EAX_MODE_CLEARTEXT_AUTH     1
23
0
#define EAX_MODE_CIPHERTEXT_AUTH    2
24
25
0
#define EAX_SIZEOF_KEY              16
26
27
/*!
28
 Decrypts cleartext data using EAX' mode (see ANSI Standard C12.22-2008).
29
30
 @param[in] pN  pointer to cleartext (canonified form)
31
 @param[in] pK  pointer to secret key
32
 @param[in,out] pC  pointer to ciphertext
33
 @param[in] SizeN byte length of cleartext (pN) buffer
34
 @param[in] SizeK byte length of secret key (pK)
35
 @param[in] SizeC byte length of ciphertext (pC) buffer
36
 @param[in] pMac  four-byte Message Authentication Code
37
 @param[in] Mode  EAX_MODE_CLEARTEXT_AUTH or EAX_MODE_CIPHERTEXT_AUTH
38
 @return    true if message has been authenticated; false if not
39
      authenticated, invalid Mode or error
40
 */
41
WS_DLL_PUBLIC
42
bool Eax_Decrypt(uint8_t *pN, uint8_t *pK, uint8_t *pC,
43
                 uint32_t SizeN, uint32_t SizeK, uint32_t SizeC, MAC_T *pMac,
44
     uint8_t Mode);
45
46
#endif