diff options
| author | J08nY | 2019-11-28 19:35:33 +0100 |
|---|---|---|
| committer | J08nY | 2019-11-28 19:35:33 +0100 |
| commit | 878d95c4e4dadf882a205316a07bc0642f773256 (patch) | |
| tree | e539512c2a5386d714b6c29735b6bd17d30b2ca6 /pyecsca/codegen/bn | |
| parent | a17c64b710688ac697427544eaaab4aae6188c3c (diff) | |
| download | pyecsca-codegen-878d95c4e4dadf882a205316a07bc0642f773256.tar.gz pyecsca-codegen-878d95c4e4dadf882a205316a07bc0642f773256.tar.zst pyecsca-codegen-878d95c4e4dadf882a205316a07bc0642f773256.zip | |
Split to builder and client.
Diffstat (limited to 'pyecsca/codegen/bn')
| -rw-r--r-- | pyecsca/codegen/bn/bn.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/pyecsca/codegen/bn/bn.c b/pyecsca/codegen/bn/bn.c index b34b789..dd22ca1 100644 --- a/pyecsca/codegen/bn/bn.c +++ b/pyecsca/codegen/bn/bn.c @@ -57,7 +57,7 @@ void bn_rand_mod_sample(bn_t *out, const bn_t *mod) { void bn_rand_mod_reduce(bn_t *out, const bn_t *mod) { int mod_len = bn_bit_length(mod); - mp_rand(out, (mod_len / (sizeof(mp_digit) * 8)) + 2); + mp_rand(out, (mod_len / MP_DIGIT_BIT) + 2); mp_mod(out, mod, out); } @@ -110,8 +110,8 @@ bool bn_eq(const bn_t *one, const bn_t *other) { } int bn_get_bit(const bn_t *bn, int which) { - int which_digit = which / (sizeof(mp_digit) * 8); - int which_bit = which % (sizeof(mp_digit) * 8); + int which_digit = which / MP_DIGIT_BIT; + int which_bit = which % MP_DIGIT_BIT; if (bn->used <= which_digit) { return 0; } |
