summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/asn1/a_enum.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/asn1/a_enum.c')
-rw-r--r--src/lib/libcrypto/asn1/a_enum.c24
1 files changed, 23 insertions, 1 deletions
diff --git a/src/lib/libcrypto/asn1/a_enum.c b/src/lib/libcrypto/asn1/a_enum.c
index b0b851028a..b35fe43666 100644
--- a/src/lib/libcrypto/asn1/a_enum.c
+++ b/src/lib/libcrypto/asn1/a_enum.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: a_enum.c,v 1.26 2022/08/10 12:06:28 tb Exp $ */ 1/* $OpenBSD: a_enum.c,v 1.27 2022/09/03 18:45:51 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 *
@@ -346,6 +346,28 @@ a2i_ASN1_ENUMERATED(BIO *bp, ASN1_ENUMERATED *bs, char *buf, int size)
346} 346}
347 347
348int 348int
349c2i_ASN1_ENUMERATED_cbs(ASN1_ENUMERATED **out_aenum, CBS *cbs)
350{
351 ASN1_ENUMERATED *aenum = NULL;
352
353 if (out_aenum == NULL)
354 return 0;
355
356 if (*out_aenum != NULL) {
357 ASN1_INTEGER_free(*out_aenum);
358 *out_aenum = NULL;
359 }
360
361 if (!c2i_ASN1_INTEGER_cbs((ASN1_INTEGER **)&aenum, cbs))
362 return 0;
363
364 aenum->type = V_ASN1_ENUMERATED | (aenum->type & V_ASN1_NEG);
365 *out_aenum = aenum;
366
367 return 1;
368}
369
370int
349i2d_ASN1_ENUMERATED(ASN1_ENUMERATED *a, unsigned char **out) 371i2d_ASN1_ENUMERATED(ASN1_ENUMERATED *a, unsigned char **out)
350{ 372{
351 return ASN1_item_i2d((ASN1_VALUE *)a, out, &ASN1_ENUMERATED_it); 373 return ASN1_item_i2d((ASN1_VALUE *)a, out, &ASN1_ENUMERATED_it);