OpenVAS Scanner 21.4.1
hmacmd5.h
Go to the documentation of this file.
1/* Copyright (C) Luke Kenneth Casson Leighton 1996-1999
2 * Copyright (C) Andrew Tridgell 1992-1999
3 *
4 * SPDX-License-Identifier: GPL-2.0-or-later
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
19 */
20
29#ifndef _HMAC_MD5_H
30#define _HMAC_MD5_H
31
32#include "md5.h"
33
34#ifndef uchar
35#define uchar unsigned char
36#endif
37
38/* zero a structure */
39#define ZERO_STRUCT(x) memset ((char *) &(x), 0, sizeof (x))
40
41typedef struct
42{
43 struct MD5Context ctx;
44 uchar k_ipad[65];
45 uchar k_opad[65];
46
48
49/*
50 * Note we duplicate the size tests in the unsigned
51 * case as int16 may be a typedef from rpc/rpc.h
52 */
53
54#if !defined(uint16) && !defined(HAVE_UINT16_FROM_RPC_RPC_H)
55#if (SIZEOF_SHORT == 4)
56#define uint16 __ERROR___CANNOT_DETERMINE_TYPE_FOR_INT16;
57#else /* SIZEOF_SHORT != 4 */
58#define uint16 unsigned short
59#endif /* SIZEOF_SHORT != 4 */
60#endif
61
62/*
63 * SMB UCS2 (16-bit unicode) internal type.
64 */
66
67#ifdef WORDS_BIGENDIAN
68#define UCS2_SHIFT 8
69#else
70#define UCS2_SHIFT 0
71#endif
72
73/* turn a 7 bit character into a ucs2 character */
74#define UCS2_CHAR(c) ((c) << UCS2_SHIFT)
75void
76hmac_md5_init_limK_to_64 (const uchar *key, int key_len, HMACMD5Context *ctx);
77
78void
79hmac_md5_update (const uchar *text, int text_len, HMACMD5Context *ctx);
80void
81hmac_md5_final (uchar *digest, HMACMD5Context *ctx);
82
83void
84hmac_md5 (uchar key[16], uchar *data, int data_len, uchar *digest);
85
86#endif /* _HMAC_MD5_H */
void hmac_md5_final(uchar *digest, HMACMD5Context *ctx)
Finish off hmac_md5 "inner" buffer and generate outer one.
Definition: hmacmd5.c:77
void hmac_md5_update(const uchar *text, int text_len, HMACMD5Context *ctx)
Update hmac_md5 "inner" buffer.
Definition: hmacmd5.c:68
#define uchar
Definition: hmacmd5.h:35
void hmac_md5(uchar key[16], uchar *data, int data_len, uchar *digest)
Function to calculate an HMAC MD5 digest from data. Use the microsoft hmacmd5 init method because the...
Definition: hmacmd5.c:95
void hmac_md5_init_limK_to_64(const uchar *key, int key_len, HMACMD5Context *ctx)
The microsoft version of hmac_md5 initialisation.
Definition: hmacmd5.c:37
uint16 smb_ucs2_t
Definition: hmacmd5.h:65
#define uint16
Definition: hmacmd5.h:58
Definition: hmacmd5.h:42
Definition: md5.h:47