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 */
28  /** Final block structure */
29  struct {
30  /** Padding */
31  uint8_t pad[56];
32  /** Length in bits */
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  */
43  /** Digest of data already processed */
45  /** Accumulated data */
46  union md5_block data;
47 } __attribute__ (( packed ));
48 
49 /** MD5 digest and data block */
51  /** Digest and data block */
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 */
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 */
#define __attribute__(x)
Definition: compiler.h:10
FILE_SECBOOT(PERMITTED)
unsigned long long uint64_t
Definition: stdint.h:13
Cryptographic API.
An MD5 data block.
Definition: md5.h:23
struct digest_algorithm md5_algorithm
MD5 algorithm.
Definition: md5.c:287
MD5 digest and data block.
Definition: md5.h:50
struct md5_digest_data dd
Digest and data block.
Definition: md5.h:52
struct md5_digest digest
Digest of data already processed.
Definition: md5.h:44
size_t len
Amount of accumulated data.
Definition: md5.h:61
An MD5 digest.
Definition: md5.h:17
uint64_t len
Length in bits.
Definition: md5.h:33
An MD5 context.
Definition: md5.h:59
unsigned char uint8_t
Definition: stdint.h:10
unsigned int uint32_t
Definition: stdint.h:12
MD5 digest and data block.
Definition: md5.h:42
uint32_t h[4]
Hash output.
Definition: md5.h:19
A message digest algorithm.
Definition: crypto.h:19
FILE_LICENCE(GPL2_OR_LATER_OR_UBDL)
union md5_digest_data_dwords ddd
Digest and accumulated data.
Definition: md5.h:63
union md5_block data
Accumulated data.
Definition: md5.h:46
uint8_t pad[56]
Padding.
Definition: md5.h:31
unsigned long int dword
Definition: smc9000.h:40