summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@gnutls.org>2012-03-04 22:50:12 +0100
committerNikos Mavrogiannopoulos <nmav@gnutls.org>2012-03-13 19:34:31 +0100
commit627774dea5e3202f4e6a1ab7ef32b6c07d0f4ec9 (patch)
treedd1083c1730ca438235afe21995fe0aa144e8dcd
parent5549db25e83d9cf7529af3df8e99c0fad1fd1c50 (diff)
downloadlibtasn1-627774dea5e3202f4e6a1ab7ef32b6c07d0f4ec9.tar.gz
API is based on integers instead of long to prevent errors in systems where sizeof(int)!=sizeof(long)
-rw-r--r--NEWS2
-rw-r--r--lib/coding.c2
-rw-r--r--lib/decoding.c6
-rw-r--r--lib/libtasn1.h6
4 files changed, 9 insertions, 7 deletions
diff --git a/NEWS b/NEWS
index 6a7b833..fae31ed 100644
--- a/NEWS
+++ b/NEWS
@@ -3,6 +3,8 @@ GNU Libtasn1 NEWS -*- outline -*-
* Noteworthy changes in release 2.12 (????-??-??) [?]
- Cleanup license headers.
- build: Update gnulib files.
+- API is based on integers instead of long to prevent errors in systems
+ where sizeof(int)!=sizeof(long).
* Noteworthy changes in release 2.11 (2011-11-25) [stable]
- qa: Now builds without compiler warnings with Solaris CC.
diff --git a/lib/coding.c b/lib/coding.c
index 8b72eba..a1896d5 100644
--- a/lib/coding.c
+++ b/lib/coding.c
@@ -68,7 +68,7 @@ _asn1_error_description_value_not_found (ASN1_TYPE node,
* The @ans buffer is pre-allocated and must have room for the output.
**/
void
-asn1_length_der (unsigned long int len, unsigned char *ans, int *ans_len)
+asn1_length_der (unsigned int len, unsigned char *ans, int *ans_len)
{
int k;
unsigned char temp[SIZEOF_UNSIGNED_LONG_INT];
diff --git a/lib/decoding.c b/lib/decoding.c
index ed144f0..e5590f2 100644
--- a/lib/decoding.c
+++ b/lib/decoding.c
@@ -56,10 +56,10 @@ _asn1_error_description_tag_error (ASN1_TYPE node, char *ErrorDescription)
* Returns: Return the decoded length value, or -1 on indefinite
* length, or -2 when the value was too big.
**/
-signed long
+signed int
asn1_get_length_der (const unsigned char *der, int der_len, int *len)
{
- signed long ans;
+ signed int ans;
int k, punt;
*len = 0;
@@ -172,7 +172,7 @@ asn1_get_tag_der (const unsigned char *der, int der_len,
*
* Since: 2.0
**/
-signed long
+signed int
asn1_get_length_ber (const unsigned char *ber, int ber_len, int *len)
{
int ret;
diff --git a/lib/libtasn1.h b/lib/libtasn1.h
index 289fb57..f18327f 100644
--- a/lib/libtasn1.h
+++ b/lib/libtasn1.h
@@ -261,14 +261,14 @@ extern "C"
int *ret_len, unsigned char *str,
int str_size, int *bit_len);
- extern ASN1_API signed long
+ extern ASN1_API signed int
asn1_get_length_der (const unsigned char *der, int der_len, int *len);
- extern ASN1_API signed long
+ extern ASN1_API signed int
asn1_get_length_ber (const unsigned char *ber, int ber_len, int *len);
extern ASN1_API void
- asn1_length_der (unsigned long int len, unsigned char *ans, int *ans_len);
+ asn1_length_der (unsigned int len, unsigned char *ans, int *ans_len);
/* Other utility functions. */