| 1 | /************************************************************************* |
| 2 | * Copyright (C) 2002 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 | /* |
| 18 | // Purpose: |
| 19 | // Intel(R) Cryptography Primitives Library |
| 20 | // Internal Unsigned arithmetic |
| 21 | // |
| 22 | // Contents: |
| 23 | // cpAddMulDgt_BNU() |
| 24 | // |
| 25 | */ |
| 26 | |
| 27 | #include "owncp.h" |
| 28 | #include "pcpbnuarith.h" |
| 29 | #include "pcpbnumisc.h" |
| 30 | |
| 31 | /*F* |
| 32 | // Name: cpAddMulDgt_BNU |
| 33 | // |
| 34 | // Purpose: multiply-and-add BNU |
| 35 | // |
| 36 | // Returns: |
| 37 | // extension of result of multiply-and-add BigNum. |
| 38 | // |
| 39 | // Parameters: |
| 40 | // pA source BigNum A |
| 41 | // pR resultant BigNum |
| 42 | // ns size of BigNums |
| 43 | // val value to multiply |
| 44 | *F*/ |
| 45 | #if !((_IPP == _IPP_W7) || (_IPP == _IPP_T7) || (_IPP == _IPP_V8) || (_IPP == _IPP_P8) || \ |
| 46 | (_IPP >= _IPP_G9) || (_IPP == _IPP_S8) || (_IPP32E == _IPP32E_M7) || \ |
| 47 | (_IPP32E == _IPP32E_U8) || (_IPP32E == _IPP32E_Y8) || (_IPP32E >= _IPP32E_E9) || \ |
| 48 | (_IPP32E == _IPP32E_N8)) || \ |
| 49 | defined(_USE_C_cpAddMulDgt_BNU_) |
| 50 | IPP_OWN_DEFN(BNU_CHUNK_T, |
| 51 | cpAddMulDgt_BNU, |
| 52 | (BNU_CHUNK_T * pR, const BNU_CHUNK_T* pA, cpSize ns, BNU_CHUNK_T val)) |
| 53 | { |
| 54 | BNU_CHUNK_T extension = 0; |
| 55 | cpSize i; |
| 56 | for (i = 0; i < ns; i++) { |
| 57 | BNU_CHUNK_T rH, rL; |
| 58 | |
| 59 | MUL_AB(rH, rL, pA[i], val); |
| 60 | ADD_ABC(extension, pR[i], pR[i], rL, extension); |
| 61 | extension += rH; |
| 62 | } |
| 63 | return extension; |
| 64 | } |
| 65 | #endif |