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