cleanup context in ripemd160/sha3

pull/25/head
Pavol Rusnak 7 years ago
parent 6580044196
commit ea30ebe393
No known key found for this signature in database
GPG Key ID: 91F3B339B9A02A3D

@ -25,9 +25,11 @@
* http://ehash.iaik.tugraz.at/wiki/RIPEMD-160
*/
#include "ripemd160.h"
#include <string.h>
#include "ripemd160.h"
#include "macros.h"
/*
* 32-bit integer manipulation macros (little endian)
*/
@ -325,6 +327,8 @@ void ripemd160_Final( RIPEMD160_CTX *ctx, uint8_t output[RIPEMD160_DIGEST_LENGTH
PUT_UINT32_LE( ctx->state[2], output, 8 );
PUT_UINT32_LE( ctx->state[3], output, 12 );
PUT_UINT32_LE( ctx->state[4], output, 16 );
MEMSET_BZERO(ctx, sizeof(RIPEMD160_CTX));
}
/*

@ -19,7 +19,9 @@
#include <assert.h>
#include <string.h>
#include "sha3.h"
#include "macros.h"
#define I64(x) x##LL
#define ROTL64(qword, n) ((qword) << (n) ^ ((qword) >> (64 - (n))))
@ -329,6 +331,7 @@ void sha3_Final(SHA3_CTX *ctx, unsigned char* result)
assert(block_size > digest_length);
if (result) me64_to_le_str(result, ctx->hash, digest_length);
MEMSET_BZERO(ctx, sizeof(SHA3_CTX));
}
#if USE_KECCAK
@ -357,6 +360,7 @@ void keccak_Final(SHA3_CTX *ctx, unsigned char* result)
assert(block_size > digest_length);
if (result) me64_to_le_str(result, ctx->hash, digest_length);
MEMSET_BZERO(ctx, sizeof(SHA3_CTX));
}
void keccak_256(const unsigned char* data, size_t len, unsigned char* digest)

Loading…
Cancel
Save