Constify where possible.

This commit is contained in:
Dag-Erling Smørgrav 2017-03-29 18:07:03 +02:00
parent cdd1a65e84
commit 895d1eb539
9 changed files with 17 additions and 17 deletions

View file

@ -82,14 +82,14 @@ int mpi_load(cryb_mpi *, const uint8_t *, size_t);
int mpi_set(cryb_mpi *, int32_t); int mpi_set(cryb_mpi *, int32_t);
int mpi_lshift(cryb_mpi *, unsigned int); int mpi_lshift(cryb_mpi *, unsigned int);
int mpi_rshift(cryb_mpi *, unsigned int); int mpi_rshift(cryb_mpi *, unsigned int);
int mpi_add_abs(cryb_mpi *, cryb_mpi *, cryb_mpi *); int mpi_add_abs(cryb_mpi *, const cryb_mpi *, const cryb_mpi *);
int mpi_add(cryb_mpi *, cryb_mpi *, cryb_mpi *); int mpi_add(cryb_mpi *, const cryb_mpi *, const cryb_mpi *);
int mpi_sub_abs(cryb_mpi *, cryb_mpi *, cryb_mpi *); int mpi_sub_abs(cryb_mpi *, const cryb_mpi *, const cryb_mpi *);
int mpi_sub(cryb_mpi *, cryb_mpi *, cryb_mpi *); int mpi_sub(cryb_mpi *, const cryb_mpi *, const cryb_mpi *);
int mpi_cmp_abs(cryb_mpi *, cryb_mpi *); int mpi_cmp_abs(const cryb_mpi *, const cryb_mpi *);
int mpi_cmp(cryb_mpi *, cryb_mpi *); int mpi_cmp(const cryb_mpi *, const cryb_mpi *);
int mpi_eq_abs(cryb_mpi *, cryb_mpi *); int mpi_eq_abs(const cryb_mpi *, const cryb_mpi *);
int mpi_eq(cryb_mpi *, cryb_mpi *); int mpi_eq(const cryb_mpi *, const cryb_mpi *);
CRYB_END CRYB_END

View file

@ -40,7 +40,7 @@
* Add two numbers together. * Add two numbers together.
*/ */
int int
mpi_add(cryb_mpi *X, cryb_mpi *A, cryb_mpi *B) mpi_add(cryb_mpi *X, const cryb_mpi *A, const cryb_mpi *B)
{ {
if (A->neg && B->neg) { if (A->neg && B->neg) {

View file

@ -40,7 +40,7 @@
* Store the sum of the absolutes values of A and B in X. * Store the sum of the absolutes values of A and B in X.
*/ */
int int
mpi_add_abs(cryb_mpi *X, cryb_mpi *A, cryb_mpi *B) mpi_add_abs(cryb_mpi *X, const cryb_mpi *A, const cryb_mpi *B)
{ {
unsigned int i; unsigned int i;
uint32_t c; uint32_t c;

View file

@ -41,7 +41,7 @@
* Compare signed values * Compare signed values
*/ */
int int
mpi_cmp(cryb_mpi *X, cryb_mpi *Y) mpi_cmp(const cryb_mpi *X, const cryb_mpi *Y)
{ {
if (X->neg) { if (X->neg) {

View file

@ -41,7 +41,7 @@
* Compare absolute values * Compare absolute values
*/ */
int int
mpi_cmp_abs(cryb_mpi *X, cryb_mpi *Y) mpi_cmp_abs(const cryb_mpi *X, const cryb_mpi *Y)
{ {
int i; int i;

View file

@ -41,7 +41,7 @@
* Compare signed values for equality * Compare signed values for equality
*/ */
int int
mpi_eq(cryb_mpi *A, cryb_mpi *B) mpi_eq(const cryb_mpi *A, const cryb_mpi *B)
{ {
return (A->neg == B->neg && A->msb == B->msb && return (A->neg == B->neg && A->msb == B->msb &&

View file

@ -41,7 +41,7 @@
* Compare absolute values for equality * Compare absolute values for equality
*/ */
int int
mpi_eq_abs(cryb_mpi *A, cryb_mpi *B) mpi_eq_abs(const cryb_mpi *A, const cryb_mpi *B)
{ {
return (A->msb == B->msb && return (A->msb == B->msb &&

View file

@ -40,7 +40,7 @@
* Subtract one number from another. * Subtract one number from another.
*/ */
int int
mpi_sub(cryb_mpi *X, cryb_mpi *A, cryb_mpi *B) mpi_sub(cryb_mpi *X, const cryb_mpi *A, const cryb_mpi *B)
{ {
if (A->neg && B->neg) { if (A->neg && B->neg) {

View file

@ -40,9 +40,9 @@
* Store the difference between the absolute values of A and B in X. * Store the difference between the absolute values of A and B in X.
*/ */
int int
mpi_sub_abs(cryb_mpi *X, cryb_mpi *A, cryb_mpi *B) mpi_sub_abs(cryb_mpi *X, const cryb_mpi *A, const cryb_mpi *B)
{ {
cryb_mpi *L, *G; const cryb_mpi *L, *G;
unsigned int i; unsigned int i;
uint32_t c, cn; uint32_t c, cn;