From 0ad3dcfd9eed2a5e253e6cb89cb1f5597d45f076 Mon Sep 17 00:00:00 2001 From: doug Date: Wed, 17 Jun 2015 07:25:56 +0000 Subject: [PATCH] Use explicit int in bs_cbs.c. ok miod@ jsing@ --- lib/libssl/bs_cbs.c | 25 +++++++++++++------------ lib/libssl/bytestring.h | 21 +++++++++++---------- lib/libssl/src/ssl/bs_cbs.c | 25 +++++++++++++------------ lib/libssl/src/ssl/bytestring.h | 21 +++++++++++---------- 4 files changed, 48 insertions(+), 44 deletions(-) diff --git a/lib/libssl/bs_cbs.c b/lib/libssl/bs_cbs.c index b36ba489f3a..45c253cc4b4 100644 --- a/lib/libssl/bs_cbs.c +++ b/lib/libssl/bs_cbs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bs_cbs.c,v 1.12 2015/06/17 07:06:22 doug Exp $ */ +/* $OpenBSD: bs_cbs.c,v 1.13 2015/06/17 07:25:56 doug Exp $ */ /* * Copyright (c) 2014, Google Inc. * @@ -223,7 +223,7 @@ CBS_get_u24_length_prefixed(CBS *cbs, CBS *out) } int -CBS_get_any_asn1_element(CBS *cbs, CBS *out, unsigned *out_tag, +CBS_get_any_asn1_element(CBS *cbs, CBS *out, unsigned int *out_tag, size_t *out_header_len) { return cbs_get_any_asn1_element_internal(cbs, out, out_tag, @@ -240,7 +240,7 @@ CBS_get_any_asn1_element(CBS *cbs, CBS *out, unsigned *out_tag, * Sections 8, 10 and 11 for DER encoding */ int -cbs_get_any_asn1_element_internal(CBS *cbs, CBS *out, unsigned *out_tag, +cbs_get_any_asn1_element_internal(CBS *cbs, CBS *out, unsigned int *out_tag, size_t *out_header_len, int strict) { uint8_t tag, length_byte; @@ -326,10 +326,10 @@ cbs_get_any_asn1_element_internal(CBS *cbs, CBS *out, unsigned *out_tag, } static int -cbs_get_asn1(CBS *cbs, CBS *out, unsigned tag_value, int skip_header) +cbs_get_asn1(CBS *cbs, CBS *out, unsigned int tag_value, int skip_header) { size_t header_len; - unsigned tag; + unsigned int tag; CBS throwaway; if (out == NULL) @@ -348,19 +348,19 @@ cbs_get_asn1(CBS *cbs, CBS *out, unsigned tag_value, int skip_header) } int -CBS_get_asn1(CBS *cbs, CBS *out, unsigned tag_value) +CBS_get_asn1(CBS *cbs, CBS *out, unsigned int tag_value) { return cbs_get_asn1(cbs, out, tag_value, 1 /* skip header */); } int -CBS_get_asn1_element(CBS *cbs, CBS *out, unsigned tag_value) +CBS_get_asn1_element(CBS *cbs, CBS *out, unsigned int tag_value) { return cbs_get_asn1(cbs, out, tag_value, 0 /* include header */); } int -CBS_peek_asn1_tag(const CBS *cbs, unsigned tag_value) +CBS_peek_asn1_tag(const CBS *cbs, unsigned int tag_value) { if (CBS_len(cbs) < 1) return 0; @@ -415,7 +415,7 @@ CBS_get_asn1_uint64(CBS *cbs, uint64_t *out) } int -CBS_get_optional_asn1(CBS *cbs, CBS *out, int *out_present, unsigned tag) +CBS_get_optional_asn1(CBS *cbs, CBS *out, int *out_present, unsigned int tag) { if (CBS_peek_asn1_tag(cbs, tag)) { if (!CBS_get_asn1(cbs, out, tag)) @@ -430,7 +430,7 @@ CBS_get_optional_asn1(CBS *cbs, CBS *out, int *out_present, unsigned tag) int CBS_get_optional_asn1_octet_string(CBS *cbs, CBS *out, int *out_present, - unsigned tag) + unsigned int tag) { CBS child; int present; @@ -452,7 +452,7 @@ CBS_get_optional_asn1_octet_string(CBS *cbs, CBS *out, int *out_present, } int -CBS_get_optional_asn1_uint64(CBS *cbs, uint64_t *out, unsigned tag, +CBS_get_optional_asn1_uint64(CBS *cbs, uint64_t *out, unsigned int tag, uint64_t default_value) { CBS child; @@ -472,7 +472,8 @@ CBS_get_optional_asn1_uint64(CBS *cbs, uint64_t *out, unsigned tag, } int -CBS_get_optional_asn1_bool(CBS *cbs, int *out, unsigned tag, int default_value) +CBS_get_optional_asn1_bool(CBS *cbs, int *out, unsigned int tag, + int default_value) { CBS child, child2; int present; diff --git a/lib/libssl/bytestring.h b/lib/libssl/bytestring.h index 2eb18e207dc..e831706b28d 100644 --- a/lib/libssl/bytestring.h +++ b/lib/libssl/bytestring.h @@ -1,4 +1,4 @@ -/* $OpenBSD: bytestring.h,v 1.11 2015/06/17 07:06:22 doug Exp $ */ +/* $OpenBSD: bytestring.h,v 1.12 2015/06/17 07:25:56 doug Exp $ */ /* * Copyright (c) 2014, Google Inc. * @@ -217,13 +217,13 @@ int CBS_get_u24_length_prefixed(CBS *cbs, CBS *out); * * Tag numbers greater than 30 are not supported (i.e. short form only). */ -int CBS_get_asn1(CBS *cbs, CBS *out, unsigned tag_value); +int CBS_get_asn1(CBS *cbs, CBS *out, unsigned int tag_value); /* * CBS_get_asn1_element acts like |CBS_get_asn1| but |out| will include the * ASN.1 header bytes too. */ -int CBS_get_asn1_element(CBS *cbs, CBS *out, unsigned tag_value); +int CBS_get_asn1_element(CBS *cbs, CBS *out, unsigned int tag_value); /* * CBS_peek_asn1_tag looks ahead at the next ASN.1 tag and returns one @@ -232,7 +232,7 @@ int CBS_get_asn1_element(CBS *cbs, CBS *out, unsigned tag_value); * it returns one, CBS_get_asn1 may still fail if the rest of the * element is malformed. */ -int CBS_peek_asn1_tag(const CBS *cbs, unsigned tag_value); +int CBS_peek_asn1_tag(const CBS *cbs, unsigned int tag_value); /* * CBS_get_any_asn1_element sets |*out| to contain the next ASN.1 element from @@ -243,7 +243,7 @@ int CBS_peek_asn1_tag(const CBS *cbs, unsigned tag_value); * * Tag numbers greater than 30 are not supported (i.e. short form only). */ -int CBS_get_any_asn1_element(CBS *cbs, CBS *out, unsigned *out_tag, +int CBS_get_any_asn1_element(CBS *cbs, CBS *out, unsigned int *out_tag, size_t *out_header_len); /* @@ -261,7 +261,8 @@ int CBS_get_asn1_uint64(CBS *cbs, uint64_t *out); * one on success, whether or not the element was present, and zero on * decode failure. */ -int CBS_get_optional_asn1(CBS *cbs, CBS *out, int *out_present, unsigned tag); +int CBS_get_optional_asn1(CBS *cbs, CBS *out, int *out_present, + unsigned int tag); /* * CBS_get_optional_asn1_octet_string gets an optional @@ -272,7 +273,7 @@ int CBS_get_optional_asn1(CBS *cbs, CBS *out, int *out_present, unsigned tag); * present, and zero on decode failure. */ int CBS_get_optional_asn1_octet_string(CBS *cbs, CBS *out, int *out_present, - unsigned tag); + unsigned int tag); /* * CBS_get_optional_asn1_uint64 gets an optional explicitly-tagged @@ -281,7 +282,7 @@ int CBS_get_optional_asn1_octet_string(CBS *cbs, CBS *out, int *out_present, * on success, whether or not the element was present, and zero on * decode failure. */ -int CBS_get_optional_asn1_uint64(CBS *cbs, uint64_t *out, unsigned tag, +int CBS_get_optional_asn1_uint64(CBS *cbs, uint64_t *out, unsigned int tag, uint64_t default_value); /* @@ -291,7 +292,7 @@ int CBS_get_optional_asn1_uint64(CBS *cbs, uint64_t *out, unsigned tag, * success, whether or not the element was present, and zero on decode * failure. */ -int CBS_get_optional_asn1_bool(CBS *cbs, int *out, unsigned tag, +int CBS_get_optional_asn1_bool(CBS *cbs, int *out, unsigned int tag, int default_value); @@ -474,7 +475,7 @@ int CBB_add_asn1_uint64(CBB *cbb, uint64_t value); * * Tag numbers greater than 30 are not supported (i.e. short form only). */ -int cbs_get_any_asn1_element_internal(CBS *cbs, CBS *out, unsigned *out_tag, +int cbs_get_any_asn1_element_internal(CBS *cbs, CBS *out, unsigned int *out_tag, size_t *out_header_len, int strict); /* diff --git a/lib/libssl/src/ssl/bs_cbs.c b/lib/libssl/src/ssl/bs_cbs.c index b36ba489f3a..45c253cc4b4 100644 --- a/lib/libssl/src/ssl/bs_cbs.c +++ b/lib/libssl/src/ssl/bs_cbs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bs_cbs.c,v 1.12 2015/06/17 07:06:22 doug Exp $ */ +/* $OpenBSD: bs_cbs.c,v 1.13 2015/06/17 07:25:56 doug Exp $ */ /* * Copyright (c) 2014, Google Inc. * @@ -223,7 +223,7 @@ CBS_get_u24_length_prefixed(CBS *cbs, CBS *out) } int -CBS_get_any_asn1_element(CBS *cbs, CBS *out, unsigned *out_tag, +CBS_get_any_asn1_element(CBS *cbs, CBS *out, unsigned int *out_tag, size_t *out_header_len) { return cbs_get_any_asn1_element_internal(cbs, out, out_tag, @@ -240,7 +240,7 @@ CBS_get_any_asn1_element(CBS *cbs, CBS *out, unsigned *out_tag, * Sections 8, 10 and 11 for DER encoding */ int -cbs_get_any_asn1_element_internal(CBS *cbs, CBS *out, unsigned *out_tag, +cbs_get_any_asn1_element_internal(CBS *cbs, CBS *out, unsigned int *out_tag, size_t *out_header_len, int strict) { uint8_t tag, length_byte; @@ -326,10 +326,10 @@ cbs_get_any_asn1_element_internal(CBS *cbs, CBS *out, unsigned *out_tag, } static int -cbs_get_asn1(CBS *cbs, CBS *out, unsigned tag_value, int skip_header) +cbs_get_asn1(CBS *cbs, CBS *out, unsigned int tag_value, int skip_header) { size_t header_len; - unsigned tag; + unsigned int tag; CBS throwaway; if (out == NULL) @@ -348,19 +348,19 @@ cbs_get_asn1(CBS *cbs, CBS *out, unsigned tag_value, int skip_header) } int -CBS_get_asn1(CBS *cbs, CBS *out, unsigned tag_value) +CBS_get_asn1(CBS *cbs, CBS *out, unsigned int tag_value) { return cbs_get_asn1(cbs, out, tag_value, 1 /* skip header */); } int -CBS_get_asn1_element(CBS *cbs, CBS *out, unsigned tag_value) +CBS_get_asn1_element(CBS *cbs, CBS *out, unsigned int tag_value) { return cbs_get_asn1(cbs, out, tag_value, 0 /* include header */); } int -CBS_peek_asn1_tag(const CBS *cbs, unsigned tag_value) +CBS_peek_asn1_tag(const CBS *cbs, unsigned int tag_value) { if (CBS_len(cbs) < 1) return 0; @@ -415,7 +415,7 @@ CBS_get_asn1_uint64(CBS *cbs, uint64_t *out) } int -CBS_get_optional_asn1(CBS *cbs, CBS *out, int *out_present, unsigned tag) +CBS_get_optional_asn1(CBS *cbs, CBS *out, int *out_present, unsigned int tag) { if (CBS_peek_asn1_tag(cbs, tag)) { if (!CBS_get_asn1(cbs, out, tag)) @@ -430,7 +430,7 @@ CBS_get_optional_asn1(CBS *cbs, CBS *out, int *out_present, unsigned tag) int CBS_get_optional_asn1_octet_string(CBS *cbs, CBS *out, int *out_present, - unsigned tag) + unsigned int tag) { CBS child; int present; @@ -452,7 +452,7 @@ CBS_get_optional_asn1_octet_string(CBS *cbs, CBS *out, int *out_present, } int -CBS_get_optional_asn1_uint64(CBS *cbs, uint64_t *out, unsigned tag, +CBS_get_optional_asn1_uint64(CBS *cbs, uint64_t *out, unsigned int tag, uint64_t default_value) { CBS child; @@ -472,7 +472,8 @@ CBS_get_optional_asn1_uint64(CBS *cbs, uint64_t *out, unsigned tag, } int -CBS_get_optional_asn1_bool(CBS *cbs, int *out, unsigned tag, int default_value) +CBS_get_optional_asn1_bool(CBS *cbs, int *out, unsigned int tag, + int default_value) { CBS child, child2; int present; diff --git a/lib/libssl/src/ssl/bytestring.h b/lib/libssl/src/ssl/bytestring.h index 2eb18e207dc..e831706b28d 100644 --- a/lib/libssl/src/ssl/bytestring.h +++ b/lib/libssl/src/ssl/bytestring.h @@ -1,4 +1,4 @@ -/* $OpenBSD: bytestring.h,v 1.11 2015/06/17 07:06:22 doug Exp $ */ +/* $OpenBSD: bytestring.h,v 1.12 2015/06/17 07:25:56 doug Exp $ */ /* * Copyright (c) 2014, Google Inc. * @@ -217,13 +217,13 @@ int CBS_get_u24_length_prefixed(CBS *cbs, CBS *out); * * Tag numbers greater than 30 are not supported (i.e. short form only). */ -int CBS_get_asn1(CBS *cbs, CBS *out, unsigned tag_value); +int CBS_get_asn1(CBS *cbs, CBS *out, unsigned int tag_value); /* * CBS_get_asn1_element acts like |CBS_get_asn1| but |out| will include the * ASN.1 header bytes too. */ -int CBS_get_asn1_element(CBS *cbs, CBS *out, unsigned tag_value); +int CBS_get_asn1_element(CBS *cbs, CBS *out, unsigned int tag_value); /* * CBS_peek_asn1_tag looks ahead at the next ASN.1 tag and returns one @@ -232,7 +232,7 @@ int CBS_get_asn1_element(CBS *cbs, CBS *out, unsigned tag_value); * it returns one, CBS_get_asn1 may still fail if the rest of the * element is malformed. */ -int CBS_peek_asn1_tag(const CBS *cbs, unsigned tag_value); +int CBS_peek_asn1_tag(const CBS *cbs, unsigned int tag_value); /* * CBS_get_any_asn1_element sets |*out| to contain the next ASN.1 element from @@ -243,7 +243,7 @@ int CBS_peek_asn1_tag(const CBS *cbs, unsigned tag_value); * * Tag numbers greater than 30 are not supported (i.e. short form only). */ -int CBS_get_any_asn1_element(CBS *cbs, CBS *out, unsigned *out_tag, +int CBS_get_any_asn1_element(CBS *cbs, CBS *out, unsigned int *out_tag, size_t *out_header_len); /* @@ -261,7 +261,8 @@ int CBS_get_asn1_uint64(CBS *cbs, uint64_t *out); * one on success, whether or not the element was present, and zero on * decode failure. */ -int CBS_get_optional_asn1(CBS *cbs, CBS *out, int *out_present, unsigned tag); +int CBS_get_optional_asn1(CBS *cbs, CBS *out, int *out_present, + unsigned int tag); /* * CBS_get_optional_asn1_octet_string gets an optional @@ -272,7 +273,7 @@ int CBS_get_optional_asn1(CBS *cbs, CBS *out, int *out_present, unsigned tag); * present, and zero on decode failure. */ int CBS_get_optional_asn1_octet_string(CBS *cbs, CBS *out, int *out_present, - unsigned tag); + unsigned int tag); /* * CBS_get_optional_asn1_uint64 gets an optional explicitly-tagged @@ -281,7 +282,7 @@ int CBS_get_optional_asn1_octet_string(CBS *cbs, CBS *out, int *out_present, * on success, whether or not the element was present, and zero on * decode failure. */ -int CBS_get_optional_asn1_uint64(CBS *cbs, uint64_t *out, unsigned tag, +int CBS_get_optional_asn1_uint64(CBS *cbs, uint64_t *out, unsigned int tag, uint64_t default_value); /* @@ -291,7 +292,7 @@ int CBS_get_optional_asn1_uint64(CBS *cbs, uint64_t *out, unsigned tag, * success, whether or not the element was present, and zero on decode * failure. */ -int CBS_get_optional_asn1_bool(CBS *cbs, int *out, unsigned tag, +int CBS_get_optional_asn1_bool(CBS *cbs, int *out, unsigned int tag, int default_value); @@ -474,7 +475,7 @@ int CBB_add_asn1_uint64(CBB *cbb, uint64_t value); * * Tag numbers greater than 30 are not supported (i.e. short form only). */ -int cbs_get_any_asn1_element_internal(CBS *cbs, CBS *out, unsigned *out_tag, +int cbs_get_any_asn1_element_internal(CBS *cbs, CBS *out, unsigned int *out_tag, size_t *out_header_len, int strict); /* -- 2.20.1