• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * This file is part of the openHiTLS project.
3  *
4  * openHiTLS is licensed under the Mulan PSL v2.
5  * You can use this software according to the terms and conditions of the Mulan PSL v2.
6  * You may obtain a copy of Mulan PSL v2 at:
7  *
8  *     http://license.coscl.org.cn/MulanPSL2
9  *
10  * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
11  * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
12  * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
13  * See the Mulan PSL v2 for more details.
14  */
15 
16 #include "hitls_build.h"
17 #ifdef HITLS_CRYPTO_BN
18 
19 #include <stdint.h>
20 #include <stdbool.h>
21 #include "bn_bincal.h"
22 
23 /* reduce(r * r) */
MontSqrBin(BN_UINT * r,BN_Mont * mont,BN_Optimizer * opt,bool consttime)24 int32_t MontSqrBin(BN_UINT *r, BN_Mont *mont, BN_Optimizer *opt, bool consttime)
25 {
26     return MontSqrBinCore(r, mont, opt, consttime);
27 }
28 
MontMulBin(BN_UINT * r,const BN_UINT * a,const BN_UINT * b,BN_Mont * mont,BN_Optimizer * opt,bool consttime)29 int32_t MontMulBin(BN_UINT *r, const BN_UINT *a, const BN_UINT *b, BN_Mont *mont,
30     BN_Optimizer *opt, bool consttime)
31 {
32     return MontMulBinCore(r, a, b, mont, opt, consttime);
33 }
34 
MontEncBin(BN_UINT * r,BN_Mont * mont,BN_Optimizer * opt,bool consttime)35 int32_t MontEncBin(BN_UINT *r, BN_Mont *mont, BN_Optimizer *opt, bool consttime)
36 {
37     return MontEncBinCore(r, mont, opt, consttime);
38 }
39 
Reduce(BN_UINT * r,BN_UINT * x,const BN_UINT * one,const BN_UINT * m,uint32_t mSize,BN_UINT m0)40 void Reduce(BN_UINT *r, BN_UINT *x, const BN_UINT *one, const BN_UINT *m, uint32_t mSize, BN_UINT m0)
41 {
42     (void)one;
43     ReduceCore(r, x, m, mSize, m0);
44 }
45 
46 #endif /* HITLS_CRYPTO_BN */
47