summaryrefslogtreecommitdiff
path: root/src/lib/libssl/bytestring.h
diff options
context:
space:
mode:
authordoug <>2015-06-18 23:25:07 +0000
committerdoug <>2015-06-18 23:25:07 +0000
commit815c9ed0143713859a67f4501a0f3698f19d25a3 (patch)
tree314dd2edc85273d817a178bbad4befe656708fd0 /src/lib/libssl/bytestring.h
parent0c8481527354cd5324e6b474cbd1cbe8e36ef4e2 (diff)
downloadopenbsd-815c9ed0143713859a67f4501a0f3698f19d25a3.tar.gz
openbsd-815c9ed0143713859a67f4501a0f3698f19d25a3.tar.bz2
openbsd-815c9ed0143713859a67f4501a0f3698f19d25a3.zip
Extend the input types for CBB_add_*() to help catch bugs.
While the previous types were correct, they can silently accept bad data via truncation or signed conversion. We now take size_t as input for CBB_add_u*() and do a range check. discussed with deraadt@ input + ok jsing@ miod@
Diffstat (limited to 'src/lib/libssl/bytestring.h')
-rw-r--r--src/lib/libssl/bytestring.h10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/lib/libssl/bytestring.h b/src/lib/libssl/bytestring.h
index e831706b28..4c9d4d8884 100644
--- a/src/lib/libssl/bytestring.h
+++ b/src/lib/libssl/bytestring.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: bytestring.h,v 1.12 2015/06/17 07:25:56 doug Exp $ */ 1/* $OpenBSD: bytestring.h,v 1.13 2015/06/18 23:25:07 doug Exp $ */
2/* 2/*
3 * Copyright (c) 2014, Google Inc. 3 * Copyright (c) 2014, Google Inc.
4 * 4 *
@@ -423,7 +423,7 @@ int CBB_add_u24_length_prefixed(CBB *cbb, CBB *out_contents);
423 * single octet identifiers are supported. It returns one on success or zero 423 * single octet identifiers are supported. It returns one on success or zero
424 * on error. 424 * on error.
425 */ 425 */
426int CBB_add_asn1(CBB *cbb, CBB *out_contents, uint8_t tag); 426int CBB_add_asn1(CBB *cbb, CBB *out_contents, unsigned int tag);
427 427
428/* 428/*
429 * CBB_add_bytes appends |len| bytes from |data| to |cbb|. It returns one on 429 * CBB_add_bytes appends |len| bytes from |data| to |cbb|. It returns one on
@@ -443,19 +443,19 @@ int CBB_add_space(CBB *cbb, uint8_t **out_data, size_t len);
443 * CBB_add_u8 appends an 8-bit number from |value| to |cbb|. It returns one on 443 * CBB_add_u8 appends an 8-bit number from |value| to |cbb|. It returns one on
444 * success and zero otherwise. 444 * success and zero otherwise.
445 */ 445 */
446int CBB_add_u8(CBB *cbb, uint8_t value); 446int CBB_add_u8(CBB *cbb, size_t value);
447 447
448/* 448/*
449 * CBB_add_u8 appends a 16-bit, big-endian number from |value| to |cbb|. It 449 * CBB_add_u8 appends a 16-bit, big-endian number from |value| to |cbb|. It
450 * returns one on success and zero otherwise. 450 * returns one on success and zero otherwise.
451 */ 451 */
452int CBB_add_u16(CBB *cbb, uint16_t value); 452int CBB_add_u16(CBB *cbb, size_t value);
453 453
454/* 454/*
455 * CBB_add_u24 appends a 24-bit, big-endian number from |value| to |cbb|. It 455 * CBB_add_u24 appends a 24-bit, big-endian number from |value| to |cbb|. It
456 * returns one on success and zero otherwise. 456 * returns one on success and zero otherwise.
457 */ 457 */
458int CBB_add_u24(CBB *cbb, uint32_t value); 458int CBB_add_u24(CBB *cbb, size_t value);
459 459
460/* 460/*
461 * CBB_add_asn1_uint64 writes an ASN.1 INTEGER into |cbb| using |CBB_add_asn1| 461 * CBB_add_asn1_uint64 writes an ASN.1 INTEGER into |cbb| using |CBB_add_asn1|