From ca9312d5d543626596a5568a236d25b77400b027 Mon Sep 17 00:00:00 2001 From: jsing Date: Wed, 27 Apr 2022 17:56:13 +0000 Subject: [PATCH] Decode via c2i_ASN1_INTEGER_cbs() from asn1_ex_c2i(). --- lib/libcrypto/asn1/asn1_locl.h | 4 +++- lib/libcrypto/asn1/tasn_dec.c | 6 ++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/libcrypto/asn1/asn1_locl.h b/lib/libcrypto/asn1/asn1_locl.h index ae9445c3823..4d4c7a348d0 100644 --- a/lib/libcrypto/asn1/asn1_locl.h +++ b/lib/libcrypto/asn1/asn1_locl.h @@ -1,4 +1,4 @@ -/* $OpenBSD: asn1_locl.h,v 1.26 2022/04/26 20:00:18 jsing Exp $ */ +/* $OpenBSD: asn1_locl.h,v 1.27 2022/04/27 17:56:13 jsing Exp $ */ /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL * project 2006. */ @@ -203,6 +203,8 @@ int asn1_tag2charwidth(int tag); int c2i_ASN1_BIT_STRING_cbs(ASN1_BIT_STRING **out_abs, CBS *cbs); +int c2i_ASN1_INTEGER_cbs(ASN1_INTEGER **out_aint, CBS *cbs); + int c2i_ASN1_OBJECT_cbs(ASN1_OBJECT **out_aobj, CBS *content); int i2t_ASN1_OBJECT_internal(const ASN1_OBJECT *aobj, char *buf, int buf_len, int no_name); diff --git a/lib/libcrypto/asn1/tasn_dec.c b/lib/libcrypto/asn1/tasn_dec.c index 3936ecba634..b88c5f2bc12 100644 --- a/lib/libcrypto/asn1/tasn_dec.c +++ b/lib/libcrypto/asn1/tasn_dec.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tasn_dec.c,v 1.52 2022/04/27 17:28:34 jsing Exp $ */ +/* $OpenBSD: tasn_dec.c,v 1.53 2022/04/27 17:56:13 jsing Exp $ */ /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL * project 2000. */ @@ -774,7 +774,6 @@ asn1_ex_c2i(ASN1_VALUE **pval, CBS *content, int utype, const ASN1_ITEM *it) ASN1_TYPE *typ = NULL; ASN1_INTEGER **tint; ASN1_BOOLEAN *tbool; - const uint8_t *p; uint8_t u8val; int ret = 0; @@ -840,8 +839,7 @@ asn1_ex_c2i(ASN1_VALUE **pval, CBS *content, int utype, const ASN1_ITEM *it) case V_ASN1_INTEGER: case V_ASN1_ENUMERATED: tint = (ASN1_INTEGER **)pval; - p = CBS_data(content); - if (!c2i_ASN1_INTEGER(tint, &p, CBS_len(content))) + if (!c2i_ASN1_INTEGER_cbs(tint, content)) goto err; /* Fixup type to match the expected form */ (*tint)->type = utype | ((*tint)->type & V_ASN1_NEG); -- 2.20.1