Debian Codegraph @

sources/ippcp/hash/sha3/shake256/pcphashstatemethodset_shake256.c

raw symbols SCIP
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/shake256/pcpshake256_stuff.h"
23
24 /*
25 // Name: ippsHashStateMethodSet_SHAKE256
26 //
27 // Purpose: Setup SHAKE256 method inside the hash state.
28 //
29 // Returns: Reason:
30 // ippStsNullPtrErr pMethod == NULL or pState == NULL
31 // ippStsOutOfRangeErr digestBitsize is not positive multiple of 8 integer
32 // ippStsNoErr no errors
33 //
34 */
35 /* clang-format off */
36 IPPFUN(IppStatus, ippsHashStateMethodSet_SHAKE256, (IppsHashState_rmf* pState,
37 IppsHashMethod* pMethod,
38 int digestBitsize))
39 /* clang-format on */
40 {
41 /* test pointers */
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_SHAKE256;
48 pMethod->hashLen = digestBitsize / 8, pMethod->msgBlkSize = MBS_SHAKE256;
49 pMethod->msgLenRepSize = 0;
50 pMethod->stateLen = IPP_SHA3_STATE_BYTESIZE;
51 pMethod->hashInit = cp_sha3_hashInit;
52 pMethod->hashUpdate = cp_shake256_hashUpdate;
53 pMethod->hashOctStr = cp_sha3_hashOctString;
54 pMethod->msgLenRep = NULL;
55
56 return ippStsNoErr;
57 } else {
58 pMethod->hashAlgId = ippHashAlg_Unknown;
59 pMethod->hashLen = 0, pMethod->msgBlkSize = 0;
60 pMethod->msgLenRepSize = 0;
61 pMethod->stateLen = 0;
62 pMethod->hashInit = NULL;
63 pMethod->hashUpdate = NULL;
64 pMethod->hashOctStr = NULL;
65 pMethod->msgLenRep = NULL;
66
67 return ippStsOutOfRangeErr;
68 }
69 }