| 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 | #ifndef IFMA_ARITH_N521_H |
| 18 | #define IFMA_ARITH_N521_H |
| 19 | |
| 20 | #include "owndefs.h" |
| 21 | |
| 22 | #if (_IPP32E >= _IPP32E_K1) |
| 23 | |
| 24 | #include "gfpec/ecnist/ifma_defs_p521.h" |
| 25 | |
| 26 | #define ifma_amm52_n521 OWNAPI(ifma_amm52_n521) |
| 27 | #define ifma_add52_n521 OWNAPI(ifma_add52_n521) |
| 28 | #define ifma_tomont52_n521 OWNAPI(ifma_tomont52_n521) |
| 29 | #define ifma_fastred52_n521 OWNAPI(ifma_fastred52_n521) |
| 30 | #define ifma_frommont52_n521 OWNAPI(ifma_frommont52_n521) |
| 31 | #define ifma_aminv52_n521 OWNAPI(ifma_aminv52_n521) |
| 32 | |
| 33 | /** |
| 34 | * \brief |
| 35 | * R = (A * B) - in domain n521r1 |
| 36 | * \param[out] pr value no normalization |
| 37 | * \param[in] a first value (in radix 2^52) |
| 38 | * \param[in] b second value (in radix 2^52) |
| 39 | */ |
| 40 | IPP_OWN_DECL(void, ifma_amm52_n521, (fe521 pr[], const fe521 a, const fe521 b)) |
| 41 | |
| 42 | /** |
| 43 | * \brief |
| 44 | * R = (A + B) mod n521r1 |
| 45 | * \param[out] pr value (in radix 2^52) |
| 46 | * \param[in] a first value (in radix 2^52) |
| 47 | * \param[in] b second value (in radix 2^52) |
| 48 | */ |
| 49 | IPP_OWN_DECL(void, ifma_add52_n521, (fe521 pr[], const fe521 a, const fe521 b)) |
| 50 | |
| 51 | /** |
| 52 | * \brief |
| 53 | * to Montgomery domain |
| 54 | * \param[out] pr value (in radix 2^52) |
| 55 | * \param[in] a value (in radix 2^52) |
| 56 | */ |
| 57 | IPP_OWN_DECL(void, ifma_tomont52_n521, (fe521 pr[], const fe521 a)) |
| 58 | |
| 59 | /** |
| 60 | * \brief |
| 61 | * fast reduction order n521r1 |
| 62 | * \param[out] pr value (in radix 2^52) |
| 63 | * \param[in] a value (in radix 2^52) |
| 64 | */ |
| 65 | IPP_OWN_DECL(void, ifma_fastred52_n521, (fe521 pr[], const fe521 a)) |
| 66 | |
| 67 | /** |
| 68 | * \brief |
| 69 | * from Montgomery domain |
| 70 | * \param[out] pr value (in radix 2^52) |
| 71 | * \param[in] a value (in radix 2^52) |
| 72 | */ |
| 73 | IPP_OWN_DECL(void, ifma_frommont52_n521, (fe521 pr[], const fe521 a)) |
| 74 | |
| 75 | /** |
| 76 | * \brief |
| 77 | * inverse R = 1/z |
| 78 | * \param[out] pr value (in radix 2^52) |
| 79 | * \param[in] z value (in radix 2^52) |
| 80 | */ |
| 81 | IPP_OWN_DECL(void, ifma_aminv52_n521, (fe521 pr[], const fe521 z)) |
| 82 | |
| 83 | #endif // (_IPP32E >= _IPP32E_K1) |
| 84 | |
| 85 | #endif |