summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjonsykkel <jonrevold@gmail.com>2021-09-21 21:30:13 +0200
committerjonsykkel <jonrevold@gmail.com>2021-09-21 21:32:40 +0200
commit2d144d1895da417dad085f00f03ba106b6fe00e9 (patch)
tree39add56a9203a311fb3cc4c120d638696a147c48
parent58c534da051fab7dd28b78c81b89e401c0cf72be (diff)
downloadokeffa-2d144d1895da417dad085f00f03ba106b6fe00e9.tar.gz
renam
-rw-r--r--calc/main.c2
-rw-r--r--src/fz_div.c10
-rw-r--r--src/fz_mod.c10
3 files changed, 11 insertions, 11 deletions
diff --git a/calc/main.c b/calc/main.c
index 9ce8f60..ecb0146 100644
--- a/calc/main.c
+++ b/calc/main.c
@@ -225,7 +225,7 @@ static void op_normal(char c){
break;
////////////////////////////////////////////////////////////////
- //modular arithmetic
+ //modular arithmetic ops
////////////////////////////////////////////////////////////////
case 'M': //modular multiply
diff --git a/src/fz_div.c b/src/fz_div.c
index bfa66a6..aae1e80 100644
--- a/src/fz_div.c
+++ b/src/fz_div.c
@@ -6,7 +6,7 @@
#include <okeffa/w_shift.h>
#include <okeffa/w_pred.h>
-void fz_idiv(word_t *a,word_t *b,word_t *q_out,word_t *r_out,size_t len){
+void fz_idiv(word_t *a,word_t *b,word_t *_q,word_t *_r,size_t len){
size_t qr_len = len*2;
size_t bitness_m1 = fz_bitness(len)-1;
word_t qr[qr_len];
@@ -26,8 +26,8 @@ void fz_idiv(word_t *a,word_t *b,word_t *q_out,word_t *r_out,size_t len){
fz_xor_w(q,c);
}
- fz_copy(q,q_out,len);
- fz_copy(r,r_out,len);
+ fz_copy(q,_q,len);
+ fz_copy(r,_r,len);
}
void fz_div(word_t *a,word_t *b,word_t *q,size_t len){
@@ -46,12 +46,12 @@ static void slice(word_t w,word_t *b,word_t *r,size_t cut){
}
}
-void fz_mod(word_t *a,word_t *b,word_t *r_out,size_t a_len,size_t br_len){
+void fz_mod(word_t *a,word_t *b,word_t *_r,size_t a_len,size_t br_len){
assert(a_len >= br_len);
word_t r[br_len];
fz_clear(r,br_len);
for(size_t x = 0 ;x < br_len-1;x++) slice(a[a_len-1-x],b,r,x+2 );
for(size_t x = br_len-1;x < a_len ;x++) slice(a[a_len-1-x],b,r,br_len);
- fz_copy(r,r_out,br_len);
+ fz_copy(r,_r,br_len);
}
diff --git a/src/fz_mod.c b/src/fz_mod.c
index f814303..683787f 100644
--- a/src/fz_mod.c
+++ b/src/fz_mod.c
@@ -4,7 +4,7 @@
#include <okeffa/fz_pred.h>
void fz_mod_mul(word_t *a,word_t *b,word_t *m,word_t *o,size_t len){
- size_t len2 = len*2;
+ size_t len2 = len*2;
word_t xy[len2];
word_t *xy_lo = xy;
word_t *xy_hi = xy+len;
@@ -13,15 +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_in,word_t *e_in,word_t *m,word_t *o_out,size_t len){
+void fz_mod_exp(word_t *_b,word_t *_e,word_t *m,word_t *_o,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_in,b,len);
- fz_copy(e_in,e,len);
+ fz_copy(_b,b,len);
+ fz_copy(_e,e,len);
fz_frombool(o,len,1);
for(size_t x = 0;x < bitness;x++){
@@ -30,6 +30,6 @@ void fz_mod_exp(word_t *b_in,word_t *e_in,word_t *m,word_t *o_out,size_t len){
fz_shr(e,e,len,1);
fz_mod_mul(b,b,m,b,len);
}
- fz_copy(o,o_out,len);
+ fz_copy(o,_o,len);
}