Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Brian Smith
nettle
Commits
64bb6b36
Commit
64bb6b36
authored
Apr 26, 2013
by
Niels Möller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use size_t for asn1 parser.
parent
c9460c81
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
14 additions
and
14 deletions
+14
-14
asn1.h
asn1.h
+4
-4
der-iterator.c
der-iterator.c
+4
-4
der2dsa.c
der2dsa.c
+3
-3
der2rsa.c
der2rsa.c
+1
-1
dsa.h
dsa.h
+1
-1
rsa.h
rsa.h
+1
-1
No files found.
asn1.h
View file @
64bb6b36
...
...
@@ -93,23 +93,23 @@ enum asn1_iterator_result
/* Parsing DER objects. */
struct
asn1_der_iterator
{
unsigned
buffer_length
;
size_t
buffer_length
;
const
uint8_t
*
buffer
;
/* Next object to parse. */
unsigned
pos
;
size_t
pos
;
enum
asn1_type
type
;
/* Pointer to the current object */
unsigned
length
;
size_t
length
;
const
uint8_t
*
data
;
};
/* Initializes the iterator. */
enum
asn1_iterator_result
asn1_der_iterator_first
(
struct
asn1_der_iterator
*
iterator
,
unsigned
length
,
const
uint8_t
*
input
);
size_t
length
,
const
uint8_t
*
input
);
enum
asn1_iterator_result
asn1_der_iterator_next
(
struct
asn1_der_iterator
*
iterator
);
...
...
der-iterator.c
View file @
64bb6b36
...
...
@@ -87,7 +87,7 @@ enum {
* first element. */
static
void
asn1_der_iterator_init
(
struct
asn1_der_iterator
*
iterator
,
unsigned
length
,
const
uint8_t
*
input
)
size_t
length
,
const
uint8_t
*
input
)
{
iterator
->
buffer_length
=
length
;
iterator
->
buffer
=
input
;
...
...
@@ -133,7 +133,7 @@ asn1_der_iterator_next(struct asn1_der_iterator *i)
if
(
LEFT
(
i
)
<
k
)
return
ASN1_ITERATOR_ERROR
;
if
(
k
>
sizeof
(
unsigned
))
if
(
k
>
sizeof
(
i
->
length
))
return
ASN1_ITERATOR_ERROR
;
i
->
pos
+=
k
;
...
...
@@ -164,7 +164,7 @@ asn1_der_iterator_next(struct asn1_der_iterator *i)
enum
asn1_iterator_result
asn1_der_iterator_first
(
struct
asn1_der_iterator
*
i
,
unsigned
length
,
const
uint8_t
*
input
)
size_t
length
,
const
uint8_t
*
input
)
{
asn1_der_iterator_init
(
i
,
length
,
input
);
return
asn1_der_iterator_next
(
i
);
...
...
@@ -216,7 +216,7 @@ asn1_der_get_uint32(struct asn1_der_iterator *i,
/* Big endian, two's complement, minimum number of octets (except 0,
which is encoded as a single octet */
uint32_t
value
=
0
;
unsigned
length
=
i
->
length
;
size_t
length
=
i
->
length
;
unsigned
k
;
if
(
!
length
||
length
>
5
)
...
...
der2dsa.c
View file @
64bb6b36
...
...
@@ -103,9 +103,9 @@ dsa_openssl_private_key_from_der_iterator(struct dsa_public_key *pub,
int
dsa_openssl_private_key_from_der
(
struct
dsa_public_key
*
pub
,
struct
dsa_private_key
*
priv
,
unsigned
p_max_bits
,
unsigned
length
,
const
uint8_t
*
data
)
struct
dsa_private_key
*
priv
,
unsigned
p_max_bits
,
size_t
length
,
const
uint8_t
*
data
)
{
struct
asn1_der_iterator
i
;
enum
asn1_iterator_result
res
;
...
...
der2rsa.c
View file @
64bb6b36
...
...
@@ -116,7 +116,7 @@ int
rsa_keypair_from_der
(
struct
rsa_public_key
*
pub
,
struct
rsa_private_key
*
priv
,
unsigned
limit
,
unsigned
length
,
const
uint8_t
*
data
)
size_t
length
,
const
uint8_t
*
data
)
{
struct
asn1_der_iterator
i
;
enum
asn1_iterator_result
res
;
...
...
dsa.h
View file @
64bb6b36
...
...
@@ -268,7 +268,7 @@ int
dsa_openssl_private_key_from_der
(
struct
dsa_public_key
*
pub
,
struct
dsa_private_key
*
priv
,
unsigned
p_max_bits
,
unsigned
length
,
const
uint8_t
*
data
);
size_t
length
,
const
uint8_t
*
data
);
/* Internal functions. */
...
...
rsa.h
View file @
64bb6b36
...
...
@@ -386,7 +386,7 @@ int
rsa_keypair_from_der
(
struct
rsa_public_key
*
pub
,
struct
rsa_private_key
*
priv
,
unsigned
limit
,
unsigned
length
,
const
uint8_t
*
data
);
size_t
length
,
const
uint8_t
*
data
);
/* OpenPGP format. Experimental interface, subject to change. */
int
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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