-/* $OpenBSD: bs_cbb.c,v 1.18 2017/11/28 16:34:20 jsing Exp $ */
+/* $OpenBSD: bs_cbb.c,v 1.19 2018/08/16 18:39:37 jsing Exp $ */
/*
* Copyright (c) 2014, Google Inc.
*
return cbb_add_u(cbb, (uint32_t)value, 3);
}
+int
+CBB_add_u32(CBB *cbb, size_t value)
+{
+ if (value > 0xffffffffUL)
+ return 0;
+
+ return cbb_add_u(cbb, (uint32_t)value, 4);
+}
+
int
CBB_add_asn1_uint64(CBB *cbb, uint64_t value)
{
-/* $OpenBSD: bytestring.h,v 1.16 2017/11/28 16:34:20 jsing Exp $ */
+/* $OpenBSD: bytestring.h,v 1.17 2018/08/16 18:39:37 jsing Exp $ */
/*
* Copyright (c) 2014, Google Inc.
*
*/
int CBB_add_u24(CBB *cbb, size_t value);
+/*
+ * CBB_add_u32 appends a 32-bit, big-endian number from |value| to |cbb|. It
+ * returns one on success and zero otherwise.
+ */
+int CBB_add_u32(CBB *cbb, size_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