mirror of
https://codeberg.org/anoncontributorxmr/monero.git
synced 2024-12-23 21:57:46 +00:00
crypto: fixed incremental keccak API on big-endian platforms
This commit is contained in:
parent
2287fb9fb4
commit
ed36335c96
1 changed files with 3 additions and 2 deletions
|
@ -145,7 +145,7 @@ void keccak1600(const uint8_t *in, size_t inlen, uint8_t *md)
|
|||
#define IS_ALIGNED_64(p) (0 == (7 & ((const char*)(p) - (const char*)0)))
|
||||
#define KECCAK_PROCESS_BLOCK(st, block) { \
|
||||
for (int i_ = 0; i_ < KECCAK_WORDS; i_++){ \
|
||||
((st))[i_] ^= ((block))[i_]; \
|
||||
((st))[i_] ^= swap64le(((block))[i_]); \
|
||||
}; \
|
||||
keccakf(st, KECCAK_ROUNDS); }
|
||||
|
||||
|
@ -207,7 +207,8 @@ void keccak_finish(KECCAK_CTX * ctx, uint8_t *md){
|
|||
}
|
||||
|
||||
static_assert(KECCAK_BLOCKLEN > KECCAK_DIGESTSIZE, "");
|
||||
static_assert(KECCAK_DIGESTSIZE % sizeof(uint64_t) == 0, "");
|
||||
if (md) {
|
||||
memcpy(md, ctx->hash, KECCAK_DIGESTSIZE);
|
||||
memcpy_swap64le(md, ctx->hash, KECCAK_DIGESTSIZE / sizeof(uint64_t));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue