summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoel Sing <jsing@cvs.openbsd.org>2022-01-06 14:32:56 +0000
committerJoel Sing <jsing@cvs.openbsd.org>2022-01-06 14:32:56 +0000
commit4d679c8565ecb8044a7f1793695f2c97bca9ee56 (patch)
tree8e1d92f30fd4faf708a4f1c29af368f0c1d2301f
parent8a2de742bbff155c0b5447c6fb8967382988daa6 (diff)
Sync from libssl.
-rw-r--r--lib/libcrypto/bytestring/bs_cbb.c15
-rw-r--r--lib/libcrypto/bytestring/bytestring.h8
2 files changed, 21 insertions, 2 deletions
diff --git a/lib/libcrypto/bytestring/bs_cbb.c b/lib/libcrypto/bytestring/bs_cbb.c
index 1fa358d6c42..130093117b5 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.2 2021/12/15 18:02:39 jsing Exp $ */
+/* $OpenBSD: bs_cbb.c,v 1.3 2022/01/06 14:32:55 jsing Exp $ */
/*
* Copyright (c) 2014, Google Inc.
*
@@ -414,6 +414,19 @@ CBB_add_u32(CBB *cbb, size_t value)
}
int
+CBB_add_u64(CBB *cbb, uint64_t value)
+{
+ uint32_t a, b;
+
+ a = value >> 32;
+ b = value & 0xffffffff;
+
+ if (!CBB_add_u32(cbb, a))
+ return 0;
+ return CBB_add_u32(cbb, b);
+}
+
+int
CBB_add_asn1_uint64(CBB *cbb, uint64_t value)
{
CBB child;
diff --git a/lib/libcrypto/bytestring/bytestring.h b/lib/libcrypto/bytestring/bytestring.h
index 54d8f54ce27..d8ef8ffdd23 100644
--- a/lib/libcrypto/bytestring/bytestring.h
+++ b/lib/libcrypto/bytestring/bytestring.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: bytestring.h,v 1.2 2021/12/15 18:02:39 jsing Exp $ */
+/* $OpenBSD: bytestring.h,v 1.3 2022/01/06 14:32:55 jsing Exp $ */
/*
* Copyright (c) 2014, Google Inc.
*
@@ -509,6 +509,12 @@ int CBB_add_u24(CBB *cbb, size_t value);
int CBB_add_u32(CBB *cbb, size_t value);
/*
+ * CBB_add_u64 appends a 64-bit, big-endian number from |value| to |cbb|. It
+ * returns one on success and zero otherwise.
+ */
+int CBB_add_u64(CBB *cbb, uint64_t value);
+
+/*
* CBB_add_asn1_uint64 writes an ASN.1 INTEGER into |cbb| using |CBB_add_asn1|
* and writes |value| in its contents. It returns one on success and zero on
* error.