mirror of
https://github.com/cryb-to/cryb-to.git
synced 2024-11-15 02:05:40 +00:00
Constify where possible.
This commit is contained in:
parent
cdd1a65e84
commit
895d1eb539
9 changed files with 17 additions and 17 deletions
|
@ -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
|
||||||
|
|
||||||
|
|
|
@ -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) {
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -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) {
|
||||||
|
|
|
@ -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;
|
||||||
|
|
||||||
|
|
|
@ -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 &&
|
||||||
|
|
|
@ -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 &&
|
||||||
|
|
|
@ -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) {
|
||||||
|
|
|
@ -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;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue