iPXE
include
ipxe
md5.h
Go to the documentation of this file.
1
#ifndef _IPXE_MD5_H
2
#define _IPXE_MD5_H
3
4
/** @file
5
*
6
* MD5 algorithm
7
*
8
*/
9
10
FILE_LICENCE
( GPL2_OR_LATER_OR_UBDL );
11
FILE_SECBOOT
( PERMITTED );
12
13
#include <
stdint.h
>
14
#include <
ipxe/crypto.h
>
15
16
/** An MD5 digest */
17
struct
md5_digest
{
18
/** Hash output */
19
uint32_t
h
[4];
20
};
21
22
/** An MD5 data block */
23
union
md5_block
{
24
/** Raw bytes */
25
uint8_t
byte
[64];
26
/** Raw dwords */
27
uint32_t
dword
[16];
28
/** Final block structure */
29
struct
{
30
/** Padding */
31
uint8_t
pad
[56];
32
/** Length in bits */
33
uint64_t
len
;
34
}
final
;
35
};
36
37
/** MD5 digest and data block
38
*
39
* The order of fields within this structure is designed to minimise
40
* code size.
41
*/
42
struct
md5_digest_data
{
43
/** Digest of data already processed */
44
struct
md5_digest
digest
;
45
/** Accumulated data */
46
union
md5_block
data
;
47
}
__attribute__
(( packed ));
48
49
/** MD5 digest and data block */
50
union
md5_digest_data_dwords
{
51
/** Digest and data block */
52
struct
md5_digest_data
dd
;
53
/** Raw dwords */
54
uint32_t
dword
[
sizeof
(
struct
md5_digest_data
) /
55
sizeof (
uint32_t
) ];
56
};
57
58
/** An MD5 context */
59
struct
md5_context
{
60
/** Amount of accumulated data */
61
size_t
len
;
62
/** Digest and accumulated data */
63
union
md5_digest_data_dwords
ddd
;
64
}
__attribute__
(( packed ));
65
66
/** MD5 context size */
67
#define MD5_CTX_SIZE sizeof ( struct md5_context )
68
69
/** MD5 block size */
70
#define MD5_BLOCK_SIZE sizeof ( union md5_block )
71
72
/** MD5 digest size */
73
#define MD5_DIGEST_SIZE sizeof ( struct md5_digest )
74
75
extern
struct
digest_algorithm
md5_algorithm
;
76
77
#endif
/* _IPXE_MD5_H */
__attribute__
#define __attribute__(x)
Definition:
compiler.h:10
FILE_SECBOOT
FILE_SECBOOT(PERMITTED)
uint64_t
unsigned long long uint64_t
Definition:
stdint.h:13
crypto.h
Cryptographic API.
md5_block
An MD5 data block.
Definition:
md5.h:23
md5_algorithm
struct digest_algorithm md5_algorithm
MD5 algorithm.
Definition:
md5.c:287
md5_digest_data_dwords
MD5 digest and data block.
Definition:
md5.h:50
md5_digest_data_dwords::dd
struct md5_digest_data dd
Digest and data block.
Definition:
md5.h:52
md5_digest_data::digest
struct md5_digest digest
Digest of data already processed.
Definition:
md5.h:44
md5_context::len
size_t len
Amount of accumulated data.
Definition:
md5.h:61
md5_digest
An MD5 digest.
Definition:
md5.h:17
md5_block::len
uint64_t len
Length in bits.
Definition:
md5.h:33
md5_context
An MD5 context.
Definition:
md5.h:59
uint8_t
unsigned char uint8_t
Definition:
stdint.h:10
uint32_t
unsigned int uint32_t
Definition:
stdint.h:12
md5_digest_data
MD5 digest and data block.
Definition:
md5.h:42
md5_digest::h
uint32_t h[4]
Hash output.
Definition:
md5.h:19
digest_algorithm
A message digest algorithm.
Definition:
crypto.h:19
stdint.h
FILE_LICENCE
FILE_LICENCE(GPL2_OR_LATER_OR_UBDL)
md5_context::ddd
union md5_digest_data_dwords ddd
Digest and accumulated data.
Definition:
md5.h:63
md5_digest_data::data
union md5_block data
Accumulated data.
Definition:
md5.h:46
md5_block::pad
uint8_t pad[56]
Padding.
Definition:
md5.h:31
dword
unsigned long int dword
Definition:
smc9000.h:40
Generated by
1.8.15