diff options
| author | J08nY | 2020-03-02 15:11:25 +0100 |
|---|---|---|
| committer | J08nY | 2020-03-02 15:11:25 +0100 |
| commit | 81e5f24363cf8f50099b7fbed0fd3bcfaac9d5ea (patch) | |
| tree | 2e4abe38a7e3b2a53bb8bb2d31b6fe1cfbfb2e13 /pyecsca/codegen/templates/point.c | |
| parent | 02d091ad7e7bb2d80e4ce6649437aad41b479346 (diff) | |
| download | pyecsca-codegen-81e5f24363cf8f50099b7fbed0fd3bcfaac9d5ea.tar.gz pyecsca-codegen-81e5f24363cf8f50099b7fbed0fd3bcfaac9d5ea.tar.zst pyecsca-codegen-81e5f24363cf8f50099b7fbed0fd3bcfaac9d5ea.zip | |
Make Barrett reduction work.
Diffstat (limited to 'pyecsca/codegen/templates/point.c')
| -rw-r--r-- | pyecsca/codegen/templates/point.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/pyecsca/codegen/templates/point.c b/pyecsca/codegen/templates/point.c index 1ea116f..8b7b07e 100644 --- a/pyecsca/codegen/templates/point.c +++ b/pyecsca/codegen/templates/point.c @@ -123,9 +123,10 @@ void point_from_affine(bn_t *x, bn_t *y, const curve_t *curve, point_t *out) { {%- endif %} {%- if variable == "Z" %} bn_from_int(1, &out->Z); + bn_red_encode(&out->Z, &curve->p, &curve->p_red); {%- endif %} {%- if variable == "T" %} - bn_mod_mul(x, y, &curve->p, &out->T); + bn_red_mul(x, y, &curve->p, &out->T); {%- endif %} {%- endfor %} {{ end_action("coord_map") }} |
