Debian Codegraph @

sources/ippcp/gfpec/ecnist/ifma_ec_addpoint_p256.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_p256.h"
26
27 /* clang-format off */
28 IPP_OWN_DEFN(IppsGFpECPoint*, gfec_AddPoint_nistp256_avx512, (IppsGFpECPoint* pR,
29 const IppsGFpECPoint* pP,
30 const IppsGFpECPoint* pQ,
31 IppsGFpECState* pEC))
32 /* clang-format on */
33 {
34 gsModEngine* pME = GFP_PMA(ECP_GFP(pEC));
35 ifmaArithMethod* pmeth = (ifmaArithMethod*)GFP_METHOD_ALT(pME);
36
37 __ALIGN64 P256_POINT_IFMA P, R;
38
39 BNU_CHUNK_T* pPool = cpGFpGetPool(3, pME);
40
41 recode_point_to_mont52(&P, ECP_POINT_DATA(pP), pPool, pmeth, pME);
42
43 if (pP == pQ) {
44 ifma_ec_nistp256_dbl_point(&R.x, &R.y, &R.z, &P.x, &P.y, &P.z);
45 } else {
46 __ALIGN64 P256_POINT_IFMA Q;
47
48 recode_point_to_mont52(&Q, ECP_POINT_DATA(pQ), pPool, pmeth, pME);
49
50 R = P; /* copy P to R */
51 ifma_ec_nistp256_add_point(&R, &Q); /* R = R + Q */
52 }
53
54 recode_point_to_mont64(pR, &R, pPool, pmeth, pME);
55
56 cpGFpReleasePool(3, pME);
57
58 ECP_POINT_FLAGS(pR) = gfec_IsPointAtInfinity(pR) ? 0 : ECP_FINITE_POINT;
59 return pR;
60 }
61
62 #endif // (_IPP32E >= _IPP32E_K1)