iPXE
Main Page
Related Pages
Modules
+
Data Structures
Data Structures
Data Structure Index
+
Data Fields
+
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
+
Functions
_
b
d
i
p
s
t
u
v
x
+
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Enumerator
+
Files
File List
+
Globals
+
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
+
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
+
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
+
Typedefs
_
a
b
c
d
e
f
g
h
i
l
m
n
o
p
r
s
t
u
v
w
x
+
Enumerations
_
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
q
r
s
t
u
v
w
x
y
+
Enumerator
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
+
Macros
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
include
ipxe
sha256.h
Go to the documentation of this file.
1
#ifndef _IPXE_SHA256_H
2
#define _IPXE_SHA256_H
3
4
/** @file
5
*
6
* SHA-256 algorithm
7
*
8
*/
9
10
FILE_LICENCE
( GPL2_OR_LATER_OR_UBDL );
11
12
#include <
stdint.h
>
13
#include <
ipxe/crypto.h
>
14
15
/** SHA-256 number of rounds */
16
#define SHA256_ROUNDS 64
17
18
/** An SHA-256 digest */
19
struct
sha256_digest
{
20
/** Hash output */
21
uint32_t
h
[8];
22
};
23
24
/** An SHA-256 data block */
25
union
sha256_block
{
26
/** Raw bytes */
27
uint8_t
byte
[64];
28
/** Raw dwords */
29
uint32_t
dword
[16];
30
/** Final block structure */
31
struct
{
32
/** Padding */
33
uint8_t
pad
[56];
34
/** Length in bits */
35
uint64_t
len
;
36
}
final
;
37
};
38
39
/** SHA-256 digest and data block
40
*
41
* The order of fields within this structure is designed to minimise
42
* code size.
43
*/
44
struct
sha256_digest_data
{
45
/** Digest of data already processed */
46
struct
sha256_digest
digest
;
47
/** Accumulated data */
48
union
sha256_block
data
;
49
}
__attribute__
(( packed ));
50
51
/** SHA-256 digest and data block */
52
union
sha256_digest_data_dwords
{
53
/** Digest and data block */
54
struct
sha256_digest_data
dd
;
55
/** Raw dwords */
56
uint32_t
dword
[
sizeof
(
struct
sha256_digest_data
) /
57
sizeof (
uint32_t
) ];
58
};
59
60
/** An SHA-256 context */
61
struct
sha256_context
{
62
/** Amount of accumulated data */
63
size_t
len
;
64
/** Digest size */
65
size_t
digestsize
;
66
/** Digest and accumulated data */
67
union
sha256_digest_data_dwords
ddd
;
68
}
__attribute__
(( packed ));
69
70
/** SHA-256 context size */
71
#define SHA256_CTX_SIZE sizeof ( struct sha256_context )
72
73
/** SHA-256 block size */
74
#define SHA256_BLOCK_SIZE sizeof ( union sha256_block )
75
76
/** SHA-256 digest size */
77
#define SHA256_DIGEST_SIZE sizeof ( struct sha256_digest )
78
79
/** SHA-224 digest size */
80
#define SHA224_DIGEST_SIZE ( SHA256_DIGEST_SIZE * 224 / 256 )
81
82
extern
void
sha256_family_init
(
struct
sha256_context
*context,
83
const
struct
sha256_digest
*init,
84
size_t
digestsize
);
85
extern
void
sha256_update
(
void
*
ctx
,
const
void
*
data
,
size_t
len
);
86
extern
void
sha256_final
(
void
*
ctx
,
void
*
out
);
87
88
extern
struct
digest_algorithm
sha256_algorithm
;
89
extern
struct
digest_algorithm
sha224_algorithm
;
90
91
#endif
/* _IPXE_SHA256_H */
__attribute__
#define __attribute__(x)
Definition:
compiler.h:10
sha256_digest_data
SHA-256 digest and data block.
Definition:
sha256.h:44
sha256_digest_data::digest
struct sha256_digest digest
Digest of data already processed.
Definition:
sha256.h:46
uint64_t
unsigned long long uint64_t
Definition:
stdint.h:13
crypto.h
Cryptographic API.
sha256_family_init
void sha256_family_init(struct sha256_context *context, const struct sha256_digest *init, size_t digestsize)
Initialise SHA-256 family algorithm.
Definition:
sha256.c:92
sha256_context::digestsize
size_t digestsize
Digest size.
Definition:
sha256.h:65
ctx
struct golan_eq_context ctx
Definition:
CIB_PRM.h:28
out
__be32 out[4]
Definition:
CIB_PRM.h:36
sha256_digest_data_dwords
SHA-256 digest and data block.
Definition:
sha256.h:52
sha256_digest::h
uint32_t h[8]
Hash output.
Definition:
sha256.h:21
sha224_algorithm
struct digest_algorithm sha224_algorithm
SHA-224 algorithm.
Definition:
sha224.c:63
sha256_final
void sha256_final(void *ctx, void *out)
Generate SHA-256 digest.
Definition:
sha256.c:239
sha256_block::pad
uint8_t pad[56]
Padding.
Definition:
sha256.h:33
sha256_block
An SHA-256 data block.
Definition:
sha256.h:25
sha256_digest_data_dwords::dd
struct sha256_digest_data dd
Digest and data block.
Definition:
sha256.h:54
sha256_context::len
size_t len
Amount of accumulated data.
Definition:
sha256.h:63
sha256_block::len
uint64_t len
Length in bits.
Definition:
sha256.h:35
sha256_algorithm
struct digest_algorithm sha256_algorithm
SHA-256 algorithm.
Definition:
sha256.c:264
uint8_t
unsigned char uint8_t
Definition:
stdint.h:10
uint32_t
unsigned int uint32_t
Definition:
stdint.h:12
sha256_update
void sha256_update(void *ctx, const void *data, size_t len)
Accumulate data with SHA-256 algorithm.
Definition:
sha256.c:216
sha256_digest_data::data
union sha256_block data
Accumulated data.
Definition:
sha256.h:48
digest_algorithm
A message digest algorithm.
Definition:
crypto.h:18
data
uint8_t data[48]
Additional event data.
Definition:
ena.h:22
stdint.h
sha256_context::ddd
union sha256_digest_data_dwords ddd
Digest and accumulated data.
Definition:
sha256.h:67
digestsize
uint32_t digestsize
Digest size (i.e.
Definition:
pccrr.h:14
sha256_context
An SHA-256 context.
Definition:
sha256.h:61
FILE_LICENCE
FILE_LICENCE(GPL2_OR_LATER_OR_UBDL)
len
uint32_t len
Length.
Definition:
ena.h:14
sha256_digest
An SHA-256 digest.
Definition:
sha256.h:19
dword
unsigned long int dword
Definition:
smc9000.h:40
Generated by
1.8.15