clean: remove comments
This commit is contained in:
parent
81f8fb3c1f
commit
365c98be7c
19
rsa/bigint.c
19
rsa/bigint.c
|
@ -72,7 +72,6 @@ int bigint_dif(bigint_t a, bigint_t b) {
|
|||
if (a.data[cursor] ^ b.data[cursor]) {
|
||||
return 1;
|
||||
}
|
||||
//cursor -= 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -89,8 +88,6 @@ int is_not_zero(bigint_t n) {
|
|||
|
||||
// TODO check opti
|
||||
void bigint_substraction(bigint_t a, bigint_t b, bigint_t borrow, bigint_t y) {
|
||||
//bigint_t borrow = bigint_clone(b);
|
||||
//bigint_t y = bigint_clone(b);
|
||||
memcpy(borrow.data, b.data, b.len * sizeof(uint32_t));
|
||||
memcpy(y.data, b.data, b.len * sizeof(uint32_t));
|
||||
while (is_not_zero(y)) {
|
||||
|
@ -100,23 +97,13 @@ void bigint_substraction(bigint_t a, bigint_t b, bigint_t borrow, bigint_t y) {
|
|||
}
|
||||
move_bigint_bitwise_left_shift(borrow, y);
|
||||
}
|
||||
//bigint_destroy(y);
|
||||
//bigint_destroy(borrow);
|
||||
}
|
||||
|
||||
// TODO check opti
|
||||
void custom_bigint_modulo(bigint_t a, bigint_t b, bigint_t result, bigint_t mod, bigint_t borrow_sub, bigint_t y_sub) {
|
||||
bigint_set_zeros(result);
|
||||
memcpy(result.data, a.data, a.len * sizeof(uint32_t));
|
||||
//bigint_t mod = bigint_clone(b);
|
||||
/*if (a.len > b.len) {
|
||||
printf("useless\n");
|
||||
//bigint_destroy(mod);
|
||||
mod = bigint_zero(a.len);
|
||||
memcpy(mod.data, b.data, b.len * sizeof(uint32_t));
|
||||
}*/
|
||||
if (bigint_cmp(result, b) < 0) {
|
||||
//bigint_destroy(mod);
|
||||
return ;
|
||||
}
|
||||
bigint_bitwise_left_shift(mod);
|
||||
|
@ -132,7 +119,6 @@ void custom_bigint_modulo(bigint_t a, bigint_t b, bigint_t result, bigint_t mod,
|
|||
while (bigint_cmp(result, b) > 0) {
|
||||
bigint_substraction(result, b, borrow_sub, y_sub);
|
||||
}
|
||||
//bigint_destroy(mod);
|
||||
}
|
||||
|
||||
bigint_t bigint_new(size_t len) {
|
||||
|
@ -261,11 +247,7 @@ void bulk_destroy(bigint_t x, bigint_t y, bigint_t n, bigint_t d, bigint_t two,
|
|||
bigint_destroy(n_minus_two);
|
||||
bigint_destroy(n_minus_one);
|
||||
}
|
||||
/*
|
||||
bigint_t bigint_random_range(bigint_t low, bigint_t high) {
|
||||
|
||||
}
|
||||
*/
|
||||
bigint_t bigint_prime(size_t len) {
|
||||
bigint_t n = bigint_zero(RSA_BLOCK_SIZE / 8 / sizeof(uint32_t) * 2);
|
||||
|
||||
|
@ -297,7 +279,6 @@ bigint_t bigint_prime(size_t len) {
|
|||
n_minus_two.data[0] -= 1;
|
||||
n_minus_one.data[0] -= 1;
|
||||
bigint_decrement(n_minus_two);
|
||||
//bigint_t a = bigint_zero(len);
|
||||
bigint_t a = bigint_zero(RSA_BLOCK_SIZE / 8 / sizeof(uint32_t) * 2);
|
||||
for (uint32_t k = 0; k < 128; k++) {
|
||||
bigint_set_zeros(a);
|
||||
|
|
Loading…
Reference in New Issue