diff options
author | job <> | 2021-09-02 20:25:40 +0000 |
---|---|---|
committer | job <> | 2021-09-02 20:25:40 +0000 |
commit | fe4f950dc448e44f66ba488d2b4d5ed042fc6ad2 (patch) | |
tree | 167a35aa653380f06ff5d44dcf68512f45b2c446 /src/lib/libcrypto/x509/x509_asid.c | |
parent | 42689e06782909a72cd58175622d83edd974719a (diff) | |
download | openbsd-fe4f950dc448e44f66ba488d2b4d5ed042fc6ad2.tar.gz openbsd-fe4f950dc448e44f66ba488d2b4d5ed042fc6ad2.tar.bz2 openbsd-fe4f950dc448e44f66ba488d2b4d5ed042fc6ad2.zip |
Move the error put functions from X509V3err() to X509V3error()
OK tb@
Diffstat (limited to '')
-rw-r--r-- | src/lib/libcrypto/x509/x509_asid.c | 46 |
1 files changed, 17 insertions, 29 deletions
diff --git a/src/lib/libcrypto/x509/x509_asid.c b/src/lib/libcrypto/x509/x509_asid.c index 59c7cabb13..1672b3c7f1 100644 --- a/src/lib/libcrypto/x509/x509_asid.c +++ b/src/lib/libcrypto/x509/x509_asid.c | |||
@@ -479,16 +479,14 @@ static int ASIdentifierChoice_is_canonical(ASIdentifierChoice *choice) | |||
479 | if ((bn == NULL && (bn = BN_new()) == NULL) || | 479 | if ((bn == NULL && (bn = BN_new()) == NULL) || |
480 | ASN1_INTEGER_to_BN(a_max, bn) == NULL || | 480 | ASN1_INTEGER_to_BN(a_max, bn) == NULL || |
481 | !BN_add_word(bn, 1)) { | 481 | !BN_add_word(bn, 1)) { |
482 | X509V3err(X509V3_F_ASIDENTIFIERCHOICE_IS_CANONICAL, | 482 | X509V3error(ERR_R_MALLOC_FAILURE); |
483 | ERR_R_MALLOC_FAILURE); | ||
484 | goto done; | 483 | goto done; |
485 | } | 484 | } |
486 | 485 | ||
487 | if ((a_max_plus_one = | 486 | if ((a_max_plus_one = |
488 | BN_to_ASN1_INTEGER(bn, orig = a_max_plus_one)) == NULL) { | 487 | BN_to_ASN1_INTEGER(bn, orig = a_max_plus_one)) == NULL) { |
489 | a_max_plus_one = orig; | 488 | a_max_plus_one = orig; |
490 | X509V3err(X509V3_F_ASIDENTIFIERCHOICE_IS_CANONICAL, | 489 | X509V3error(ERR_R_MALLOC_FAILURE); |
491 | ERR_R_MALLOC_FAILURE); | ||
492 | goto done; | 490 | goto done; |
493 | } | 491 | } |
494 | 492 | ||
@@ -552,8 +550,7 @@ static int ASIdentifierChoice_canonize(ASIdentifierChoice *choice) | |||
552 | */ | 550 | */ |
553 | if (choice->type != ASIdentifierChoice_asIdsOrRanges || | 551 | if (choice->type != ASIdentifierChoice_asIdsOrRanges || |
554 | sk_ASIdOrRange_num(choice->u.asIdsOrRanges) == 0) { | 552 | sk_ASIdOrRange_num(choice->u.asIdsOrRanges) == 0) { |
555 | X509V3err(X509V3_F_ASIDENTIFIERCHOICE_CANONIZE, | 553 | X509V3error(X509V3_R_EXTENSION_VALUE_ERROR); |
556 | X509V3_R_EXTENSION_VALUE_ERROR); | ||
557 | return 0; | 554 | return 0; |
558 | } | 555 | } |
559 | 556 | ||
@@ -593,8 +590,7 @@ static int ASIdentifierChoice_canonize(ASIdentifierChoice *choice) | |||
593 | * Check for overlaps. | 590 | * Check for overlaps. |
594 | */ | 591 | */ |
595 | if (ASN1_INTEGER_cmp(a_max, b_min) >= 0) { | 592 | if (ASN1_INTEGER_cmp(a_max, b_min) >= 0) { |
596 | X509V3err(X509V3_F_ASIDENTIFIERCHOICE_CANONIZE, | 593 | X509V3error(X509V3_R_EXTENSION_VALUE_ERROR); |
597 | X509V3_R_EXTENSION_VALUE_ERROR); | ||
598 | goto done; | 594 | goto done; |
599 | } | 595 | } |
600 | 596 | ||
@@ -604,16 +600,14 @@ static int ASIdentifierChoice_canonize(ASIdentifierChoice *choice) | |||
604 | if ((bn == NULL && (bn = BN_new()) == NULL) || | 600 | if ((bn == NULL && (bn = BN_new()) == NULL) || |
605 | ASN1_INTEGER_to_BN(a_max, bn) == NULL || | 601 | ASN1_INTEGER_to_BN(a_max, bn) == NULL || |
606 | !BN_add_word(bn, 1)) { | 602 | !BN_add_word(bn, 1)) { |
607 | X509V3err(X509V3_F_ASIDENTIFIERCHOICE_CANONIZE, | 603 | X509V3error(ERR_R_MALLOC_FAILURE); |
608 | ERR_R_MALLOC_FAILURE); | ||
609 | goto done; | 604 | goto done; |
610 | } | 605 | } |
611 | 606 | ||
612 | if ((a_max_plus_one = | 607 | if ((a_max_plus_one = |
613 | BN_to_ASN1_INTEGER(bn, orig = a_max_plus_one)) == NULL) { | 608 | BN_to_ASN1_INTEGER(bn, orig = a_max_plus_one)) == NULL) { |
614 | a_max_plus_one = orig; | 609 | a_max_plus_one = orig; |
615 | X509V3err(X509V3_F_ASIDENTIFIERCHOICE_CANONIZE, | 610 | X509V3error(ERR_R_MALLOC_FAILURE); |
616 | ERR_R_MALLOC_FAILURE); | ||
617 | goto done; | 611 | goto done; |
618 | } | 612 | } |
619 | 613 | ||
@@ -625,8 +619,7 @@ static int ASIdentifierChoice_canonize(ASIdentifierChoice *choice) | |||
625 | switch (a->type) { | 619 | switch (a->type) { |
626 | case ASIdOrRange_id: | 620 | case ASIdOrRange_id: |
627 | if ((r = OPENSSL_malloc(sizeof(*r))) == NULL) { | 621 | if ((r = OPENSSL_malloc(sizeof(*r))) == NULL) { |
628 | X509V3err(X509V3_F_ASIDENTIFIERCHOICE_CANONIZE, | 622 | X509V3error(ERR_R_MALLOC_FAILURE); |
629 | ERR_R_MALLOC_FAILURE); | ||
630 | goto done; | 623 | goto done; |
631 | } | 624 | } |
632 | r->min = a_min; | 625 | r->min = a_min; |
@@ -702,7 +695,7 @@ static void *v2i_ASIdentifiers(const struct v3_ext_method *method, | |||
702 | int i; | 695 | int i; |
703 | 696 | ||
704 | if ((asid = ASIdentifiers_new()) == NULL) { | 697 | if ((asid = ASIdentifiers_new()) == NULL) { |
705 | X509V3err(X509V3_F_V2I_ASIDENTIFIERS, ERR_R_MALLOC_FAILURE); | 698 | X509V3error(ERR_R_MALLOC_FAILURE); |
706 | return NULL; | 699 | return NULL; |
707 | } | 700 | } |
708 | 701 | ||
@@ -718,8 +711,7 @@ static void *v2i_ASIdentifiers(const struct v3_ext_method *method, | |||
718 | } else if (!name_cmp(val->name, "RDI")) { | 711 | } else if (!name_cmp(val->name, "RDI")) { |
719 | which = V3_ASID_RDI; | 712 | which = V3_ASID_RDI; |
720 | } else { | 713 | } else { |
721 | X509V3err(X509V3_F_V2I_ASIDENTIFIERS, | 714 | X509V3error(X509V3_R_EXTENSION_NAME_ERROR); |
722 | X509V3_R_EXTENSION_NAME_ERROR); | ||
723 | X509V3_conf_err(val); | 715 | X509V3_conf_err(val); |
724 | goto err; | 716 | goto err; |
725 | } | 717 | } |
@@ -730,8 +722,7 @@ static void *v2i_ASIdentifiers(const struct v3_ext_method *method, | |||
730 | if (strcmp(val->value, "inherit") == 0) { | 722 | if (strcmp(val->value, "inherit") == 0) { |
731 | if (X509v3_asid_add_inherit(asid, which)) | 723 | if (X509v3_asid_add_inherit(asid, which)) |
732 | continue; | 724 | continue; |
733 | X509V3err(X509V3_F_V2I_ASIDENTIFIERS, | 725 | X509V3error(X509V3_R_INVALID_INHERITANCE); |
734 | X509V3_R_INVALID_INHERITANCE); | ||
735 | X509V3_conf_err(val); | 726 | X509V3_conf_err(val); |
736 | goto err; | 727 | goto err; |
737 | } | 728 | } |
@@ -746,8 +737,7 @@ static void *v2i_ASIdentifiers(const struct v3_ext_method *method, | |||
746 | is_range = 1; | 737 | is_range = 1; |
747 | i2 = i1 + strspn(val->value + i1, " \t"); | 738 | i2 = i1 + strspn(val->value + i1, " \t"); |
748 | if (val->value[i2] != '-') { | 739 | if (val->value[i2] != '-') { |
749 | X509V3err(X509V3_F_V2I_ASIDENTIFIERS, | 740 | X509V3error(X509V3_R_INVALID_ASNUMBER); |
750 | X509V3_R_INVALID_ASNUMBER); | ||
751 | X509V3_conf_err(val); | 741 | X509V3_conf_err(val); |
752 | goto err; | 742 | goto err; |
753 | } | 743 | } |
@@ -755,8 +745,7 @@ static void *v2i_ASIdentifiers(const struct v3_ext_method *method, | |||
755 | i2 = i2 + strspn(val->value + i2, " \t"); | 745 | i2 = i2 + strspn(val->value + i2, " \t"); |
756 | i3 = i2 + strspn(val->value + i2, "0123456789"); | 746 | i3 = i2 + strspn(val->value + i2, "0123456789"); |
757 | if (val->value[i3] != '\0') { | 747 | if (val->value[i3] != '\0') { |
758 | X509V3err(X509V3_F_V2I_ASIDENTIFIERS, | 748 | X509V3error(X509V3_R_INVALID_ASRANGE); |
759 | X509V3_R_INVALID_ASRANGE); | ||
760 | X509V3_conf_err(val); | 749 | X509V3_conf_err(val); |
761 | goto err; | 750 | goto err; |
762 | } | 751 | } |
@@ -767,13 +756,13 @@ static void *v2i_ASIdentifiers(const struct v3_ext_method *method, | |||
767 | */ | 756 | */ |
768 | if (!is_range) { | 757 | if (!is_range) { |
769 | if (!X509V3_get_value_int(val, &min)) { | 758 | if (!X509V3_get_value_int(val, &min)) { |
770 | X509V3err(X509V3_F_V2I_ASIDENTIFIERS, ERR_R_MALLOC_FAILURE); | 759 | X509V3error(ERR_R_MALLOC_FAILURE); |
771 | goto err; | 760 | goto err; |
772 | } | 761 | } |
773 | } else { | 762 | } else { |
774 | char *s = OPENSSL_strdup(val->value); | 763 | char *s = OPENSSL_strdup(val->value); |
775 | if (s == NULL) { | 764 | if (s == NULL) { |
776 | X509V3err(X509V3_F_V2I_ASIDENTIFIERS, ERR_R_MALLOC_FAILURE); | 765 | X509V3error(ERR_R_MALLOC_FAILURE); |
777 | goto err; | 766 | goto err; |
778 | } | 767 | } |
779 | s[i1] = '\0'; | 768 | s[i1] = '\0'; |
@@ -781,17 +770,16 @@ static void *v2i_ASIdentifiers(const struct v3_ext_method *method, | |||
781 | max = s2i_ASN1_INTEGER(NULL, s + i2); | 770 | max = s2i_ASN1_INTEGER(NULL, s + i2); |
782 | free(s); | 771 | free(s); |
783 | if (min == NULL || max == NULL) { | 772 | if (min == NULL || max == NULL) { |
784 | X509V3err(X509V3_F_V2I_ASIDENTIFIERS, ERR_R_MALLOC_FAILURE); | 773 | X509V3error(ERR_R_MALLOC_FAILURE); |
785 | goto err; | 774 | goto err; |
786 | } | 775 | } |
787 | if (ASN1_INTEGER_cmp(min, max) > 0) { | 776 | if (ASN1_INTEGER_cmp(min, max) > 0) { |
788 | X509V3err(X509V3_F_V2I_ASIDENTIFIERS, | 777 | X509V3error(X509V3_R_EXTENSION_VALUE_ERROR); |
789 | X509V3_R_EXTENSION_VALUE_ERROR); | ||
790 | goto err; | 778 | goto err; |
791 | } | 779 | } |
792 | } | 780 | } |
793 | if (!X509v3_asid_add_id_or_range(asid, which, min, max)) { | 781 | if (!X509v3_asid_add_id_or_range(asid, which, min, max)) { |
794 | X509V3err(X509V3_F_V2I_ASIDENTIFIERS, ERR_R_MALLOC_FAILURE); | 782 | X509V3error(ERR_R_MALLOC_FAILURE); |
795 | goto err; | 783 | goto err; |
796 | } | 784 | } |
797 | min = max = NULL; | 785 | min = max = NULL; |