| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
#ifndef VBOOT_REFERENCE_2SHA_PRIVATE_H_ |
| 9 |
#define VBOOT_REFERENCE_2SHA_PRIVATE_H_ |
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
#define SHA256_MIN_PAD_LEN 9 |
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
#define SHA256_PAD_BEGIN 0x80 |
| 19 |
|
| 20 |
extern const uint32_t vb2_sha256_h0[8]; |
| 21 |
extern const uint32_t vb2_sha256_k[64]; |
| 22 |
extern const uint32_t vb2_hash_seq[8]; |
| 23 |
extern struct vb2_sha256_context vb2_sha_ctx; |
| 24 |
|
| 25 |
#define UNPACK32(x, str) \ |
| 26 |
{ \ |
| 27 |
*((str) + 3) = (uint8_t) ((x) ); \ |
| 28 |
*((str) + 2) = (uint8_t) ((x) >> 8); \ |
| 29 |
*((str) + 1) = (uint8_t) ((x) >> 16); \ |
| 30 |
*((str) + 0) = (uint8_t) ((x) >> 24); \ |
| 31 |
} |
| 32 |
|
| 33 |
#define PACK32(str, x) \ |
| 34 |
{ \ |
| 35 |
*(x) = ((uint32_t) *((str) + 3) ) \ |
| 36 |
| ((uint32_t) *((str) + 2) << 8) \ |
| 37 |
| ((uint32_t) *((str) + 1) << 16) \ |
| 38 |
| ((uint32_t) *((str) + 0) << 24); \ |
| 39 |
} |
| 40 |
|
| 41 |
void vb2_sha256_transform_hwcrypto(const uint8_t *message, |
| 42 |
unsigned int block_nb); |
| 43 |
#endif |