Fix Keccak invocation and reset default checksum back to SKEIN 256.

This commit is contained in:
Moinak Ghosh 2012-12-30 01:13:55 +05:30
parent 28224d29d3
commit 8bfa49fc66
2 changed files with 3 additions and 3 deletions

View file

@ -119,11 +119,11 @@ compute_checksum(uchar_t *cksum_buf, int cksum, uchar_t *buf, int64_t bytes)
SHA512_Final(cksum_buf, &ctx); SHA512_Final(cksum_buf, &ctx);
} else if (cksum == CKSUM_KECCAK256) { } else if (cksum == CKSUM_KECCAK256) {
if (Keccak_Hash(256, buf, bytes, cksum_buf) != 0) if (Keccak_Hash(256, buf, bytes * 8, cksum_buf) != 0)
return (-1); return (-1);
} else if (cksum == CKSUM_KECCAK512) { } else if (cksum == CKSUM_KECCAK512) {
if (Keccak_Hash(512, buf, bytes, cksum_buf) != 0) if (Keccak_Hash(512, buf, bytes * 8, cksum_buf) != 0)
return (-1); return (-1);
} else { } else {
return (-1); return (-1);

View file

@ -35,7 +35,7 @@ extern "C" {
#define MAX_PW_LEN 16 #define MAX_PW_LEN 16
#define CKSUM_MASK 0x700 #define CKSUM_MASK 0x700
#define CKSUM_MAX_BYTES 64 #define CKSUM_MAX_BYTES 64
#define DEFAULT_CKSUM "KECCAK256" #define DEFAULT_CKSUM "SKEIN256"
#define ENCRYPT_FLAG 1 #define ENCRYPT_FLAG 1
#define DECRYPT_FLAG 0 #define DECRYPT_FLAG 0