diff options
Diffstat (limited to 'src/include/securerom/sha512.H')
-rw-r--r-- | src/include/securerom/sha512.H | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/src/include/securerom/sha512.H b/src/include/securerom/sha512.H index 4a87aaf4e..ef0fa3160 100644 --- a/src/include/securerom/sha512.H +++ b/src/include/securerom/sha512.H @@ -25,27 +25,32 @@ #ifndef SHA512_H #define SHA512_H -#define SHA512_BLOCK_LENGTH 128 -#define SHA512_DIGEST_LENGTH 64 +#define SHA512_BLOCK_LENGTH 128 +#define SHA512_DIGEST_LENGTH 64 #include <stdlib.h> -typedef uint8_t __attribute__((aligned(8))) sha2_hash_t[ SHA512_DIGEST_LENGTH / sizeof(uint8_t) ]; +typedef uint8_t __attribute__((aligned(8))) \ + sha2_hash_t[ SHA512_DIGEST_LENGTH / sizeof(uint8_t) ]; -typedef uint8_t sha2_byte; /* Exactly 1 byte */ -typedef uint32_t sha2_word32; /* Exactly 4 bytes */ -typedef uint64_t sha2_word64; /* Exactly 8 bytes */ +typedef uint8_t sha2_byte; /* Exactly 1 byte */ +typedef uint32_t sha2_word32; /* Exactly 4 bytes */ +typedef uint64_t sha2_word64; /* Exactly 8 bytes */ -typedef struct _SHA512_CTX { - uint64_t state[8]; - uint64_t bitcount[2]; - uint8_t buffer[SHA512_BLOCK_LENGTH]; +typedef struct _SHA512_CTX +{ + uint64_t state[8]; + uint64_t bitcount[2]; + uint8_t buffer[SHA512_BLOCK_LENGTH]; } SHA512_CTX; +extern "C" void SHA512_Init(SHA512_CTX* context); +extern "C" void SHA512_Update(SHA512_CTX* context, const sha2_byte *data, size_t len); +extern "C" void SHA512_Final(SHA512_CTX* context, sha2_hash_t *result); - +extern "C" void SHA512_Hash(const sha2_byte *data, size_t len, sha2_hash_t *result); #endif |