OpenVAS Scanner  22.7.9
md5.h
Go to the documentation of this file.
1 /* SPDX-FileCopyrightText: 2023 Greenbone AG
2  *
3  * SPDX-License-Identifier: GPL-2.0-or-later
4  */
5 
6 /*
7  * This code implements the MD5 message-digest algorithm.
8  * The algorithm is due to Ron Rivest. This code was
9  * written by Colin Plumb in 1993, no copyright is claimed.
10  * This code is in the public domain; do with it what you wish.
11  *
12  * Equivalent code is available from RSA Data Security, Inc.
13  * This code has been tested against that, and is equivalent,
14  * except that you don't need to include two pages of legalese
15  * with every copy.
16  *
17  * To compute the message digest of a chunk of bytes, declare an
18  * MD5Context structure, pass it to MD5Init, call MD5Update as
19  * needed on buffers full of bytes, and then call MD5Final, which
20  * will fill a supplied 16-byte array with the digest.
21  */
22 
23 /* This code slightly modified to fit into Samba by
24  abartlet@samba.org Jun 2001 */
25 
26 #ifndef NASL_MD5_H
27 #define NASL_MD5_H
28 #ifndef HEADER_MD5_H
29 /* Try to avoid clashes with OpenSSL */
30 #define HEADER_MD5_H
31 #endif
32 
33 /*
34  * Note we duplicate the size tests in the unsigned
35  * case as int32 may be a typedef from rpc/rpc.h
36  */
37 
38 #if !defined(uint32) && !defined(HAVE_UINT32_FROM_RPC_RPC_H)
39 #if (SIZEOF_INT == 4)
40 #define uint32 unsigned int
41 #elif (SIZEOF_LONG == 4)
42 #define uint32 unsigned long
43 #elif (SIZEOF_SHORT == 4)
44 #define uint32 unsigned short
45 #else
46 /* uggh - no 32 bit type?? probably a CRAY. just hope this works ... */
47 #define uint32 unsigned
48 #endif
49 #endif
50 
51 struct MD5Context
52 {
53  uint32 buf[4];
55  unsigned char in[64];
56 };
57 
58 void
59 MD5Init (struct MD5Context *context);
60 void
61 MD5Update (struct MD5Context *context, unsigned char const *buf, unsigned len);
62 void
63 MD5Final (unsigned char digest[16], struct MD5Context *context);
64 
65 #endif /* !NASL_MD5_H */
MD5Context::in
unsigned char in[64]
Definition: md5.h:55
MD5Context::bits
uint32 bits[2]
Definition: md5.h:54
MD5Context::buf
uint32 buf[4]
Definition: md5.h:53
MD5Update
void MD5Update(struct MD5Context *context, unsigned char const *buf, unsigned len)
Definition: md5.c:71
len
uint8_t len
Definition: nasl_packet_forgery.c:1
MD5Init
void MD5Init(struct MD5Context *context)
Definition: md5.c:55
MD5Final
void MD5Final(unsigned char digest[16], struct MD5Context *context)
Definition: md5.c:123
uint32
#define uint32
Definition: md5.h:47
MD5Context
Definition: md5.h:52