diff options
author | Joel Sing <jsing@cvs.openbsd.org> | 2022-09-03 19:14:26 +0000 |
---|---|---|
committer | Joel Sing <jsing@cvs.openbsd.org> | 2022-09-03 19:14:26 +0000 |
commit | 04a22272e7cace3b644b3edac33b28b03d80c968 (patch) | |
tree | 0e4ed0c19356833f01bffb80a3293875d4deb0de /lib/libcrypto/asn1 | |
parent | 753c7282b3a3e97f1efd0791e2e6def6ea027eda (diff) |
Tidy up asn1_c2i_primitive() slightly.
Rename some variables and consistently goto error.
ok tb@
Diffstat (limited to 'lib/libcrypto/asn1')
-rw-r--r-- | lib/libcrypto/asn1/tasn_dec.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/lib/libcrypto/asn1/tasn_dec.c b/lib/libcrypto/asn1/tasn_dec.c index f89d8e1c24c..272fead49d2 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.81 2022/09/03 19:11:45 jsing Exp $ */ +/* $OpenBSD: tasn_dec.c,v 1.82 2022/09/03 19:14:25 jsing Exp $ */ /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL * project 2000. */ @@ -276,16 +276,16 @@ asn1_find_end(CBS *cbs, size_t length, int indefinite) static int asn1_c2i_primitive(ASN1_VALUE **pval, CBS *content, int utype, const ASN1_ITEM *it) { + ASN1_BOOLEAN *abool; ASN1_STRING *astr; - ASN1_BOOLEAN *tbool; - uint8_t u8val; + uint8_t val; int ret = 0; if (it->funcs != NULL) - return 0; + goto err; if (CBS_len(content) > INT_MAX) - return 0; + goto err; switch (utype) { case V_ASN1_OBJECT: @@ -302,14 +302,14 @@ asn1_c2i_primitive(ASN1_VALUE **pval, CBS *content, int utype, const ASN1_ITEM * break; case V_ASN1_BOOLEAN: - tbool = (ASN1_BOOLEAN *)pval; + abool = (ASN1_BOOLEAN *)pval; if (CBS_len(content) != 1) { ASN1error(ASN1_R_BOOLEAN_IS_WRONG_LENGTH); goto err; } - if (!CBS_get_u8(content, &u8val)) + if (!CBS_get_u8(content, &val)) goto err; - *tbool = u8val; + *abool = val; break; case V_ASN1_BIT_STRING: |