diff options
author | Dusan Klinec <dusan.klinec@gmail.com> | 2018-08-14 23:23:00 +0200 |
---|---|---|
committer | Dusan Klinec <dusan.klinec@gmail.com> | 2018-08-15 18:20:22 +0200 |
commit | 4e081001c007178d9d970219c14ae78afd9a6935 (patch) | |
tree | 4f74fe9038b0cd321093336bc7e80944d8fef15a /src/crypto/keccak.h | |
parent | Merge pull request #4129 (diff) | |
download | monero-4e081001c007178d9d970219c14ae78afd9a6935.tar.xz |
Incremental Keccak API added
- needed for TREZOR integration
Diffstat (limited to 'src/crypto/keccak.h')
-rw-r--r-- | src/crypto/keccak.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/crypto/keccak.h b/src/crypto/keccak.h index fb9d8bd04..9123c7a3b 100644 --- a/src/crypto/keccak.h +++ b/src/crypto/keccak.h @@ -15,6 +15,17 @@ #define ROTL64(x, y) (((x) << (y)) | ((x) >> (64 - (y)))) #endif +// SHA3 Algorithm context. +typedef struct KECCAK_CTX +{ + // 1600 bits algorithm hashing state + uint64_t hash[25]; + // 1088-bit buffer for leftovers, block size = 136 B for 256-bit keccak + uint64_t message[17]; + // count of bytes in the message[] buffer + size_t rest; +} KECCAK_CTX; + // compute a keccak hash (md) of given byte length from "in" void keccak(const uint8_t *in, size_t inlen, uint8_t *md, int mdlen); @@ -23,4 +34,7 @@ void keccakf(uint64_t st[25], int norounds); void keccak1600(const uint8_t *in, size_t inlen, uint8_t *md); +void keccak_init(KECCAK_CTX * ctx); +void keccak_update(KECCAK_CTX * ctx, const uint8_t *in, size_t inlen); +void keccak_finish(KECCAK_CTX * ctx, uint8_t *md); #endif |