10 FILE_LICENCE ( GPL2_OR_LATER );
13 #include <ipxe/crypto.h>
15 /** An SHA-256 digest */
16 struct sha256_digest {
21 /** An SHA-256 data block */
27 /** Final block structure */
36 /** SHA-256 digest and data block
38 * The order of fields within this structure is designed to minimise
41 struct sha256_digest_data {
42 /** Digest of data already processed */
43 struct sha256_digest digest;
44 /** Accumulated data */
45 union sha256_block data;
46 } __attribute__ (( packed ));
48 /** SHA-256 digest and data block */
49 union sha256_digest_data_dwords {
50 /** Digest and data block */
51 struct sha256_digest_data dd;
53 uint32_t dword[ sizeof ( struct sha256_digest_data ) /
54 sizeof ( uint32_t ) ];
57 /** An SHA-256 context */
58 struct sha256_context {
59 /** Amount of accumulated data */
61 /** Digest and accumulated data */
62 union sha256_digest_data_dwords ddd;
63 } __attribute__ (( packed ));
65 /** SHA-256 context size */
66 #define SHA256_CTX_SIZE sizeof ( struct sha256_context )
68 /** SHA-256 digest size */
69 #define SHA256_DIGEST_SIZE sizeof ( struct sha256_digest )
71 extern struct digest_algorithm sha256_algorithm;
73 #endif /* _IPXE_SHA256_H */