summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjsing <>2022-09-03 19:14:25 +0000
committerjsing <>2022-09-03 19:14:25 +0000
commit3b7d92f43d7f2b8765256815f6c8303ab94766c9 (patch)
tree92460c9c0a0ad86c5c0cd86f8b8ab17d3533064b
parent5399328ca4a094e245816151319f788ee5adeacf (diff)
downloadopenbsd-3b7d92f43d7f2b8765256815f6c8303ab94766c9.tar.gz
openbsd-3b7d92f43d7f2b8765256815f6c8303ab94766c9.tar.bz2
openbsd-3b7d92f43d7f2b8765256815f6c8303ab94766c9.zip
Tidy up asn1_c2i_primitive() slightly.
Rename some variables and consistently goto error. ok tb@
-rw-r--r--src/lib/libcrypto/asn1/tasn_dec.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/lib/libcrypto/asn1/tasn_dec.c b/src/lib/libcrypto/asn1/tasn_dec.c
index f89d8e1c24..272fead49d 100644
--- a/src/lib/libcrypto/asn1/tasn_dec.c
+++ b/src/lib/libcrypto/asn1/tasn_dec.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: tasn_dec.c,v 1.81 2022/09/03 19:11:45 jsing Exp $ */ 1/* $OpenBSD: tasn_dec.c,v 1.82 2022/09/03 19:14:25 jsing Exp $ */
2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
3 * project 2000. 3 * project 2000.
4 */ 4 */
@@ -276,16 +276,16 @@ asn1_find_end(CBS *cbs, size_t length, int indefinite)
276static int 276static int
277asn1_c2i_primitive(ASN1_VALUE **pval, CBS *content, int utype, const ASN1_ITEM *it) 277asn1_c2i_primitive(ASN1_VALUE **pval, CBS *content, int utype, const ASN1_ITEM *it)
278{ 278{
279 ASN1_BOOLEAN *abool;
279 ASN1_STRING *astr; 280 ASN1_STRING *astr;
280 ASN1_BOOLEAN *tbool; 281 uint8_t val;
281 uint8_t u8val;
282 int ret = 0; 282 int ret = 0;
283 283
284 if (it->funcs != NULL) 284 if (it->funcs != NULL)
285 return 0; 285 goto err;
286 286
287 if (CBS_len(content) > INT_MAX) 287 if (CBS_len(content) > INT_MAX)
288 return 0; 288 goto err;
289 289
290 switch (utype) { 290 switch (utype) {
291 case V_ASN1_OBJECT: 291 case V_ASN1_OBJECT:
@@ -302,14 +302,14 @@ asn1_c2i_primitive(ASN1_VALUE **pval, CBS *content, int utype, const ASN1_ITEM *
302 break; 302 break;
303 303
304 case V_ASN1_BOOLEAN: 304 case V_ASN1_BOOLEAN:
305 tbool = (ASN1_BOOLEAN *)pval; 305 abool = (ASN1_BOOLEAN *)pval;
306 if (CBS_len(content) != 1) { 306 if (CBS_len(content) != 1) {
307 ASN1error(ASN1_R_BOOLEAN_IS_WRONG_LENGTH); 307 ASN1error(ASN1_R_BOOLEAN_IS_WRONG_LENGTH);
308 goto err; 308 goto err;
309 } 309 }
310 if (!CBS_get_u8(content, &u8val)) 310 if (!CBS_get_u8(content, &val))
311 goto err; 311 goto err;
312 *tbool = u8val; 312 *abool = val;
313 break; 313 break;
314 314
315 case V_ASN1_BIT_STRING: 315 case V_ASN1_BIT_STRING: