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_lshift(cryb_mpi *, unsigned int);
int mpi_rshift(cryb_mpi *, unsigned int);
int mpi_add_abs(cryb_mpi *, cryb_mpi *, cryb_mpi *);
int mpi_add(cryb_mpi *, cryb_mpi *, cryb_mpi *);
int mpi_sub_abs(cryb_mpi *, cryb_mpi *, cryb_mpi *);
int mpi_sub(cryb_mpi *, cryb_mpi *, cryb_mpi *);
int mpi_cmp_abs(cryb_mpi *, cryb_mpi *);
int mpi_cmp(cryb_mpi *, cryb_mpi *);
int mpi_eq_abs(cryb_mpi *, cryb_mpi *);
int mpi_eq(cryb_mpi *, cryb_mpi *);
int mpi_add_abs(cryb_mpi *, const cryb_mpi *, const cryb_mpi *);
int mpi_add(cryb_mpi *, const cryb_mpi *, const cryb_mpi *);
int mpi_sub_abs(cryb_mpi *, const cryb_mpi *, const cryb_mpi *);
int mpi_sub(cryb_mpi *, const cryb_mpi *, const cryb_mpi *);
int mpi_cmp_abs(const cryb_mpi *, const cryb_mpi *);
int mpi_cmp(const cryb_mpi *, const cryb_mpi *);
int mpi_eq_abs(const cryb_mpi *, const cryb_mpi *);
int mpi_eq(const cryb_mpi *, const cryb_mpi *);
CRYB_END

View file

@ -40,7 +40,7 @@
* Add two numbers together.
*/
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) {

View file

@ -40,7 +40,7 @@
* Store the sum of the absolutes values of A and B in X.
*/
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;
uint32_t c;

View file

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

View file

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

View file

@ -41,7 +41,7 @@
* Compare signed values for equality
*/
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 &&

View file

@ -41,7 +41,7 @@
* Compare absolute values for equality
*/
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 &&

View file

@ -40,7 +40,7 @@
* Subtract one number from another.
*/
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) {

View file

@ -40,9 +40,9 @@
* Store the difference between the absolute values of A and B in X.
*/
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;
uint32_t c, cn;