summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authortb <>2024-10-11 06:21:30 +0000
committertb <>2024-10-11 06:21:30 +0000
commit26c4ae05cadee4d742c2f47d99ddb52c615f3863 (patch)
tree68981abda60c73def0b31e7409b5b33a1f8a6970 /src
parent21c4c01973776dfcfee7cf814d20e9ae67e04515 (diff)
downloadopenbsd-26c4ae05cadee4d742c2f47d99ddb52c615f3863.tar.gz
openbsd-26c4ae05cadee4d742c2f47d99ddb52c615f3863.tar.bz2
openbsd-26c4ae05cadee4d742c2f47d99ddb52c615f3863.zip
Remove params argument from ec_asn1_group2parameters()
Its only caller passes NULL, so we can simplify the entry point and the exit of this function a bit. ok jsing
Diffstat (limited to 'src')
-rw-r--r--src/lib/libcrypto/ec/ec_asn1.c21
1 files changed, 8 insertions, 13 deletions
diff --git a/src/lib/libcrypto/ec/ec_asn1.c b/src/lib/libcrypto/ec/ec_asn1.c
index 61216df26f..147061b5c3 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.60 2024/10/11 06:19:52 tb Exp $ */ 1/* $OpenBSD: ec_asn1.c,v 1.61 2024/10/11 06:21:30 tb Exp $ */
2/* 2/*
3 * Written by Nils Larsch for the OpenSSL project. 3 * Written by Nils Larsch for the OpenSSL project.
4 */ 4 */
@@ -697,7 +697,7 @@ ec_asn1_group2curve(const EC_GROUP *group, X9_62_CURVE *curve)
697} 697}
698 698
699static ECPARAMETERS * 699static ECPARAMETERS *
700ec_asn1_group2parameters(const EC_GROUP *group, ECPARAMETERS *param) 700ec_asn1_group2parameters(const EC_GROUP *group)
701{ 701{
702 int ok = 0; 702 int ok = 0;
703 size_t len = 0; 703 size_t len = 0;
@@ -711,13 +711,10 @@ ec_asn1_group2parameters(const EC_GROUP *group, ECPARAMETERS *param)
711 ECerror(ERR_R_MALLOC_FAILURE); 711 ECerror(ERR_R_MALLOC_FAILURE);
712 goto err; 712 goto err;
713 } 713 }
714 if (param == NULL) { 714 if ((ret = ECPARAMETERS_new()) == NULL) {
715 if ((ret = ECPARAMETERS_new()) == NULL) { 715 ECerror(ERR_R_MALLOC_FAILURE);
716 ECerror(ERR_R_MALLOC_FAILURE); 716 goto err;
717 goto err; 717 }
718 }
719 } else
720 ret = param;
721 718
722 /* set the version (always one) */ 719 /* set the version (always one) */
723 ret->version = (long) 0x1; 720 ret->version = (long) 0x1;
@@ -781,8 +778,7 @@ ec_asn1_group2parameters(const EC_GROUP *group, ECPARAMETERS *param)
781 778
782 err: 779 err:
783 if (!ok) { 780 if (!ok) {
784 if (ret && !param) 781 ECPARAMETERS_free(ret);
785 ECPARAMETERS_free(ret);
786 ret = NULL; 782 ret = NULL;
787 } 783 }
788 BN_free(tmp); 784 BN_free(tmp);
@@ -817,8 +813,7 @@ ec_asn1_group2pkparameters(const EC_GROUP *group)
817 } else { 813 } else {
818 /* use the ECPARAMETERS structure */ 814 /* use the ECPARAMETERS structure */
819 ret->type = 1; 815 ret->type = 1;
820 if ((ret->value.parameters = ec_asn1_group2parameters(group, 816 if ((ret->value.parameters = ec_asn1_group2parameters(group)) == NULL)
821 NULL)) == NULL)
822 ok = 0; 817 ok = 0;
823 } 818 }
824 819