diff options
author | jsing <> | 2022-01-06 14:30:30 +0000 |
---|---|---|
committer | jsing <> | 2022-01-06 14:30:30 +0000 |
commit | 274701b65cfcccb8efeaacf15d6bf5f78a0b3412 (patch) | |
tree | 912faa7b647b693968113808eab2bfc787aca861 | |
parent | 473510cd8b577e6b1d32cfec4196726f563886fa (diff) | |
download | openbsd-274701b65cfcccb8efeaacf15d6bf5f78a0b3412.tar.gz openbsd-274701b65cfcccb8efeaacf15d6bf5f78a0b3412.tar.bz2 openbsd-274701b65cfcccb8efeaacf15d6bf5f78a0b3412.zip |
Provide CBB_add_u64()
Prompted by and ok tb@
-rw-r--r-- | src/lib/libssl/bs_cbb.c | 15 | ||||
-rw-r--r-- | src/lib/libssl/bytestring.h | 8 |
2 files changed, 21 insertions, 2 deletions
diff --git a/src/lib/libssl/bs_cbb.c b/src/lib/libssl/bs_cbb.c index e17c57edd6..95e53861f0 100644 --- a/src/lib/libssl/bs_cbb.c +++ b/src/lib/libssl/bs_cbb.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: bs_cbb.c,v 1.26 2021/05/16 10:58:27 jsing Exp $ */ | 1 | /* $OpenBSD: bs_cbb.c,v 1.27 2022/01/06 14:30:30 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 | ||
416 | int | 416 | int |
417 | CBB_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 | |||
429 | int | ||
417 | CBB_add_asn1_uint64(CBB *cbb, uint64_t value) | 430 | CBB_add_asn1_uint64(CBB *cbb, uint64_t value) |
418 | { | 431 | { |
419 | CBB child; | 432 | CBB child; |
diff --git a/src/lib/libssl/bytestring.h b/src/lib/libssl/bytestring.h index ce933f3f7b..022bc683a3 100644 --- a/src/lib/libssl/bytestring.h +++ b/src/lib/libssl/bytestring.h | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: bytestring.h,v 1.22 2021/12/15 17:36:49 jsing Exp $ */ | 1 | /* $OpenBSD: bytestring.h,v 1.23 2022/01/06 14:30:30 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); | |||
509 | int CBB_add_u32(CBB *cbb, size_t value); | 509 | int 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 | */ | ||
515 | int 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. |