diff options
| author | jsing <> | 2024-06-22 15:25:06 +0000 |
|---|---|---|
| committer | jsing <> | 2024-06-22 15:25:06 +0000 |
| commit | bdceef815e1722d0d26b681122064e8052c52a32 (patch) | |
| tree | ba319425ed8219cd90fe0d4b736b23239883585d /src | |
| parent | 78226f722a71dc3d99196c898e58604d8824610d (diff) | |
| download | openbsd-bdceef815e1722d0d26b681122064e8052c52a32.tar.gz openbsd-bdceef815e1722d0d26b681122064e8052c52a32.tar.bz2 openbsd-bdceef815e1722d0d26b681122064e8052c52a32.zip | |
Provide CBB_add_u32_length_prefixed().
This is needed for an upcoming change in libcrypto.
ok tb@
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib/libssl/bs_cbb.c | 8 | ||||
| -rw-r--r-- | src/lib/libssl/bytestring.h | 9 |
2 files changed, 15 insertions, 2 deletions
diff --git a/src/lib/libssl/bs_cbb.c b/src/lib/libssl/bs_cbb.c index 059f9abd06..9d7ad7d46d 100644 --- a/src/lib/libssl/bs_cbb.c +++ b/src/lib/libssl/bs_cbb.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: bs_cbb.c,v 1.29 2024/05/25 15:14:26 tb Exp $ */ | 1 | /* $OpenBSD: bs_cbb.c,v 1.30 2024/06/22 15:25:06 jsing Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2014, Google Inc. | 3 | * Copyright (c) 2014, Google Inc. |
| 4 | * | 4 | * |
| @@ -329,6 +329,12 @@ CBB_add_u24_length_prefixed(CBB *cbb, CBB *out_contents) | |||
| 329 | } | 329 | } |
| 330 | 330 | ||
| 331 | int | 331 | int |
| 332 | CBB_add_u32_length_prefixed(CBB *cbb, CBB *out_contents) | ||
| 333 | { | ||
| 334 | return cbb_add_length_prefixed(cbb, out_contents, 4); | ||
| 335 | } | ||
| 336 | |||
| 337 | int | ||
| 332 | CBB_add_asn1(CBB *cbb, CBB *out_contents, unsigned int tag) | 338 | CBB_add_asn1(CBB *cbb, CBB *out_contents, unsigned int tag) |
| 333 | { | 339 | { |
| 334 | if (tag > UINT8_MAX) | 340 | if (tag > UINT8_MAX) |
diff --git a/src/lib/libssl/bytestring.h b/src/lib/libssl/bytestring.h index 51284da8db..750343d4fa 100644 --- a/src/lib/libssl/bytestring.h +++ b/src/lib/libssl/bytestring.h | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: bytestring.h,v 1.24 2022/11/09 23:14:51 jsing Exp $ */ | 1 | /* $OpenBSD: bytestring.h,v 1.25 2024/06/22 15:25:06 jsing Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2014, Google Inc. | 3 | * Copyright (c) 2014, Google Inc. |
| 4 | * | 4 | * |
| @@ -460,6 +460,13 @@ int CBB_add_u16_length_prefixed(CBB *cbb, CBB *out_contents); | |||
| 460 | int CBB_add_u24_length_prefixed(CBB *cbb, CBB *out_contents); | 460 | int CBB_add_u24_length_prefixed(CBB *cbb, CBB *out_contents); |
| 461 | 461 | ||
| 462 | /* | 462 | /* |
| 463 | * CBB_add_u32_length_prefixed sets |*out_contents| to a new child of |cbb|. | ||
| 464 | * The data written to |*out_contents| will be prefixed in |cbb| with a 32-bit, | ||
| 465 | * big-endian length. It returns one on success or zero on error. | ||
| 466 | */ | ||
| 467 | int CBB_add_u32_length_prefixed(CBB *cbb, CBB *out_contents); | ||
| 468 | |||
| 469 | /* | ||
| 463 | * CBB_add_asn sets |*out_contents| to a |CBB| into which the contents of an | 470 | * CBB_add_asn sets |*out_contents| to a |CBB| into which the contents of an |
| 464 | * ASN.1 object can be written. The |tag| argument will be used as the tag for | 471 | * ASN.1 object can be written. The |tag| argument will be used as the tag for |
| 465 | * the object. Passing in |tag| number 31 will return in an error since only | 472 | * the object. Passing in |tag| number 31 will return in an error since only |
