X-Git-Url: http://wagner.pp.ru/gitweb/?a=blobdiff_plain;f=ecp_id_tc26_gost_3410_2012_512_paramSetC.c;h=f5d379e4ee481160e584b5437e5eee4a2c1eb372;hb=46ebb505e1b2ade87bef52b389ecdebdd2049af4;hp=10fe5d215b7e56c54632c2b967d60d39448e3574;hpb=c43ce313a786fc16c60b0ce5782af29ff8b6d622;p=openssl-gost%2Fengine.git diff --git a/ecp_id_tc26_gost_3410_2012_512_paramSetC.c b/ecp_id_tc26_gost_3410_2012_512_paramSetC.c index 10fe5d2..f5d379e 100644 --- a/ecp_id_tc26_gost_3410_2012_512_paramSetC.c +++ b/ecp_id_tc26_gost_3410_2012_512_paramSetC.c @@ -4126,10 +4126,10 @@ static void point_add_proj(pt_prj_t *R, const pt_prj_t *Q, const pt_prj_t *P) { */ static void point_edwards2legacy(pt_prj_t *Q, const pt_prj_t *P) { /* temporary variables */ - fe_t t0, t1; + fe_t t0; /* constants */ - const limb_t *T = const_T; const limb_t *S = const_S; + const limb_t *T = const_T; const limb_t *X1 = P->X; const limb_t *Y1 = P->Y; const limb_t *Z1 = P->Z; @@ -4139,13 +4139,13 @@ static void point_edwards2legacy(pt_prj_t *Q, const pt_prj_t *P) { limb_t *Z3 = Q->Z; /* the curve arith formula */ - fiat_id_tc26_gost_3410_2012_512_paramSetC_carry_add(t0, Z1, Y1); - fiat_id_tc26_gost_3410_2012_512_paramSetC_carry_sub(t1, Z1, Y1); - fiat_id_tc26_gost_3410_2012_512_paramSetC_carry_mul(T3, S, t0); + fiat_id_tc26_gost_3410_2012_512_paramSetC_carry_add(T3, Z1, Y1); + fiat_id_tc26_gost_3410_2012_512_paramSetC_carry_sub(t0, Z1, Y1); + fiat_id_tc26_gost_3410_2012_512_paramSetC_carry_mul(T3, S, T3); fiat_id_tc26_gost_3410_2012_512_paramSetC_carry_mul(Y3, Z1, T3); - fiat_id_tc26_gost_3410_2012_512_paramSetC_carry_mul(Z3, X3, t1); - fiat_id_tc26_gost_3410_2012_512_paramSetC_carry_mul(t1, t1, T); - fiat_id_tc26_gost_3410_2012_512_paramSetC_carry_add(t0, T3, t1); + fiat_id_tc26_gost_3410_2012_512_paramSetC_carry_mul(Z3, X1, t0); + fiat_id_tc26_gost_3410_2012_512_paramSetC_carry_mul(t0, t0, T); + fiat_id_tc26_gost_3410_2012_512_paramSetC_carry_add(t0, T3, t0); fiat_id_tc26_gost_3410_2012_512_paramSetC_carry_mul(X3, X1, t0); } @@ -4223,9 +4223,9 @@ static int scalar_get_bit(const unsigned char in[64], int idx) { * {\pm 1, \pm 3, \pm 5, \pm 7, \pm 9, ...} * i.e. signed odd digits with _no zeroes_ -- that makes it "regular". */ -static void scalar_rwnaf(char out[103], const unsigned char in[64]) { +static void scalar_rwnaf(int8_t out[103], const unsigned char in[64]) { int i; - char window, d; + int8_t window, d; window = (in[0] & (DRADIX_WNAF - 1)) | 1; for (i = 0; i < 102; i++) { @@ -4245,9 +4245,9 @@ static void scalar_rwnaf(char out[103], const unsigned char in[64]) { * Compute "textbook" wnaf representation of a scalar. * NB: not constant time */ -static void scalar_wnaf(char out[513], const unsigned char in[64]) { +static void scalar_wnaf(int8_t out[513], const unsigned char in[64]) { int i; - char window, d; + int8_t window, d; window = in[0] & (DRADIX_WNAF - 1); for (i = 0; i < 513; i++) { @@ -4267,8 +4267,8 @@ static void scalar_wnaf(char out[513], const unsigned char in[64]) { static void var_smul_wnaf_two(pt_aff_t *out, const unsigned char a[64], const unsigned char b[64], const pt_aff_t *P) { int i, d, is_neg, is_inf = 1, flipped = 0; - char anaf[513] = {0}; - char bnaf[513] = {0}; + int8_t anaf[513] = {0}; + int8_t bnaf[513] = {0}; pt_prj_t Q; pt_prj_t precomp[DRADIX / 2]; @@ -4342,7 +4342,7 @@ static void var_smul_wnaf_two(pt_aff_t *out, const unsigned char a[64], static void var_smul_rwnaf(pt_aff_t *out, const unsigned char scalar[64], const pt_aff_t *P) { int i, j, d, diff, is_neg; - char rnaf[103] = {0}; + int8_t rnaf[103] = {0}; pt_prj_t Q, lut; pt_prj_t precomp[DRADIX / 2]; @@ -4430,7 +4430,7 @@ static void var_smul_rwnaf(pt_aff_t *out, const unsigned char scalar[64], */ static void fixed_smul_cmb(pt_aff_t *out, const unsigned char scalar[64]) { int i, j, k, d, diff, is_neg = 0; - char rnaf[103] = {0}; + int8_t rnaf[103] = {0}; pt_prj_t Q, R; pt_aff_t lut; @@ -4543,6 +4543,7 @@ static void point_mul(unsigned char outx[64], unsigned char outy[64], fiat_id_tc26_gost_3410_2012_512_paramSetC_to_bytes(outy, P.Y); } + #include static const unsigned char const_zb[64] = {0}; @@ -11975,7 +11976,7 @@ static void point_add_proj(pt_prj_t *R, const pt_prj_t *Q, const pt_prj_t *P) { */ static void point_edwards2legacy(pt_prj_t *Q, const pt_prj_t *P) { /* temporary variables */ - fe_t t0, t1; + fe_t t0; /* constants */ const limb_t *S = const_S; const limb_t *T = const_T; @@ -11988,13 +11989,13 @@ static void point_edwards2legacy(pt_prj_t *Q, const pt_prj_t *P) { limb_t *Z3 = Q->Z; /* the curve arith formula */ - fiat_id_tc26_gost_3410_2012_512_paramSetC_carry_add(t0, Z1, Y1); - fiat_id_tc26_gost_3410_2012_512_paramSetC_carry_sub(t1, Z1, Y1); - fiat_id_tc26_gost_3410_2012_512_paramSetC_carry_mul(T3, S, t0); + fiat_id_tc26_gost_3410_2012_512_paramSetC_carry_add(T3, Z1, Y1); + fiat_id_tc26_gost_3410_2012_512_paramSetC_carry_sub(t0, Z1, Y1); + fiat_id_tc26_gost_3410_2012_512_paramSetC_carry_mul(T3, S, T3); fiat_id_tc26_gost_3410_2012_512_paramSetC_carry_mul(Y3, Z1, T3); - fiat_id_tc26_gost_3410_2012_512_paramSetC_carry_mul(Z3, X3, t1); - fiat_id_tc26_gost_3410_2012_512_paramSetC_carry_mul(t1, t1, T); - fiat_id_tc26_gost_3410_2012_512_paramSetC_carry_add(t0, T3, t1); + fiat_id_tc26_gost_3410_2012_512_paramSetC_carry_mul(Z3, X1, t0); + fiat_id_tc26_gost_3410_2012_512_paramSetC_carry_mul(t0, t0, T); + fiat_id_tc26_gost_3410_2012_512_paramSetC_carry_add(t0, T3, t0); fiat_id_tc26_gost_3410_2012_512_paramSetC_carry_mul(X3, X1, t0); } @@ -12072,9 +12073,9 @@ static int scalar_get_bit(const unsigned char in[64], int idx) { * {\pm 1, \pm 3, \pm 5, \pm 7, \pm 9, ...} * i.e. signed odd digits with _no zeroes_ -- that makes it "regular". */ -static void scalar_rwnaf(char out[103], const unsigned char in[64]) { +static void scalar_rwnaf(int8_t out[103], const unsigned char in[64]) { int i; - char window, d; + int8_t window, d; window = (in[0] & (DRADIX_WNAF - 1)) | 1; for (i = 0; i < 102; i++) { @@ -12094,9 +12095,9 @@ static void scalar_rwnaf(char out[103], const unsigned char in[64]) { * Compute "textbook" wnaf representation of a scalar. * NB: not constant time */ -static void scalar_wnaf(char out[513], const unsigned char in[64]) { +static void scalar_wnaf(int8_t out[513], const unsigned char in[64]) { int i; - char window, d; + int8_t window, d; window = in[0] & (DRADIX_WNAF - 1); for (i = 0; i < 513; i++) { @@ -12116,8 +12117,8 @@ static void scalar_wnaf(char out[513], const unsigned char in[64]) { static void var_smul_wnaf_two(pt_aff_t *out, const unsigned char a[64], const unsigned char b[64], const pt_aff_t *P) { int i, d, is_neg, is_inf = 1, flipped = 0; - char anaf[513] = {0}; - char bnaf[513] = {0}; + int8_t anaf[513] = {0}; + int8_t bnaf[513] = {0}; pt_prj_t Q; pt_prj_t precomp[DRADIX / 2]; @@ -12191,7 +12192,7 @@ static void var_smul_wnaf_two(pt_aff_t *out, const unsigned char a[64], static void var_smul_rwnaf(pt_aff_t *out, const unsigned char scalar[64], const pt_aff_t *P) { int i, j, d, diff, is_neg; - char rnaf[103] = {0}; + int8_t rnaf[103] = {0}; pt_prj_t Q, lut; pt_prj_t precomp[DRADIX / 2]; @@ -12279,7 +12280,7 @@ static void var_smul_rwnaf(pt_aff_t *out, const unsigned char scalar[64], */ static void fixed_smul_cmb(pt_aff_t *out, const unsigned char scalar[64]) { int i, j, k, d, diff, is_neg = 0; - char rnaf[103] = {0}; + int8_t rnaf[103] = {0}; pt_prj_t Q, R; pt_aff_t lut; @@ -12392,6 +12393,7 @@ static void point_mul(unsigned char outx[64], unsigned char outy[64], fiat_id_tc26_gost_3410_2012_512_paramSetC_to_bytes(outy, P.Y); } + #include static const unsigned char const_zb[64] = {0};