diff options
-rw-r--r-- | src/lib/libcrypto/ec/ec_asn1.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/src/lib/libcrypto/ec/ec_asn1.c b/src/lib/libcrypto/ec/ec_asn1.c index 2ce7d785c4..504948b237 100644 --- a/src/lib/libcrypto/ec/ec_asn1.c +++ b/src/lib/libcrypto/ec/ec_asn1.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ec_asn1.c,v 1.53 2024/04/17 23:24:18 tb Exp $ */ | 1 | /* $OpenBSD: ec_asn1.c,v 1.54 2024/10/03 04:15:52 tb Exp $ */ |
2 | /* | 2 | /* |
3 | * Written by Nils Larsch for the OpenSSL project. | 3 | * Written by Nils Larsch for the OpenSSL project. |
4 | */ | 4 | */ |
@@ -760,20 +760,19 @@ ec_asn1_group2parameters(const EC_GROUP *group, ECPARAMETERS *param) | |||
760 | ECerror(ERR_R_ASN1_LIB); | 760 | ECerror(ERR_R_ASN1_LIB); |
761 | goto err; | 761 | goto err; |
762 | } | 762 | } |
763 | /* set the order */ | ||
764 | if (!EC_GROUP_get_order(group, tmp, NULL)) { | 763 | if (!EC_GROUP_get_order(group, tmp, NULL)) { |
765 | ECerror(ERR_R_EC_LIB); | 764 | ECerror(ERR_R_EC_LIB); |
766 | goto err; | 765 | goto err; |
767 | } | 766 | } |
768 | ret->order = BN_to_ASN1_INTEGER(tmp, ret->order); | 767 | ASN1_INTEGER_free(ret->order); |
769 | if (ret->order == NULL) { | 768 | if ((ret->order = BN_to_ASN1_INTEGER(tmp, NULL)) == NULL) { |
770 | ECerror(ERR_R_ASN1_LIB); | 769 | ECerror(ERR_R_ASN1_LIB); |
771 | goto err; | 770 | goto err; |
772 | } | 771 | } |
773 | /* set the cofactor (optional) */ | 772 | ASN1_INTEGER_free(ret->cofactor); |
773 | ret->cofactor = NULL; | ||
774 | if (EC_GROUP_get_cofactor(group, tmp, NULL)) { | 774 | if (EC_GROUP_get_cofactor(group, tmp, NULL)) { |
775 | ret->cofactor = BN_to_ASN1_INTEGER(tmp, ret->cofactor); | 775 | if ((ret->cofactor = BN_to_ASN1_INTEGER(tmp, NULL)) == NULL) { |
776 | if (ret->cofactor == NULL) { | ||
777 | ECerror(ERR_R_ASN1_LIB); | 776 | ECerror(ERR_R_ASN1_LIB); |
778 | goto err; | 777 | goto err; |
779 | } | 778 | } |