aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJ08nY2025-10-01 13:08:22 +0200
committerJ08nY2025-10-01 13:08:22 +0200
commit8ae840b6d8937fc3de2a3feb932ce282c249e4cd (patch)
tree6f05d681ba0df772dd8c11f1193d16f254952b46
parentfd61cf7b86f2b7c61de7794b616c80c23f0ca364 (diff)
downloadpyecsca-codegen-8ae840b6d8937fc3de2a3feb932ce282c249e4cd.tar.gz
pyecsca-codegen-8ae840b6d8937fc3de2a3feb932ce282c249e4cd.tar.zst
pyecsca-codegen-8ae840b6d8937fc3de2a3feb932ce282c249e4cd.zip
Expose bn digit size from tommath at runtime.
-rw-r--r--pyecsca/codegen/bn/bn.c2
-rw-r--r--pyecsca/codegen/bn/bn.h2
2 files changed, 4 insertions, 0 deletions
diff --git a/pyecsca/codegen/bn/bn.c b/pyecsca/codegen/bn/bn.c
index 148403c..f41a1d7 100644
--- a/pyecsca/codegen/bn/bn.c
+++ b/pyecsca/codegen/bn/bn.c
@@ -27,6 +27,8 @@ void math_init(void) {
#endif //TODO: COMBA
}
+const int bn_digit_bits __attribute__((used)) = MP_DIGIT_BIT;
+
bn_err bn_init(bn_t *bn) {
return mp_init(bn);
}
diff --git a/pyecsca/codegen/bn/bn.h b/pyecsca/codegen/bn/bn.h
index 7c25c22..58bd6df 100644
--- a/pyecsca/codegen/bn/bn.h
+++ b/pyecsca/codegen/bn/bn.h
@@ -78,6 +78,8 @@ typedef struct {
void math_init(void);
+extern const int bn_digit_bits;
+
bn_err bn_init(bn_t *bn);
#define bn_init_multi mp_init_multi
bn_err bn_copy(const bn_t *from, bn_t *to);