Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
LSH
lsh
Commits
94a2fe58
Commit
94a2fe58
authored
Jan 10, 1999
by
Niels Möller
Browse files
Constified.
Rev: src/bignum.c:1.11 Rev: src/bignum.h:1.13
parent
380aab21
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/bignum.c
View file @
94a2fe58
...
...
@@ -31,7 +31,7 @@
#include
"prime_table.h"
static
void
limbs_to_octets
(
mpz_t
n
,
UINT32
length
,
static
void
limbs_to_octets
(
const
mpz_t
n
,
UINT32
length
,
UINT8
pad
,
UINT8
*
data
)
{
UINT8
*
dst
=
data
+
length
-
1
;
...
...
@@ -85,7 +85,7 @@ void bignum_parse_s(mpz_t n, UINT32 length, UINT8 *data)
mpz_clear
(
digit
);
}
static
int
mpz_size_of_complement
(
mpz_t
n
)
static
int
mpz_size_of_complement
(
const
mpz_t
n
)
{
int
bits
;
...
...
@@ -103,7 +103,7 @@ static int mpz_size_of_complement(mpz_t n)
}
/* This function should handle both positive and negative numbers */
UINT32
bignum_format_s_length
(
mpz_t
n
)
UINT32
bignum_format_s_length
(
const
mpz_t
n
)
{
switch
(
mpz_sgn
(
n
))
{
...
...
@@ -118,7 +118,7 @@ UINT32 bignum_format_s_length(mpz_t n)
}
}
UINT32
bignum_format_s
(
mpz_t
n
,
UINT8
*
data
)
UINT32
bignum_format_s
(
const
mpz_t
n
,
UINT8
*
data
)
{
switch
(
mpz_sgn
(
n
))
{
...
...
@@ -173,7 +173,7 @@ void bignum_parse_u(mpz_t n, UINT32 length, UINT8 *data)
mpz_clear
(
digit
);
}
UINT32
bignum_format_u_length
(
mpz_t
n
)
UINT32
bignum_format_u_length
(
const
mpz_t
n
)
{
switch
(
mpz_sgn
(
n
))
{
...
...
@@ -191,7 +191,7 @@ void bignum_write(mpz_t n, unsigned length, UINT8 *data)
limbs_to_octets
(
n
,
length
,
0
,
data
);
}
UINT32
bignum_format_u
(
mpz_t
n
,
UINT8
*
data
)
UINT32
bignum_format_u
(
const
mpz_t
n
,
UINT8
*
data
)
{
switch
(
mpz_sgn
(
n
))
{
...
...
src/bignum.h
View file @
94a2fe58
...
...
@@ -45,11 +45,11 @@
void
bignum_parse_s
(
mpz_t
n
,
UINT32
length
,
UINT8
*
data
);
void
bignum_parse_u
(
mpz_t
n
,
UINT32
length
,
UINT8
*
data
);
UINT32
bignum_format_s
(
mpz_t
n
,
UINT8
*
data
);
UINT32
bignum_format_s_length
(
mpz_t
n
);
UINT32
bignum_format_s
(
const
mpz_t
n
,
UINT8
*
data
);
UINT32
bignum_format_s_length
(
const
mpz_t
n
);
UINT32
bignum_format_u
(
mpz_t
n
,
UINT8
*
data
);
UINT32
bignum_format_u_length
(
mpz_t
n
);
UINT32
bignum_format_u
(
const
mpz_t
n
,
UINT8
*
data
);
UINT32
bignum_format_u_length
(
const
mpz_t
n
);
void
bignum_write
(
mpz_t
n
,
unsigned
length
,
UINT8
*
data
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment