| 1 | /************************************************************************* |
| 2 | * Copyright (C) 2025 Intel Corporation |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 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/sha3-512/pcpsha3_512_stuff.h" |
| 23 | |
| 24 | /* |
| 25 | // Name: ippsHashStateMethodSet_SHA3_512 |
| 26 | // |
| 27 | // Purpose: Setup SHA3_512 method inside the hash state. |
| 28 | // |
| 29 | // Returns: Reason: |
| 30 | // ippStsNullPtrErr pMethod == NULL or pState == NULL |
| 31 | // ippStsNoErr no errors |
| 32 | // |
| 33 | */ |
| 34 | /* clang-format off */ |
| 35 | IPPFUN(IppStatus, ippsHashStateMethodSet_SHA3_512, (IppsHashState_rmf* pState, |
| 36 | IppsHashMethod* pMethod)) |
| 37 | /* clang-format on */ |
| 38 | { |
| 39 | /* test pointers */ |
| 40 | IPP_BAD_PTR2_RET(pState, pMethod); |
| 41 | |
| 42 | HASH_METHOD(pState) = pMethod; |
| 43 | |
| 44 | pMethod->hashAlgId = ippHashAlg_SHA3_512; |
| 45 | pMethod->hashLen = IPP_SHA3_512_DIGEST_BITSIZE / 8; |
| 46 | pMethod->msgBlkSize = MBS_SHA3_512; |
| 47 | pMethod->msgLenRepSize = 0; |
| 48 | pMethod->stateLen = IPP_SHA3_STATE_BYTESIZE; |
| 49 | pMethod->hashInit = cp_sha3_hashInit; |
| 50 | pMethod->hashUpdate = cp_sha3_512_hashUpdate; |
| 51 | pMethod->hashOctStr = cp_sha3_hashOctString; |
| 52 | pMethod->msgLenRep = NULL; |
| 53 | |
| 54 | return ippStsNoErr; |
| 55 | } |