summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorjsing <>2022-05-21 11:12:03 +0000
committerjsing <>2022-05-21 11:12:03 +0000
commitae0791b7327af957c26affd56876662cab6e8d78 (patch)
tree975d0df818dfa54bb6ede1de5b03204e707a4922 /src
parent64dc3ad49828db299a5c111c01c4d2163f01562c (diff)
downloadopenbsd-ae0791b7327af957c26affd56876662cab6e8d78.tar.gz
openbsd-ae0791b7327af957c26affd56876662cab6e8d78.tar.bz2
openbsd-ae0791b7327af957c26affd56876662cab6e8d78.zip
Remove _ex_ from all of the internal function names.
It no longer makes sense to have "extended" versions of functions internally. No functional change. ok tb@
Diffstat (limited to 'src')
-rw-r--r--src/lib/libcrypto/asn1/tasn_dec.c70
1 files changed, 35 insertions, 35 deletions
diff --git a/src/lib/libcrypto/asn1/tasn_dec.c b/src/lib/libcrypto/asn1/tasn_dec.c
index 7583019aaa..e3b631d61d 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.72 2022/05/19 19:45:18 jsing Exp $ */ 1/* $OpenBSD: tasn_dec.c,v 1.73 2022/05/21 11:12:03 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 */
@@ -86,7 +86,7 @@
86#define ASN1_MAX_STRING_NEST 5 86#define ASN1_MAX_STRING_NEST 5
87#endif 87#endif
88 88
89static int asn1_template_ex_d2i(ASN1_VALUE **pval, CBS *cbs, 89static int asn1_template_d2i(ASN1_VALUE **pval, CBS *cbs,
90 const ASN1_TEMPLATE *tt, char optional, int depth); 90 const ASN1_TEMPLATE *tt, char optional, int depth);
91 91
92static int 92static int
@@ -275,7 +275,7 @@ asn1_find_end(CBS *cbs, size_t length, char indefinite)
275} 275}
276 276
277static int 277static int
278asn1_ex_c2i_primitive(ASN1_VALUE **pval, CBS *content, int utype, const ASN1_ITEM *it) 278asn1_c2i_primitive(ASN1_VALUE **pval, CBS *content, int utype, const ASN1_ITEM *it)
279{ 279{
280 ASN1_STRING *stmp; 280 ASN1_STRING *stmp;
281 ASN1_INTEGER **tint; 281 ASN1_INTEGER **tint;
@@ -380,7 +380,7 @@ asn1_ex_c2i_primitive(ASN1_VALUE **pval, CBS *content, int utype, const ASN1_ITE
380} 380}
381 381
382static int 382static int
383asn1_ex_c2i_any(ASN1_VALUE **pval, CBS *content, int utype, const ASN1_ITEM *it) 383asn1_c2i_any(ASN1_VALUE **pval, CBS *content, int utype, const ASN1_ITEM *it)
384{ 384{
385 ASN1_TYPE *atype; 385 ASN1_TYPE *atype;
386 386
@@ -395,7 +395,7 @@ asn1_ex_c2i_any(ASN1_VALUE **pval, CBS *content, int utype, const ASN1_ITEM *it)
395 if ((atype = ASN1_TYPE_new()) == NULL) 395 if ((atype = ASN1_TYPE_new()) == NULL)
396 return 0; 396 return 0;
397 397
398 if (!asn1_ex_c2i_primitive(&atype->value.asn1_value, content, utype, it)) { 398 if (!asn1_c2i_primitive(&atype->value.asn1_value, content, utype, it)) {
399 ASN1_TYPE_free(atype); 399 ASN1_TYPE_free(atype);
400 return 0; 400 return 0;
401 } 401 }
@@ -411,7 +411,7 @@ asn1_ex_c2i_any(ASN1_VALUE **pval, CBS *content, int utype, const ASN1_ITEM *it)
411} 411}
412 412
413static int 413static int
414asn1_ex_c2i(ASN1_VALUE **pval, CBS *content, int utype, const ASN1_ITEM *it) 414asn1_c2i(ASN1_VALUE **pval, CBS *content, int utype, const ASN1_ITEM *it)
415{ 415{
416 if (CBS_len(content) > INT_MAX) 416 if (CBS_len(content) > INT_MAX)
417 return 0; 417 return 0;
@@ -428,9 +428,9 @@ asn1_ex_c2i(ASN1_VALUE **pval, CBS *content, int utype, const ASN1_ITEM *it)
428 } 428 }
429 429
430 if (it->utype == V_ASN1_ANY) 430 if (it->utype == V_ASN1_ANY)
431 return asn1_ex_c2i_any(pval, content, utype, it); 431 return asn1_c2i_any(pval, content, utype, it);
432 432
433 return asn1_ex_c2i_primitive(pval, content, utype, it); 433 return asn1_c2i_primitive(pval, content, utype, it);
434} 434}
435 435
436/* 436/*
@@ -446,7 +446,7 @@ asn1_ex_c2i(ASN1_VALUE **pval, CBS *content, int utype, const ASN1_ITEM *it)
446 * after the object. 446 * after the object.
447 */ 447 */
448static int 448static int
449asn1_d2i_ex_primitive_content(ASN1_VALUE **pval, CBS *cbs, CBS *cbs_object, 449asn1_d2i_primitive_content(ASN1_VALUE **pval, CBS *cbs, CBS *cbs_object,
450 int utype, char constructed, char indefinite, size_t length, 450 int utype, char constructed, char indefinite, size_t length,
451 const ASN1_ITEM *it) 451 const ASN1_ITEM *it)
452{ 452{
@@ -499,7 +499,7 @@ asn1_d2i_ex_primitive_content(ASN1_VALUE **pval, CBS *cbs, CBS *cbs_object,
499 goto err; 499 goto err;
500 } 500 }
501 501
502 if (!asn1_ex_c2i(pval, &cbs_content, utype, it)) 502 if (!asn1_c2i(pval, &cbs_content, utype, it))
503 goto err; 503 goto err;
504 504
505 if (!CBS_skip(cbs, CBS_offset(cbs_object))) 505 if (!CBS_skip(cbs, CBS_offset(cbs_object)))
@@ -515,7 +515,7 @@ asn1_d2i_ex_primitive_content(ASN1_VALUE **pval, CBS *cbs, CBS *cbs_object,
515} 515}
516 516
517static int 517static int
518asn1_d2i_ex_any(ASN1_VALUE **pval, CBS *cbs, const ASN1_ITEM *it, 518asn1_d2i_any(ASN1_VALUE **pval, CBS *cbs, const ASN1_ITEM *it,
519 int tag_number, int tag_class, char optional) 519 int tag_number, int tag_class, char optional)
520{ 520{
521 char constructed, indefinite; 521 char constructed, indefinite;
@@ -547,12 +547,12 @@ asn1_d2i_ex_any(ASN1_VALUE **pval, CBS *cbs, const ASN1_ITEM *it,
547 if (object_class != V_ASN1_UNIVERSAL) 547 if (object_class != V_ASN1_UNIVERSAL)
548 object_type = V_ASN1_OTHER; 548 object_type = V_ASN1_OTHER;
549 549
550 return asn1_d2i_ex_primitive_content(pval, cbs, &cbs_object, object_type, 550 return asn1_d2i_primitive_content(pval, cbs, &cbs_object, object_type,
551 constructed, indefinite, length, it); 551 constructed, indefinite, length, it);
552} 552}
553 553
554static int 554static int
555asn1_d2i_ex_mstring(ASN1_VALUE **pval, CBS *cbs, const ASN1_ITEM *it, 555asn1_d2i_mstring(ASN1_VALUE **pval, CBS *cbs, const ASN1_ITEM *it,
556 int tag_number, int tag_class, char optional) 556 int tag_number, int tag_class, char optional)
557{ 557{
558 char constructed, indefinite; 558 char constructed, indefinite;
@@ -593,12 +593,12 @@ asn1_d2i_ex_mstring(ASN1_VALUE **pval, CBS *cbs, const ASN1_ITEM *it,
593 return 0; 593 return 0;
594 } 594 }
595 595
596 return asn1_d2i_ex_primitive_content(pval, cbs, &cbs_object, 596 return asn1_d2i_primitive_content(pval, cbs, &cbs_object,
597 object_tag, constructed, indefinite, length, it); 597 object_tag, constructed, indefinite, length, it);
598} 598}
599 599
600static int 600static int
601asn1_d2i_ex_primitive(ASN1_VALUE **pval, CBS *cbs, const ASN1_ITEM *it, 601asn1_d2i_primitive(ASN1_VALUE **pval, CBS *cbs, const ASN1_ITEM *it,
602 int tag_number, int tag_class, char optional) 602 int tag_number, int tag_class, char optional)
603{ 603{
604 CBS cbs_object; 604 CBS cbs_object;
@@ -613,7 +613,7 @@ asn1_d2i_ex_primitive(ASN1_VALUE **pval, CBS *cbs, const ASN1_ITEM *it,
613 return 0; 613 return 0;
614 614
615 if (it->utype == V_ASN1_ANY) 615 if (it->utype == V_ASN1_ANY)
616 return asn1_d2i_ex_any(pval, cbs, it, tag_number, tag_class, optional); 616 return asn1_d2i_any(pval, cbs, it, tag_number, tag_class, optional);
617 617
618 if (tag_number == -1) { 618 if (tag_number == -1) {
619 tag_number = it->utype; 619 tag_number = it->utype;
@@ -629,12 +629,12 @@ asn1_d2i_ex_primitive(ASN1_VALUE **pval, CBS *cbs, const ASN1_ITEM *it,
629 return 0; 629 return 0;
630 } 630 }
631 631
632 return asn1_d2i_ex_primitive_content(pval, cbs, &cbs_object, utype, 632 return asn1_d2i_primitive_content(pval, cbs, &cbs_object, utype,
633 constructed, indefinite, length, it); 633 constructed, indefinite, length, it);
634} 634}
635 635
636static int 636static int
637asn1_item_ex_d2i_choice(ASN1_VALUE **pval, CBS *cbs, const ASN1_ITEM *it, 637asn1_item_d2i_choice(ASN1_VALUE **pval, CBS *cbs, const ASN1_ITEM *it,
638 int tag_number, int tag_class, char optional, int depth) 638 int tag_number, int tag_class, char optional, int depth)
639{ 639{
640 const ASN1_TEMPLATE *tt, *errtt = NULL; 640 const ASN1_TEMPLATE *tt, *errtt = NULL;
@@ -679,7 +679,7 @@ asn1_item_ex_d2i_choice(ASN1_VALUE **pval, CBS *cbs, const ASN1_ITEM *it,
679 pchptr = asn1_get_field_ptr(&achoice, tt); 679 pchptr = asn1_get_field_ptr(&achoice, tt);
680 680
681 /* Mark field as OPTIONAL so its absence can be identified. */ 681 /* Mark field as OPTIONAL so its absence can be identified. */
682 ret = asn1_template_ex_d2i(pchptr, cbs, tt, 1, depth); 682 ret = asn1_template_d2i(pchptr, cbs, tt, 1, depth);
683 if (ret == -1) 683 if (ret == -1)
684 continue; 684 continue;
685 if (ret != 1) { 685 if (ret != 1) {
@@ -726,7 +726,7 @@ asn1_item_ex_d2i_choice(ASN1_VALUE **pval, CBS *cbs, const ASN1_ITEM *it,
726} 726}
727 727
728static int 728static int
729asn1_item_ex_d2i_sequence(ASN1_VALUE **pval, CBS *cbs, const ASN1_ITEM *it, 729asn1_item_d2i_sequence(ASN1_VALUE **pval, CBS *cbs, const ASN1_ITEM *it,
730 int tag_number, int tag_class, char optional, int depth) 730 int tag_number, int tag_class, char optional, int depth)
731{ 731{
732 CBS cbs_seq, cbs_seq_content, cbs_object; 732 CBS cbs_seq, cbs_seq_content, cbs_object;
@@ -816,13 +816,13 @@ asn1_item_ex_d2i_sequence(ASN1_VALUE **pval, CBS *cbs, const ASN1_ITEM *it,
816 * This was originally implemented to "increase efficiency", 816 * This was originally implemented to "increase efficiency",
817 * however it currently needs to remain since it papers over 817 * however it currently needs to remain since it papers over
818 * the use of ASN.1 ANY with OPTIONAL in SEQUENCEs (which 818 * the use of ASN.1 ANY with OPTIONAL in SEQUENCEs (which
819 * asn1_d2i_ex_primitive() currently rejects). 819 * asn1_d2i_primitive() currently rejects).
820 */ 820 */
821 optional_field = (seqtt->flags & ASN1_TFLG_OPTIONAL) != 0; 821 optional_field = (seqtt->flags & ASN1_TFLG_OPTIONAL) != 0;
822 if (i == it->tcount - 1) 822 if (i == it->tcount - 1)
823 optional_field = 0; 823 optional_field = 0;
824 824
825 ret = asn1_template_ex_d2i(pseqval, &cbs_seq_content, 825 ret = asn1_template_d2i(pseqval, &cbs_seq_content,
826 seqtt, optional_field, depth); 826 seqtt, optional_field, depth);
827 if (ret == -1) { 827 if (ret == -1) {
828 /* Absent OPTIONAL component. */ 828 /* Absent OPTIONAL component. */
@@ -902,7 +902,7 @@ asn1_item_ex_d2i_sequence(ASN1_VALUE **pval, CBS *cbs, const ASN1_ITEM *it,
902 * If 'opt' set and tag mismatch return -1 to handle OPTIONAL 902 * If 'opt' set and tag mismatch return -1 to handle OPTIONAL
903 */ 903 */
904static int 904static int
905asn1_item_ex_d2i(ASN1_VALUE **pval, CBS *cbs, const ASN1_ITEM *it, 905asn1_item_d2i(ASN1_VALUE **pval, CBS *cbs, const ASN1_ITEM *it,
906 int tag_number, int tag_class, char optional, int depth) 906 int tag_number, int tag_class, char optional, int depth)
907{ 907{
908 const ASN1_EXTERN_FUNCS *ef = it->funcs; 908 const ASN1_EXTERN_FUNCS *ef = it->funcs;
@@ -932,14 +932,14 @@ asn1_item_ex_d2i(ASN1_VALUE **pval, CBS *cbs, const ASN1_ITEM *it,
932 ASN1error(ASN1_R_ILLEGAL_OPTIONS_ON_ITEM_TEMPLATE); 932 ASN1error(ASN1_R_ILLEGAL_OPTIONS_ON_ITEM_TEMPLATE);
933 goto err; 933 goto err;
934 } 934 }
935 return asn1_template_ex_d2i(pval, cbs, 935 return asn1_template_d2i(pval, cbs, it->templates,
936 it->templates, optional, depth); 936 optional, depth);
937 } 937 }
938 return asn1_d2i_ex_primitive(pval, cbs, it, tag_number, 938 return asn1_d2i_primitive(pval, cbs, it, tag_number, tag_class,
939 tag_class, optional); 939 optional);
940 940
941 case ASN1_ITYPE_MSTRING: 941 case ASN1_ITYPE_MSTRING:
942 return asn1_d2i_ex_mstring(pval, cbs, it, tag_number, tag_class, 942 return asn1_d2i_mstring(pval, cbs, it, tag_number, tag_class,
943 optional); 943 optional);
944 944
945 case ASN1_ITYPE_EXTERN: 945 case ASN1_ITYPE_EXTERN:
@@ -954,12 +954,12 @@ asn1_item_ex_d2i(ASN1_VALUE **pval, CBS *cbs, const ASN1_ITEM *it,
954 return ret; 954 return ret;
955 955
956 case ASN1_ITYPE_CHOICE: 956 case ASN1_ITYPE_CHOICE:
957 return asn1_item_ex_d2i_choice(pval, cbs, it, tag_number, 957 return asn1_item_d2i_choice(pval, cbs, it, tag_number,
958 tag_class, optional, depth); 958 tag_class, optional, depth);
959 959
960 case ASN1_ITYPE_NDEF_SEQUENCE: 960 case ASN1_ITYPE_NDEF_SEQUENCE:
961 case ASN1_ITYPE_SEQUENCE: 961 case ASN1_ITYPE_SEQUENCE:
962 return asn1_item_ex_d2i_sequence(pval, cbs, it, tag_number, 962 return asn1_item_d2i_sequence(pval, cbs, it, tag_number,
963 tag_class, optional, depth); 963 tag_class, optional, depth);
964 964
965 default: 965 default:
@@ -1055,7 +1055,7 @@ asn1_template_stack_of_d2i(ASN1_VALUE **pval, CBS *cbs, const ASN1_TEMPLATE *tt,
1055 eoc_needed = 0; 1055 eoc_needed = 0;
1056 break; 1056 break;
1057 } 1057 }
1058 if (!asn1_item_ex_d2i(&aval, &cbs_object_content, tt->item, 1058 if (!asn1_item_d2i(&aval, &cbs_object_content, tt->item,
1059 -1, 0, 0, depth)) { 1059 -1, 0, 0, depth)) {
1060 ASN1error(ERR_R_NESTED_ASN1_ERROR); 1060 ASN1error(ERR_R_NESTED_ASN1_ERROR);
1061 goto err; 1061 goto err;
@@ -1113,7 +1113,7 @@ asn1_template_noexp_d2i(ASN1_VALUE **pval, CBS *cbs, const ASN1_TEMPLATE *tt,
1113 tag_class = tt->flags & ASN1_TFLG_TAG_CLASS; 1113 tag_class = tt->flags & ASN1_TFLG_TAG_CLASS;
1114 } 1114 }
1115 1115
1116 ret = asn1_item_ex_d2i(pval, cbs, tt->item, tag_number, tag_class, 1116 ret = asn1_item_d2i(pval, cbs, tt->item, tag_number, tag_class,
1117 optional, depth); 1117 optional, depth);
1118 if (ret == -1) 1118 if (ret == -1)
1119 return -1; 1119 return -1;
@@ -1131,7 +1131,7 @@ asn1_template_noexp_d2i(ASN1_VALUE **pval, CBS *cbs, const ASN1_TEMPLATE *tt,
1131} 1131}
1132 1132
1133static int 1133static int
1134asn1_template_ex_d2i(ASN1_VALUE **pval, CBS *cbs, const ASN1_TEMPLATE *tt, 1134asn1_template_d2i(ASN1_VALUE **pval, CBS *cbs, const ASN1_TEMPLATE *tt,
1135 char optional, int depth) 1135 char optional, int depth)
1136{ 1136{
1137 CBS cbs_exp, cbs_exp_content; 1137 CBS cbs_exp, cbs_exp_content;
@@ -1225,7 +1225,7 @@ ASN1_item_ex_d2i(ASN1_VALUE **pval, const unsigned char **in, long inlen,
1225 1225
1226 CBS_init(&cbs, *in, inlen); 1226 CBS_init(&cbs, *in, inlen);
1227 1227
1228 if ((ret = asn1_item_ex_d2i(pval, &cbs, it, tag_number, tag_class, 1228 if ((ret = asn1_item_d2i(pval, &cbs, it, tag_number, tag_class,
1229 optional, 0)) == 1) 1229 optional, 0)) == 1)
1230 *in = CBS_data(&cbs); 1230 *in = CBS_data(&cbs);
1231 1231
@@ -1243,7 +1243,7 @@ ASN1_template_d2i(ASN1_VALUE **pval, const unsigned char **in, long len,
1243 return 0; 1243 return 0;
1244 1244
1245 CBS_init(&cbs, *in, len); 1245 CBS_init(&cbs, *in, len);
1246 if ((ret = asn1_template_ex_d2i(pval, &cbs, tt, 0, 0)) == 1) 1246 if ((ret = asn1_template_d2i(pval, &cbs, tt, 0, 0)) == 1)
1247 *in = CBS_data(&cbs); 1247 *in = CBS_data(&cbs);
1248 1248
1249 return ret; 1249 return ret;