summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjonsykkel <jonrevold@gmail.com>2021-09-21 21:24:46 +0200
committerjonsykkel <jonrevold@gmail.com>2021-09-21 21:24:46 +0200
commit58c534da051fab7dd28b78c81b89e401c0cf72be (patch)
treed3646a584e32424c001bd38319d89dd0be395a57
parent723cc7ee5e17729c056cf97d5014685527e44db1 (diff)
downloadokeffa-58c534da051fab7dd28b78c81b89e401c0cf72be.tar.gz
gopy
-rw-r--r--src/fz_mod.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/fz_mod.c b/src/fz_mod.c
index 9a55a05..f814303 100644
--- a/src/fz_mod.c
+++ b/src/fz_mod.c
@@ -13,14 +13,15 @@ void fz_mod_mul(word_t *a,word_t *b,word_t *m,word_t *o,size_t len){
fz_mod(xy,m,o,len2,len);
}
-void fz_mod_exp(word_t *_b,word_t *_e,word_t *m,word_t *o,size_t len){
+void fz_mod_exp(word_t *b_in,word_t *e_in,word_t *m,word_t *o_out,size_t len){
size_t bitness = fz_bitness(len);
word_t b[len];
word_t e[len];
word_t t[len];
+ word_t o[len];
- fz_copy(_b,b,len);
- fz_copy(_e,e,len);
+ fz_copy(b_in,b,len);
+ fz_copy(e_in,e,len);
fz_frombool(o,len,1);
for(size_t x = 0;x < bitness;x++){
@@ -29,5 +30,6 @@ void fz_mod_exp(word_t *_b,word_t *_e,word_t *m,word_t *o,size_t len){
fz_shr(e,e,len,1);
fz_mod_mul(b,b,m,b,len);
}
+ fz_copy(o,o_out,len);
}