summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/asn1/a_bitstr.c
diff options
context:
space:
mode:
authorjsing <>2022-04-26 20:00:18 +0000
committerjsing <>2022-04-26 20:00:18 +0000
commit96fcb9bb1156a80f7ecf943f678799e3f82229d2 (patch)
treefec9a82c257f4ca26cfe78d9eb92d1020b194c8d /src/lib/libcrypto/asn1/a_bitstr.c
parenta21700d1cbc0c5673e9dc658afc73350b8dd01ff (diff)
downloadopenbsd-96fcb9bb1156a80f7ecf943f678799e3f82229d2.tar.gz
openbsd-96fcb9bb1156a80f7ecf943f678799e3f82229d2.tar.bz2
openbsd-96fcb9bb1156a80f7ecf943f678799e3f82229d2.zip
Decode via c2i_ASN1_BIT_STRING_cbs() from asn1_ex_c2i().
ok inoguchi@ tb@
Diffstat (limited to 'src/lib/libcrypto/asn1/a_bitstr.c')
-rw-r--r--src/lib/libcrypto/asn1/a_bitstr.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/lib/libcrypto/asn1/a_bitstr.c b/src/lib/libcrypto/asn1/a_bitstr.c
index 52fe0eb9cd..aa854f1d7a 100644
--- a/src/lib/libcrypto/asn1/a_bitstr.c
+++ b/src/lib/libcrypto/asn1/a_bitstr.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: a_bitstr.c,v 1.34 2022/04/23 18:56:54 jsing Exp $ */ 1/* $OpenBSD: a_bitstr.c,v 1.35 2022/04/26 20:00:18 jsing Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -291,7 +291,7 @@ i2c_ASN1_BIT_STRING(ASN1_BIT_STRING *a, unsigned char **pp)
291 return (ret); 291 return (ret);
292} 292}
293 293
294static int 294int
295c2i_ASN1_BIT_STRING_cbs(ASN1_BIT_STRING **out_abs, CBS *cbs) 295c2i_ASN1_BIT_STRING_cbs(ASN1_BIT_STRING **out_abs, CBS *cbs)
296{ 296{
297 ASN1_BIT_STRING *abs = NULL; 297 ASN1_BIT_STRING *abs = NULL;
@@ -300,9 +300,14 @@ c2i_ASN1_BIT_STRING_cbs(ASN1_BIT_STRING **out_abs, CBS *cbs)
300 uint8_t unused_bits; 300 uint8_t unused_bits;
301 int ret = 0; 301 int ret = 0;
302 302
303 if (out_abs == NULL || *out_abs != NULL) 303 if (out_abs == NULL)
304 goto err; 304 goto err;
305 305
306 if (*out_abs != NULL) {
307 ASN1_BIT_STRING_free(*out_abs);
308 *out_abs = NULL;
309 }
310
306 if (!CBS_get_u8(cbs, &unused_bits)) { 311 if (!CBS_get_u8(cbs, &unused_bits)) {
307 ASN1error(ASN1_R_STRING_TOO_SHORT); 312 ASN1error(ASN1_R_STRING_TOO_SHORT);
308 goto err; 313 goto err;