Debian Codegraph @

sources/ippcp/hash/sha3/shake128/pcphashmethodset_shake128.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/shake128/pcpshake128_stuff.h"
23
24 /*
25 // Name: ippsHashMethodSet_SHAKE128
26 //
27 // Purpose: Setup SHAKE128 method.
28 //
29 // Returns: Reason:
30 // ippStsNullPtrErr pMethod == NULL
31 // ippStsOutOfRangeErr digestBitsize is not positive multiple of 8 integer
32 // ippStsNoErr no errors
33 //
34 */
35 IPPFUN(IppStatus, ippsHashMethodSet_SHAKE128, (IppsHashMethod * pMethod, int digestBitsize))
36 {
37 /* test pointers */
38 IPP_BAD_PTR1_RET(pMethod);
39
40 if (digestBitsize > 0 && (digestBitsize % 8) == 0) {
41 pMethod->hashAlgId = ippHashAlg_SHAKE128;
42 pMethod->hashLen = digestBitsize / 8, pMethod->msgBlkSize = MBS_SHAKE128;
43 pMethod->msgLenRepSize = 0;
44 pMethod->stateLen = IPP_SHA3_STATE_BYTESIZE;
45 pMethod->hashInit = cp_sha3_hashInit;
46 pMethod->hashUpdate = cp_shake128_hashUpdate;
47 pMethod->hashOctStr = cp_sha3_hashOctString;
48 pMethod->msgLenRep = NULL;
49
50 return ippStsNoErr;
51 } else {
52 pMethod->hashAlgId = ippHashAlg_Unknown;
53 pMethod->hashLen = 0, pMethod->msgBlkSize = 0;
54 pMethod->msgLenRepSize = 0;
55 pMethod->stateLen = 0;
56 pMethod->hashInit = NULL;
57 pMethod->hashUpdate = NULL;
58 pMethod->hashOctStr = NULL;
59 pMethod->msgLenRep = NULL;
60
61 return ippStsOutOfRangeErr;
62 }
63 }