summaryrefslogtreecommitdiff
path: root/src/lib/libssl/bytestring.h
diff options
context:
space:
mode:
authorjsing <>2021-12-15 17:36:49 +0000
committerjsing <>2021-12-15 17:36:49 +0000
commit3f6877b440d5d44fc0c6d366d1b5d5fdeead626c (patch)
tree4286d43eb057877d629e82cdd4789c6a63842692 /src/lib/libssl/bytestring.h
parentc65b7fde1b92fc7227e530fe38647376938edebd (diff)
downloadopenbsd-3f6877b440d5d44fc0c6d366d1b5d5fdeead626c.tar.gz
openbsd-3f6877b440d5d44fc0c6d366d1b5d5fdeead626c.tar.bz2
openbsd-3f6877b440d5d44fc0c6d366d1b5d5fdeead626c.zip
Provide various CBS_peek_* functions.
These will be used in libcrypto. With input from and ok tb@
Diffstat (limited to 'src/lib/libssl/bytestring.h')
-rw-r--r--src/lib/libssl/bytestring.h32
1 files changed, 31 insertions, 1 deletions
diff --git a/src/lib/libssl/bytestring.h b/src/lib/libssl/bytestring.h
index fa5e05fa27..ce933f3f7b 100644
--- a/src/lib/libssl/bytestring.h
+++ b/src/lib/libssl/bytestring.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: bytestring.h,v 1.21 2021/12/15 17:30:20 jsing Exp $ */ 1/* $OpenBSD: bytestring.h,v 1.22 2021/12/15 17:36:49 jsing Exp $ */
2/* 2/*
3 * Copyright (c) 2014, Google Inc. 3 * Copyright (c) 2014, Google Inc.
4 * 4 *
@@ -172,6 +172,36 @@ int CBS_get_u16_length_prefixed(CBS *cbs, CBS *out);
172 */ 172 */
173int CBS_get_u24_length_prefixed(CBS *cbs, CBS *out); 173int CBS_get_u24_length_prefixed(CBS *cbs, CBS *out);
174 174
175/*
176 * CBS_peek_u8 sets |*out| to the next uint8_t from |cbs|, but does not advance
177 * |cbs|. It returns one on success and zero on error.
178 */
179int CBS_peek_u8(CBS *cbs, uint8_t *out);
180
181/*
182 * CBS_peek_u16 sets |*out| to the next, big-endian uint16_t from |cbs|, but
183 * does not advance |cbs|. It returns one on success and zero on error.
184 */
185int CBS_peek_u16(CBS *cbs, uint16_t *out);
186
187/*
188 * CBS_peek_u24 sets |*out| to the next, big-endian 24-bit value from |cbs|, but
189 * does not advance |cbs|. It returns one on success and zero on error.
190 */
191int CBS_peek_u24(CBS *cbs, uint32_t *out);
192
193/*
194 * CBS_peek_u32 sets |*out| to the next, big-endian uint32_t value from |cbs|,
195 * but does not advance |cbs|. It returns one on success and zero on error.
196 */
197int CBS_peek_u32(CBS *cbs, uint32_t *out);
198
199/*
200 * CBS_peek_last_u8 sets |*out| to the last uint8_t from |cbs|, but does not
201 * shorten |cbs|. It returns one on success and zero on error.
202 */
203int CBS_peek_last_u8(CBS *cbs, uint8_t *out);
204
175 205
176/* Parsing ASN.1 */ 206/* Parsing ASN.1 */
177 207