iPXE
md4.h
Go to the documentation of this file.
1 #ifndef _IPXE_MD4_H
2 #define _IPXE_MD4_H
3 
4 /** @file
5  *
6  * MD4 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 MD4 digest */
17 struct md4_digest {
18  /** Hash output */
19  uint32_t h[4];
20 };
21 
22 /** An MD4 data block */
23 union md4_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 /** MD4 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 md4_block data;
47 } __attribute__ (( packed ));
48 
49 /** MD4 digest and data block */
51  /** Digest and data block */
53  /** Raw dwords */
54  uint32_t dword[ sizeof ( struct md4_digest_data ) /
55  sizeof ( uint32_t ) ];
56 };
57 
58 /** An MD4 context */
59 struct md4_context {
60  /** Amount of accumulated data */
61  size_t len;
62  /** Digest and accumulated data */
64 } __attribute__ (( packed ));
65 
66 /** MD4 context size */
67 #define MD4_CTX_SIZE sizeof ( struct md4_context )
68 
69 /** MD4 block size */
70 #define MD4_BLOCK_SIZE sizeof ( union md4_block )
71 
72 /** MD4 digest size */
73 #define MD4_DIGEST_SIZE sizeof ( struct md4_digest )
74 
75 extern struct digest_algorithm md4_algorithm;
76 
77 #endif /* _IPXE_MD4_H */
#define __attribute__(x)
Definition: compiler.h:10
struct md4_digest_data dd
Digest and data block.
Definition: md4.h:52
unsigned long long uint64_t
Definition: stdint.h:13
Cryptographic API.
struct digest_algorithm md4_algorithm
MD4 algorithm.
Definition: md4.c:262
uint8_t pad[56]
Padding.
Definition: md4.h:31
uint32_t h[4]
Hash output.
Definition: md4.h:19
FILE_SECBOOT(PERMITTED)
union md4_block data
Accumulated data.
Definition: md4.h:46
FILE_LICENCE(GPL2_OR_LATER_OR_UBDL)
size_t len
Amount of accumulated data.
Definition: md4.h:61
An MD4 context.
Definition: md4.h:59
An MD4 data block.
Definition: md4.h:23
union md4_digest_data_dwords ddd
Digest and accumulated data.
Definition: md4.h:63
An MD4 digest.
Definition: md4.h:17
unsigned char uint8_t
Definition: stdint.h:10
unsigned int uint32_t
Definition: stdint.h:12
uint64_t len
Length in bits.
Definition: md4.h:33
MD4 digest and data block.
Definition: md4.h:50
MD4 digest and data block.
Definition: md4.h:42
A message digest algorithm.
Definition: crypto.h:19
unsigned long int dword
Definition: smc9000.h:40
struct md4_digest digest
Digest of data already processed.
Definition: md4.h:44