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
10FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
11FILE_SECBOOT ( PERMITTED );
12
13#include <stdint.h>
14#include <ipxe/crypto.h>
15
16/** An MD5 digest */
17struct md5_digest {
18 /** Hash output */
20};
21
22/** An MD5 data block */
23union md5_block {
24 /** Raw bytes */
25 uint8_t byte[64];
26 /** Raw dwords */
28 /** Final block structure */
29 struct {
30 /** Padding */
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 */
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 */
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
76
77#endif /* _IPXE_MD5_H */
unsigned int uint32_t
Definition stdint.h:12
unsigned long long uint64_t
Definition stdint.h:13
unsigned char uint8_t
Definition stdint.h:10
#define FILE_LICENCE(_licence)
Declare a particular licence as applying to a file.
Definition compiler.h:896
#define FILE_SECBOOT(_status)
Declare a file's UEFI Secure Boot permission status.
Definition compiler.h:926
#define __attribute__(x)
Definition compiler.h:10
Cryptographic API.
struct digest_algorithm md5_algorithm
MD5 algorithm.
Definition md5.c:287
A message digest algorithm.
Definition crypto.h:19
An MD5 context.
Definition md5.h:59
size_t len
Amount of accumulated data.
Definition md5.h:61
union md5_digest_data_dwords ddd
Digest and accumulated data.
Definition md5.h:63
MD5 digest and data block.
Definition md5.h:42
struct md5_digest digest
Digest of data already processed.
Definition md5.h:44
union md5_block data
Accumulated data.
Definition md5.h:46
An MD5 digest.
Definition md5.h:17
uint32_t h[4]
Hash output.
Definition md5.h:19
An MD5 data block.
Definition md5.h:23
uint32_t dword[16]
Raw dwords.
Definition md5.h:27
uint8_t pad[56]
Padding.
Definition md5.h:31
uint64_t len
Length in bits.
Definition md5.h:33
MD5 digest and data block.
Definition md5.h:50
struct md5_digest_data dd
Digest and data block.
Definition md5.h:52
uint32_t dword[sizeof(struct md5_digest_data)/sizeof(uint32_t)]
Raw dwords.
Definition md5.h:55