From 5de06c1d0d23388ea3e98ae4d3b06c2718e1c115 Mon Sep 17 00:00:00 2001 From: jsing Date: Sat, 22 Jun 2024 15:32:51 +0000 Subject: [PATCH] Sync bytestring from libssl. --- lib/libcrypto/bytestring/bs_cbb.c | 8 +++++++- lib/libcrypto/bytestring/bytestring.h | 9 ++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/lib/libcrypto/bytestring/bs_cbb.c b/lib/libcrypto/bytestring/bs_cbb.c index 3c66a28e669..cd29e168dc2 100644 --- a/lib/libcrypto/bytestring/bs_cbb.c +++ b/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/lib/libcrypto/bytestring/bytestring.h b/lib/libcrypto/bytestring/bytestring.h index d80e89c9a69..ec4abf6229a 100644 --- a/lib/libcrypto/bytestring/bytestring.h +++ b/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 -- 2.20.1