summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjsing <>2022-01-06 14:32:55 +0000
committerjsing <>2022-01-06 14:32:55 +0000
commit3d97d023e5d89c93dbf1d035844bc375ea6c91ea (patch)
tree906fa1f41e794e30d36b2c7d8fc06f9d2d9fc0f5
parent39bcad2e07438c24cf5e10f2048fc12aca67f19a (diff)
downloadopenbsd-3d97d023e5d89c93dbf1d035844bc375ea6c91ea.tar.gz
openbsd-3d97d023e5d89c93dbf1d035844bc375ea6c91ea.tar.bz2
openbsd-3d97d023e5d89c93dbf1d035844bc375ea6c91ea.zip
Sync from libssl.
-rw-r--r--src/lib/libcrypto/bytestring/bs_cbb.c15
-rw-r--r--src/lib/libcrypto/bytestring/bytestring.h8
2 files changed, 21 insertions, 2 deletions
diff --git a/src/lib/libcrypto/bytestring/bs_cbb.c b/src/lib/libcrypto/bytestring/bs_cbb.c
index 1fa358d6c4..130093117b 100644
--- a/src/lib/libcrypto/bytestring/bs_cbb.c
+++ b/src/lib/libcrypto/bytestring/bs_cbb.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: bs_cbb.c,v 1.2 2021/12/15 18:02:39 jsing Exp $ */ 1/* $OpenBSD: bs_cbb.c,v 1.3 2022/01/06 14:32:55 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/libcrypto/bytestring/bytestring.h b/src/lib/libcrypto/bytestring/bytestring.h
index 54d8f54ce2..d8ef8ffdd2 100644
--- a/src/lib/libcrypto/bytestring/bytestring.h
+++ b/src/lib/libcrypto/bytestring/bytestring.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: bytestring.h,v 1.2 2021/12/15 18:02:39 jsing Exp $ */ 1/* $OpenBSD: bytestring.h,v 1.3 2022/01/06 14:32:55 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.