-/* $OpenBSD: bs_cbb.c,v 1.26 2021/05/16 10:58:27 jsing Exp $ */
+/* $OpenBSD: bs_cbb.c,v 1.27 2022/01/06 14:30:30 jsing Exp $ */
/*
* Copyright (c) 2014, Google Inc.
*
return cbb_add_u(cbb, (uint32_t)value, 4);
}
+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)
{
-/* $OpenBSD: bytestring.h,v 1.22 2021/12/15 17:36:49 jsing Exp $ */
+/* $OpenBSD: bytestring.h,v 1.23 2022/01/06 14:30:30 jsing Exp $ */
/*
* Copyright (c) 2014, Google Inc.
*
*/
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