Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
N
nettle
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Norbert Pócs
nettle
Commits
64bb6b36
Commit
64bb6b36
authored
12 years ago
by
Niels Möller
Browse files
Options
Downloads
Patches
Plain Diff
Use size_t for asn1 parser.
parent
c9460c81
No related branches found
No related tags found
No related merge requests found
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
asn1.h
+4
-4
4 additions, 4 deletions
asn1.h
der-iterator.c
+4
-4
4 additions, 4 deletions
der-iterator.c
der2dsa.c
+3
-3
3 additions, 3 deletions
der2dsa.c
der2rsa.c
+1
-1
1 addition, 1 deletion
der2rsa.c
dsa.h
+1
-1
1 addition, 1 deletion
dsa.h
rsa.h
+1
-1
1 addition, 1 deletion
rsa.h
with
14 additions
and
14 deletions
asn1.h
+
4
−
4
View file @
64bb6b36
...
@@ -93,23 +93,23 @@ enum asn1_iterator_result
...
@@ -93,23 +93,23 @@ enum asn1_iterator_result
/* Parsing DER objects. */
/* Parsing DER objects. */
struct
asn1_der_iterator
struct
asn1_der_iterator
{
{
unsigned
buffer_length
;
size_t
buffer_length
;
const
uint8_t
*
buffer
;
const
uint8_t
*
buffer
;
/* Next object to parse. */
/* Next object to parse. */
unsigned
pos
;
size_t
pos
;
enum
asn1_type
type
;
enum
asn1_type
type
;
/* Pointer to the current object */
/* Pointer to the current object */
unsigned
length
;
size_t
length
;
const
uint8_t
*
data
;
const
uint8_t
*
data
;
};
};
/* Initializes the iterator. */
/* Initializes the iterator. */
enum
asn1_iterator_result
enum
asn1_iterator_result
asn1_der_iterator_first
(
struct
asn1_der_iterator
*
iterator
,
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
enum
asn1_iterator_result
asn1_der_iterator_next
(
struct
asn1_der_iterator
*
iterator
);
asn1_der_iterator_next
(
struct
asn1_der_iterator
*
iterator
);
...
...
This diff is collapsed.
Click to expand it.
der-iterator.c
+
4
−
4
View file @
64bb6b36
...
@@ -87,7 +87,7 @@ enum {
...
@@ -87,7 +87,7 @@ enum {
* first element. */
* first element. */
static
void
static
void
asn1_der_iterator_init
(
struct
asn1_der_iterator
*
iterator
,
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_length
=
length
;
iterator
->
buffer
=
input
;
iterator
->
buffer
=
input
;
...
@@ -133,7 +133,7 @@ asn1_der_iterator_next(struct asn1_der_iterator *i)
...
@@ -133,7 +133,7 @@ asn1_der_iterator_next(struct asn1_der_iterator *i)
if
(
LEFT
(
i
)
<
k
)
if
(
LEFT
(
i
)
<
k
)
return
ASN1_ITERATOR_ERROR
;
return
ASN1_ITERATOR_ERROR
;
if
(
k
>
sizeof
(
unsigned
))
if
(
k
>
sizeof
(
i
->
length
))
return
ASN1_ITERATOR_ERROR
;
return
ASN1_ITERATOR_ERROR
;
i
->
pos
+=
k
;
i
->
pos
+=
k
;
...
@@ -164,7 +164,7 @@ asn1_der_iterator_next(struct asn1_der_iterator *i)
...
@@ -164,7 +164,7 @@ asn1_der_iterator_next(struct asn1_der_iterator *i)
enum
asn1_iterator_result
enum
asn1_iterator_result
asn1_der_iterator_first
(
struct
asn1_der_iterator
*
i
,
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
);
asn1_der_iterator_init
(
i
,
length
,
input
);
return
asn1_der_iterator_next
(
i
);
return
asn1_der_iterator_next
(
i
);
...
@@ -216,7 +216,7 @@ asn1_der_get_uint32(struct asn1_der_iterator *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,
/* Big endian, two's complement, minimum number of octets (except 0,
which is encoded as a single octet */
which is encoded as a single octet */
uint32_t
value
=
0
;
uint32_t
value
=
0
;
unsigned
length
=
i
->
length
;
size_t
length
=
i
->
length
;
unsigned
k
;
unsigned
k
;
if
(
!
length
||
length
>
5
)
if
(
!
length
||
length
>
5
)
...
...
This diff is collapsed.
Click to expand it.
der2dsa.c
+
3
−
3
View file @
64bb6b36
...
@@ -105,7 +105,7 @@ int
...
@@ -105,7 +105,7 @@ int
dsa_openssl_private_key_from_der
(
struct
dsa_public_key
*
pub
,
dsa_openssl_private_key_from_der
(
struct
dsa_public_key
*
pub
,
struct
dsa_private_key
*
priv
,
struct
dsa_private_key
*
priv
,
unsigned
p_max_bits
,
unsigned
p_max_bits
,
unsigned
length
,
const
uint8_t
*
data
)
size_t
length
,
const
uint8_t
*
data
)
{
{
struct
asn1_der_iterator
i
;
struct
asn1_der_iterator
i
;
enum
asn1_iterator_result
res
;
enum
asn1_iterator_result
res
;
...
...
This diff is collapsed.
Click to expand it.
der2rsa.c
+
1
−
1
View file @
64bb6b36
...
@@ -116,7 +116,7 @@ int
...
@@ -116,7 +116,7 @@ int
rsa_keypair_from_der
(
struct
rsa_public_key
*
pub
,
rsa_keypair_from_der
(
struct
rsa_public_key
*
pub
,
struct
rsa_private_key
*
priv
,
struct
rsa_private_key
*
priv
,
unsigned
limit
,
unsigned
limit
,
unsigned
length
,
const
uint8_t
*
data
)
size_t
length
,
const
uint8_t
*
data
)
{
{
struct
asn1_der_iterator
i
;
struct
asn1_der_iterator
i
;
enum
asn1_iterator_result
res
;
enum
asn1_iterator_result
res
;
...
...
This diff is collapsed.
Click to expand it.
dsa.h
+
1
−
1
View file @
64bb6b36
...
@@ -268,7 +268,7 @@ int
...
@@ -268,7 +268,7 @@ int
dsa_openssl_private_key_from_der
(
struct
dsa_public_key
*
pub
,
dsa_openssl_private_key_from_der
(
struct
dsa_public_key
*
pub
,
struct
dsa_private_key
*
priv
,
struct
dsa_private_key
*
priv
,
unsigned
p_max_bits
,
unsigned
p_max_bits
,
unsigned
length
,
const
uint8_t
*
data
);
size_t
length
,
const
uint8_t
*
data
);
/* Internal functions. */
/* Internal functions. */
...
...
This diff is collapsed.
Click to expand it.
rsa.h
+
1
−
1
View file @
64bb6b36
...
@@ -386,7 +386,7 @@ int
...
@@ -386,7 +386,7 @@ int
rsa_keypair_from_der
(
struct
rsa_public_key
*
pub
,
rsa_keypair_from_der
(
struct
rsa_public_key
*
pub
,
struct
rsa_private_key
*
priv
,
struct
rsa_private_key
*
priv
,
unsigned
limit
,
unsigned
limit
,
unsigned
length
,
const
uint8_t
*
data
);
size_t
length
,
const
uint8_t
*
data
);
/* OpenPGP format. Experimental interface, subject to change. */
/* OpenPGP format. Experimental interface, subject to change. */
int
int
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment