Commit 64bb6b36 authored by Niels Möller's avatar Niels Möller

Use size_t for asn1 parser.

parent c9460c81
......@@ -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);
......
......@@ -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)
......
......@@ -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;
......
......@@ -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;
......
......@@ -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. */
......
......@@ -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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment