summaryrefslogtreecommitdiff
path: root/src/lib/libssl/bs_cbs.c
diff options
context:
space:
mode:
authorjsing <>2021-12-15 17:30:20 +0000
committerjsing <>2021-12-15 17:30:20 +0000
commitc65b7fde1b92fc7227e530fe38647376938edebd (patch)
treed08eff21ae5dbf5ea173d6a4a6d63881bd7be7cb /src/lib/libssl/bs_cbs.c
parent4d85c2eaad13fb1a929709a9c386d1179d1f4ac1 (diff)
downloadopenbsd-c65b7fde1b92fc7227e530fe38647376938edebd.tar.gz
openbsd-c65b7fde1b92fc7227e530fe38647376938edebd.tar.bz2
openbsd-c65b7fde1b92fc7227e530fe38647376938edebd.zip
Provide CBS_get_u64().
This will be used in the libcrypto certificate transparency code. ok tb@
Diffstat (limited to '')
-rw-r--r--src/lib/libssl/bs_cbs.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/src/lib/libssl/bs_cbs.c b/src/lib/libssl/bs_cbs.c
index 627c609bb9..97b0163f3f 100644
--- a/src/lib/libssl/bs_cbs.c
+++ b/src/lib/libssl/bs_cbs.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: bs_cbs.c,v 1.22 2021/12/15 17:23:34 jsing Exp $ */ 1/* $OpenBSD: bs_cbs.c,v 1.23 2021/12/15 17:30:20 jsing Exp $ */
2/* 2/*
3 * Copyright (c) 2014, Google Inc. 3 * Copyright (c) 2014, Google Inc.
4 * 4 *
@@ -191,6 +191,23 @@ CBS_get_u32(CBS *cbs, uint32_t *out)
191} 191}
192 192
193int 193int
194CBS_get_u64(CBS *cbs, uint64_t *out)
195{
196 uint32_t a, b;
197
198 if (cbs->len < 8)
199 return 0;
200
201 if (!CBS_get_u32(cbs, &a))
202 return 0;
203 if (!CBS_get_u32(cbs, &b))
204 return 0;
205
206 *out = (uint64_t)a << 32 | b;
207 return 1;
208}
209
210int
194CBS_get_last_u8(CBS *cbs, uint8_t *out) 211CBS_get_last_u8(CBS *cbs, uint8_t *out)
195{ 212{
196 if (cbs->len == 0) 213 if (cbs->len == 0)