Debian Codegraph @

sources/ippcp/gfpec/ecnist/ifma_ec_mulpoint_p384.c

raw symbols SCIP
1 /*************************************************************************
2 * Copyright (C) 2021 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
19 #if (_IPP32E >= _IPP32E_K1)
20
21 #include "gfpec/pcpgfpstuff.h"
22 #include "gfpec/pcpgfpecstuff.h"
23
24 #include "gfpec/ecnist/ifma_arith_method.h"
25 #include "gfpec/ecnist/ifma_ecpoint_p384.h"
26
27 /* clang-format off */
28 IPP_OWN_DEFN(IppsGFpECPoint*, gfec_MulPoint_nistp384_avx512, (IppsGFpECPoint* pR,
29 const IppsGFpECPoint* pP,
30 const BNU_CHUNK_T* pScalar,
31 int scalarLen,
32 IppsGFpECState* pEC,
33 Ipp8u* pScratchBuffer))
34 /* clang-format on */
35 {
36 IPP_UNREFERENCED_PARAMETER(pScratchBuffer);
37
38 gsModEngine* pME = GFP_PMA(ECP_GFP(pEC));
39 ifmaArithMethod* pmeth = (ifmaArithMethod*)GFP_METHOD_ALT(pME);
40
41 const int orderBits = ECP_ORDBITSIZE(pEC);
42 const int orderLen = BITS_BNU_CHUNK(orderBits);
43 const int elemLen = GFP_PELEN(pME);
44
45 BNU_CHUNK_T* pPool = cpGFpGetPool(5, pME);
46 BNU_CHUNK_T* pExtendedScalar = pPool; /* 2 pool elem to hold scalar */
47 BNU_CHUNK_T* pPointPool = pPool + 2 * elemLen; /* 3 pool elem to to hold 3 point coordinates */
48
49 /* Copy scalar */
50 cpGFpElementCopyPad(pExtendedScalar, orderLen + 1, pScalar, scalarLen);
51
52 __ALIGN64 P384_POINT_IFMA P, R;
53
54 recode_point_to_mont52(&P, ECP_POINT_DATA(pP), pPointPool, pmeth, pME);
55
56 ifma_ec_nistp384_mul_point(&R, &P, (Ipp8u*)pExtendedScalar, orderBits);
57
58 recode_point_to_mont64(pR, &R, pPointPool, pmeth, pME);
59
60 cpGFpReleasePool(5, pME);
61
62 ECP_POINT_FLAGS(pR) = gfec_IsPointAtInfinity(pR) ? 0 : ECP_FINITE_POINT;
63 return pR;
64 }
65
66 #endif // (_IPP32E >= _IPP32E_K1)