From: jsing Date: Thu, 6 Jan 2022 14:32:55 +0000 (+0000) Subject: Sync from libssl. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=e1219dfcf83fcd798b5fd8f4e0b0910434072c65;p=openbsd Sync from libssl. --- 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. * @@ -413,6 +413,19 @@ CBB_add_u32(CBB *cbb, size_t value) 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) { 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. * @@ -508,6 +508,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