diff options
author | Richard Moore <rich@kde.org> | 2013-02-03 11:33:26 +0000 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-02-09 15:58:09 +0100 |
commit | 20bde28448583eecb1e37b9492eb4dc73b1409fe (patch) | |
tree | 27a086a50f7b2f5ab1fcb2f366e3114921dc1dd3 /src/3rdparty/sha3/KeccakNISTInterface.c | |
parent | d1acaf2b1c60f276dfbe4ed33eb3b6800d99fcbb (diff) |
Add support for SHA3 to QCryptographicHash.
This commit adds SHA3 support to QCryptographicHash. Two implementations
are provided, one optimised for 32 bit and one for 64 bits. The code has
been written to make it easy to add further implementations, for example
ones using NEON instructions on ARM.
Change-Id: I3be9c45bbd4fcc2771d697e7f7ae74e48a831e8f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src/3rdparty/sha3/KeccakNISTInterface.c')
-rwxr-xr-x | src/3rdparty/sha3/KeccakNISTInterface.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/3rdparty/sha3/KeccakNISTInterface.c b/src/3rdparty/sha3/KeccakNISTInterface.c index 5d92c74239..33e6e0d28b 100755 --- a/src/3rdparty/sha3/KeccakNISTInterface.c +++ b/src/3rdparty/sha3/KeccakNISTInterface.c @@ -12,10 +12,10 @@ http://creativecommons.org/publicdomain/zero/1.0/ */ #include <string.h> -#include "KeccakNISTInterface.h" +//#include "KeccakNISTInterface.h" #include "KeccakF-1600-interface.h" -HashReturn Init(hashState *state, int hashbitlen) +static HashReturn Init(hashState *state, int hashbitlen) { switch(hashbitlen) { case 0: // Default parameters, arbitrary length output @@ -40,29 +40,29 @@ HashReturn Init(hashState *state, int hashbitlen) return SUCCESS; } -HashReturn Update(hashState *state, const BitSequence *data, DataLength databitlen) +static HashReturn Update(hashState *state, const BitSequence *data, DataLength databitlen) { if ((databitlen % 8) == 0) - return Absorb((spongeState*)state, data, databitlen); + return (HashReturn) Absorb((spongeState*)state, data, databitlen); else { - HashReturn ret = Absorb((spongeState*)state, data, databitlen - (databitlen % 8)); + HashReturn ret = (HashReturn) Absorb((spongeState*)state, data, databitlen - (databitlen % 8)); if (ret == SUCCESS) { unsigned char lastByte; // Align the last partial byte to the least significant bits lastByte = data[databitlen/8] >> (8 - (databitlen % 8)); - return Absorb((spongeState*)state, &lastByte, databitlen % 8); + return (HashReturn) Absorb((spongeState*)state, &lastByte, databitlen % 8); } else return ret; } } -HashReturn Final(hashState *state, BitSequence *hashval) +static HashReturn Final(hashState *state, BitSequence *hashval) { - return Squeeze(state, hashval, state->fixedOutputLength); + return (HashReturn) Squeeze(state, hashval, state->fixedOutputLength); } -HashReturn Hash(int hashbitlen, const BitSequence *data, DataLength databitlen, BitSequence *hashval) +static HashReturn Hash(int hashbitlen, const BitSequence *data, DataLength databitlen, BitSequence *hashval) { hashState state; HashReturn result; |