From b5b93f3e56996c0034f98d6244c49b48e309478a Mon Sep 17 00:00:00 2001 From: jsing <> Date: Sat, 22 Jun 2024 15:32:51 +0000 Subject: Sync bytestring from libssl. --- src/lib/libcrypto/bytestring/bs_cbb.c | 8 +++++++- src/lib/libcrypto/bytestring/bytestring.h | 9 ++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/lib/libcrypto/bytestring/bs_cbb.c b/src/lib/libcrypto/bytestring/bs_cbb.c index 3c66a28e66..cd29e168dc 100644 --- a/src/lib/libcrypto/bytestring/bs_cbb.c +++ b/src/lib/libcrypto/bytestring/bs_cbb.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bs_cbb.c,v 1.5 2024/05/25 15:12:47 tb Exp $ */ +/* $OpenBSD: bs_cbb.c,v 1.6 2024/06/22 15:32:51 jsing Exp $ */ /* * Copyright (c) 2014, Google Inc. * @@ -328,6 +328,12 @@ CBB_add_u24_length_prefixed(CBB *cbb, CBB *out_contents) return cbb_add_length_prefixed(cbb, out_contents, 3); } +int +CBB_add_u32_length_prefixed(CBB *cbb, CBB *out_contents) +{ + return cbb_add_length_prefixed(cbb, out_contents, 4); +} + int CBB_add_asn1(CBB *cbb, CBB *out_contents, unsigned int tag) { diff --git a/src/lib/libcrypto/bytestring/bytestring.h b/src/lib/libcrypto/bytestring/bytestring.h index d80e89c9a6..ec4abf6229 100644 --- a/src/lib/libcrypto/bytestring/bytestring.h +++ b/src/lib/libcrypto/bytestring/bytestring.h @@ -1,4 +1,4 @@ -/* $OpenBSD: bytestring.h,v 1.4 2022/11/09 19:05:42 jsing Exp $ */ +/* $OpenBSD: bytestring.h,v 1.5 2024/06/22 15:32:51 jsing Exp $ */ /* * Copyright (c) 2014, Google Inc. * @@ -459,6 +459,13 @@ int CBB_add_u16_length_prefixed(CBB *cbb, CBB *out_contents); */ int CBB_add_u24_length_prefixed(CBB *cbb, CBB *out_contents); +/* + * CBB_add_u32_length_prefixed sets |*out_contents| to a new child of |cbb|. + * The data written to |*out_contents| will be prefixed in |cbb| with a 32-bit, + * big-endian length. It returns one on success or zero on error. + */ +int CBB_add_u32_length_prefixed(CBB *cbb, CBB *out_contents); + /* * CBB_add_asn sets |*out_contents| to a |CBB| into which the contents of an * ASN.1 object can be written. The |tag| argument will be used as the tag for -- cgit v1.2.3-55-g6feb