summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/lib/libssl/bs_cbb.c15
-rw-r--r--src/lib/libssl/bytestring.h8
2 files changed, 21 insertions, 2 deletions
diff --git a/src/lib/libssl/bs_cbb.c b/src/lib/libssl/bs_cbb.c
index e17c57edd6..95e53861f0 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.26 2021/05/16 10:58:27 jsing Exp $ */ 1/* $OpenBSD: bs_cbb.c,v 1.27 2022/01/06 14:30:30 jsing Exp $ */
2/* 2/*
3 * Copyright (c) 2014, Google Inc. 3 * Copyright (c) 2014, Google Inc.
4 * 4 *
@@ -414,6 +414,19 @@ CBB_add_u32(CBB *cbb, size_t value)
414} 414}
415 415
416int 416int
417CBB_add_u64(CBB *cbb, uint64_t value)
418{
419 uint32_t a, b;
420
421 a = value >> 32;
422 b = value & 0xffffffff;
423
424 if (!CBB_add_u32(cbb, a))
425 return 0;
426 return CBB_add_u32(cbb, b);
427}
428
429int
417CBB_add_asn1_uint64(CBB *cbb, uint64_t value) 430CBB_add_asn1_uint64(CBB *cbb, uint64_t value)
418{ 431{
419 CBB child; 432 CBB child;
diff --git a/src/lib/libssl/bytestring.h b/src/lib/libssl/bytestring.h
index ce933f3f7b..022bc683a3 100644
--- a/src/lib/libssl/bytestring.h
+++ b/src/lib/libssl/bytestring.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: bytestring.h,v 1.22 2021/12/15 17:36:49 jsing Exp $ */ 1/* $OpenBSD: bytestring.h,v 1.23 2022/01/06 14:30:30 jsing Exp $ */
2/* 2/*
3 * Copyright (c) 2014, Google Inc. 3 * Copyright (c) 2014, Google Inc.
4 * 4 *
@@ -509,6 +509,12 @@ int CBB_add_u24(CBB *cbb, size_t value);
509int CBB_add_u32(CBB *cbb, size_t value); 509int CBB_add_u32(CBB *cbb, size_t value);
510 510
511/* 511/*
512 * CBB_add_u64 appends a 64-bit, big-endian number from |value| to |cbb|. It
513 * returns one on success and zero otherwise.
514 */
515int CBB_add_u64(CBB *cbb, uint64_t value);
516
517/*
512 * CBB_add_asn1_uint64 writes an ASN.1 INTEGER into |cbb| using |CBB_add_asn1| 518 * CBB_add_asn1_uint64 writes an ASN.1 INTEGER into |cbb| using |CBB_add_asn1|
513 * and writes |value| in its contents. It returns one on success and zero on 519 * and writes |value| in its contents. It returns one on success and zero on
514 * error. 520 * error.