| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
#include "owndefs.h" |
| 18 |
#include "owncp.h" |
| 19 |
#include "hash/pcphash.h" |
| 20 |
#include "hash/pcphash_rmf.h" |
| 21 |
#include "pcptool.h" |
| 22 |
#include "hash/sha3/shake128/pcpshake128_stuff.h" |
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
IPPFUN(IppStatus, ippsHashStateMethodSet_SHAKE128, (IppsHashState_rmf* pState, |
| 37 |
IppsHashMethod* pMethod, |
| 38 |
int digestBitsize)) |
| 39 |
|
| 40 |
{ |
| 41 |
|
| 42 |
IPP_BAD_PTR2_RET(pState, pMethod); |
| 43 |
|
| 44 |
HASH_METHOD(pState) = pMethod; |
| 45 |
|
| 46 |
if (digestBitsize > 0 && (digestBitsize % 8) == 0) { |
| 47 |
pMethod->hashAlgId = ippHashAlg_SHAKE128; |
| 48 |
pMethod->hashLen = digestBitsize / 8; |
| 49 |
pMethod->msgBlkSize = MBS_SHAKE128; |
| 50 |
pMethod->msgLenRepSize = 0; |
| 51 |
pMethod->stateLen = IPP_SHA3_STATE_BYTESIZE; |
| 52 |
pMethod->hashInit = cp_sha3_hashInit; |
| 53 |
pMethod->hashUpdate = cp_shake128_hashUpdate; |
| 54 |
pMethod->hashOctStr = cp_sha3_hashOctString; |
| 55 |
pMethod->msgLenRep = NULL; |
| 56 |
|
| 57 |
return ippStsNoErr; |
| 58 |
} |
| 59 |
|
| 60 |
else { |
| 61 |
pMethod->hashAlgId = ippHashAlg_Unknown; |
| 62 |
pMethod->hashLen = 0, pMethod->msgBlkSize = 0; |
| 63 |
pMethod->msgLenRepSize = 0; |
| 64 |
pMethod->stateLen = 0; |
| 65 |
pMethod->hashInit = NULL; |
| 66 |
pMethod->hashUpdate = NULL; |
| 67 |
pMethod->hashOctStr = NULL; |
| 68 |
pMethod->msgLenRep = NULL; |
| 69 |
|
| 70 |
return ippStsOutOfRangeErr; |
| 71 |
} |
| 72 |
} |